Skip to content

Commit

Permalink
feat(subsonic): add stub lyrics.view
Browse files Browse the repository at this point in the history
fixes #274
  • Loading branch information
sentriz committed Dec 26, 2022
1 parent 2bf8595 commit 0407a15
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/ctrlsubsonic/handlers_common.go
Expand Up @@ -407,3 +407,9 @@ func (c *Controller) ServeJukebox(r *http.Request) *spec.Response { // nolint:go
sub.JukeboxStatus = status
return sub
}

func (c *Controller) ServeGetLyrics(r *http.Request) *spec.Response {
sub := spec.NewResponse()
sub.Lyrics = &spec.Lyrics{}
return sub
}
7 changes: 7 additions & 0 deletions server/ctrlsubsonic/spec/spec.go
Expand Up @@ -58,6 +58,7 @@ type Response struct {
SimilarSongs *SimilarSongs `xml:"similarSongs" json:"similarSongs,omitempty"`
SimilarSongsTwo *SimilarSongsTwo `xml:"similarSongs2" json:"similarSongs2,omitempty"`
InternetRadioStations *InternetRadioStations `xml:"internetRadioStations" json:"internetRadioStations,omitempty"`
Lyrics *Lyrics `xml:"lyrics" json:"lyrics,omitempty"`
}

func NewResponse() *Response {
Expand Down Expand Up @@ -409,6 +410,12 @@ type InternetRadioStation struct {
HomepageURL string `xml:"homepageUrl,attr" json:"homepageUrl"`
}

type Lyrics struct {
Value string `xml:",chardata" json:"value,omitempty"`
Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`
Title string `xml:"title,attr,omitempty" json:"title,omitempty"`
}

func formatRating(rating float64) string {
if rating == 0 {
return ""
Expand Down
1 change: 1 addition & 0 deletions server/server.go
Expand Up @@ -236,6 +236,7 @@ func setupSubsonic(r *mux.Router, ctrl *ctrlsubsonic.Controller) {
r.Handle("/getTopSongs{_:(?:\\.view)?}", ctrl.H(ctrl.ServeGetTopSongs))
r.Handle("/getSimilarSongs{_:(?:\\.view)?}", ctrl.H(ctrl.ServeGetSimilarSongs))
r.Handle("/getSimilarSongs2{_:(?:\\.view)?}", ctrl.H(ctrl.ServeGetSimilarSongsTwo))
r.Handle("/getLyrics{_:(?:\\.view)?}", ctrl.H(ctrl.ServeGetLyrics))

// raw
r.Handle("/getCoverArt{_:(?:\\.view)?}", ctrl.HR(ctrl.ServeGetCoverArt))
Expand Down

0 comments on commit 0407a15

Please sign in to comment.