Module playlist
[hide private]
[frames] | no frames]

Module playlist

source code


Code to handle Playlist items.

The playlist data includes 2 components: the list of available songs, and
the playlist items.

The format of the Playlist items is standardized.  It is a list of dict which
has the following standard fields:

name: string=the name of the play list
type: string=the type of this play list.  Current supported types are mp3 and wma.
songs: [ 'song name', ... ]

To implement Playlist read/write for a phone module:
1. Add 2 entries into Profile._supportedsyncs:
        ...
        ('playlist', 'read', 'OVERWRITE'),
        ('playlist', 'write', 'OVERWRITE'),
2. Implement the following 2 methods in your Phone class:
    def getplaylist(self, result)
    def saveplaylist(self, result, merge)

The result dict should have:
results[playlist.masterlist_key]=['song name 1', 'song name 2', ...]
results[playlist.playlist_key=[playlist.PlaylistEntry, playlist.PlaylistEntry, ..]

Classes [hide private]
  MasterListDataObject
  PlaylistDataObject
  PlaylistEntryDataObject
  PlaylistEntry
  PlaylistWidget
Variables [hide private]
  playlist_key = 'playlist'
  masterlist_key = 'masterlist'
  playlists_list = 'playlists'
  mp3_type = 'mp3'
  wma_type = 'wma'
  playlist_type = ('mp3', 'wma')
  masterlistobjectfactory = database.dataobjectfactory(MasterLis...
  playlistobjectfactory = database.dataobjectfactory(PlaylistDat...
  playlistentryobjectfactory = database.dataobjectfactory(Playli...
Variables Details [hide private]

masterlistobjectfactory

Value:
database.dataobjectfactory(MasterListDataObject)

playlistobjectfactory

Value:
database.dataobjectfactory(PlaylistDataObject)

playlistentryobjectfactory

Value:
database.dataobjectfactory(PlaylistEntryDataObject)