coherence.backends.banshee_storage (module)

TODO:

  • podcasts
get_cover_path(artist_name, album_title)[source]
class SQLiteDB(database)[source]

Bases: coherence.log.LogAble

Python DB API 2.0 backend support.

Connect to a db backend hosting the given database.

logCategory = 'sqlite'
__init__(database)[source]

Connect to a db backend hosting the given database.

disconnect()[source]
connect()[source]

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

reconnect()[source]

Disconnect and reconnect to the database.

sql_execute(request, *params, **kw)[source]

Execute a SQL query in the db backend

class Container(id, parent_id, name, children_callback=None, store=None, play_container=False)[source]

Bases: coherence.backend.BackendItem

get_path = None
add_child(child)[source]
get_children(start=0, request_count=0)[source]

called by the CDS and the MediaServer web should return

  • a list of its childs[start:end]
  • or a Deferred

if end == 0, the request is for all childs after start - childs[start:]

get_child_count()[source]

called by the CDS should return

  • the number of its childs - len(childs)
  • or a Deferred
get_item()[source]

called by the CDS and the MediaServer web should return

  • an UPnP ContentDirectoryServer DIDLLite object
  • or a Deferred
get_name()[source]

called by the MediaServer web should return

  • the name of the item, it is always expected to be in unicode
get_id()[source]
class Artist(*args, **kwargs)[source]

Bases: coherence.backend.BackendItem

get_children(start=0, end=0)[source]

called by the CDS and the MediaServer web should return

  • a list of its childs[start:end]
  • or a Deferred

if end == 0, the request is for all childs after start - childs[start:]

get_child_count()[source]

called by the CDS should return

  • the number of its childs - len(childs)
  • or a Deferred
get_item()[source]

called by the CDS and the MediaServer web should return

  • an UPnP ContentDirectoryServer DIDLLite object
  • or a Deferred
get_id()[source]
class Album(*args, **kwargs)[source]

Bases: coherence.backend.BackendItem

definition for an album

mimetype = 'directory'
get_path = None
get_children(start=0, request_count=0)[source]

called by the CDS and the MediaServer web should return

  • a list of its childs[start:end]
  • or a Deferred

if end == 0, the request is for all childs after start - childs[start:]

get_child_count()[source]

called by the CDS should return

  • the number of its childs - len(childs)
  • or a Deferred
get_item()[source]

called by the CDS and the MediaServer web should return

  • an UPnP ContentDirectoryServer DIDLLite object
  • or a Deferred
get_id()[source]
get_name()[source]

called by the MediaServer web should return

  • the name of the item, it is always expected to be in unicode
get_cover()[source]

called by the MediaServer web should return

  • the filepath where to find the album art file

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

class BasePlaylist(*args, **kwargs)[source]

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)[source]
db_to_didl(row)[source]
get_id()[source]
get_children(start=0, request_count=0)[source]

called by the CDS and the MediaServer web should return

  • a list of its childs[start:end]
  • or a Deferred

if end == 0, the request is for all childs after start - childs[start:]

get_child_count()[source]

called by the CDS should return

  • the number of its childs - len(childs)
  • or a Deferred
get_item()[source]

called by the CDS and the MediaServer web should return

  • an UPnP ContentDirectoryServer DIDLLite object
  • or a Deferred
get_name()[source]

called by the MediaServer web should return

  • the name of the item, it is always expected to be in unicode
class MusicPlaylist(*args, **kwargs)[source]

Bases: coherence.backends.banshee_storage.BasePlaylist

id_type = 'musicplaylist'
db_id

Should be implemented in subclass

get_tracks(request_count)[source]
class MusicSmartPlaylist(*args, **kwargs)[source]

Bases: coherence.backends.banshee_storage.BasePlaylist

id_type = 'musicsmartplaylist'
db_id

Should be implemented in subclass

get_tracks(request_count)[source]
class VideoPlaylist(*args, **kwargs)[source]

Bases: coherence.backends.banshee_storage.MusicPlaylist

id_type = 'videoplaylist'
db_to_didl(row)[source]
class VideoSmartPlaylist(*args, **kwargs)[source]

Bases: coherence.backends.banshee_storage.MusicSmartPlaylist

id_type = 'videosmartplaylist'
db_to_didl(row)[source]
class BaseTrack(*args, **kwargs)[source]

Bases: coherence.backend.BackendItem

definition for a track

get_children(start=0, request_count=0)[source]

called by the CDS and the MediaServer web should return

  • a list of its childs[start:end]
  • or a Deferred

if end == 0, the request is for all childs after start - childs[start:]

get_child_count()[source]

called by the CDS should return

  • the number of its childs - len(childs)
  • or a Deferred
get_resources()[source]
get_path()[source]

called by the MediaServer web should return

  • the filepath where to find the media file that this item does refer to
get_id()[source]
get_name()[source]

called by the MediaServer web should return

  • the name of the item, it is always expected to be in unicode
get_url()[source]
get_cover()[source]

called by the MediaServer web should return

  • the filepath where to find the album art file

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

class Track(*args, **kwargs)[source]

Bases: coherence.backends.banshee_storage.BaseTrack

get_item()[source]

called by the CDS and the MediaServer web should return

  • an UPnP ContentDirectoryServer DIDLLite object
  • or a Deferred
class Video(*args, **kwargs)[source]

Bases: coherence.backends.banshee_storage.BaseTrack

get_item()[source]

called by the CDS and the MediaServer web should return

  • an UPnP ContentDirectoryServer DIDLLite object
  • or a Deferred
class BansheeDB(path=None)[source]

Bases: coherence.log.LogAble

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

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

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

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()[source]

if anything needs to be cleaned up upon shutdown of this backend, this is the place for it

get_by_id(item_id)[source]

called by the CDS or the MediaServer web

id is the id property of our DIDLLite item

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

should return

  • None when no matching item for that id is found,
  • a BackendItem,
  • or a Deferred
_lookup(item_type, item_id)[source]