USDX icon indicating copy to clipboard operation
USDX copied to clipboard

[Linux] Please make media file links case insensitive

Open uhrheber opened this issue 6 years ago • 11 comments

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.

uhrheber avatar Dec 29 '18 14:12 uhrheber

As a quick fix, you could use UltraStar Manager (use 'assign missing tasks automatically' task).

bohning avatar Dec 29 '18 14:12 bohning

What should USDX do on Linux if there are several files that only differ in case?

s09bQ5 avatar Dec 29 '18 14:12 s09bQ5

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.

uhrheber avatar Dec 29 '18 15:12 uhrheber

@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.

uhrheber avatar Dec 29 '18 16:12 uhrheber

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.

ePirat avatar Jan 02 '19 16:01 ePirat

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 avatar Jan 03 '19 10:01 abrock

@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

basisbit avatar Jan 03 '19 10:01 basisbit

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 avatar Jan 03 '19 13:01 ePirat

@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

basisbit avatar Jan 03 '19 14:01 basisbit

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!

ePirat avatar Jan 03 '19 14:01 ePirat

related and a possible workaround: https://www.phoronix.com/scan.php?page=news_item&px=EXT4-Case-Insensitive-Sent

jose1711 avatar Jul 11 '19 06:07 jose1711