whoeevee / EeveeSpotify

A tweak to get Spotify Premium for free, just like Spotilife
1.36k stars 109 forks source link

Switching between actual and romaji lyrics for Japanese songs using Genius #225

Closed GinyuSpecialForce closed 2 days ago

GinyuSpecialForce commented 3 days ago

Is this issue appropriate?

Is this issue unique to EeveeSpotify?

Have you searched the existing issues?

Describe the bug.

would be cool idk if possible

yodaluca23 commented 3 days ago

Should be easy, to add a switch for Romaji lyrics:

Search for the song first here for Romaji lyrics:

https://genius.com/artists/Genius-romanizations/songs

If not present then just do what it does now, and search the rest of genius.

yodaluca23 commented 3 days ago

Should be easy, to add a switch for Romaji lyrics:

Search for the song first here for Romaji lyrics:

https://genius.com/artists/Genius-romanizations/songs

If not present then just do what it does now, and search the rest of genius.

Or it could append (Romanized) to the end of the song title when searching for the song, if yields no results then get normal lyrics.

yodaluca23 commented 3 days ago

Or it could append (Romanized) to the end of the song title when searching for the song, if yields no results then get normal lyrics.

In my testing, this should work, converting https://github.com/whoeevee/EeveeSpotify/blob/swift4.3/Sources/EeveeSpotify/Lyrics/DataSources/GeniusLyricsDataSource.swift to a cURL request:

curl -X GET "https://api.genius.com/search/song?q=your_query" \
-H "X-Genius-iOS-Version: 6.21.0" \
-H "X-Genius-Logged-Out: true" \
-H "User-Agent: Genius/1109 CFNetworkVersion DarwinVersion"

Then from here https://github.com/whoeevee/EeveeSpotify/blob/e8e77f07cfb1e37dbb0837bb44e9f27932ac17a7/Sources/EeveeSpotify/Lyrics/LyricsRepository.swift#L17 we know it constructs the quarry in the form of "{SongName} {Artist}"

So if for example we run

curl -X GET "https://api.genius.com/search/song?q=How%20You%20Like%20That%20BlackPink" \
-H "X-Genius-iOS-Version: 6.21.0" \
-H "X-Genius-Logged-Out: true" \
-H "User-Agent: Genius/1109 CFNetworkVersion DarwinVersion"

We get the expected result of the non-romaji song info https://pastebin.com/nhD3trNk While if we append "(Romanized)" to the end of our quary such

curl -X GET "https://api.genius.com/search/song?q=How%20You%20Like%20That%20BlackPink%20(Romanized)" \
-H "X-Genius-iOS-Version: 6.21.0" \
-H "X-Genius-Logged-Out: true" \
-H "User-Agent: Genius/1109 CFNetworkVersion DarwinVersion"

We get the song info of the romaji version! https://pastebin.com/EECn78jG

So, it should be simple to add a toggle in settings for Romaji lyrics when available, and add an if statement on line 17 of LyricsRepository.swift, specified above. If that setting is toggled then: let query = "\(strippedTitle) \(artist) (Romanized)" Else keep it how it is now: let query = "\(strippedTitle) \(artist)"

Then additional logic would need to be added to the error handling, where if it gets an error while it had originally searched with the appended "(Romanized)" then try again without it.

yodaluca23 commented 3 days ago

I have implemented first searching for it with "(Romanized)" appended then without it, if no song is found, in my fork. https://github.com/yodaluca23/EeveeSpotify I just have absoulty no idea how to add a switch to the settings menu, and how to check it's status... But that should be the easy part for someone knowledgeable. You can get the debs from the workflow https://github.com/yodaluca23/EeveeSpotify/actions/runs/9788525123

Edit: I should probably mention, I have tested it, and it does work.

yodaluca23 commented 3 days ago

I have implemented first searching for it with "(Romanized)" appended then without it, if no song is found, in my fork. yodaluca23/EeveeSpotify I just have absoulty no idea how to add a switch to the settings menu, and how to check it's status... But that should be the easy part for someone knowledgeable. You can get the debs from the workflow yodaluca23/EeveeSpotify/actions/runs/9788525123

Here you can see it working: IMG_0013

Before: IMG_8BED9440630D-1

Also, anyone is free to use implement code from my fork, PR it copy/paste it idc.

asdfzxcvbn commented 2 days ago

@GinyuSpecialForce you can use his fork

yodaluca23 commented 2 days ago

@GinyuSpecialForce I got it working to be togglable, and added a switch in settings, that only appears if Genius is selected as the source. You can get the Debs from the workflow run https://github.com/yodaluca23/EeveeSpotify/actions/runs/9802758520

@asdfzxcvbn would you accept a PR? I know the code is messy, and probably inefficient, you could edit it to be better. But I would love to be able to contribute, and get this in the main branch :)

whoeevee commented 2 days ago

open the pr

GinyuSpecialForce commented 2 days ago

Whoa thanks so much I didn’t expect this much contribution

yodaluca23 commented 2 days ago

Btw, Musixmatch Romaji is possible.

    curl -G \
     --url "https://apic.musixmatch.com/ws/1.1/crowd.track.translations.get" \
     --data-urlencode "track_spotify_id=4SFknyjLcyTLJFPKD2m96o" \
     --data-urlencode "selected_language=rkr" \
     --data-urlencode "q_track= " \
     --data-urlencode "usertoken=YOUR_MUSIXMATCH_USER_TOKEN" \
     --data-urlencode "app_id=mac-ios-v2.0"

for selected_language is the original language two letter code, in this case Korean "kr" prefixed with a "r" for romaji (so "r{Code}"), its in a weird format, where it matches each line to a translation, so you would have to take the original lyrics and recursively find and replace, or something, it is possible...

yodaluca23 commented 1 day ago

Btw, Musixmatch Romaji is possible.

Got it working https://github.com/yodaluca23/EeveeSpotify/tree/952c57683c84d906dd3f342eaadf4fe93929233d Debs: https://github.com/yodaluca23/EeveeSpotify/actions/runs/9817306830

yodaluca23 commented 1 day ago

Btw, Musixmatch Romaji is possible.

Got it working yodaluca23/EeveeSpotify@952c576 Debs: yodaluca23/EeveeSpotify/actions/runs/9817306830

It doesn't work for some songs that do I have it, and I have no idea why...

Edit: Figured it out! https://github.com/yodaluca23/EeveeSpotify/tree/af4e924072c876ec43805ead5d10d8a9608e8224 Debs: https://github.com/yodaluca23/EeveeSpotify/actions/runs/9817533327