coherence.upnp.core.DIDLLite (module) — Cohen3 0.8.0 documentation

# coherence.upnp.core.DIDLLite (module)

## DIDLLite

Different classes and methods used to represent atomic content objects for DIDL (Digital Item Declaration Language)

Note

For more information about DIDL you can check the wikipedia entry.

### `Resources`

A list of resources, always sorted after an append

### `Resource`

An object representing a resource.

### `PlayContainerResource`

An object representing a DLNA play container resource.

### `Object`

The root class of the entire content directory class hierarchy.

### `Item`

A class used to represent atomic (non-container) content objects.

### `ImageItem`

An item class which represents a image.

### `Photo`

An item class which represents a photo.

### `AudioItem`

An item class which represents a audio.

### `MusicTrack`

An item class which represents a music track.

### `AudioBroadcast`

An item class which represents a audio broadcast.

### `AudioBook`

An item class which represents a audio book.

### `VideoItem`

An item class which represents a video.

### `Movie`

An item class which represents a movie.

### `VideoBroadcast`

An item class which represents a video broadcast.

### `MusicVideoClip`

An item class which represents a music video clip.

### `PlayListItem`

An item class which represents a play list.

### `TextItem`

An item class which represents a text.

### `Container`

An object that can contain other objects.

### `Person`

An container class which represents a Person.

### `MusicArtist`

An container class which represents a Music Artist.

### `PlaylistContainer`

An container class which represents a Play List.

### `Album`

An container class which represents a generic Album.

### `MusicAlbum`

An container class which represents a Music Album.

### `PhotoAlbum`

An container class which represents a Photo Album.

### `Genre`

An container class which represents a generic genre.

### `MusicGenre`

An container class which represents a Music genre.

### `MovieGenre`

An container class which represents a Movie genre.

### `StorageSystem`

An container class which represents a Storage System.

### `StorageVolume`

An container class which represents a Storage Volume.

### `StorageFolder`

An container class which represents a Storage Folder.

### `DIDLElement`

Our element for DIDL (Digital Item Declaration Language).

`qname`(tag, ns=None)

`is_audio`(mimetype)

  Checks for type audio, expects a mimetype or an UPnP protocolInfo.

`is_video`(mimetype)

  Checks for type video, expects a mimetype or an UPnP protocolInfo.

class `Resources`

  Bases: `list`

  A list of resources, always sorted after an append.

  `append`(value)

    Append object to the end of the list.

  `p_sort`(x, y)

    We want the following order: http-get is always at the beginning, rtsp-rtp-udp the second and anything else after that.

  `get_matching`(local_protocol_infos, protocol_type=None)

`classChooser`(mimetype, sub=None)

`build_dlna_additional_info`(content_format, does_playcontainer=False)

class `Resource`(data=None, protocol_info=None)

  Bases: `object`

  An object representing a resource.

  `get_additional_info`(upnp_client='')
  `toElement`(**kwargs)
  `fromElement`(elt)
  `toString`(**kwargs)
  classmethod `fromString`(_string)
  `transcoded`(format)

class `PlayContainerResource`(udn, sid='urn:upnp-org:serviceId:ContentDirectory', cid=None, fid=None, fii=0, sc='', md=0, protocol_info=None)

  Bases: `coherence.upnp.core.DIDLLite.Resource`

  An object representing a DLNA play container resource.

class `Object`(id=None, parentID=None, title=None, restricted=False, creator=None)

  Bases: `coherence.log.LogAble`

  The root class of the entire content directory class hierarchy.

  `logCategory` = 'didllite'
  `elementName` = None
  `upnp_class` = 'object'
  `writeStatus` = None
  `date` = None
  `albumArtURI` = None
  `artist` = None
  `genre` = None
  `genres` = None
  `album` = None
  `originalTrackNumber` = None
  `description` = None
  `longDescription` = None
  `refID` = None
  `server_uuid` = None
  `creator` = None
  `res` = None
  `checkUpdate`()
  `toElement`(**kwargs)
  `toString`(**kwargs)
  `fromElement`(elt)
  classmethod `fromString`(data)

class `Item`(*args, **kwargs)

  Bases: `coherence.upnp.core.DIDLLite.Object`

  A class used to represent atomic (non-container) content objects.

  `upnp_class` = 'object.item'
  `elementName` = 'item'
  `refID` = None
  `director` = None
  `actors` = []
  `language` = None
  `toElement`(**kwargs)
  `fromElement`(elt)

class `ImageItem`(*args, **kwargs)

  Bases: `coherence.upnp.core.DIDLLite.Item`

  `upnp_class` = 'object.item.imageItem'
  `rating` = None
  `storageMedium` = None
  `publisher` = None
  `rights` = None
  `toElement`(**kwargs)

class `Photo`(*args, **kwargs)

  Bases: `coherence.upnp.core.DIDLLite.ImageItem`

  `upnp_class` = 'object.item.imageItem.photo'
  `album` = None
  `toElement`(**kwargs)

class `AudioItem`(*args, **kwargs)

  Bases: `coherence.upnp.core.DIDLLite.Item`

  A piece of content that when rendered generates some audio.

  `upnp_class` = 'object.item.audioItem'
  `publisher` = None
  `language` = None
  `relation` = None
  `rights` = None
  `valid_keys` = ['genre', 'description', 'longDescription', 'publisher', 'language', 'relation', 'rights', 'albumArtURI']
  `toElement`(**kwargs)
  `fromElement`(elt)

