Add Internet Radio support (#2063)
* add internet radio support * Add dynamic sidebar icon to Radios * Fix typos * Make URL suffix consistent * Fix typo * address feedback * Don't need to preload when playing Internet Radios * Reorder migration, or else it won't be applied * Make Radio list view responsive Also added filter by name, removed RadioActions and RadioContextMenu, and added a default radio icon, in case of favicon is not available. * Simplify StreamField usage * fix button, hide progress on mobile * use js styles over index.css Co-authored-by: Deluan <deluan@navidrome.org>
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","internetRadioStations":{"internetRadioStation":[{"id":"12345678","streamUrl":"https://example.com/stream","name":"Example Stream","homePageUrl":"https://example.com"}]}}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><internetRadioStations><internetRadioStation><id>12345678</id><streamUrl>https://example.com/stream</streamUrl><name>Example Stream</name><homePageUrl>https://example.com</homePageUrl></internetRadioStation></internetRadioStations></subsonic-response>
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","internetRadioStations":{}}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><internetRadioStations></internetRadioStations></subsonic-response>
|
||||
@@ -47,6 +47,8 @@ type Subsonic struct {
|
||||
Bookmarks *Bookmarks `xml:"bookmarks,omitempty" json:"bookmarks,omitempty"`
|
||||
ScanStatus *ScanStatus `xml:"scanStatus,omitempty" json:"scanStatus,omitempty"`
|
||||
Lyrics *Lyrics `xml:"lyrics,omitempty" json:"lyrics,omitempty"`
|
||||
|
||||
InternetRadioStations *InternetRadioStations `xml:"internetRadioStations,omitempty" json:"internetRadioStations,omitempty"`
|
||||
}
|
||||
|
||||
type JsonWrapper struct {
|
||||
@@ -359,3 +361,14 @@ type Lyrics struct {
|
||||
Title string `xml:"title,omitempty,attr" json:"title,omitempty"`
|
||||
Value string `xml:",chardata" json:"value"`
|
||||
}
|
||||
|
||||
type InternetRadioStations struct {
|
||||
Radios []Radio `xml:"internetRadioStation" json:"internetRadioStation,omitempty"`
|
||||
}
|
||||
|
||||
type Radio struct {
|
||||
ID string `xml:"id" json:"id"`
|
||||
StreamUrl string `xml:"streamUrl" json:"streamUrl"`
|
||||
Name string `xml:"name" json:"name"`
|
||||
HomepageUrl string `xml:"homePageUrl" json:"homePageUrl"`
|
||||
}
|
||||
|
||||
@@ -594,4 +594,39 @@ var _ = Describe("Responses", func() {
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
Describe("InternetRadioStations", func() {
|
||||
BeforeEach(func() {
|
||||
response.InternetRadioStations = &InternetRadioStations{}
|
||||
})
|
||||
|
||||
Describe("without data", func() {
|
||||
It("should match .XML", func() {
|
||||
Expect(xml.Marshal(response)).To(MatchSnapshot())
|
||||
})
|
||||
It("should match .JSON", func() {
|
||||
Expect(json.Marshal(response)).To(MatchSnapshot())
|
||||
})
|
||||
})
|
||||
|
||||
Describe("with data", func() {
|
||||
BeforeEach(func() {
|
||||
radio := make([]Radio, 1)
|
||||
radio[0] = Radio{
|
||||
ID: "12345678",
|
||||
StreamUrl: "https://example.com/stream",
|
||||
Name: "Example Stream",
|
||||
HomepageUrl: "https://example.com",
|
||||
}
|
||||
response.InternetRadioStations.Radios = radio
|
||||
})
|
||||
|
||||
It("should match .XML", func() {
|
||||
Expect(xml.Marshal(response)).To(MatchSnapshot())
|
||||
})
|
||||
It("should match .JSON", func() {
|
||||
Expect(json.Marshal(response)).To(MatchSnapshot())
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user