Open codello opened 11 months ago
While the alternative would indeed be more inelegant, it would prevent having to modify the db update script to parse .txt file contents, which is one of the main improvements in performance compared to the old version. However, a duet indicator could easily be added if either .txt files or song titles were to contain duet in them (as this clearly marks duets without having to parse the .txt).
To be honest, performance isn't much of an issue, we can easily run a script that takes an hour every night. But reliability is an issue and if I understand it correctly, different encodings and parsing problems were the main problems with the old solution.
I don't think that a full parser implementation is necessary to support this. The UltraStar file format is pretty simple. Assuming that a song is valid, it would be sufficient to check if any line starts with the letter P
(without trimming leading whitespace). The only valid lines starting with P
are the player indicators which are only found in duets.
If performance is a potential concern, it should be enough to check the first 20 or so lines of each song. The first P
-line has to be the first line after the header (lines starting with #
). If the P
appears later, the song would be considered invalid by UltraStar anyways.
UltraStar basically supports three encodings (UTF-8, CP-1250, and CP-1252), all of which are ASCII-compatible. So checking if a song is a duet could be done without knowledge of a song's encoding. I think Vocaluxe also only supports these encodings. IIRC encodings present the most issues in the following cases:
#COVER
or #MP3
) contains special characters, the file might not be found if the wrong encoding is used. This is the point that made loading songs unreliable in the past.
UltraStar songs can contain up to 2 voices (duets). It would be very useful if there was some kind of indicator in the search results for duets (songs with more than one voice).
Use Cases
Alternatives Considered
As a workaround duets might be renamed to contain "Duet" in the song title. While being somewhat inelegant this would solve the above use cases. However, I think a dedicated indicator would provide an improved experience.