Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement lyrics #488

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

TorchedSammy
Copy link

@TorchedSammy TorchedSammy commented Mar 24, 2024

closes #371

Implements both /getLyrics and OpenSubsonic /getLyricsBySongId

TODO:

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

@duckfromdiscord
Copy link

Awesome!

@duckfromdiscord
Copy link

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.

@TorchedSammy
Copy link
Author

TorchedSammy commented Mar 24, 2024

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.

@duckfromdiscord
Copy link

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

@TorchedSammy
Copy link
Author

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

@sentriz
Copy link
Owner

sentriz commented Apr 13, 2024

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

@TorchedSammy
Copy link
Author

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 TorchedSammy marked this pull request as ready for review April 25, 2024 23:35
@sentriz
Copy link
Owner

sentriz commented May 4, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.lrc lyrics?
3 participants