CLI implementations for add, enqueue, and tag commands.
This commit is contained in:
parent
b0532f6733
commit
3401060a70
@ -355,43 +355,46 @@ Configuration:
|
||||
|
||||
private def processAdd(LinkedList line) {
|
||||
|
||||
def option = line.poll()
|
||||
def thingToAddId, targetPlaylistId
|
||||
List<String> parts = line.join(' ').split(' to playlist ').collect { it.trim() }
|
||||
|
||||
def errMsg = "Invalid options to the ${promptStyle}add${normalStyle}" +
|
||||
" command. Use ${promptStyle}help add${normalStyle} to see a " +
|
||||
"list of valid options.";
|
||||
if (parts.size() != 2) {
|
||||
printLongMessage(
|
||||
"Invalid options to the ${promptStyle}add${normalStyle}" +
|
||||
" command. Use ${promptStyle}help add${normalStyle} to see a " +
|
||||
"list of valid options.")
|
||||
return }
|
||||
|
||||
if (option != "selection" && !(thingToAddId = line.poll())) {
|
||||
printLongMessage(errMsg); return null }
|
||||
Selection selectionToAdd
|
||||
Playlist targetPlaylist
|
||||
|
||||
if (line.poll() != 'to' && line.poll() != 'playlist') {
|
||||
printLongMessage(errMsg); return null }
|
||||
if (parts[0] == "selection") { selectionToAdd = currentSelection }
|
||||
else selectionToAdd = processSelect(parts[0].split(' ') as LinkedList)
|
||||
|
||||
if (!(targetPlaylistId = line.poll())) {
|
||||
printLongMessage(errMsg); return null }
|
||||
targetPlaylist = ensureExactlyOne(
|
||||
library.getByIdOrName(Playlist, parts[1]))
|
||||
|
||||
switch(option) {
|
||||
case 'selection':
|
||||
case 'album':
|
||||
case 'artist':
|
||||
case 'file':
|
||||
// TODO
|
||||
default:
|
||||
printLongMessage("Unrecognized option to the ${promptStyle}" +
|
||||
"add${normalStyle} command. Use ${promptStyle}help add" +
|
||||
"${normalStyle} to see a list of valid options.")
|
||||
return null
|
||||
}
|
||||
}
|
||||
return library.addToPlaylist(targetPlaylist.id,
|
||||
selection.selectedFiles.collect { it.id }) }
|
||||
|
||||
private def processEnqueue(LinkedList line) {
|
||||
// TODO
|
||||
}
|
||||
Selection selection = processSelect(line)
|
||||
return library.addToPlaylist(playQueue.id,
|
||||
selection.selectedFiles.collect { it.id }) }
|
||||
|
||||
private def processTag(LinkedList line) {
|
||||
// TODO
|
||||
}
|
||||
List<String> parts = line.join(' ').split(' as ').collect { it.trim() }
|
||||
|
||||
if (parts.size() != 2) {
|
||||
printLongMessage(
|
||||
"Invalid options to the ${promptStyle}tag${normalStyle}" +
|
||||
" command. Use ${promptStyle}help tag${normalStyle} to see a " +
|
||||
"list of valid options.")
|
||||
return }
|
||||
|
||||
|
||||
Selection selection = processSelect(parts[0].split(' ') as LinkedList)
|
||||
library.tagMediaFiles(selection.selectedFiles.collect { it.id },
|
||||
parts[1].split(' ') as List) }
|
||||
|
||||
private def processClear(LinkedList line) {
|
||||
def option = line.poll()
|
||||
|
Loading…
Reference in New Issue
Block a user