coherence.backends.models.items (module)¶
Backend models for BackendItem¶
Backend items to be used directly or subclassed. This classes inherits from
BackendItem
. This classes should cover the most
basic needs for different types of media and goes one step further from the
backend
by initializing the corresponding DIDLLite object.
For video backends:
BackendVideoItem
: item representing a video resource
For audio backends:
BackendAudioItem
: item representing a audio resourceBackendMusicTrackItem
: item representing an audio resource
For image/photo backends:
BackendImageItem
: item representing a image resourceBackendPhotoItem
: item representing a photo resource
For create a custom backend:
- If the items described above does not meet your needs, you can subclass
them or you may use the base class
BackendBaseItem
, used to develop all those backend items described above.
- If the items described above does not meet your needs, you can subclass
them or you may use the base class
Note
To write this module, some of the the old backends has been taken as a reference:
Warning
Be aware that we use super to initialize all the classes of this module in order to have a better MRO class resolution…so…take it into account if you inherit from one of this classes.
New in version 0.8.3.
-
class
BackendBaseItem
(parent_id, item_id, urlbase, **kwargs)[source]¶ Bases:
coherence.backend.BackendItem
This class is intended to be used as a base class for creating a custom backend item. It has the ability to support proxy or non-proxy items by using the property proxy_cls.
Warning
ReverseProxyUriResource does not support https connections, so…better stick to non-proxy if the target resource is in a secure connection until… we grant support for https connections.
-
proxy_cls
¶
-
item_cls
¶ alias of
coherence.upnp.core.DIDLLite.Item
-
mimetype
= ''¶ The mimetype of your item
-
location
= None¶ Represents a file path of our media file, or alternatively a FilePath or a ReverseProxyResource object. It will be set automatically based on the value of the class
proxy_cls
(if the propertyis_proxy
equals to True).
-
is_proxy
= False¶ If the item should be considered a ReverseProxyUriResource. This property is automatically set when the item is initialized
-
item
= None¶ Define the initialized
item_cls
. It will be set when the classBackendBaseItem
is initialized based on the attributeitem_cls
-
get_name
()[source]¶ Called by the MediaServer web.
Returns: the name of the item, it is always expected to be in unicode.
-
get_children
(start=0, request_count=0)[source]¶ Called by the CDS and the MediaServer web.
Parameters: Returns: - a list of its childs, from start to end.
- or a Deferred
-
-
class
BackendVideoItem
(parent_id, item_id, urlbase, **kwargs)[source]¶ Bases:
coherence.backends.models.items.BackendBaseItem
This Represents a Backend Video Item.
-
item_cls
¶
-
-
class
BackendAudioItem
(parent_id, item_id, urlbase, **kwargs)[source]¶ Bases:
coherence.backends.models.items.BackendBaseItem
- This Represents an Audio Item. It supports those properties:
artist
: The name of the artistalbum
: an instance of aBackendMusicAlbum
genre
: The music genre for the audioplaylist
: Playlist
-
item_cls
¶
-
class
BackendMusicTrackItem
(parent_id, item_id, urlbase, **kwargs)[source]¶ Bases:
coherence.backends.models.items.BackendAudioItem
This is like
BackendAudioItem
but with a track number added.-
item_cls
¶
-
-
class
BackendImageItem
(parent_id, item_id, urlbase, **kwargs)[source]¶ Bases:
coherence.backends.models.items.BackendBaseItem
This Represents a Backend Image Item.
-
item_cls
¶
-
mimetype
= ''¶
-
-
class
BackendPhotoItem
(parent_id, item_id, urlbase, **kwargs)[source]¶ Bases:
coherence.backends.models.items.BackendImageItem
This Represents a Backend Photo Item. Iis like
BackendImageItem
but with additional attribute addedalbum
.-
item_cls
¶ alias of
coherence.upnp.core.DIDLLite.Photo
-