vcromclaim icon indicating copy to clipboard operation
vcromclaim copied to clipboard

Filename generation scheme considered harmful

Open stan423321 opened this issue 6 years ago • 2 comments

The way program appears to work right now is that it extracts internal game titles, then inserts them directly into templates for filenames. This behavior causes a variety of problems. I am not sure if submitting them as one issue is perfect, but they stem from this single behavior. Following are symptoms on Windows NTFS partition.

  • Problem 1A: Some games have characters in titles which are not accepted. For example, PAL release of (NA version of) Air "Zonk" for TG has those quotes in the title, which causes Windows to protest. My understanding is that using quotes in filenames is allowed on *nices but can results in problems when used.
  • Problem 1B: Some games have titles which Windows converts... sometimes. For example, PAL release of Alex Kidd (the first one) for SMS has a title with a space on the end for some reason. While ROM file gets written out with space before the extension, manual directory gets renamed to skip the space, then Windows protests when manual files are supposed to be written to directory with the space.
  • Problem 2: Some games have counterparts with identical titles which causes confusion; I have specifically dumped PAL Sonic the Hedgehog for SMS and MD from separate NAND images due to NAND limits, and it results in identically named manual directories, which merge... badly. I have not tried to see what happens when they are on the same NAND image. It is possible that in some cases problem is amplified on Windows filesystems due to case insensitivity.

Based on the above, I would suggest implementing some kind of a different naming scheme, however the choice of specifics is not apparent and thus I don't want to force any particular suggestions.

stan423321 avatar Apr 10 '18 19:04 stan423321

This is the same as issue #7

As mentioned there, a workaround is to change line 37 of wiimetadata.py FROM: self.name = name TO: self.name = id

Although it gives everything very ugly filenames. I don't know much Python, I'm guessing it should be fairly easy to filter any non-A-Z/numerical (to fix "1A"), trim head and tail whitespace (to fix "1B") and to perhaps append console (SMS, MD, SNES, etc) or some ID (all games have an 8 character hexadecimal ID and another 4-character alphabetical ID, e.g. "JMVA") to all titles to fix "2".

JanErikGunnar avatar Apr 10 '18 21:04 JanErikGunnar

I've made a fix that should resolve all the issues except the one with duplicated games (Sonic the Hedgehog). Basically everything that are not known safe characters are stripped from the file name. I've made a pull request, meanwhile you can download my fork.

JanErikGunnar avatar Apr 14 '18 11:04 JanErikGunnar