Skip to content

Commit

Permalink
implemented playlist-rename
Browse files Browse the repository at this point in the history
  • Loading branch information
wendlers committed Oct 18, 2012
1 parent c13cb66 commit 978714e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/PyScMPDImplementation.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ prioid No Same as above but ueses ids.
shuffle No Shuffle the current playlist. shuffle No Shuffle the current playlist.
swap No Swap two songs. swap No Swap two songs.
swapid No As above but ueses ids. swapid No As above but ueses ids.
listplaylist No Lists the songs in the playlist. listplaylist Yes Lists the songs in the playlist.
listplaylistinfo Yes Lists the songs with metadata in the playlist. listplaylistinfo Yes Lists the songs with metadata in the playlist.
listplaylists No Prints a list of the playlist directory. listplaylists No Prints a list of the playlist directory.
load Yes Loads the playlist into the current queue. load Yes Loads the playlist into the current queue.
playlistadd No Adds track to a playlist. playlistadd No Adds track to a playlist.
playlistclear No Clears a playlist. playlistclear No Clears a playlist.
playlistdelete No Delete track from playlist. playlistdelete No Delete track from playlist.
playlistmove No Move songe in playlist. playlistmove No Move songe in playlist.
rename No Rename a playlist. rename Yes Rename a playlist.
rm No Remove a playlist. rm Yes Remove a playlist.
save Yes Save a playlist. save Yes Save a playlist.
count No Counts the number of songs and their total playtime in the db. count No Counts the number of songs and their total playtime in the db.
find No Fins songs in the db. find No Fins songs in the db.
Expand Down
4 changes: 4 additions & 0 deletions extlib/python-mpd-server/mpdserver/command_skel.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -199,12 +199,16 @@ class Load(Command):
""" Load a playlist in current playlist. Songs are added to """ Load a playlist in current playlist. Songs are added to
current playlist.""" current playlist."""
formatArg=[('playlistName',str)] formatArg=[('playlistName',str)]

class Save(Command): class Save(Command):
formatArg=[('playlistName',str)] formatArg=[('playlistName',str)]


class Rm(Command): class Rm(Command):
formatArg=[('playlistName',str)] formatArg=[('playlistName',str)]


class Rename(Command):
formatArg=[('playlistName',str), ('playlistNameNew',str)]

class Decoders(CommandItems): class Decoders(CommandItems):
def items(self): def items(self):
return [('plugin','gstreamer'), return [('plugin','gstreamer'),
Expand Down
1 change: 1 addition & 0 deletions extlib/python-mpd-server/mpdserver/mpdserver.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class MpdRequestHandler(SocketServer.StreamRequestHandler):
'save' :{'class':None,'users':[],'group':'write','mpdVersion':"0.12",'neededBy':None}, 'save' :{'class':None,'users':[],'group':'write','mpdVersion':"0.12",'neededBy':None},
'search' :{'class':None,'users':[],'group':'read','mpdVersion':"0.12",'neededBy':None}, 'search' :{'class':None,'users':[],'group':'read','mpdVersion':"0.12",'neededBy':None},
'rm' :{'class':None,'users':[],'group':'write','mpdVersion':"0.12",'neededBy':None}, 'rm' :{'class':None,'users':[],'group':'write','mpdVersion':"0.12",'neededBy':None},
'rename' :{'class':None,'users':[],'group':'write','mpdVersion':"0.12",'neededBy':None},
'setvol' :{'class':None,'users':[],'group':'control','mpdVersion':"0.12",'neededBy':None}, 'setvol' :{'class':None,'users':[],'group':'control','mpdVersion':"0.12",'neededBy':None},
'decoders' :{'class':Decoders,'users':['default'],'group':'reflection','mpdVersion':"0.12",'neededBy':None} 'decoders' :{'class':Decoders,'users':['default'],'group':'reflection','mpdVersion':"0.12",'neededBy':None}
} }
Expand Down
9 changes: 9 additions & 0 deletions src/pyscmpd/scmpd.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def __init__(self, favoriteUsers, favoriteGroups, favoriteFavorites, serverPort
self.requestHandler.RegisterCommand(ListPlaylistInfo) self.requestHandler.RegisterCommand(ListPlaylistInfo)
self.requestHandler.RegisterCommand(ListPlaylists) self.requestHandler.RegisterCommand(ListPlaylists)
self.requestHandler.RegisterCommand(Rm) self.requestHandler.RegisterCommand(Rm)
self.requestHandler.RegisterCommand(Rename)


self.requestHandler.Playlist = MpdPlaylist self.requestHandler.Playlist = MpdPlaylist


Expand Down Expand Up @@ -249,6 +250,14 @@ def handle_args(self, playlistName):


ScMpdServerDaemon.player.removePlaylist(playlistName) ScMpdServerDaemon.player.removePlaylist(playlistName)


class Rename(mpdserver.Rename):

def handle_args(self, playlistName, playlistNameNew):

logging.info("Renaming playlist: %s to %s" % (playlistName, playlistNameNew))

ScMpdServerDaemon.player.renamePlaylist(playlistName, playlistNameNew)

class Add(mpdserver.Add): class Add(mpdserver.Add):


def handle_args(self, song): def handle_args(self, song):
Expand Down

0 comments on commit 978714e

Please sign in to comment.