class `MusicTrack`(*args, **kwargs)

  Bases: `coherence.upnp.core.DIDLLite.AudioItem`

  A discrete piece of audio that should be interpreted as music.

  `upnp_class` = 'object.item.audioItem.musicTrack'
  `album` = None
  `playlist` = None
  `storageMedium` = None
  `contributor` = None
  `toElement`(**kwargs)

class `AudioBroadcast`(*args, **kwargs)

  Bases: `coherence.upnp.core.DIDLLite.AudioItem`

  `upnp_class` = 'object.item.audioItem.audioBroadcast'

class `AudioBook`(*args, **kwargs)

  Bases: `coherence.upnp.core.DIDLLite.AudioItem`

  `upnp_class` = 'object.item.audioItem.audioBook'

class `VideoItem`(*args, **kwargs)

  Bases: `coherence.upnp.core.DIDLLite.Item`

  `upnp_class` = 'object.item.videoItem'
  `valid_attrs` = {'producer': 'urn:schemas-upnp-org:metadata-1-0/upnp/', 'publisher': 'http://purl.org/dc/elements/1.1/', 'rating': 'urn:schemas-upnp-org:metadata-1-0/upnp/', 'relation': 'http://purl.org/dc/elements/1.1/'}
  `toElement`(**kwargs)
  `fromElement`(elt)

class `Movie`(*args, **kwargs)

  Bases: `coherence.upnp.core.DIDLLite.VideoItem`

  `upnp_class` = 'object.item.videoItem.movie'

class `VideoBroadcast`(*args, **kwargs)

  Bases: `coherence.upnp.core.DIDLLite.VideoItem`

  `upnp_class` = 'object.item.videoItem.videoBroadcast'

class `MusicVideoClip`(*args, **kwargs)

  Bases: `coherence.upnp.core.DIDLLite.VideoItem`

  `upnp_class` = 'object.item.videoItem.musicVideoClip'

class `PlaylistItem`(*args, **kwargs)

  Bases: `coherence.upnp.core.DIDLLite.Item`

  `upnp_class` = 'object.item.playlistItem'

class `TextItem`(*args, **kwargs)

  Bases: `coherence.upnp.core.DIDLLite.Item`

  `upnp_class` = 'object.item.textItem'

class `Container`(id=None, parent_id=None, title=None, restricted=False, creator=None)

  Bases: `coherence.upnp.core.DIDLLite.Object`

  An object that can contain other objects.

  `upnp_class` = 'object.container'
  `elementName` = 'container'
  `childCount` = None
  `createClass` = None
  `searchable` = None
  `toElement`(**kwargs)
  `fromElement`(elt)

class `Person`(id=None, parent_id=None, title=None, restricted=False, creator=None)

  Bases: `coherence.upnp.core.DIDLLite.Container`

  `upnp_class` = 'object.container.person'

class `MusicArtist`(id=None, parent_id=None, title=None, restricted=False, creator=None)

  Bases: `coherence.upnp.core.DIDLLite.Person`

  `upnp_class` = 'object.container.person.musicArtist'

class `PlaylistContainer`(id=None, parent_id=None, title=None, restricted=False, creator=None)

  Bases: `coherence.upnp.core.DIDLLite.Container`

  `upnp_class` = 'object.container.playlistContainer'

class `Album`(id=None, parent_id=None, title=None, restricted=False, creator=None)

  Bases: `coherence.upnp.core.DIDLLite.Container`

  `upnp_class` = 'object.container.album'

class `MusicAlbum`(id=None, parent_id=None, title=None, restricted=False, creator=None)

  Bases: `coherence.upnp.core.DIDLLite.Album`

  `upnp_class` = 'object.container.album.musicAlbum'

class `PhotoAlbum`(id=None, parent_id=None, title=None, restricted=False, creator=None)

  Bases: `coherence.upnp.core.DIDLLite.Album`

  `upnp_class` = 'object.container.album.photoAlbum'

class `Genre`(id=None, parent_id=None, title=None, restricted=False, creator=None)

  Bases: `coherence.upnp.core.DIDLLite.Container`

  `upnp_class` = 'object.container.genre'

class `MusicGenre`(id=None, parent_id=None, title=None, restricted=False, creator=None)

  Bases: `coherence.upnp.core.DIDLLite.Genre`

  `upnp_class` = 'object.container.genre.musicGenre'

class `MovieGenre`(id=None, parent_id=None, title=None, restricted=False, creator=None)

  Bases: `coherence.upnp.core.DIDLLite.Genre`

  `upnp_class` = 'object.container.genre.movieGenre'

class `StorageSystem`(id=None, parent_id=None, title=None, restricted=False, creator=None)

  Bases: `coherence.upnp.core.DIDLLite.Container`

  `upnp_class` = 'object.container.storageSystem'

class `StorageVolume`(id=None, parent_id=None, title=None, restricted=False, creator=None)

  Bases: `coherence.upnp.core.DIDLLite.Container`

  `upnp_class` = 'object.container.storageVolume'

class `StorageFolder`(id=None, parent_id=None, title=None, restricted=False, creator=None)

  Bases: `coherence.upnp.core.DIDLLite.Container`

  `upnp_class` = 'object.container.storageFolder'

class `DIDLElement`(upnp_client='', parent_container=None, requested_id=None, transcoding=False)

  Bases: `coherence.log.LogAble`

  `logCategory` = 'didllite'
  `addContainer`(id, parent_id, title, restricted=False)
  `addItem`(item)
  `rebuild`()
  `numItems`()
  `getItems`()
  `toString`()
  `get_upnp_class`(name)
  classmethod `fromString`(data)