banner Module

A module for managing banner information

Although some banners are related to a specific season, all banners will be stored as a property of the related Show instance.

class pytvdbapi.banner.Banner(mirror, data, show)

Bases: object

Representing a Banner as provided by thetvdb.com. More information about the data provided for a Banner can be found here.

Attributes:

The number and types of attributes that the Banner has is dependent on the type of Banner it is. Below is a description of the different attributes.

Note: Wherever ‘text’ is given as the attribute type, this means that on Python 2.X it will be of type unicode and on Python 3.X str.

Common:

These attributes are present for all Banner objects.

  • BannerPath (text). The last part of the URL pointing to the image. This is appended to the correct mirror address to form the full URL.
  • BannerType (text). This could be any of fanart, season or poster. This value controls what other attributes are available as described below.
  • BannerType2 (text). What this attribute contains will depend on the type of Banner and will be described in each sub section below.
  • Language (text).
  • Rating (float).
  • RatingCount (int).
  • id (int).
  • banner_url (text). This is generated by pytvdbapi and is the full URL for the banner.

fanart:

Additional to the common attributes, the following attributes are included on objects of type fanart.

  • BannerType2 (text). Contains the dimension of the image as text.
  • Colors (list).
  • SeriesName (bool).
  • ThumbnailPath (text).
  • VignettePath (text).

poster:

poster type does not contain any additional attributes.

  • BannerType2 (text). Contains the dimension of the image as a string.

season:

Additional to the common attributes, the following attributes are included on objects of type season.

  • BannerType2 (text). Contains the word ‘season’
  • Season (int).

Example:

>>> from pytvdbapi import api
>>> db = api.TVDB('B43FF87DE395DF56', banners=True)
>>> show = db.get_series( 79349, "en" )  # Dexter
>>> show.update()

>>> assert len(show.banner_objects) > 0
>>> banner = show.banner_objects[0]

>>> print(banner.banner_url) 
http://thetvdb.com/banners/fanart/original/79349-...jpg

>>> print(banner.Language)
en

Showing the different banner types and their attributes.

>>> fanart = [b for b in show.banner_objects if b.BannerType == "fanart"]
>>> dir(fanart[0])  
['BannerPath', 'BannerType', 'BannerType2', 'Colors', 'Language',
'Rating', 'RatingCount', 'SeriesName', 'ThumbnailPath', 'VignettePath',
'banner_url', 'id']

>>> print(fanart[0].BannerType2)
1280x720


>>> posters = [b for b in show.banner_objects if b.BannerType == "poster"]
>>> dir(posters[0])  
['BannerPath', 'BannerType', 'BannerType2', 'Language', 'Rating',
'RatingCount', 'banner_url', 'id']

>>> print(posters[0].BannerType2)
680x1000


>>> seasons = [b for b in show.banner_objects if b.BannerType == "season"]
>>> dir(seasons[0])  
['BannerPath', 'BannerType', 'BannerType2', 'Language', 'Rating',
'RatingCount', 'Season', 'banner_url', 'id']

>>> print(seasons[0].BannerType2)
season

Previous topic

actor Module

Next topic

error Module

This Page