Skip to content

Commit 3f651c5

Browse files
author
Datanoise
committed
fix: resolve AutoDJ metadata visibility and connecting status in player
1 parent ca8c394 commit 3f651c5

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

relay/streamer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ func (sm *StreamerManager) streamFile(ctx context.Context, s *Streamer, path str
381381
if s.InjectMetadata {
382382
output.CurrentSong = s.CurrentFile
383383
output.Name = s.Name
384+
output.Visible = true
384385
sm.relay.UpdateMetadata(s.OutputMount, s.CurrentFile)
385386
}
386387
output.Bitrate = fmt.Sprintf("%d", s.Bitrate)

server/server.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,11 @@ func (s *Server) Start() error {
402402
logrus.WithError(err).Errorf("Failed to start AutoDJ %s", adj.Name)
403403
} else {
404404
logrus.Infof("AutoDJ %s started on %s", adj.Name, adj.Mount)
405+
if adj.InjectMetadata {
406+
if st, ok := s.Relay.GetStream(adj.Mount); ok {
407+
st.SetVisible(true)
408+
}
409+
}
405410
if len(adj.Playlist) == 0 {
406411
streamer.ScanMusicDir() // Initial scan
407412
}
@@ -2198,6 +2203,11 @@ func (s *Server) handleAddAutoDJ(w http.ResponseWriter, r *http.Request) {
21982203
// Start it immediately
21992204
streamer, err := s.StreamerM.StartStreamer(adj.Name, adj.Mount, adj.MusicDir, adj.Loop, adj.Format, adj.Bitrate, adj.InjectMetadata, nil, adj.MPDEnabled, adj.MPDPort)
22002205
if err == nil {
2206+
if adj.InjectMetadata {
2207+
if st, ok := s.Relay.GetStream(adj.Mount); ok {
2208+
st.SetVisible(true)
2209+
}
2210+
}
22012211
streamer.ScanMusicDir()
22022212
streamer.Play()
22032213
}
@@ -2246,6 +2256,11 @@ func (s *Server) handleToggleAutoDJ(w http.ResponseWriter, r *http.Request) {
22462256
if adj.Enabled {
22472257
streamer, err := s.StreamerM.StartStreamer(adj.Name, adj.Mount, adj.MusicDir, adj.Loop, adj.Format, adj.Bitrate, adj.InjectMetadata, adj.Playlist, adj.MPDEnabled, adj.MPDPort)
22482258
if err == nil {
2259+
if adj.InjectMetadata {
2260+
if st, ok := s.Relay.GetStream(adj.Mount); ok {
2261+
st.SetVisible(true)
2262+
}
2263+
}
22492264
if len(adj.Playlist) == 0 {
22502265
streamer.ScanMusicDir()
22512266
}

0 commit comments

Comments
 (0)