gonic icon indicating copy to clipboard operation
gonic copied to clipboard

feat: implement lyrics

Open sammy-ette opened this issue 1 year ago • 8 comments

closes #371

Implements both /getLyrics and OpenSubsonic /getLyricsBySongId

TODO:

  • [ ] /getLyrics
    • [ ] Use artist in search for songs
    • [ ] Embedded
    • [x] .lrc
  • [ ] /getLyricsBySongId
    • [ ] Embedded
    • [x] .lrc

sammy-ette avatar Mar 24 '24 13:03 sammy-ette

Awesome!

duckcantcode avatar Mar 24 '24 15:03 duckcantcode

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.

duckcantcode avatar Mar 24 '24 15:03 duckcantcode

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.

sammy-ette avatar Mar 24 '24 20:03 sammy-ette

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

duckcantcode avatar Mar 24 '24 23:03 duckcantcode

Should this also pick up .txt files? I noticed that lrcget will download unsynced lyrics as .txt files.

sammy-ette avatar Mar 25 '24 22:03 sammy-ette

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

sentriz avatar Apr 13 '24 12:04 sentriz

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?

sammy-ette avatar Apr 15 '24 14:04 sammy-ette

@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

sentriz avatar May 04 '24 19:05 sentriz

looks like someone else is working on a pr for this, awesome.

sammy-ette avatar Jul 18 '24 00:07 sammy-ette