kelvinlawson/pykaraoke — Issue #14: Artist-Title parsing fails under certain circumstances
Author: SlashQuit
Created: 2011-12-19 07:08:16+00:00
State: open

Using the "DISC-TRACK - ARTIST - TITLE" structure, the following will parse correctly;
/cdg/CB/CB3xxxx/CB30055/CB30055-15 - Switchfoot - Stars.zip
Title: Stars
Artist: Switchfoot

However, the following examples do not parse;
/cdg/PH/PHM - Pop/PHM0512/PHM0512-08 - Switchfoot - Stars.zip
I assume this is due to the "-" character as part of the path.

SC3448-03 - All-American Rejects - Dirty Little Secret.zip
(Again I assume to the "-" in the artist name.)

CB5056-03-06 - Al Green - Let's Stay Together.zip
(Probably due to their being a "-" in the disc code CB5056-03.)

I understand that the format follows the correct specs of 'optional spaces', and this makes things tricky (near impossible) to parse certain valid filenames.

The problems here could be solved by adding an additional parsing option of
"DISC-TRACK-ARTIST-TITLE" - This is what exists, and allows the optional spaces.
"DISC-TRACK - ARTIST - TITLE" - This is what could be added, where the spaces are required.

- First delimiter " " (or " - " if you want to be more strict) separates the DISC-TRACK from the rest of the string. If the next character is "-" or "- " (dash space), trim that too.
- In the obtained DISC-TRACK, the LAST delimiter "-" separates the disc ID and the track. This would allow DISC ID's to contain dashes.
- In the remaining artist-title string, use the first found delimiter " - ". Any further delimiter counts as the title (or artist, if the format is "title - artist".