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

View File

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