feat(ipc): add an endpoint for getting current track (#911)

This commit is contained in:
tdakkota
2026-04-20 19:36:11 -07:00
committed by GitHub
parent 56546a9314
commit cfa45a4647
10 changed files with 94 additions and 18 deletions
+22 -4
View File
@@ -1,6 +1,7 @@
package mediaprovider
import (
"slices"
"time"
"fyne.io/fyne/v2"
@@ -205,11 +206,14 @@ type SavedPlayQueue struct {
}
type RadioStation struct {
Name string
ID string
StationName string
HomePageURL string
StreamURL string
CoverArtID string
Title string
Artists []string
CoverArtID string
}
type MediaItemType int
@@ -267,16 +271,30 @@ func (r *RadioStation) Metadata() MediaItemMetadata {
if r == nil {
return MediaItemMetadata{}
}
name := r.Title
if name == "" {
name = r.StationName
}
return MediaItemMetadata{
Type: MediaItemTypeRadioStation,
ID: r.ID,
Name: r.Name,
Name: name,
CoverArtID: r.CoverArtID,
Artists: r.Artists,
}
}
func (r *RadioStation) Copy() MediaItem {
return r // no need to copy since RadioStations are immutable
return &RadioStation{
ID: r.ID,
StationName: r.StationName,
HomePageURL: r.HomePageURL,
StreamURL: r.StreamURL,
Title: r.Title,
Artists: slices.Clone(r.Artists),
CoverArtID: r.CoverArtID,
}
}
type ContentType int