Prioritize synced lyrics and improved artist value for lyrics on videos #3254

Open
AARP41298 wants to merge 15 commits from AARP41298/master into master
AARP41298 commented 2025-04-17 17:56:52 +00:00 (Migrated from github.com)

Hi
With the artist value i achive to resolve #3117
And prioritize lyrics improve a bit #3206
Ex. starseed was displaying the plain lyrics

This is my very first PR, let me know if somethings is wrong.

Hi With the artist value i achive to resolve #3117 And prioritize lyrics improve a bit #3206 Ex. starseed was displaying the plain lyrics This is my very first PR, let me know if somethings is wrong.
JellyBrick (Migrated from github.com) reviewed 2025-04-17 17:56:52 +00:00
JellyBrick (Migrated from github.com) requested changes 2025-04-21 07:02:25 +00:00
@ -31,1 +47,3 @@
let response = await fetch(url);
const trackName = alternativeTitle || title;
let alternativeArtist = trackName.split(' - ')[0];
alternativeArtist =
JellyBrick (Migrated from github.com) commented 2025-04-21 07:01:50 +00:00

YouTube has many edge cases, so it's not appropriate to parse the title and artist name using such a simple approach.

YouTube has many edge cases, so it's not appropriate to parse the title and artist name using such a simple approach.
@ -44,0 +134,4 @@
if (ratio <= 0.9) continue;
filteredResults.push(item);
}
JellyBrick (Migrated from github.com) commented 2025-04-21 07:02:11 +00:00

What is this change?

What is this change?
Owner

Nice idea, but ontop of that I propose you construct an array of all the queries to be made, and iterate over it.
That way it is much easier to add fallback queries and expand on it in the future, and it is less repetitive.

e.g.

const queries = [`${info.artist} - ${info.title}`];
if (info.alternativeTitle) queries.push(`${info.artist} - ${info.alternativeTitle}`);
if (info.album) {
    queries.push(`${info.album} - ${info.title}`);
    if (info.alternativeTitle) queries.push(`${info.album} - ${info.alternativeTitle}`);
}

let lyrics = null;
for (const query of queries) {
    const results = await ...;

    lyrics = ...;
    if (lyrics) break;
}

...

heck, you may even gather all the search results from all the queries and do the filter on all of them

