jacquesh / foo_openlyrics

An open-source lyric display panel for foobar2000
MIT License
401 stars 24 forks source link

Collapsing lines don't work properly on translated LRC #354

Open strongville opened 3 months ago

strongville commented 3 months ago

When trying to add a translated LRC with OpenLyrics (translated files can have several lines marked with the same timestamp, typically two) and having enabled the option to "compress" LRC file, some of the repeated lines are not considered and skipped on the processed file, losing translated lines on the process.

Steps to reproduce

  1. Enable, if not already, the option "Collapse multiple instances of the same line when saving timestamped lyrics"
  2. Open lyrics editor for adding synced lyrics
  3. Add a LRC file already translated (example on additional information)
  4. Save the file with the "Apply" button
  5. Switch playback to other track and return to the one with the lyrics
  6. Some lines are lost between the saving and loading of the LRC from local (result on additional information)

(Timestamps were garbled too, but that's not the main issue here.)

Some of the lines lost during saving on a diff editor

A line chopped during save

Expected behavior

No lines lost on saving compressed and translated lyrics file.

Versions

Debug logs

``` INFO-OpenLyrics: Querying for lyrics in file://D:\Music\Akari Kito - Dream Thread.lrc... INFO-OpenLyrics: Querying for lyrics in file://D:\Music\Akari Kito - Dream Thread.txt... INFO-OpenLyrics: Found 1 lyrics in local files: file://D:\Music\Akari Kito - Dream Thread INFO-OpenLyrics: Lookup local-file file://D:\Music\Akari Kito - Dream Thread.lrc for lyrics... INFO-OpenLyrics: Successfully retrieved lyrics from file://D:\Music\Akari Kito - Dream Thread.lrc INFO-OpenLyrics: Successfully looked-up lyrics from source: Local files INFO-OpenLyrics: Parsing lyrics text... INFO-OpenLyrics: Loaded lyrics already form a valid UTF-8 sequence INFO-OpenLyrics: Parsing LRC lyric text... INFO-OpenLyrics: Lyric loading complete INFO-OpenLyrics: Skipping lyric save. User-requested: no, Autosave: yes, Local: yes INFO-OpenLyrics: Spawning editor window... INFO-OpenLyrics: Expanding lyric text... INFO-OpenLyrics: Initializing editor window... INFO-OpenLyrics: Saving lyrics from editor... INFO-OpenLyrics: Parsing LRC lyric text... INFO-OpenLyrics: Expanding lyric text... INFO-OpenLyrics: Saving lyrics to a local file... INFO-OpenLyrics: Save file name format '[%filename%]' with directory class 'TrackFileDirectory' evaluated to 'file://D:\Music\Akari Kito - Dream Thread' INFO-OpenLyrics: Saving lyrics to file://D:\Music\Akari Kito - Dream Thread.lrc... INFO-OpenLyrics: Successfully saved lyrics to file://D:\Music\Akari Kito - Dream Thread.lrc [......] Opening track for playback: "D:\Music\Akari Kito - Dream Thread.flac" INFO-OpenLyrics: Failed to read search-avoidance info: Unsupported format or corrupted file INFO-OpenLyrics: Searching for lyrics for artist='Akari Kito', album='Dream Thread', title='Dream Thread'... INFO-OpenLyrics: Save file name format '[%filename%]' with directory class 'TrackFileDirectory' evaluated to 'file://D:\Music\Akari Kito - Dream Thread' INFO-OpenLyrics: Querying for lyrics in file://D:\Music\Akari Kito - Dream Thread.lrc... INFO-OpenLyrics: Querying for lyrics in file://D:\Music\Akari Kito - Dream Thread.txt... INFO-OpenLyrics: Found 1 lyrics in local files: file://D:\Music\Akari Kito - Dream Thread INFO-OpenLyrics: Lookup local-file file://D:\Music\Akari Kito - Dream Thread.lrc for lyrics... INFO-OpenLyrics: Successfully retrieved lyrics from file://D:\Music\Akari Kito - Dream Thread.lrc INFO-OpenLyrics: Successfully looked-up lyrics from source: Local files INFO-OpenLyrics: Parsing lyrics text... INFO-OpenLyrics: Loaded lyrics already form a valid UTF-8 sequence INFO-OpenLyrics: Parsing LRC lyric text... INFO-OpenLyrics: Lyric loading complete INFO-OpenLyrics: Skipping lyric save. User-requested: no, Autosave: yes, Local: yes ```

Additional information

Example for proper LRC ```lrc [00:00.00][00:20.96][00:54.53][01:15.51][01:38.51][01:59.64][02:41.98][02:52.02][03:09.80] [00:00.83]そっと目を覚ませば 暗い闇に覆われ [00:00.83]Quietly, when I open my eyes, I find myself covered in dark darkness [00:10.79]1人…また1人…散る涙に悲しみを堪えて [00:10.79]Alone... one by one... holding back the sadness in falling tears [00:18.31]手に掴むと誓った 希望を [00:18.31]I pledged to grasp onto hope [00:35.27]ずっと夢を見ていた 遠く高く届かない [00:35.27]I've always dreamed, unreachable, far and high [00:44.97]きっと叶うんだってそう願ってた [00:44.97]Surely it will come true, that's what I wished for [00:50.21]そんな時に君が私と繋がった [00:50.21]At that moment, you became connected to me [00:54.66][02:42.37]“いつだって前向きで” “いつだって純粋で” [00:54.66][02:42.37]"Always be positive" "Always be pure" [01:00.05][02:47.83]きっと君とならいけるよ [01:00.05][02:47.83]I'm sure I can do it with you [01:04.40]必ずこの世界を光の園へ [01:04.40]Definitely, I'll lead this world to the garden of light [01:09.90][01:53.96]絶対変えてみせる 未来へと繋ぐよ [01:09.90][01:53.96]I'll show you, connecting to the future [01:19.39]ずっと夢に魅せられ 想い胸に絡まる [01:19.39]Enchanted by dreams all along, feelings entwined in my heart [01:29.12]強く想う程に湧き上がってく [01:29.12]The more strongly I feel, the more it wells up [01:34.28]まるで“夢の糸”に絡まれたみたいに [01:34.28]As if entangled in the "threads of dreams" [01:38.72]いつだって追い求め いつだって熱い鼓動を [01:38.72]Always pursuing, always with a passionate heartbeat [01:44.10]ずっと燃やし歩んでいく [01:44.10]I'll keep burning and walking forever [01:48.52]溢れるこの想いよ あなたに届け [01:48.52]Let these overflowing feelings reach you [02:17.93]夢の糸 囚われた私は蝶となり [02:17.93]Threads of dreams, I, who was imprisoned, become a butterfly [02:28.06]あの空の下へと帰るから [02:28.06]Because I will return beneath that sky [02:34.95]いつの日かこの世界を塗り替えよう [02:34.95]Someday, let's repaint this world [02:52.14]絡まる糸 夢を引きよせる魔法 [02:52.14]Entwined threads, a magic that pulls dreams [02:57.64]絶対変えてみせる 未来へと [02:57.64]I'll definitely change and connect to the future [03:02.76]絶対最高の未来が待ってるよ [03:02.76]The absolute best future is waiting [03:06.76]繋げよう [03:06.76]Let's connect ```
Result LRC saved by OpenLyrics ```lrc [00:00.00][00:20.96][00:54.53][01:15.51][01:38.50][01:59.64][02:41.97][02:52.02][03:09.80] [00:00.83]そっと目を覚ませば 暗い闇に覆われ [00:00.83]Quietly, when I open my eyes, I find myself covered in dark darkness [00:10.79]1人…また1人…散る涙に悲しみを堪えて [00:10.79]Alone... one by one... holding back the sadness in falling tears [00:18.30]手に掴むと誓った 希望を [00:18.30]I pledged to grasp onto hope [00:35.27]ずっと夢を見ていた 遠く高く届かない [00:35.27]I've always dreamed, unreachable, far and high [00:44.96]きっと叶うんだってそう願ってた [00:44.96]Surely it will come true, that's what I wished for [00:50.21]そんな時に君が私と繋がった [00:50.21]At that moment, you became connected to me [00:54.65][02:42.37]“いつだって前向きで” “いつだって純粋で” [00:54.65]"Always be positive" "Always be pure" [01:00.04][02:47.82]きっと君とならいけるよ [01:00.04]I'm sure I can do it with you [01:04.40]必ずこの世界を光の園へ [01:04.40]Definitely, I'll lead this world to the garden of light [01:09.90][01:53.96]絶対変えてみせる 未来へと繋ぐよ [01:09.90]I'll show you, connecting to the future [01:19.39]ずっと夢に魅せられ 想い胸に絡まる [01:19.39]Enchanted by dreams all along, feelings entwined in my heart [01:29.12]強く想う程に湧き上がってく [01:29.12]The more strongly I feel, the more it wells up [01:34.28]まるで“夢の糸”に絡まれたみたいに [01:34.28]As if entangled in the "threads of dreams" [01:38.71]いつだって追い求め いつだって熱い鼓動を [01:38.71]Always pursuing, always with a passionate heartbeat [01:44.09]ずっと燃やし歩んでいく [01:44.09]I'll keep burning and walking forever [01:48.52]溢れるこの想いよ あなたに届け [01:48.52]Let these overflowing feelings reach you [02:17.93]夢の糸 囚われた私は蝶となり [02:17.93]Threads of dreams, I, who was imprisoned, become a butterfly [02:28.06]あの空の下へと帰るから [02:28.06]Because I will return beneath that sky [02:34.94]いつの日かこの世界を塗り替えよう [02:34.94]Someday, let's repaint this world [02:52.13]絡まる糸 夢を引きよせる魔法 [02:52.13]Entwined threads, a magic that pulls dreams [02:57.63]絶対変えてみせる 未来へと [02:57.63]I'll definitely change and connect to the future [03:02.75]絶対最高の未来が待ってるよ [03:02.75]The absolute best future is waiting [03:06.75]繋げよう [03:06.75]Let's connect ```