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(lyrics-plus): translation Below-mode Individual copy implementation #3308

Merged
merged 10 commits into from
Feb 13, 2025

Conversation

Lseoksee
Copy link
Contributor

If the lyrics are in Below-mode, the original lyrics or the translated lyrics can now be copy depending on the cursor position.

Additionally, when changing the musixmatch translation language in lyrics plus config, the page is now designed to re-load, allowing the translation feature to be used without switching to the next song.

And minor bugs were fixed, and unnecessary code was revised

  • lyrics copy
2025-02-11.19-37-21.mp4
  • musixmatch translation language change
2025-02-11.19-38-03.mp4

@rxri
Copy link
Member

rxri commented Feb 11, 2025

Does it fix #3303?

@Lseoksee
Copy link
Contributor Author

@rxri
modified it so that the convert part is also applied.
Additionally, I will check for any additional bugs and let you know when the pull is ready.

Desktop Screenshot 2025 02 12 - 01 50 06 13

@rxri
Copy link
Member

rxri commented Feb 11, 2025

ok. converting to draft for now then

@rxri rxri marked this pull request as draft February 11, 2025 18:44
@Lseoksee
Copy link
Contributor Author

When changing the Musixmatch Translation Language or switching lyrics providers, the lyrics cache is cleared, and the lyrics are reloaded.

@rxri
Copy link
Member

rxri commented Feb 12, 2025

cool. is it ready now then

@Lseoksee
Copy link
Contributor Author

fix duplication active issues between convert and translation.
If convert is enabled, translation will be disabled, and vice versa.

@rxri It's not yet. I think I just need to do one last thing.

@Lseoksee
Copy link
Contributor Author

for songs in languages that support translation but not conversion (e.g., English), the Convert option is disabled.

@rxri I'll wrap it up here. There are more changes, but I'll include them in the next pull request.

@Lseoksee Lseoksee marked this pull request as ready for review February 13, 2025 10:51
@rxri rxri requested a review from Copilot February 13, 2025 20:54
@rxri
Copy link
Member

rxri commented Feb 13, 2025

since i have access to @copilot, let's see what he has to say lol

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (10)

CustomApps/lyrics-plus/Utils.js:99

  • The variable name 'conver' in the convertParsedToLRC and convertParsedToUnsynced functions is likely a typo. It should be renamed to 'converted' or something more descriptive.
const rawLyrics = lyrics[0].originalText ? lyrics.map((line) => line.originalText).join(" ") : lyrics.map((line) => line.text).join(" ");

CustomApps/lyrics-plus/Utils.js:105

  • The 'p1' element is not a valid HTML element. It should be 'p'.
return react.createElement("p1", null, reactChildren);

CustomApps/lyrics-plus/Utils.js:102

  • The 'formatTime' function should ensure that the seconds are always padded to two decimal places.
let seconds = ((timestamp - minutes * 60000) / 1000).toFixed(2);

CustomApps/lyrics-plus/Utils.js:227

  • Ensure that the new 'convertParsedToLRC' function is covered by tests to verify its correctness.
convertParsedToLRC(lyrics, isBelow) {

CustomApps/lyrics-plus/Utils.js:247

  • Ensure that the new 'convertParsedToUnsynced' function is covered by tests to verify its correctness.
convertParsedToUnsynced(lyrics, isBelow) {

CustomApps/lyrics-plus/Pages.js:207

  • [nitpick] The error message 'Failed to copy lyrics to clipboard' is not very descriptive. Consider providing more context, such as 'Failed to copy lyrics to clipboard. Please try again.'
Spicetify.showNotification("Failed to copy lyrics to clipboard");

CustomApps/lyrics-plus/Pages.js:223

  • [nitpick] The error message 'Failed to copy translated lyrics to clipboard' is not very descriptive. Consider providing more context, such as 'Failed to copy translated lyrics to clipboard. Please try again.'
Spicetify.showNotification("Failed to copy translated lyrics to clipboard");

CustomApps/lyrics-plus/index.js:184

  • [nitpick] The variable name 'reRenderLyricsPage' is ambiguous. It should be renamed to 'forceLyricsPageRerender'.
this.reRenderLyricsPage = false;

CustomApps/lyrics-plus/index.js:3

  • The function 'getConfig' should handle potential invalid values from 'localStorage' more robustly. Consider using 'return value === "true" ? true : (value === "false" ? false : defaultVal);'.
return value ? value === "true" : defaultVal;

CustomApps/lyrics-plus/Settings.js:662

  • The 'reloadLyrics' function is called without checking if it is defined. Ensure 'reloadLyrics' is defined before calling it.
reloadLyrics?.();
Copy link
Member

@rxri rxri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well copilot didn't find anything so am good with it too

@rxri rxri merged commit 2d9b637 into spicetify:main Feb 13, 2025
5 checks passed
@rxri
Copy link
Member

rxri commented Feb 13, 2025

CustomApps/lyrics-plus/Utils.js:105
The 'p1' element is not a valid HTML element. It should be 'p'.
return react.createElement("p1", null, reactChildren);

okay, lmao how no one noticed this

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.

2 participants