coherence.backends.banshee_storage (module) — Cohen3 0.8.0 documentation

# coherence.backends.banshee_storage (module)

`get_cover_path`(artist_name, album_title)

class `SQLiteDB`(database)

  Bases: `coherence.log.LogAble`

  Python DB API 2.0 backend support.

  Connect to a db backend hosting the given database.

  `logCategory` = 'sqlite'
  `__init__`(database)

    Connect to a db backend hosting the given database.

  `disconnect`()
  `connect`()

    Connect to the database, set L{_db} instance variable.

  `reconnect`()

    Disconnect and reconnect to the database.

  `sql_execute`(request, *params, **kw)

    Execute a SQL query in the db backend

class `Container`(id, parent_id, name, children_callback=None, store=None, play_container=False)

  Bases: `coherence.backend.BackendItem`

  `get_path` = None
  `add_child`(child)
  `get_children`(start=0, request_count=0)

    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`()

    Called by the CDS.

    Returns: | the number of its childs - len(childs) or a Deferred

  `get_item`()

    Called by the CDS and the MediaServer web.

    Returns: | an UPnP ContentDirectoryServer DIDLLite object or a Deferred

  `get_name`()

    Called by the MediaServer web.

    Returns: | the name of the item, it is always expected to be in unicode.

  `get_id`()

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

  Bases: `coherence.backend.BackendItem`

  `get_children`(start=0, end=0)

    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`()

    Called by the CDS.

    Returns: | the number of its childs - len(childs) or a Deferred

  `get_item`()

    Called by the CDS and the MediaServer web.

    Returns: | an UPnP ContentDirectoryServer DIDLLite object or a Deferred

  `get_id`()

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

  Bases: `coherence.backend.BackendItem`

  definition for an album

  `mimetype` = 'directory'
  `get_path` = None
  `get_children`(start=0, request_count=0)

    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`()

    Called by the CDS.

    Returns: | the number of its childs - len(childs) or a Deferred

  `get_item`()

    Called by the CDS and the MediaServer web.

    Returns: | an UPnP ContentDirectoryServer DIDLLite object or a Deferred

  `get_id`()
  `get_name`()

    Called by the MediaServer web.

    Returns: | the name of the item, it is always expected to be in unicode.

  `get_cover`()

    Called by the MediaServer web.

    Returns: | the filepath where to find the album art file

    Note

    only needed when we have created for that item an albumArtURI property that does point back to us.

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

  Bases: `coherence.backend.BackendItem`

  definition for a playlist

  `id_type` = 'baseplaylist'
  `mimetype` = 'directory'
  `get_path` = None
  `db_id`

    Should be implemented in subclass

  `get_tracks`(request_count)
  `db_to_didl`(row)
  `get_id`()
  `get_children`(start=0, request_count=0)

    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`()

    Called by the CDS.

    Returns: | the number of its childs - len(childs) or a Deferred

  `get_item`()

    Called by the CDS and the MediaServer web.

    Returns: | an UPnP ContentDirectoryServer DIDLLite object or a Deferred

  `get_name`()

    Called by the MediaServer web.

    Returns: | the name of the item, it is always expected to be in unicode.

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

  Bases: `coherence.backends.banshee_storage.BasePlaylist`

  `id_type` = 'musicplaylist'
  `db_id`

    Should be implemented in subclass

  `get_tracks`(request_count)

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

  Bases: `coherence.backends.banshee_storage.BasePlaylist`

  `id_type` = 'musicsmartplaylist'
  `db_id`

    Should be implemented in subclass

  `get_tracks`(request_count)

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

  Bases: `coherence.backends.banshee_storage.MusicPlaylist`

  `id_type` = 'videoplaylist'
  `db_to_didl`(row)

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

  Bases: `coherence.backends.banshee_storage.MusicSmartPlaylist`

  `id_type` = 'videosmartplaylist'
  `db_to_didl`(row)

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

  Bases: `coherence.backend.BackendItem`

  definition for a track

  `get_children`(start=0, request_count=0)

    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`()

    Called by the CDS.

    Returns: | the number of its childs - len(childs) or a Deferred

  `get_resources`()
  `get_path`()

    Called by the MediaServer web.

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

  `get_id`()
  `get_name`()

    Called by the MediaServer web.

    Returns: | the name of the item, it is always expected to be in unicode.

  `get_url`()
  `get_cover`()

    Called by the MediaServer web.

    Returns: | the filepath where to find the album art file

    Note

    only needed when we have created for that item an albumArtURI property that does point back to us.

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

  Bases: `coherence.backends.banshee_storage.BaseTrack`

  `get_item`()

    Called by the CDS and the MediaServer web.

    Returns: | an UPnP ContentDirectoryServer DIDLLite object or a Deferred

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

  Bases: `coherence.backends.banshee_storage.BaseTrack`

  `get_item`()

    Called by the CDS and the MediaServer web.

    Returns: | an UPnP ContentDirectoryServer DIDLLite object or a Deferred

class `BansheeDB`(path=None)

  Bases: `coherence.log.LogAble`

  `logCategory` = 'banshee_db'
  `open_db`()
  `close`()
  `get_local_music_library_id`()
  `get_local_video_library_id`()
  `get_artists`()
  `get_albums`()
  `get_music_playlists`()
  `get_playlists`(source_id, PlaylistClass, SmartPlaylistClass)
  `get_artist_with_id`(artist_id)
  `get_album_with_id`(album_id)
  `get_playlist_with_id`(playlist_id, PlaylistClass)
  `get_smart_playlist_with_id`(playlist_id, PlaylistClass)
  `get_music_playlist_with_id`(playlist_id)
  `get_music_smart_playlist_with_id`(playlist_id)
  `get_video_playlist_with_id`(playlist_id)
  `get_video_smart_playlist_with_id`(playlist_id)
  `get_track_with_id`(track_id)
  `get_track_for_uri`(track_uri)
  `get_tracks`()
  `get_video_with_id`(video_id)
  `get_videos`()
  `get_video_playlists`()

class `BansheeStore`(server, **kwargs)

  Bases: `coherence.backend.BackendStore`, `coherence.backends.banshee_storage.BansheeDB`

  Changed in version 0.9.0: Migrated from louie/dispatcher to EventDispatcher

  `logCategory` = 'banshee_store'
  `implements` = ['MediaServer']
  `upnp_init`()

    This method gets called after the device is fired, here all initializations of service related state variables should happen, as the services aren’t available before that point.

  `release`()

    If anything needs to be cleaned up upon shutdown of this backend, this is the place for it. Should be overwritten in subclass.

  `get_by_id`(item_id)

    Parameters: | id (object) – is the id property of our DIDLLite item
    Returns: | None when no matching item for that id is found, a BackendItem, or a Deferred

    Called by the CDS or the MediaServer web.

    Note

    if this MediaServer implements containers that can share their content, like ‘all tracks’, ‘album’ and ‘album_of_artist’ (they all have the same track item as content), then the id may be passed by the CDS like this:

    > ‘id@container’ or ‘id@container@container@container…’

    therefore a

        if isinstance(id, basestring):
            id = id.split('@',1)
            id = id[0]

    may be appropriate as the first thing to do when entering this method.

  `_lookup`(item_type, item_id)