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

A setting to overwrite files/bulk optimization? #8

Open
abbuw opened this issue Oct 2, 2022 · 4 comments
Open

A setting to overwrite files/bulk optimization? #8

abbuw opened this issue Oct 2, 2022 · 4 comments
Labels
enhancement New feature or request hacktoberfest Issues you can help with for Hacktoberfest!

Comments

@abbuw
Copy link

abbuw commented Oct 2, 2022

Hello! I've stumbled upon this program, and the first thing I thought is that it would be extremely handy if I could just point this application at a folder and have it optimize everything within it without having to manually input each file. I'm a barely tech literate sort of person so I don't really know how to write a fancy script that would do that for me automagically like what I've seen others do. If there was a setting to optimize and overwrite the original files without having to do it all manually, that would rock my socks off. It would be doubly awesome if I could just drag and drop files/folders on the executable and have it do all the magic without ever touching a command prompt, kind of like how PNGOUT does it!

@AlexTMjugador
Copy link
Member

AlexTMjugador commented Oct 2, 2022

Hi! 👋

In-place optimization is a bit tricky for OptiVorbis. Its two-pass optimization techniques require the input file to be available while the output file is generated, so a temporary output file must be used and atomically moved to the original path after optimizations. Getting this done right across platforms requires attention to detail, so it was not in scope for the first public release.

On the dragging and dropping part, while I understand that it can be a significant UX improvement, at a technical level that gesture is just another way of passing command line parameters, and I'm unsure whether I want to change the CLI interface to accommodate that use case. For example, if two files are dragged and dropped, two paths are passed to the CLI, so what should OptiVorbis do: optimize the file referenced by the first path to the second path (the current behavior), or optimize both files in place? OptiVorbis does not know if the user dragged and dropped files or used a command-line prompt, so it's impossible to guess what the user wants from the paths alone.

Anyway, your suggestions are intriguing, and even if they do not make it to the application, I welcome user-contributed ways to make these operations easier! Thank you for your feedback 😄

@AlexTMjugador AlexTMjugador added enhancement New feature or request hacktoberfest Issues you can help with for Hacktoberfest! labels Oct 2, 2022
@murlakatamenka
Copy link

murlakatamenka commented May 22, 2023

@abbuw you can leverage other utilities to make your CPU cores busy with optimizing a folder, such as fd:

fd . --type file --extension ogg "/path/to/folder" -x optivorbis {} {.}_optimized.ogg

After that, you can verify that optimized files are valid and remove the original ones, then strip _optimized from filenames. Quick and dirty, take it or leave it 😄

@AlexTMjugador
Copy link
Member

Thanks for the tip, @murlakatamenka! I've used tools like parallel several times myself to execute commands in parallel across file sets, but I didn't think of it when I wrote that reply 😄

@murlakatamenka
Copy link

Yes, GNU parallel is another alternative.

@abbuw didn't specify the platform he uses, so I've written about cross-platform fd only. parallel is via MSYS2 or WSL on Windows as I understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest Issues you can help with for Hacktoberfest!
Development

No branches or pull requests

3 participants