41pha1 / spicetify-extensions

Collection of Spicetify extensions
MIT License
34 stars 7 forks source link

The extension recursively replaces "&" with "amp;" and lags out #2

Closed Arghadatta closed 1 year ago

Arghadatta commented 1 year ago

@41pha1 PRETTY MUCH THE TITLE.did manual installation via manually putting the js file in extension load directory and ran config and apply command.but it doesn't work.tried to reinstall spicetify and even entire spotify,but it apparently don't work. asking for help,dev

41pha1 commented 1 year ago

That's strange, are you using the normal Spotify lyrics function? Probably due to a differing Spotify version...

Alternatively you could use this modification of the lyrics plus custom app I made, which comes with a lot more features and better UI as well: https://github.com/41pha1/spicetify-cli/tree/lyrics-converter/CustomApps%2Flyrics-plus Just replace the lyrics plus extension folder in appdata/local/spicetify/customapps with my version and run spicetify apply

To enable lyrics plus I think it's something like spicetify config custom_apps lyrics-plus spicetify apply

If I have time I will implement these features into this extension as well.

Make sure to let me now if it works for you :)

Arghadatta commented 1 year ago

That's strange, are you using the normal Spotify lyrics function? Probably due to a differing Spotify version...

Alternatively you could use this modification of the lyrics plus custom app I made, which comes with a lot more features and better UI as well: https://github.com/41pha1/spicetify-cli/tree/lyrics-converter/CustomApps%2Flyrics-plus Just replace the lyrics plus extension folder in appdata/local/spicetify/customapps with my version and run spicetify apply

To enable lyrics plus I think it's something like spicetify config custom_apps lyrics-plus spicetify apply

If I have time I will implement these features into this extension as well.

Make sure to let me now if it works for you :)

thanks i will let you know.

Arghadatta commented 1 year ago

That's strange, are you using the normal Spotify lyrics function? Probably due to a differing Spotify version...

Alternatively you could use this modification of the lyrics plus custom app I made, which comes with a lot more features and better UI as well: https://github.com/41pha1/spicetify-cli/tree/lyrics-converter/CustomApps%2Flyrics-plus Just replace the lyrics plus extension folder in appdata/local/spicetify/customapps with my version and run spicetify apply

To enable lyrics plus I think it's something like spicetify config custom_apps lyrics-plus spicetify apply

If I have time I will implement these features into this extension as well.

Make sure to let me now if it works for you :)

it surely works but the synced lyrics provider(nelease if am right)kinda is short on some songs but the genius one is good enough

Arghadatta commented 1 year ago

That's strange, are you using the normal Spotify lyrics function? Probably due to a differing Spotify version...

Alternatively you could use this modification of the lyrics plus custom app I made, which comes with a lot more features and better UI as well: https://github.com/41pha1/spicetify-cli/tree/lyrics-converter/CustomApps%2Flyrics-plus Just replace the lyrics plus extension folder in appdata/local/spicetify/customapps with my version and run spicetify apply

To enable lyrics plus I think it's something like spicetify config custom_apps lyrics-plus spicetify apply

If I have time I will implement these features into this extension as well.

Make sure to let me now if it works for you :)

thanks for helping. also willing for help if need any help(testing or contributing)

41pha1 commented 1 year ago

thanks for helping. also willing for help if need any help(testing or contributing)

Would you mind looking into the console to maybe look for an error caused by this extension? (There will probably be lots of others) You can look at the console by running spicetify enable-devtools, and then pressing ctrl+shift+i in spotify.

pedrohenrique23 commented 1 year ago

@41pha1 I am having the same problem, and the console gives me this error:

Uncaught ReferenceError: Kuroshiro is not defined
    at new Translator (romaji_lyrics.js:9:30)
    at romaji_lyrics.js:46:20

The marketplace version have no errors, but it also doesn't work for me. Spotify is version 1.1.97, and Spicetify is version 2.14.1.

41pha1 commented 1 year ago

Thank you for posting the logs.

What OS are you running Spotify on?

Could you tell me if document.querySelector(".Button-sc-1dqy6lx-0") And base_dat_gz result in undefined in the devoloper JavaScript console?

pedrohenrique23 commented 1 year ago

OS is Windows 11 22H2 22621.674.

base_dat_gz returns

Uncaught ReferenceError: base_dat_gz is not defined
    at <anonymous>:1:1
(anonymous) @ VM38:1

with a manual installation. If I use the marketplace version, it returns a huge string of 5.3MB.

document.querySelector(".Button-sc-1dqy6lx-0") returns the same button in either version.

<button tabindex="-1" class="Button-sc-1dqy6lx-0 dmmeCL main-rootlist-expandArrow main-rootlist-expandArrowActive" aria-label="Expandir a pasta">
    <span aria-hidden="true" class="IconWrapper__Wrapper-sc-16usrgb-0 bxwPwV">
        <svg role="img" height="16" width="16" viewBox="0 0 16 16" class="Svg-ytk21e-0 jAKAlG">
            <path d="M14 6l-6 6-6-6h12z">
            </path>
        </svg>
    </span>
</button>
41pha1 commented 1 year ago

Very strange indeed, I have uploaded a minor change that will skip checking if the lyrics container is open in the first place. The update wont come through though until jsdeliver dumps its cache which will take a day or so, but a manual install should apply the changes immediately.

You could also check if document.querySelectorAll("[data-testid=fullscreen-lyric]") returns an array of the lyric divs. if Romaji_Lyrics.translator.finished is true and if Romaji_Lyrics.translated_lyrics is a string containing the translated lyrics (given you have the lyrics for a Japanese song open).

Thank you very much for the detailed information you are providing!

pedrohenrique23 commented 1 year ago

No problem, I'm glad to be of help!

This new version does work, translations is instantaneous, and those commands return what is expected. In the older version, the lyric div is returned, but the other two return undefined.

Weirdly, a song kept having amp; being added to the middle of the translated lyric, and that caused Spotify to slow down for each amp added until another lyric was loaded or the lyrics page was closed. Another song just had the same amp; in the lyrics from the get go, and it wasn't increasing. Both of them had this amp; after an &.

41pha1 commented 1 year ago

I am glad it works at least somewhat now! This amp; thing is also new to, mind sharing a song where it occurred? Is it reproducible?

pedrohenrique23 commented 1 year ago

This is the song: https://open.spotify.com/track/6Yw1yTceEQ9nvvbyYruGTg?si=140a11df163d4262

It is reproducible. Everytime I open the lyrics it starts too add this amp; after a &. If I close then open the lyrics again, all the amp: previously added are gone, and it starts to add them again.

The song that just has this amp; in the lyrics is this one: https://open.spotify.com/track/3LMJC8Xc8ECuS53VRZFLBB?si=d3551146d423406a

Again, after every &, but in this one, it doesn't keep adding more.

41pha1 commented 1 year ago

Amazing thanks! I will look into this tomorrow and try to implement a fix

41pha1 commented 1 year ago

It seems to be all working now, & is just the "&" is represented in Html so there needed to be some exceptions for html entities.

pedrohenrique23 commented 1 year ago

Yep, working pretty good now. :)