feat: implement lyrics
closes #371
Implements both /getLyrics and OpenSubsonic /getLyricsBySongId
TODO:
- [ ] /getLyrics
- [ ] Use artist in search for songs
- [ ] Embedded
- [x] .lrc
- [ ] /getLyricsBySongId
- [ ] Embedded
- [x] .lrc
Awesome!
I'm glad you also implemented /getLyrics since one of the apps I use is not maintained much anymore but does have support for it.
Works in Sonixd:
~~Does not seem to work in Symfonium.~~ Now it does (?)
Should /getLyrics also return the timestamps as they are from the lrc file? I assume the current behavior is the correct one, where it's just the text. Though some clients will just parse the times from it.
Should /getLyrics also return the timestamps as they are from the lrc file?
No, see the getLyrics example: https://www.subsonic.org/pages/inc/api/examples/lyrics_example_1.xml
Should this also pick up .txt files? I noticed that lrcget will download unsynced lyrics as .txt files.
this looks great. i think we can get stuff merged incrementally here wdyt? for example just shipping support for .lrc files first in one PR. like you have here without extra stuff
I can exclude the embedded lyrics but can you give some guidance on how to query the artist in the database for /getLyrics search to be done?
@TorchedSammy hi sorry for delay. regarding quering for artist, maybe ServeGetTopSongs could help. it does
artistName, err := params.Get("artist")
if err != nil {
return spec.NewError(10, "please provide an `artist` parameter")
}
var artist db.Artist
if err := c.dbc.Where("name=?", artistName).Find(&artist).Error; err != nil {
return spec.NewError(0, "finding artist by name: %v", err)
}
// ...
var tracks []*db.Track
err = c.dbc.
// ...
Joins("JOIN track_artists ON track_artists.track_id=tracks.id").
Joins("JOIN artists ON artists.id=track_artists.artist_id").
Where("artists.id=?", artist.ID).
// ...
Error
looks like someone else is working on a pr for this, awesome.