Skip to content

Commit

Permalink
Upd
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Jun 14, 2024
1 parent 773fcfe commit 72866d8
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 21 deletions.
8 changes: 7 additions & 1 deletion Jukebox/JukeboxBlissify.lua
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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))
Expand Down
32 changes: 17 additions & 15 deletions Jukebox/JukeboxRandomPlaylist.lua
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions Jukebox/README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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.
2 changes: 1 addition & 1 deletion index.json
Original file line number Diff line number Diff line change
@@ -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}}

0 comments on commit 72866d8

Please sign in to comment.