Enhance support for lrc files.

Open Ulices requested to merge hasecilu/gnome-subtitles:lyrics_lrc_files into master

I noticed that when opening a lrc file half of the content was deleted, this was reported quite some time ago on #98, I just can add that I have never seen a lrc with end timestamps (using two lines per string) so it definitively needs to change.

Also made some minor changes like:

  • Allow *.flac files to be opened. As reported in #203, the flac format is not in the whitelist of files so I added it. Nowadays is very a common audio format.
  • Fix typo.
  • Remove a space character that was being added on the title tag, ex: before [ti: Title song], after [ti:Title song].
  • Some lrc file contains the length tag and after saving the file it was removed, so I added the length variable.
  • I added an extra line between the tags and the lyrics.
  • The version and program ([ve:], [re:]) tags now are filled with the version of the program used and the name of the application, any previous data is overwritten.
  • I modified the regex to omit that second void line that is not needed.
    • I added a space character between the timestamp and the string just for better readability, ex: [04:20.00] Lyrics line 17
    • I tested the new and old files with Lollypop and mpv and both worked as expected.
    • The only downside happens if you try to open a lrc file that was previously saved by Gnome subtitles but is easily fixable with Vim/Neovim/Emacs or using the multi-line cursor feature on modern editors (picture below).
    • There is no data loss with most files from the wild internet. I haven seen tags like offset and language but are not very common.
    • IMPORTANT: The editor MUST add an empty at the end to prevent the last string to show until the end of the song. Also can use icon on no lyrics spaces, like: [02:07.10] ♪


Closes #98, #203

Edited by Ulices

Merge request reports