From 72866d85011267922932f25cd3ef7ea37bc02cb0 Mon Sep 17 00:00:00 2001 From: jcorporation Date: Sat, 15 Jun 2024 01:06:13 +0200 Subject: [PATCH] Upd --- Jukebox/JukeboxBlissify.lua | 8 +++++++- Jukebox/JukeboxRandomPlaylist.lua | 32 ++++++++++++++++--------------- Jukebox/README.md | 9 +++++---- index.json | 2 +- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/Jukebox/JukeboxBlissify.lua b/Jukebox/JukeboxBlissify.lua index 72864de..3c138df 100644 --- a/Jukebox/JukeboxBlissify.lua +++ b/Jukebox/JukeboxBlissify.lua @@ -1,5 +1,11 @@ -- {"name": "JukeboxBlissify", "file": "Jukebox/JukeboxBlissify.lua", "version": 2, "desc": "Uses blissify-rs to populate the jukebox queue.", "order":1,"arguments":["addToQueue"]} local blissify_path = mympd_env.var_blissify_path +local blissify_config = "" +if mympd_env.var_blissify_config ~= nil and + mympd_env.var_blissify_config ~= "" +then + blissify_config = "-c " .. mympd_env.var_blissify_config +end local addSongs = 1 local min_jukebox_length = 50 @@ -46,7 +52,7 @@ end local full_song_path = mympd_state.music_directory .. "/" .. last_song local prefix_len = #mympd_state.music_directory + 2 local songs = {} -local cmd = string.format("%s playlist --dry-run --from-song \"%s\" %d 2>/dev/null", blissify_path, full_song_path, to_add) +local cmd = string.format("%s %s playlist --dry-run --from-song \"%s\" %d 2>/dev/null", blissify_path, blissify_config, full_song_path, to_add) local output = mympd.os_capture(cmd) for line in string.gmatch(output, "[^\n]+") do table.insert(songs, string.sub(line, prefix_len)) diff --git a/Jukebox/JukeboxRandomPlaylist.lua b/Jukebox/JukeboxRandomPlaylist.lua index 28d668f..ef79962 100644 --- a/Jukebox/JukeboxRandomPlaylist.lua +++ b/Jukebox/JukeboxRandomPlaylist.lua @@ -1,4 +1,4 @@ --- {"name": "JukeboxRandomPlaylist", "file": "Jukebox/JukeboxRandomPlaylist.lua", "version": 1, "desc": "Populates the jukebox queue with random songs from a random playlist.", "order":0, "arguments":[]} +-- {"name": "JukeboxRandomPlaylist", "file": "Jukebox/JukeboxRandomPlaylist.lua", "version": 2, "desc": "Populates the jukebox queue with random songs from a random playlist.", "order":0, "arguments":["addToQueue"]} local addSongs = 1 local min_jukebox_length = 50 @@ -49,23 +49,25 @@ if rc == 1 then return end --- Add addSongs entries from playlist to the MPD queue -local addUris = {} -for i = 1, addSongs do - table.insert(addUris, songs.data[i].uri) -end -rc, result = mympd.api("MYMPD_API_QUEUE_APPEND_URIS", { - uris = addUris, - play = true -}) -if rc == 1 then - send_error(result.message) - return +if mympd_arguments.addToQueue == "1" then + -- Add addSongs entries from playlist to the MPD queue + local addUris = {} + for i = 1, addSongs do + table.insert(addUris, songs.data[i].uri) + end + rc, result = mympd.api("MYMPD_API_QUEUE_APPEND_URIS", { + uris = addUris, + play = true + }) + if rc == 1 then + send_error(result.message) + return + end + addSongs = addSongs + 1 end -- Add additional songs to the jukebox queue -addUris = {} -addSongs = addSongs + 1 +local addUris = {} for i = addSongs, songs.returnedEntities do table.insert(addUris, songs.data[i].uri) end diff --git a/Jukebox/README.md b/Jukebox/README.md index d09e963..9995edc 100644 --- a/Jukebox/README.md +++ b/Jukebox/README.md @@ -1,6 +1,6 @@ # Jukebox -This scripts can be used to fill the jukebox queue. You must add a trigger for the `mympd_jukebox` event and change the jukebox mode to `Script`. +This scripts can be used to extend the jukebox function of myMPD. You must add a trigger for the `mympd_jukebox` event and change the jukebox mode to `Script`. ## Random Playlists @@ -13,6 +13,7 @@ Blissify is a program used to make playlists of songs that sound alike from your This script creates a "seeded" playlist. 1. Install Blissify: https://github.com/Polochon-street/blissify-rs -2. Add a variable `blissify_path` to define the path to your blissify binary. -3. Index your MPD library: `blissify init` - this can take a long time. -4. Clear the queue and play a song from which Blissify should start. +2. Index your MPD library: `blissify init` - this can take a long time. +3. Add the variable `blissify_path` to define the path to your blissify binary. +4. Optional: Add the variable `blissify_config` to specify the blissify configuration file. +5. Clear the queue and play a song from which Blissify should start. diff --git a/index.json b/index.json index 63a53be..d572f35 100644 --- a/index.json +++ b/index.json @@ -1 +1 @@ -{"Albumart/Albumart.lua":{"name":"Albumart","desc":"Fetches albumart on demand.","version":1},"Albumart/AlbumartProviders.lua":{"name":"AlbumartProviders","desc":"Albumart providers for the Albumart script.","version":1},"BatteryIndicator/BatteryIndicator.lua":{"name":"BatteryIndicator","desc":"Displays the battery status from sys filesystem.","version":1},"Channel/ChannelReadMessages.lua":{"name":"ChannelReadMessages","desc":"Reads all message from a MPD channel.","version":1},"Channel/ChannelSendMessage.lua":{"name":"ChannelSendMessage","desc":"Sends a message to a MPD channel.","version":1},"Channel/ChannelSubscribe.lua":{"name":"ChannelSubscribe","desc":"Subscribes to a MPD channel.","version":1},"Covercache/CovercachePrepopulate.lua":{"name":"CovercachePrepopulate","desc":"Prepopulates the myMPD covercache.","version":1},"Jukebox/JukeboxBlissify.lua":{"name":"JukeboxBlissify","desc":"Uses blissify-rs to populate the jukebox queue.","version":2},"Jukebox/JukeboxRandomPlaylist.lua":{"name":"JukeboxRandomPlaylist","desc":"Populates the jukebox queue with random songs from a random playlist.","version":1},"ListenBrainz/ListenBrainzFeedback.lua":{"name":"ListenBrainzFeedback","desc":"Sends feedback to ListenBrainz.","version":1},"ListenBrainz/ListenBrainzPlaylistImport.lua":{"name":"ListenBrainzPlaylistImport","desc":"Imports generated playlists from ListenBrainz.","version":1},"ListenBrainz/ListenBrainzScrobbler.lua":{"name":"ListenBrainzScrobbler","desc":"Scrobbles songs to ListenBrainz.","version":1},"ListenBrainz/ListenBrainzSetPin.lua":{"name":"ListenBrainzSetPin","desc":"Sets or unsets the pin on ListenBrainz.","version":1},"Lyrics/Lyrics.lua":{"name":"Lyrics","desc":"Fetches lyrics on demand.","version":3},"Lyrics/LyricsProviders.lua":{"name":"LyricsProviders","desc":"Lyrics providers for the Lyrics script.","version":3},"Maloja/MalojaScrobbler.lua":{"name":"MalojaScrobbler","desc":"Scrobbles songs to your Maloja server.","version":1},"Misc/EnableJukebox.lua":{"name":"EnableJukebox","desc":"Enables the jukebox with specified options.","version":1},"Misc/PlayRandomPlaylist.lua":{"name":"PlayRandomPlaylist","desc":"Plays a random playlist.","version":1},"Radiobrowser/Radiobrowser.lua":{"name":"Radiobrowser","desc":"Radiobrowser interface.","version":1},"Tagart/Tagart.lua":{"name":"Tagart","desc":"Fetches tagart on demand.","version":1},"Tagart/TagartProviders.lua":{"name":"TagartProviders","desc":"Tagart providers for the Tagart script.","version":1},"last.fm/lastfmFeedback.lua":{"name":"lastfmFeedback","desc":"Sends feedback to last.fm.","version":1},"last.fm/lastfmGetSessionKey.lua":{"name":"lastfmGetSessionKey","desc":"Fetches the session key from last.fm and sets the myMPD variable.","version":1},"last.fm/lastfmLib.lua":{"name":"lastfmLib","desc":"Library requried by the other last.fm modules.","version":1},"last.fm/lastfmPlayer.lua":{"name":"lastfmPlayer","desc":"Sends the now playing info to last.fm.","version":1},"last.fm/lastfmScrobbler.lua":{"name":"lastfmScrobbler","desc":"Scrobbles songs to last.fm.","version":1}} +{"Albumart/Albumart.lua":{"name":"Albumart","desc":"Fetches albumart on demand.","version":1},"Albumart/AlbumartProviders.lua":{"name":"AlbumartProviders","desc":"Albumart providers for the Albumart script.","version":1},"BatteryIndicator/BatteryIndicator.lua":{"name":"BatteryIndicator","desc":"Displays the battery status from sys filesystem.","version":1},"Channel/ChannelReadMessages.lua":{"name":"ChannelReadMessages","desc":"Reads all message from a MPD channel.","version":1},"Channel/ChannelSendMessage.lua":{"name":"ChannelSendMessage","desc":"Sends a message to a MPD channel.","version":1},"Channel/ChannelSubscribe.lua":{"name":"ChannelSubscribe","desc":"Subscribes to a MPD channel.","version":1},"Covercache/CovercachePrepopulate.lua":{"name":"CovercachePrepopulate","desc":"Prepopulates the myMPD covercache.","version":1},"Jukebox/JukeboxBlissify.lua":{"name":"JukeboxBlissify","desc":"Uses blissify-rs to populate the jukebox queue.","version":2},"Jukebox/JukeboxRandomPlaylist.lua":{"name":"JukeboxRandomPlaylist","desc":"Populates the jukebox queue with random songs from a random playlist.","version":2},"ListenBrainz/ListenBrainzFeedback.lua":{"name":"ListenBrainzFeedback","desc":"Sends feedback to ListenBrainz.","version":1},"ListenBrainz/ListenBrainzPlaylistImport.lua":{"name":"ListenBrainzPlaylistImport","desc":"Imports generated playlists from ListenBrainz.","version":1},"ListenBrainz/ListenBrainzScrobbler.lua":{"name":"ListenBrainzScrobbler","desc":"Scrobbles songs to ListenBrainz.","version":1},"ListenBrainz/ListenBrainzSetPin.lua":{"name":"ListenBrainzSetPin","desc":"Sets or unsets the pin on ListenBrainz.","version":1},"Lyrics/Lyrics.lua":{"name":"Lyrics","desc":"Fetches lyrics on demand.","version":3},"Lyrics/LyricsProviders.lua":{"name":"LyricsProviders","desc":"Lyrics providers for the Lyrics script.","version":3},"Maloja/MalojaScrobbler.lua":{"name":"MalojaScrobbler","desc":"Scrobbles songs to your Maloja server.","version":1},"Misc/EnableJukebox.lua":{"name":"EnableJukebox","desc":"Enables the jukebox with specified options.","version":1},"Misc/PlayRandomPlaylist.lua":{"name":"PlayRandomPlaylist","desc":"Plays a random playlist.","version":1},"Radiobrowser/Radiobrowser.lua":{"name":"Radiobrowser","desc":"Radiobrowser interface.","version":1},"Tagart/Tagart.lua":{"name":"Tagart","desc":"Fetches tagart on demand.","version":1},"Tagart/TagartProviders.lua":{"name":"TagartProviders","desc":"Tagart providers for the Tagart script.","version":1},"last.fm/lastfmFeedback.lua":{"name":"lastfmFeedback","desc":"Sends feedback to last.fm.","version":1},"last.fm/lastfmGetSessionKey.lua":{"name":"lastfmGetSessionKey","desc":"Fetches the session key from last.fm and sets the myMPD variable.","version":1},"last.fm/lastfmLib.lua":{"name":"lastfmLib","desc":"Library requried by the other last.fm modules.","version":1},"last.fm/lastfmPlayer.lua":{"name":"lastfmPlayer","desc":"Sends the now playing info to last.fm.","version":1},"last.fm/lastfmScrobbler.lua":{"name":"lastfmScrobbler","desc":"Scrobbles songs to last.fm.","version":1}}