Slow down bookmark updates. Allow tags to be selectable/listable.
This commit is contained in:
parent
26f6378125
commit
e1f64b7b86
@ -276,6 +276,7 @@ Configuration:
|
||||
public void repl() {
|
||||
this.running = true
|
||||
String line = null
|
||||
long nextBookmarkUpdate = 0
|
||||
|
||||
outStream.println "\n\n\n"
|
||||
drawLeader()
|
||||
@ -295,10 +296,11 @@ Configuration:
|
||||
dismissMsgDate = new Date(new Date().time + msgTimeout) } } }
|
||||
else {
|
||||
drawLeader()
|
||||
if (curMediaFile) {
|
||||
if (curMediaFile && System.currentTimeMillis() > nextBookmarkUpdate) {
|
||||
playBookmark.playTimeMs =
|
||||
vlcj.mediaListPlayer.mediaPlayer.time
|
||||
library.save(playBookmark) }
|
||||
library.save(playBookmark)
|
||||
nextBookmarkUpdate = System.currentTimeMillis() + 2000 }
|
||||
Thread.sleep(250) } } }
|
||||
|
||||
private def processInput(String line) {
|
||||
@ -366,7 +368,7 @@ Configuration:
|
||||
if (options == 'bookmarks') selection = library.getBookmarks()
|
||||
else if (options != 'selection') selection = select(options, selection)
|
||||
|
||||
if (!selection) msg "Nothing selected."
|
||||
if (!selection) err "Nothing selected."
|
||||
else return printLongMessage(makeList(selection, { "${it.id}: ${it} " })) }
|
||||
|
||||
private List<Model> processSelect(String options, List<Model> selection) {
|
||||
@ -384,10 +386,11 @@ Configuration:
|
||||
Class modelClass
|
||||
|
||||
switch (options) {
|
||||
case ~/playing ($selectableModels)s?/:
|
||||
case ~/playing ($selectableModels|tag)s?/:
|
||||
if (!curMediaFile) err "No media is currently playing."
|
||||
|
||||
modelClass = modelClasses[Matcher.lastMatcher[0][1]]
|
||||
logger.debug("modelClass: {}\tcurMediaFileId: {}", modelClass, curMediaFile.id)
|
||||
if (modelClass == MediaFile) return [curMediaFile]
|
||||
else if (modelClass == Playlist) return playQueue
|
||||
else return library.getWhere(modelClass,
|
||||
@ -572,7 +575,7 @@ Configuration:
|
||||
List<MediaFile> mediaFiles = library.collectMediaFiles(selection)
|
||||
library.tagMediaFiles(mediaFiles.collect { it.id }, tags)
|
||||
|
||||
msg "Tagged '${mediaFiles.size()}' files as $tags."
|
||||
msg "Tagged ${mediaFiles.size()} files as $tags."
|
||||
return mediaFiles }
|
||||
|
||||
private def processClear(String options) {
|
||||
@ -609,6 +612,7 @@ Configuration:
|
||||
vlcj.mediaListPlayer.playItem(playBookmark.playIndex + count) }
|
||||
|
||||
private def processPrev(String rest) {
|
||||
def count
|
||||
try { count = rest ? rest as int : 1 }
|
||||
catch (Exception e) { err "$count is not a valid number" }
|
||||
vlcj.mediaListPlayer.stop()
|
||||
@ -628,14 +632,15 @@ Configuration:
|
||||
|
||||
private def processFastForward(String rest) {
|
||||
String[] parts = rest.split(' ')
|
||||
String amount = parts.size() > 0 ? parts[0]?.trim() : null
|
||||
String strAmount = parts.size() > 0 ? parts[0]?.trim() : null
|
||||
String unit = parts.size() > 1 ? parts[1]?.trim() : null
|
||||
|
||||
if (!amount) { amount = "10"; unit = "s" }
|
||||
if (!strAmount) { strAmount = "10"; unit = "s" }
|
||||
if (!unit) unit = 's'
|
||||
|
||||
try { amount = amount as int }
|
||||
catch (Exception e) { err "$amount must be an integer." }
|
||||
long amount
|
||||
try { amount = strAmount as long }
|
||||
catch (Exception e) { err "$strAmount must be an integer." }
|
||||
|
||||
switch (unit) {
|
||||
case 'ms': case 'millis': case 'millisecond': case 'milliseconds':
|
||||
@ -653,14 +658,15 @@ Configuration:
|
||||
|
||||
private def processRewind(String rest) {
|
||||
String[] parts = rest.split(' ')
|
||||
String amount = parts.size() > 0 ? parts[0]?.trim() : null
|
||||
String strAmount = parts.size() > 0 ? parts[0]?.trim() : null
|
||||
String unit = parts.size() > 1 ? parts[1]?.trim() : null
|
||||
|
||||
if (!amount) { amount = "10"; unit = "s" }
|
||||
if (!strAmount) { strAmount = "10"; unit = "s" }
|
||||
if (!unit) unit = 's'
|
||||
|
||||
try { amount = -(amount as int) }
|
||||
catch (Exception e) { err "$amount must be an integer." }
|
||||
long amount
|
||||
try { amount = -(strAmount as int) }
|
||||
catch (Exception e) { err "$strAmount must be an integer." }
|
||||
|
||||
switch (unit) {
|
||||
case 'ms': case 'millis': case 'millisecond': case 'milliseconds':
|
||||
@ -755,7 +761,7 @@ Configuration:
|
||||
String result = new StringBuilder()
|
||||
.append(eraseLeader)
|
||||
.append(msg)
|
||||
.append("\n\n")
|
||||
.append("\n\n\n")
|
||||
.toString()
|
||||
|
||||
outStream.println result
|
||||
|
Loading…
Reference in New Issue
Block a user