USDX
USDX copied to clipboard
[Linux] Please make media file links case insensitive
Actual behaviour
Some song creators (accidentally or carelessly) use different cases in the links to the media files than the real file names. Example: MySong.txt: #MP3:The best Band in the World.mp3
Real file name: The Best Band In The World.mp3
Windows doesn't care about this, and finds the files anyway (and that's why the creator never notices the error), but Linux does, and therefore doesn't find the file.
Expected behaviour
The Linux version should either ignore the cases of the file names by default, to match the Windows behaviour, or at least have an option to do so. Correcting the song files manually is a lot of work for big collections.
Steps to reproduce
Change one letter of a songs media file from upper to lower case or vice versa, start USDX, see the Error about a missing media file in the log.
Details
- USDX version: Every Linux version up to today
- Operating System + version: generic Linux.
As a quick fix, you could use UltraStar Manager (use 'assign missing tasks automatically' task).
What should USDX do on Linux if there are several files that only differ in case?
Try to find the one that matches the case exactly, if there is none, write a warning to the log, then convert everything to lower case and use the first find.
But I doubt that this will ever happen, because most people seem to use Windows to create songs, and Windows doesn't allow two files of the same name in one directory, regardless of the case.
@bohning: I didn't know that it can do that, it needs about half an hour to open my song collection, therefore I never used it. This function indeed assigned most of the missing files automatically. Many thanks.
Try to find the one that matches the case exactly, if there is none, write a warning to the log, then convert everything to lower case and use the first find.
This can't work for case-sensitive file systems. Imagine the file is called "Foo.mp3" and the USDX song file has "FOO.mp3" instead. Converting that to all lowercase would give "foo.mp3" which still does not match "Foo.mp3". USDX would need to try all variations of lower/upper-case for each character in the file name which is a huge performance impact.
USDX would need to try all variations of lower/upper-case for each character in the file name which is a huge performance impact.
No, it would only need to convert all file names in USDX song files to lowercase and store for each file found in the song directory both the original path and the path converted to lowercase. The performance impact is most likely insignificant compared to for example the time needed for filesystem traversal.
@abrock feel free to submit a pull request, having fun with freepascal ;-) Because of how song file scanning is implemented in usdx, this would either require quite a bit of refactoring/rewriting or it would require a full folder contents lookup for each valid looking us .txt file, increasing loading time up to a third on HDD systems with inefficient caching / big ultrastar song collections
No, it would only need to convert all file names in USDX song files to lowercase
I don't understand how this is supposed to work, sorry. As @basisbit said, feel free to submit a pull request that implements it.
@ePirat as far as I understood, @abrock suggested that (enhancement suggestion: if the file is not found) usdx looks up all file names in that folder, then tries to find the matching file and then use the correct file name internally. On second thought, this might not be too bad after all because that code could also be used to find files with non-ansi-characters in filename on windows or other systems
Ah indeed that should work if the file list is not too big and given how USDX songs are usually structured it should be relatively small in most cases. Clever idea!
related and a possible workaround: https://www.phoronix.com/scan.php?page=news_item&px=EXT4-Case-Insensitive-Sent