Closed ryanfb closed 4 years ago
First things first: your utility's name is awesome :sunglasses:
Yes, you're right. It only matches file names and that's all. It's not out of scope per se, but it would indeed be an expansion over what this tool aimed to achieve in the first place. Which is not bad at all (feel free to open a PR if you want :smile:).
Now, yes, I have thought about matching with the hash (and I even attempted something). The only issue is that there's a huge variety of ways people can organize and archive ROMs and I found it to be a bit hard to code something that would allow most people to use it. As far as I could see, it would have to:
While this is all easy to do (except maybe ZIP files), it takes some testing to get it right, and I lack the time right now.
Well, I kinda just did it.
It was easier than I thought, tbh. I'll commit the changes in a bit
Well, would you do the honors of testing what I made? :wink:
You should use the --use-hashes
option.
I get the following error:
Traceback (most recent call last):
File "generate.py", line 1224, in <module>
main(sys.argv[1:])
File "generate.py", line 832, in main
file = file_relative_to_input(file, input_dir)
File "generate.py", line 939, in file_relative_to_input
return file.replace(input_dir, '', count=1).lstrip(os.path.sep)
TypeError: replace() takes no keyword arguments
Running under Python 3.8.0.
@ryanfb it should work now
Thanks! Seems to work fine now.
I have refined the hash processing and sped it up too. And I also fixed a couple issues with the copied files's names.
I released it as 1.6.0
The first time I tried this utility, I was curious as to why it didn't find any matches, since DAT files have hash information—it seems like it only uses filenames to find matches in the DAT file. I looked briefly at just trying to make a pull request for this, but I'm not sure if you think it would be out of scope. Python does have SHA1 functionality in hashlib, so it shouldn't introduce an external dependency.
In the meantime, I've written a very simple companion utility that will use the SHA1 hashes in a DAT to copy files into a new directory with the correct filenames that this utility expects: https://github.com/ryanfb/copydatrom