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:

  • For audio backends:

  • For image/photo backends:

  • 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.

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

alias of coherence.upnp.core.utils.ReverseProxyUriResource

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 property is_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 class BackendBaseItem is initialized based on the attribute item_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
  • start (int) – the start.

  • end (int) – the end.

Returns

  • a list of its childs, from start to end.

  • or a Deferred

get_child_count()[source]

Called by the CDS.

Returns

  • the number of its childs - len(childs)

  • or a Deferred

get_path()[source]

Called by the MediaServer web.

Returns

the filepath where to find the media file that this item does refer to.

class BackendVideoItem(parent_id, item_id, urlbase, **kwargs)[source]

Bases: coherence.backends.models.items.BackendBaseItem

This Represents a Backend Video Item.

item_cls

alias of coherence.upnp.core.DIDLLite.VideoItem

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 artist

  • album: an instance of a

    BackendMusicAlbum

  • genre: The music genre for the audio

  • playlist: Playlist

item_cls

alias of coherence.upnp.core.DIDLLite.AudioItem

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

alias of coherence.upnp.core.DIDLLite.MusicTrack

class BackendImageItem(parent_id, item_id, urlbase, **kwargs)[source]

Bases: coherence.backends.models.items.BackendBaseItem

This Represents a Backend Image Item.

item_cls

alias of coherence.upnp.core.DIDLLite.ImageItem

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 added album.

item_cls

alias of coherence.upnp.core.DIDLLite.Photo