Synced Lyrics: Also search for lyrics with the original title language #3206

Merged
Laesx merged 4 commits from synced-subs into master 2025-04-16 14:12:04 +00:00
Laesx commented 2025-04-06 19:08:10 +00:00 (Migrated from github.com)

I need to test this a bit more, since I have only tested with Japanese songs (Interface in English (US)), I'm not sure if maybe we should keep the original matching as a toggle in the menu.

Added a new array to the song-info type which gets the tags array from microformat.

From what I've seen this array sometimes contains the english artist name, the original artist name, the album name, the album or song producer/composer in both languages, the album name, the song name, etc.

Then we pass alternativeTitle and tags to LRCLib search, here it first tries to the exact match, then searches by the alternative title first, if not found it will fallback to searching the title only again.

On filtering, if the localized artist match is below the threshold, it will compare each tag with each artist from the response.

The songs I've tested are
Oracle - Amane Kanata.
Chandelier - Murasaki Shion

Both weren't working before and are now.

I need to test this a bit more, since I have only tested with Japanese songs (Interface in English (US)), I'm not sure if maybe we should keep the original matching as a toggle in the menu. Added a new array to the song-info type which gets the tags array from microformat. From what I've seen this array sometimes contains the english artist name, the original artist name, the album name, the album or song producer/composer in both languages, the album name, the song name, etc. Then we pass alternativeTitle and tags to LRCLib search, here it first tries to the exact match, then searches by the alternative title first, if not found it will fallback to searching the title only again. On filtering, if the localized artist match is below the threshold, it will compare each tag with each artist from the response. The songs I've tested are Oracle - Amane Kanata. Chandelier - Murasaki Shion Both weren't working before and are now.
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-04-07 03:03:22 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

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

Comments suppressed due to low confidence (2)

src/providers/song-info.ts:101

  • Consider providing a fallback (e.g., an empty array) if microformat.tags is undefined to ensure songInfo.tags is always an array.
songInfo.tags = microformat.tags;

src/plugins/synced-lyrics/providers/LRCLib.ts:55

  • [nitpick] Consider using a more descriptive error message, such as including the status code (e.g., 'HTTP request failed with status code: ${response.status}') for improved debugging.
throw new Error(`bad HTTPStatus(${response.statusText})`);
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments. <details> <summary>Comments suppressed due to low confidence (2)</summary> **src/providers/song-info.ts:101** * Consider providing a fallback (e.g., an empty array) if microformat.tags is undefined to ensure songInfo.tags is always an array. ``` songInfo.tags = microformat.tags; ``` **src/plugins/synced-lyrics/providers/LRCLib.ts:55** * [nitpick] Consider using a more descriptive error message, such as including the status code (e.g., 'HTTP request failed with status code: ${response.status}') for improved debugging. ``` throw new Error(`bad HTTPStatus(${response.statusText})`); ``` </details>
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-04-13 05:55:44 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

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

Comments suppressed due to low confidence (3)

src/plugins/synced-lyrics/providers/LRCLib.ts:49

  • Verify that using the query parameter 'q' for searching with the alternative title is intentional, as the initial search uses 'artist_name' and 'track_name'. Consider aligning these parameters with the API specification if required.
const trackName = alternativeTitle || title;

src/plugins/synced-lyrics/providers/LRCLib.ts:55

  • [nitpick] Consider providing a more descriptive error message that includes the numeric status code for easier debugging of API failures.
throw new Error(`bad HTTPStatus(${response.statusText})`);

src/plugins/synced-lyrics/providers/LRCLib.ts:60

  • [nitpick] Consider including additional context or the response body in the error message to facilitate debugging of unexpected API responses.
throw new Error(`Expected an array, instead got ${typeof data}`);
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments. <details> <summary>Comments suppressed due to low confidence (3)</summary> **src/plugins/synced-lyrics/providers/LRCLib.ts:49** * Verify that using the query parameter 'q' for searching with the alternative title is intentional, as the initial search uses 'artist_name' and 'track_name'. Consider aligning these parameters with the API specification if required. ``` const trackName = alternativeTitle || title; ``` **src/plugins/synced-lyrics/providers/LRCLib.ts:55** * [nitpick] Consider providing a more descriptive error message that includes the numeric status code for easier debugging of API failures. ``` throw new Error(`bad HTTPStatus(${response.statusText})`); ``` **src/plugins/synced-lyrics/providers/LRCLib.ts:60** * [nitpick] Consider including additional context or the response body in the error message to facilitate debugging of unexpected API responses. ``` throw new Error(`Expected an array, instead got ${typeof data}`); ``` </details>
JellyBrick (Migrated from github.com) approved these changes 2025-04-16 14:11:49 +00:00
JellyBrick (Migrated from github.com) left a comment

Thanks!

Thanks!
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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#3206
No description provided.