Finished implementing clear command.
This commit is contained in:
parent
f80ff182ad
commit
7cad273a0b
@ -54,7 +54,8 @@ play playlist <id | name>
|
||||
|
||||
clear
|
||||
queue
|
||||
playlist
|
||||
playlist < id | name >
|
||||
selected playlist
|
||||
selection
|
||||
|
||||
* Transport operations
|
||||
|
@ -386,10 +386,28 @@ Configuration:
|
||||
private def processClear(LinkedList line) {
|
||||
def option = line.poll()
|
||||
switch(option) {
|
||||
case 'queue': library.removeAllFromPlaylist(playQueue.id)
|
||||
case 'queue': return library.removeAllFromPlaylist(playQueue.id)
|
||||
case 'selected playlist':
|
||||
if (!selection.playlist) {
|
||||
printLongMessage("No playlist currently selected.")
|
||||
return null }
|
||||
return library.removeAllFromPlaylist(selected.playlist.id)
|
||||
case 'playlist':
|
||||
def criteria = line.poll()
|
||||
if (!criteria) {
|
||||
printLongMessage("Missing playlist id or name. Use " +
|
||||
"${promptStyle}help clear${normalStyle} to see a " +
|
||||
"list of valid options.")
|
||||
return null }
|
||||
def playlist = library.getByIdOrName(Playlist, criteria)
|
||||
if (!playlist) {
|
||||
printLongMessage("No playlist matches '${criteria}'.")
|
||||
return null }
|
||||
return library.removeAllFromPlaylist(playlist.id)
|
||||
case 'selection':
|
||||
default:
|
||||
printLongMessage("Unrecognized option to the ${promptStyle}" +
|
||||
"add${normalStyle} command. Use ${promptStyle}help add" +
|
||||
"add${normalStyle} command. Use ${promptStyle}help clear" +
|
||||
"${normalStyle} to see a list of valid options.")
|
||||
return null
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user