Skip to content

Commit

Permalink
Merge pull request #450 from datafruits/fix-live-notifs
Browse files Browse the repository at this point in the history
fix syncing metadata from liquidsoap
  • Loading branch information
mcfiredrill authored Feb 22, 2025
2 parents 1a1cb4f + eef0dad commit 14e5c42
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/models/scheduled_show.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def queue_playlist!
end
puts "found track: #{track}"
if track
# should be audio_file_name in dev ???
liquidsoap.add_to_queue track.url
puts "added to queue: #{track.url}"
ScheduledShowExpAwardWorker.perform_later self.id
Expand Down
3 changes: 2 additions & 1 deletion app/services/liquidsoap_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def add_to_queue uri
end

def skip
@liquidsoap_socket.write("icecast.skip").encode("UTF-8")
# @liquidsoap_socket.write("icecast.skip").encode("UTF-8")
@liquidsoap_socket.write("backup_playlist.flush_and_skip").encode("UTF-8")
end

def scheduled_shows_queue
Expand Down
3 changes: 1 addition & 2 deletions app/services/live_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ def self.perform radio, notification
if s.present? && s.dj.username == user
current_show[:scheduled_show] = s.id
else
current_show[:scheduled_show] = nil
current_show[:scheduled_show] = ""
end

# why does this fail
::StreamPusher.redis.hset "#{radio}:current_show", current_show
end
end
6 changes: 6 additions & 0 deletions app/services/schedule_monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ def self.perform radio, now, liquidsoap_socket_class=Liquidsoap::Socket
end
# current_scheduled_show_in_db and redis should sync
radio.set_current_show_playing current_scheduled_show_in_db.id
# TODO set current_show metadata here
# TODO when to clear this ??
#
# on fallback switch???
current_show = { title: current_scheduled_show_in_db.title, user: current_scheduled_show_in_db.dj.username }
StreamPusher.redis.hset "#{radio}:current_show", current_show
else
puts "current show is already playing and queued?"
end
Expand Down

0 comments on commit 14e5c42

Please sign in to comment.