Made playlists default to user-created.

This commit is contained in:
Jonathan Bernard 2016-06-01 11:28:27 -05:00
parent 19e21811e2
commit 7101f3fd53
2 changed files with 14 additions and 6 deletions

View File

@ -313,7 +313,8 @@ Configuration:
library.clean() library.clean()
playQueue = library.save(new Playlist( playQueue = library.save(new Playlist(
name: "CLI Queue ${sdf.format(new Date())}")) name: "CLI Queue ${sdf.format(new Date())}",
userCreated: false))
String user = System.getProperty('user.name') String user = System.getProperty('user.name')
String os = System.getProperty('os.name') String os = System.getProperty('os.name')
@ -569,12 +570,17 @@ Configuration:
switch (options) { switch (options) {
case ~/bookmark named (.+) on playlist (.+) at (.+)/: case ~/bookmark named (.+) on playlist (.+) at (.+)/:
Playlist p = getExactlyOne(Matcher.lastMatcher[0][2].trim()) Playlist p = getExactlyOne(
MediaFile mf = getExactlyOne(Matcher.lastMatcher[0][3].trim()) Playlist, Matcher.lastMatcher[0][2].trim())
MediaFile mf = getExactlyOne(
MediaFile, Matcher.lastMatcher[0][3].trim())
Bookmark b = new Bookmark(name: Matcher.lastMatcher[0][1].trim(), Bookmark b = new Bookmark(name: Matcher.lastMatcher[0][1].trim(),
playlistId: p.id, mediaFileId: mf.id) playlistId: p.id, mediaFileId: mf.id)
if (!p.userCreated) {
p.userCreated = true
p = library.save(p) }
b = library.save(b) b = library.save(b)
msg "New bookmark: ${b.id}: ${b.name}" msg "New bookmark: ${b.id}: ${b.name}"
return b return b
@ -585,6 +591,9 @@ Configuration:
b.name = Matcher.lastMatcher[0][1].trim() b.name = Matcher.lastMatcher[0][1].trim()
b.id = null; b.id = null;
Playlist p = library.getById(Playlist, b.playlistId)
p.userCreated = true
p = library.save(p)
b = library.save(b) b = library.save(b)
msg "New bookmark: ${b.id}: ${b.name}" msg "New bookmark: ${b.id}: ${b.name}"
return b return b
@ -610,8 +619,7 @@ Configuration:
case ~/playlist named (.+)/: case ~/playlist named (.+)/:
Playlist p = new Playlist( Playlist p = new Playlist(
name: Matcher.lastMatcher[0][1].trim(), name: Matcher.lastMatcher[0][1].trim())
userCreated: true)
p = library.save(p) p = library.save(p)
msg "New playlist: ${p.id}: ${p.name}" msg "New playlist: ${p.id}: ${p.name}"

View File

@ -5,7 +5,7 @@ import java.util.Date;
import java.util.UUID; import java.util.UUID;
public class Playlist extends Model { public class Playlist extends Model {
public boolean userCreated = false; public boolean userCreated = true;
public String name; public String name;
public int mediaFileCount = 0; public int mediaFileCount = 0;
public UUID copiedFromId = null; public UUID copiedFromId = null;