animetosho / ParPar

High performance PAR2 create client for NodeJS
193 stars 19 forks source link

Par2cmdline compatible command line parameters. #2

Closed fetzerms closed 2 years ago

fetzerms commented 7 years ago

Hi,

Would it be possible to implement a "par2cmdline"-compatibility switch? I am currently porting my backup scripts to use parpar. But I am missing the equivalent of the -r switch - that is the level of redundancy.

The -r option of parpar seems to differ from par2cmdline:

Parpar2: -r, --recovery-slices Number of recovery slices to generate.

par2cmdline: -r<n> : Level of Redundancy (%%)

This is the option is miss the most - but having a "fully compatible" command line would be quite handy.

animetosho commented 7 years ago

Thanks for the suggestion!

Indeed, I can see it being quite useful to have a drop in replacement for par2create to make it easier to let existing scripts/toolchains work.

At the moment, the CLI does need a fair bit of work, as it's fairly bare and not particularly user friendly, as you've pointed out (it's mostly just a proof of concept / experimental application for now), so it's something I'll keep in mind when I overhaul it a bit.

fetzerms commented 7 years ago

I find it user friendly enough - I am just missing the "level of redundancy"-switch. I'm not sure how par2cmdline automatically calculates the slice size and counts. Would you be open for a PR, if I manage to extend parpar to have a similar option?

animetosho commented 7 years ago

Sure, if you're willing to do it - saves me from finding spare time to do it!

It's not the simplest of things to implement though. You'd need the total size of all files, which you could calculate here. But you'd need to probably move most of the constructor logic elsewhere for it to work, then somehow pass the flag from the CLI into the PAR2Gen object.

Thanks for the offer by the way.

fetzerms commented 7 years ago

I did not look too deep into the code yet. But my first idea was to calculate sliceSize and recoverySlices and pass this to the PAR2Gen constructor. This should be possible, after calculating the overall size of the passed files as well as the "recoveryPercentage". Tho passing the parameter itself and have the calculation in (the right) place sounds like a cleaner solution.

I think I may find some time soon to look into it.

fetzerms commented 7 years ago

Sorry, I completely forgot about this. I try to remember it, when I have more time again....

bingoxo commented 4 years ago

@fetzerms can you take a look at it again please ?

animetosho commented 2 years ago

-r switch supporting percentages has been added for a while now.

I have decided not to bother with doing any drop-in par2cmdline replacement. Hopefully script migration isn't particularly difficult any more (most, if not all par2cmdline options should have an equivalent) and there being a GUI in development, eliminating the need for compatibility with existing GUIs.