Commit 6e6fbf9
xxwhirlpool
·
2026-04-09 17:09:24 -0400 EDT
parent e9a9bb5
add more radio stations, add ryan's ics script
2 files changed,
+62,
-3
+9,
-3
| ... | ... | @@ -13,13 +13,16 @@ declare -A stations=( | |
| 13 | 13 | ["indiebeat-bonkwave"]="https://azura.theindiebeat.fm/listen/not_what_i_call_radio_bonk_wave/radio.mp3" | |
| 14 | 14 | ["dadradio"]="http://stacey-campbell.com:8001/dadradio.mp3" | |
| 15 | 15 | ["vintageobscura"]="https://radio.vintageobscura.net/stream" | |
| 16 | + | ["hbr1-tranceponder"]="https://www.hbr1.com/playlist/trance.ogg.m3u" # full-on/psychedelic | |
| 17 | + | ["hbr1-tronic"]="https://www.hbr1.com/playlist/tronic.ogg.m3u" # minimal/tech | |
| 18 | + | ["hbr1-dream"]="https://www.hbr1.com/playlist/ambient.ogg.m3u" # chillout | |
| 16 | 19 | ) | |
| 17 | 20 | ||
| 18 | 21 | # little header text graphic to show before playback | |
| 19 | 22 | ||
| 20 | 23 | gum_echo() { | |
| 21 | - | top=$(gum style --bold --foreground "#a6d189" --border none --width 20 --margin "1 0" --align center "♥ NOW PLAYING ♥") | |
| 22 | - | bottom=$(gum style --foreground "#f4b8e4" --border none --width 20 --margin "1 0" --align center "$@") | |
| 24 | + | top=$(gum style --bold --foreground "#a6d189" --border none --width 50 --margin "1 0" --align center "♥ NOW PLAYING ♥") | |
| 25 | + | bottom=$(gum style --foreground "#f4b8e4" --border none --width 50 --margin "1 0" --align center "$@") | |
| 23 | 26 | ||
| 24 | 27 | joingum=$(gum join --vertical --align center "$top" "$bottom") | |
| 25 | 28 | all=$(gum style --border-foreground "#99d1db" --border double --width 50 --padding "0 0" --align center "$joingum") |
| ... | ... | @@ -30,7 +33,7 @@ gum_echo() { | |
| 30 | 33 | # run the script | |
| 31 | 34 | ||
| 32 | 35 | choice() { | |
| 33 | - | choose=$(gum choose --header "radio stations" "kexp" "nts1" "nts2" "dadradio" "indiebeat-pop" "indiebeat-rock" "indiebeat-jazz" "vintageobscura") | |
| 36 | + | choose=$(gum choose --height 20 --header "radio stations" "kexp" "nts1" "nts2" "dadradio" "indiebeat-pop" "indiebeat-rock" "indiebeat-jazz" "vintageobscura" "hbr1-tranceponder" "hbr1-tronic" "hbr1-dream") | |
| 34 | 37 | case "$choose" in | |
| 35 | 38 | kexp) gum_echo "KEXP" && mpv "${stations['KEXP']}";; | |
| 36 | 39 | nts1) gum_echo "NTS1" && mpv "${stations['NTS1']}";; |
| ... | ... | @@ -42,6 +45,9 @@ choice() { | |
| 42 | 45 | indiebeat-electronic) gum_echo "indiebeat - electronic" && mpv "${stations['indiebeat-electronic']}";; | |
| 43 | 46 | indiebeat-bonkwave) gum_echo "indiebeat - bonkwave" && mpv "${stations['indiebeat-bonkwave']}";; | |
| 44 | 47 | vintageobscura) gum_echo "vintage obscura" && mpv "${stations['vintageobscura']}";; | |
| 48 | + | hbr1-tranceponder) gum_echo "HBR1 I.D.M. tranceponder" && mpv "${stations['hbr1-tranceponder']}";; | |
| 49 | + | hbr1-tronic) gum_echo "HBR1 tronic lounge" && mpv "${stations['hbr1-tronic']}";; | |
| 50 | + | hbr1-dream) gum_echo "HBR1 dream factory" && mpv "${stations['hbr1-dream']}" | |
| 45 | 51 | esac | |
| 46 | 52 | } | |
| 47 | 53 |
+53,
-0
| ... | ... | @@ -0,0 +1,53 @@ | |
| 1 | + | #!/usr/bin/env ruby | |
| 2 | + | # | |
| 3 | + | # written by ryan of miyaku media | |
| 4 | + | # https://miyaku.media/ | |
| 5 | + | ||
| 6 | + | require 'erb' | |
| 7 | + | require 'securerandom' | |
| 8 | + | require 'mediainfo' | |
| 9 | + | ||
| 10 | + | def print_usage_and_exit | |
| 11 | + | $stderr.puts "usage:\n ./schedulebot.rb 20251207T201500 'title1' title1.mp4 'title2' title2.mp4 [...]" | |
| 12 | + | exit 1 | |
| 13 | + | end | |
| 14 | + | ||
| 15 | + | debug = false | |
| 16 | + | url = 'https://miru.miyaku.media' | |
| 17 | + | ||
| 18 | + | if ARGV.empty? | |
| 19 | + | print_usage_and_exit | |
| 20 | + | end | |
| 21 | + | ||
| 22 | + | arguments = ARGV.dup | |
| 23 | + | start_time = arguments.shift | |
| 24 | + | if arguments.empty? || arguments.length.odd? | |
| 25 | + | print_usage_and_exit | |
| 26 | + | end | |
| 27 | + | ||
| 28 | + | $stderr.puts "Got start time: #{start_time}" if debug | |
| 29 | + | current_time = Time.strptime(start_time, "%Y%m%dT%H%M%S") | |
| 30 | + | $stderr.puts "Reparsed: #{current_time.strftime("%Y%m%dT%H%M%S")}" if debug | |
| 31 | + | until arguments.empty? do | |
| 32 | + | title = arguments.shift | |
| 33 | + | filename = arguments.shift | |
| 34 | + | $stderr.puts "Generating block for #{title} from #{filename}" if debug | |
| 35 | + | media_info = MediaInfo.from(filename) | |
| 36 | + | duration = media_info.video.duration | |
| 37 | + | $stderr.puts "#{duration / 1000} seconds" if debug | |
| 38 | + | event = ERB.new(<<-EVENTBLOCK).result(binding) | |
| 39 | + | BEGIN:VEVENT | |
| 40 | + | UID:<%= SecureRandom.uuid.upcase %> | |
| 41 | + | DTSTAMP:<%= Time.now.utc.strftime('%Y%m%dT%H%M%SZ') %> | |
| 42 | + | DTSTART;TZID=America/New_York:<%= current_time.strftime("%Y%m%dT%H%M%S") %> | |
| 43 | + | DURATION:P0DT<%= Time.at(duration / 1000).utc.strftime("%HH%MM%SS") %> | |
| 44 | + | SUMMARY:<%= title %> | |
| 45 | + | DESCRIPTION:Livestream at: <%= url %> | |
| 46 | + | URL:<%= url %> | |
| 47 | + | END:VEVENT | |
| 48 | + | EVENTBLOCK | |
| 49 | + | ||
| 50 | + | puts event | |
| 51 | + | ||
| 52 | + | current_time += (duration / 1000) | |
| 53 | + | end |