Nice idea, but ontop of that I propose you construct an array of all the queries to be made, and iterate over it. That way it is much easier to add fallback queries and expand on it in the future, and it is less repetitive. e.g. ```typescript const queries = [`${info.artist} - ${info.title}`]; if (info.alternativeTitle) queries.push(`${info.artist} - ${info.alternativeTitle}`); if (info.album) { queries.push(`${info.album} - ${info.title}`); if (info.alternativeTitle) queries.push(`${info.album} - ${info.alternativeTitle}`); } let lyrics = null; for (const query of queries) { const results = await ...; lyrics = ...; if (lyrics) break; } ... ``` heck, you may even gather all the search results from all the queries and do the filter on all of them
@ -26,152 +42,174 @@ export class LRCLib implements LyricProvider {
if (query.get('album_name') === 'undefined') {
query.delete('album_name');
Owner

you might wanna do the break only if a result matches the other criteria as well, e.g. duration/artists

you might wanna do the `break` only if a result matches the other criteria as well, e.g. duration/artists
Laesx commented 2025-04-23 23:02:46 +00:00 (Migrated from github.com)

To put my two cents here, I've done a quick test on your branch and the fixes from my PR seem to still work in the songs I tested, however I noticed the searching for LRCLIB seem to be much slower. Might just be me not noticing before though I'll look into it further if I have the time.

To put my two cents here, I've done a quick test on your branch and the fixes from my PR seem to still work in the songs I tested, however I noticed the searching for LRCLIB seem to be much slower. Might just be me not noticing before though I'll look into it further if I have the time.
AARP41298 commented 2025-06-04 00:39:11 +00:00 (Migrated from github.com)

TODO: Prioritize album name using jaroWinkler
Ex.
Gorillaz - Hong Kong
Played D-Sides version, showing Demon Days Live at the Manchester Opera House lyrics

BIGBANG - Fantastic Baby
Identify
Alive vs Still Alive vs 100 live versions of the song

TODO: Prioritize album name using jaroWinkler Ex. Gorillaz - Hong Kong Played `D-Sides` version, showing `Demon Days Live at the Manchester Opera House` lyrics BIGBANG - Fantastic Baby Identify `Alive` vs `Still Alive` vs 100 live versions of the song
github-actions[bot] (Migrated from github.com) reviewed 2025-09-15 07:16:46 +00:00
github-actions[bot] (Migrated from github.com) commented 2025-09-15 07:16:45 +00:00

⚠️ [eslint] <stylistic/no-mixed-operators> reported by reviewdog 🐶
Unexpected mix of '*' and '-'. Use parentheses to clarify the intended order of operations.

⚠️ **[eslint]** <[stylistic/no-mixed-operators](https://eslint.style/rules/no-mixed-operators)> <sub>reported by [reviewdog](https://github.com/reviewdog/reviewdog) :dog:</sub><br>Unexpected mix of '*' and '-'. Use parentheses to clarify the intended order of operations. <!-- __reviewdog__:ChA1OWJkYTVmMTI4N2IzZjRhEgZlc2xpbnQ= -->
github-actions[bot] (Migrated from github.com) commented 2025-09-15 07:16:45 +00:00

⚠️ [eslint] <stylistic/no-mixed-operators> reported by reviewdog 🐶
Unexpected mix of '*' and '-'. Use parentheses to clarify the intended order of operations.

⚠️ **[eslint]** <[stylistic/no-mixed-operators](https://eslint.style/rules/no-mixed-operators)> <sub>reported by [reviewdog](https://github.com/reviewdog/reviewdog) :dog:</sub><br>Unexpected mix of '*' and '-'. Use parentheses to clarify the intended order of operations. <!-- __reviewdog__:ChA5YTEwZTFlNWE2NzliNGZhEgZlc2xpbnQ= -->
github-actions[bot] (Migrated from github.com) commented 2025-09-15 07:16:45 +00:00

⚠️ [eslint] <stylistic/no-mixed-operators> reported by reviewdog 🐶
Unexpected mix of '-' and '*'. Use parentheses to clarify the intended order of operations.

⚠️ **[eslint]** <[stylistic/no-mixed-operators](https://eslint.style/rules/no-mixed-operators)> <sub>reported by [reviewdog](https://github.com/reviewdog/reviewdog) :dog:</sub><br>Unexpected mix of '-' and '*'. Use parentheses to clarify the intended order of operations. <!-- __reviewdog__:Cg9iNWE2YTNhMGQzYzU1YWESBmVzbGludA== -->
github-actions[bot] (Migrated from github.com) commented 2025-09-15 07:16:45 +00:00

⚠️ [eslint] <stylistic/no-mixed-operators> reported by reviewdog 🐶
Unexpected mix of '-' and '*'. Use parentheses to clarify the intended order of operations.

⚠️ **[eslint]** <[stylistic/no-mixed-operators](https://eslint.style/rules/no-mixed-operators)> <sub>reported by [reviewdog](https://github.com/reviewdog/reviewdog) :dog:</sub><br>Unexpected mix of '-' and '*'. Use parentheses to clarify the intended order of operations. <!-- __reviewdog__:ChA1ZDRjMTJmNzYzNGYxYzAyEgZlc2xpbnQ= -->
github-actions[bot] (Migrated from github.com) commented 2025-09-15 07:16:46 +00:00

⚠️ [eslint] <stylistic/no-mixed-operators> reported by reviewdog 🐶
Unexpected mix of '*' and '-'. Use parentheses to clarify the intended order of operations.

⚠️ **[eslint]** <[stylistic/no-mixed-operators](https://eslint.style/rules/no-mixed-operators)> <sub>reported by [reviewdog](https://github.com/reviewdog/reviewdog) :dog:</sub><br>Unexpected mix of '*' and '-'. Use parentheses to clarify the intended order of operations. <!-- __reviewdog__:Cg8yNjYwN2FjNTAyYzY2M2USBmVzbGludA== -->
github-actions[bot] (Migrated from github.com) commented 2025-09-15 07:16:46 +00:00

⚠️ [eslint] <stylistic/no-mixed-operators> reported by reviewdog 🐶
Unexpected mix of '*' and '-'. Use parentheses to clarify the intended order of operations.

⚠️ **[eslint]** <[stylistic/no-mixed-operators](https://eslint.style/rules/no-mixed-operators)> <sub>reported by [reviewdog](https://github.com/reviewdog/reviewdog) :dog:</sub><br>Unexpected mix of '*' and '-'. Use parentheses to clarify the intended order of operations. <!-- __reviewdog__:ChA4MzRmNTllOTI1ZTYwYzdhEgZlc2xpbnQ= -->
github-actions[bot] (Migrated from github.com) commented 2025-09-15 07:16:46 +00:00

⚠️ [eslint] <stylistic/no-mixed-operators> reported by reviewdog 🐶
Unexpected mix of '-' and '*'. Use parentheses to clarify the intended order of operations.

⚠️ **[eslint]** <[stylistic/no-mixed-operators](https://eslint.style/rules/no-mixed-operators)> <sub>reported by [reviewdog](https://github.com/reviewdog/reviewdog) :dog:</sub><br>Unexpected mix of '-' and '*'. Use parentheses to clarify the intended order of operations. <!-- __reviewdog__:ChA0Y2YwZDQ2YmUyMDgwMmJhEgZlc2xpbnQ= -->
github-actions[bot] (Migrated from github.com) commented 2025-09-15 07:16:46 +00:00

⚠️ [eslint] <stylistic/no-mixed-operators> reported by reviewdog 🐶
Unexpected mix of '-' and '*'. Use parentheses to clarify the intended order of operations.

⚠️ **[eslint]** <[stylistic/no-mixed-operators](https://eslint.style/rules/no-mixed-operators)> <sub>reported by [reviewdog](https://github.com/reviewdog/reviewdog) :dog:</sub><br>Unexpected mix of '-' and '*'. Use parentheses to clarify the intended order of operations. <!-- __reviewdog__:ChBmODAxYjhiMzc2YjBiOThlEgZlc2xpbnQ= -->
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin AARP41298/master:AARP41298/master
git switch AARP41298/master

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff AARP41298/master
git switch AARP41298/master
git rebase master
git switch master
git merge --ff-only AARP41298/master
git switch AARP41298/master
git rebase master
git switch master
git merge --no-ff AARP41298/master
git switch master
git merge --squash AARP41298/master
git switch master
git merge --ff-only AARP41298/master
git switch master
git merge AARP41298/master
git push origin master
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: YTMD/youtube-music#3254
No description provided.