Simplify the new playlist creation logic.

This commit is contained in:
Jonathan Bernard 2016-06-01 11:31:05 -05:00
parent 451956dc4f
commit ffcfc7bc77

View File

@ -602,22 +602,16 @@ Configuration:
return b
case ~/playlist named (.+) from (queue|selection|.+)/:
Playlist p
if (Matcher.lastMatcher[0][2] == 'queue') {
p = playQueue.clone()
p.name = Matcher.lastMatcher[0][1].trim()
p.id = null
p = library.save(p) }
else {
p = new Playlist(name: Matcher.lastMatcher[0][1])
p = library.save(p)
Playlist p = library.save(
new Playlist( name: Matcher.lastMatcher[0][1].trim()))
if (Matcher.lastMatcher[0][2] != 'selection')
selection = select(Matcher.lastMatcher[0][2], selection)
if (Matcher.lastMatcher[0][2] != 'selection')
selection = select(Matcher.lastMatcher[0][2], selection)
library.addToPlaylist(p.id,
library.collectMediaFiles(selection).collect { it.id }) }
library.addToPlaylist(p.id,
library.collectMediaFiles(selection).collect { it.id })
msg "New playlist: ${p.id}: ${p.name}"
return p
case ~/playlist named (.+)/: