Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extras folder #872

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

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.

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