l radio: better irc output, eat blanks, wishes
This commit is contained in:
parent
610cd87749
commit
d26c371b14
@ -9,7 +9,6 @@ let
|
|||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# TODO come up with new rating, without moving files
|
# TODO come up with new rating, without moving files
|
||||||
# music_dir=${lib.escapeShellArg music_dir}
|
|
||||||
# current_track=$(${pkgs.curl}/bin/curl -fSs http://localhost:8002/current | ${pkgs.jq}/bin/jq -r .filename)
|
# current_track=$(${pkgs.curl}/bin/curl -fSs http://localhost:8002/current | ${pkgs.jq}/bin/jq -r .filename)
|
||||||
# track_infos=$(${print_current}/bin/print_current)
|
# track_infos=$(${print_current}/bin/print_current)
|
||||||
# skip_count=$(${pkgs.attr}/bin/getfattr -n user.skip_count --only-values "$current_track" || echo 0)
|
# skip_count=$(${pkgs.attr}/bin/getfattr -n user.skip_count --only-values "$current_track" || echo 0)
|
||||||
@ -22,13 +21,13 @@ let
|
|||||||
# mv "$current_track" "$music_dir"/the_playlist/.graveyard/
|
# mv "$current_track" "$music_dir"/the_playlist/.graveyard/
|
||||||
# echo killing: "$track_infos"
|
# echo killing: "$track_infos"
|
||||||
# fi
|
# fi
|
||||||
${pkgs.curl}/bin/curl -X POST http://localhost:8002/skip
|
${pkgs.curl}/bin/curl -fSs -X POST http://localhost:8002/skip |
|
||||||
|
${pkgs.jq}/bin/jq -r '.filename'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
good_track = pkgs.writeBashBin "good_track" ''
|
good_track = pkgs.writeBashBin "good_track" ''
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
music_dir=${lib.escapeShellArg music_dir}
|
|
||||||
current_track=$(${pkgs.curl}/bin/curl -fSs http://localhost:8002/current | ${pkgs.jq}/bin/jq -r .filename)
|
current_track=$(${pkgs.curl}/bin/curl -fSs http://localhost:8002/current | ${pkgs.jq}/bin/jq -r .filename)
|
||||||
track_infos=$(${print_current}/bin/print_current)
|
track_infos=$(${print_current}/bin/print_current)
|
||||||
# TODO come up with new rating, without moving files
|
# TODO come up with new rating, without moving files
|
||||||
@ -41,7 +40,15 @@ let
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
print_current = pkgs.writeDashBin "print_current" ''
|
print_current = pkgs.writeDashBin "print_current" ''
|
||||||
${pkgs.curl}/bin/curl -fSs http://localhost:8002/current | ${pkgs.jq}/bin/jq -r '"\(.filename): \(.purl)"'
|
file=$(${pkgs.curl}/bin/curl -fSs http://localhost:8002/current |
|
||||||
|
${pkgs.jq}/bin/jq -r '.filename' |
|
||||||
|
${pkgs.gnused}/bin/sed 's,^${music_dir},,'
|
||||||
|
)
|
||||||
|
link=$(${pkgs.curl}/bin/curl http://localhost:8002/current |
|
||||||
|
${pkgs.jq}/bin/jq -r '.filename' |
|
||||||
|
${pkgs.gnused}/bin/sed 's@.*\(.\{11\}\)\.ogg@https://youtu.be/\1@'
|
||||||
|
)
|
||||||
|
echo "$file": "$link"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
set_irc_topic = pkgs.writeDash "set_irc_topic" ''
|
set_irc_topic = pkgs.writeDash "set_irc_topic" ''
|
||||||
@ -181,6 +188,12 @@ in {
|
|||||||
like.filename = "${good_track}/bin/good_track";
|
like.filename = "${good_track}/bin/good_track";
|
||||||
|
|
||||||
current.filename = "${print_current}/bin/print_current";
|
current.filename = "${print_current}/bin/print_current";
|
||||||
|
wish.filename = pkgs.writeDash "wish" ''
|
||||||
|
echo "youtube-dl:$1" | ${pkgs.curl}/bin/curl -fSs http://localhost:8002/wish -d @- > /dev/null
|
||||||
|
'';
|
||||||
|
wishlist.filename = pkgs.writeDash "wishlist" ''
|
||||||
|
${pkgs.curl}/bin/curl -fSs http://localhost:8002/wish | ${pkgs.jq}/bin/jq -r '.[]'
|
||||||
|
'';
|
||||||
suggest.filename = pkgs.writeDash "suggest" ''
|
suggest.filename = pkgs.writeDash "suggest" ''
|
||||||
echo "$@" >> playlist_suggest
|
echo "$@" >> playlist_suggest
|
||||||
'';
|
'';
|
||||||
|
@ -30,6 +30,7 @@ port = string.to_int(env["RADIO_PORT"], default = 8000)
|
|||||||
all_music = playlist(env["MUSIC"], check_next = filter_graveyard)
|
all_music = playlist(env["MUSIC"], check_next = filter_graveyard)
|
||||||
wishlist = request.queue()
|
wishlist = request.queue()
|
||||||
tracks = fallback(track_sensitive = true, [wishlist, all_music])
|
tracks = fallback(track_sensitive = true, [wishlist, all_music])
|
||||||
|
tracks = blank.eat(tracks)
|
||||||
|
|
||||||
last_metadata = ref([])
|
last_metadata = ref([])
|
||||||
def on_metadata(m) =
|
def on_metadata(m) =
|
||||||
|
Loading…
Reference in New Issue
Block a user