Skip to content

Extras folder#872

Open
blathers16 wants to merge 8 commits intofrederic-mahe:masterfrom
blathers16:extras-folder
Open

Extras folder#872
blathers16 wants to merge 8 commits intofrederic-mahe:masterfrom
blathers16:extras-folder

Conversation

@blathers16
Copy link
Contributor

This pull request is to allow copying files found in the source directory that are not found in the database to a designated folder when running the build pack script.
The rationale behind this is that you may have a bunch of ROMs from various sources randomly mixed together. Since there is no guarantee that these databases will always have every ROM in existence in them, with this change any roms from the source folder will either end up in the build pack or in the extras folder.
The user can then safely keep only a copy of the built pack and the extras folder with the knowledge that they haven't deleted any ROMs from the source that are not yet in the db.
This can also help in keeping the db up to date, as any files that end up in the extras folder can be investigated to determine whether they need to be added to the db.

@blathers16
Copy link
Contributor Author

@tjanas can I get this looked at? Do you need me to file an issue to go with it or something?

@tjanas
Copy link
Collaborator

tjanas commented Jun 3, 2023

I would ask @frederic-mahe instead

@frederic-mahe
Copy link
Owner

@blathers16 I am really sorry for not looking at your pull request earlier. I was hoping to refactor my build_pack.py script first, but I've been too busy with work.

Before merging your new option, there are a few things that could be improved or clarified. I hope you won't mind.

For instance, that check could be done only once, rather than for each file in the source folder:

# create directory structure if need be
if not os.path.exists(new_path):
    os.makedirs(new_path, exist_ok=True)

Also, there is a possibility that someone will put the extras_folder in the source or destination folder by mistake. As it is, the script should work as expected, but that needs to be tested.

Finally, I am not sure to understand your strategy when there are multiple source files with the same name. You add part of the hash value to the filename h[0:4]. Assuming that same-name files can only appear in different sub-folders, an alternative to name alteration could be to simply recreate the source subfolders in the extras_folder. What do you think of that?

@blathers16
Copy link
Contributor Author

Hi, @frederic-mahe
I made the requested changes.
I have also tested and confirmed that putting the extras folder in either the input or the output folder does not cause problems, nor does specifying an extras folder that does not yet exist.

@blathers16
Copy link
Contributor Author

Hi, @frederic-mahe, sorry to revive this from the dead. I've been rather busy with life and forgot about it. I could recreate the folders if you want, but I felt the other option was simpler, and in general, I prefer simple solutions as there is less to go wrong. Please let me know if there is anything you would like me to do to get this merged.

@blathers16
Copy link
Contributor Author

Hi, @frederic-mahe. Given further thought, I decided to give the user the option of whether to append a hash or preserve the folder structure. I also fixed an issue with relative folder paths. Please let me know if any additional changes are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants