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

Add user choice on existing output file; don't just overwrite target #179

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

t-nil
Copy link
Contributor

@t-nil t-nil commented Jan 16, 2024

Overwriting should not be a sane default, but neither are skip or ask (because some person could start a batch job and go AFK, just to find their encodings weren't done).

This adds a command line flag, together with an ask menu and a rename function (with tests). Renames are done based on the pattern that if a file name ends on _<number>, that number is incremented. If it doesn't, an _1 is appended.

@alexheretic I didn't ask you if you want this feature, so it's ok if you dont. But what do you think about it?

@alexheretic
Copy link
Owner

Thanks for raising this. My gut feelings are

  • I'd prefer to avoid interactive prompts if possible
  • I wouldn't really expect renaming by default, this is more difficult to handle with scripts and is more something GUI apps tend to try to do.

A simpler alternative would be:

  • Change default behaviour to exit with non-zero status if output already exists.
  • Add --overwrite arg to get existing behaviour.

wdyt?

@t-nil
Copy link
Contributor Author

t-nil commented Jan 17, 2024

I think your answer points out very accurately the decisions to be done about design direction - how much the target of the app is to be used by users directly, or via scripting; and how much the user should need to know - about scripting or encoding.

E.g I would love to close #159 with hints to an easy shell scripting solution, as that averts feature creep imho. On the other hand, I am undecided as to the general direction in which I would want this project to go. (And obviously I have no authority whatsoever - It's your project and I am fine with that :) ) But an action about overwriting should not be left to scripting, since it's not a nuisance but data-critical and painful to get wrong.

It's ok for me to leave out the "ask" dialog, as I can imagine the use cases would be very few. On the other hand even ffmpeg by default asks if it should overwrite an output, and the code isn't very complex or prone to break in the future I think.

As for the renaming part - a friend actually raised the issue as I talked to him about the patch I was just starting; he brought up the idea, but I really liked about it, that you have an option wherein you neither overwrite some file nor abort prematurely (and possibly lose a day or more in which no rendering is done). I know the logic and tests are quite complex, and I don't think I have the energy to reduce the complexity, but we have tests and I think the feature could be quite handy.

@alexheretic
Copy link
Owner

I don't think I'd accept "rename" as default behaviour, it just isn't how I would expect any cli to behave.

I'm ok with "rename" or "ask" as opt-in behaviours, if someone actually has a use case.

So I think the default should either remain "overwrite" or become "fail" (shouldn't be called "skip" since it should return a non-zero exit code).

@t-nil
Copy link
Contributor Author

t-nil commented May 26, 2024

Thanks for the feedback, I see your point!

I will adapt my changes as soon as I find time.

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.

None yet

2 participants