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

Added ability to split merged bin files #4

Merged
merged 4 commits into from
Mar 9, 2019
Merged

Added ability to split merged bin files #4

merged 4 commits into from
Mar 9, 2019

Conversation

cgarz
Copy link
Contributor

@cgarz cgarz commented Jan 11, 2019

After asking about a binsplit in issue #3 I had a look at making it myself. Reading your code was very informative. Would never have guessed cue/bin was actually so relatively simple.

With this, returning to split bin format and verifying against their dat files will be much easier. This also helps anyone who uses MAME's chdman to compress their images as it turns out that it also merges the split bin format.

Line endings also had to be forced to CRLF to match redump. Everything should match all the checksums when reverted now.

Was also considering reformatting the code here and there to help my editor stop complaining about PEP 8's guidelines. Figured less is more but if you'd like I can add another commit to do that.

Copy link
Owner

@putnam putnam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for your contribution! Really useful to be able to swap back, and good catch on the CRLF issue. I'm not a huge stickler for PEP8 compliance. I just throw stuff together in vim that looks pretty. Feel free to submit cosmetic changes too.

Apologies for taking a while to respond as I seem to have all my github notifications setup wrong.

@putnam putnam merged commit 2dab725 into putnam:master Mar 9, 2019
@cgarz
Copy link
Contributor Author

cgarz commented Mar 9, 2019

Yes I'm the same. Only got introduced to it when I switched from vim to PyCharm for the debugger. Was very annoying to be told off for things like making successive variable assignments with similar data line up verically. Felt like a vendetta against beautiful code lol.

No worries about the delay, your code was all the help I needed. Was a great learning experience implimenting this.

So do you actually want the PEP8 tweaks?

@BParks21
Copy link

BParks21 commented Feb 5, 2022

@putnam So I have this batch file that splits all my bins but it always names the bin tracks with (redump) how do I change it to retain the original file names for the tracks. Yeah I'm dumb idk how to change the bat command to do that. This is the bat. I've tried removing redump from the parenthesis but then I get the parenthesis in the file names. I'm so confused....

for /r %%i in (*.cue) do binmerge -s "%%i" "%%~ni (Redump)"

Could someone help me? I want to be able to revert chd's back to the original bin/cue format but chdman combines the bin files. I have a lot of chd's and need this bat file to bulk split my bin files but retain the original track names. Please help. How do I use the --split parameter exactly, can I just do that for bulk splitting, I'm not sure how to use it? I just need a way to bulk split my bins so that they properly match redump dats.

@cgarz
Copy link
Contributor Author

cgarz commented Feb 11, 2022

@BParks21 If you don't want it to say (Redump) then you just don't put (Redump).

The 2 arguments for binmerge are cuefile and basename.

  • cuefile is just the path to the cue file that you want to work with, in this case your loop provides that with the variable %%i
  • basename is the basename of the new cue file that will be created, without any path prefix or .cue suffix.
    This is also provided by the for loop with the variable %%~ni. The prefix ~n before the variable name i changes the variable expansion so that it expands %%i to a file name only. As in, it strips the path prefix and file extension suffix.

However if you just keep the output basename the same as the input cue file it wont work since that would be the same file and I don't think binmerge supports in place merging and splitting. To work around that just specify an output dir that the split files should go to using the --output argument.

For example to have the output dir name be the basename of the cue file you would do this:
for /r %%i in (*.cue) do binmerge -s "%%i" "%%~ni" --output "%%~ni"

More info about the for command and the special variable expansions is here: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490909(v=technet.10

@BParks21
Copy link

@BParks21 If you don't want it to say (Redump) then you just don't put (Redump).

The 2 arguments for binmerge are cuefile and basename.

  • cuefile is just the path to the cue file that you want to work with, in this case your loop provides that with the variable %%i
  • basename is the basename of the new cue file that will be created, without any path prefix or .cue suffix.
    This is also provided by the for loop with the variable %%~ni. The prefix ~n before the variable name i changes the variable expansion so that it expands %%i to a file name only. As in, it strips the path prefix and file extension suffix.

However if you just keep the output basename the same as the input cue file it wont work since that would be the same file and I don't think binmerge supports in place merging and splitting. To work around that just specify an output dir that the split files should go to using the --output argument.

For example to have the output dir name be the basename of the cue file you would do this: for /r %%i in (*.cue) do binmerge -s "%%i" "%%~ni" --output "%%~ni"

More info about the for command and the special variable expansions is here: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490909(v=technet.10

Yeah idk, when I remove (Redump) from the bat I provided changing it to
for /r %%i in (*.cue) do binmerge -s "%%i" "%%~ni"
It doesn't work at all. I have to have some kind of characters in between the ni and "
Then it works.

@cgarz
Copy link
Contributor Author

cgarz commented Feb 12, 2022

@BParks21 What does the error say?
If it just says file exists then I already explained why that is and how to work around it.

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