diff --git a/cli/src/main/groovy/com/jdbernard/wdiwtlt/cli/CommandLineInterface.groovy b/cli/src/main/groovy/com/jdbernard/wdiwtlt/cli/CommandLineInterface.groovy index 1494af6..0200f26 100644 --- a/cli/src/main/groovy/com/jdbernard/wdiwtlt/cli/CommandLineInterface.groovy +++ b/cli/src/main/groovy/com/jdbernard/wdiwtlt/cli/CommandLineInterface.groovy @@ -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}" diff --git a/core/src/main/java/com/jdbernard/wdiwtlt/db/models/Playlist.java b/core/src/main/java/com/jdbernard/wdiwtlt/db/models/Playlist.java index cabb53c..d79ce3a 100644 --- a/core/src/main/java/com/jdbernard/wdiwtlt/db/models/Playlist.java +++ b/core/src/main/java/com/jdbernard/wdiwtlt/db/models/Playlist.java @@ -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;