emericg / OpenSubtitlesDownload

Automatically find and download the right subtitles for your favorite videos!
https://emeric.io/OpenSubtitlesDownload
GNU General Public License v3.0
588 stars 64 forks source link

Handle CLI usage #6

Closed Gui13 closed 10 years ago

Gui13 commented 11 years ago

Can't use without zenity, too bad! Could you try enabling a CLI usage, without any dependency to visual windows?

emericg commented 11 years ago

Yes, I was actually working on it for the next version! I have yet to decide how to do that correctly but it's on my todo list.

emericg commented 11 years ago

Allright, I started working on that issue. But I'm not sure what to do with it...

The thing is that a full CLI mode should be integrated into the current application and not into a separated version of it.

The script works well without zenity, no problem here. It is easy to route all zenity "popup windows" to a terminal. But these messages are often using text formatting, break lines, special titles and icons.

I guess it come down to what do we want to do with the CLI mode. Should it offer the exact same functionnalities (verbose and formated output, subtitles selection list) or is it intended as a "fully automated" script that we could plug into our torrent softwares or storage servers, with minimal output and auto-selected subtitles.

Ideas ?

Gui13 commented 11 years ago

I guess a fully automated process is nice for the time being. I indeed asked this for an easy integration in a torrent download processus. The subtitle selection could be integrated later, with an index-based selection, with color hints and default selection to indicate which subtitle is likely to be the best.

I currently use Soleol ( http://eduo.info/apps/soleol ) to retrieve the subtitles, which has a pretty good "auto" mode, where it selects the most dowloaded subtitle that has a good reputation on OS. But this still needs clicking "ok", and doesn't run under CLI...

emericg commented 11 years ago

You can follow progresses here: https://github.com/emericg/opensubtitles-download/tree/multigui

I have yet to handle automatic or manual subtitles selection (right now the first of the list is downloaded) and print message cleanup (remove various tag and new lines). Also, the "kdialog" mode doesn't do anything yet.

emericg commented 11 years ago

Hi Gui13! I believe everything you want is now implemented in the "multigui" branch (https://github.com/emericg/opensubtitles-download/tree/multigui).

You can select the selection mode ('auto' based on the download count and 'manual') as well as your target gui mode (gnome, kde or terminal). Please note that the 'kde' mode is widely untested :-)

emericg commented 10 years ago

Ok thanks I merged the pull request ;-)

I'm not entierly satisfied with the argument parsing code taking over the default text settings. I want to keep easy setting editing at the begining of the file, for the people who are using the script as a nautilus script, then the argument parser should overwrite these settings only if an argument as been specified. I'll move the argument parsing down the file if that's ok with you.

emericg commented 10 years ago

Allright the last two commits should seal the deal. And the terminal is able to handle more than one file at a time again ! If we are in 'auto' mode, just let it do its magic, however if we are in 'manual' mode, we can just tell the dispatcher to spaw child process synchronously and let the user treat the searches one by one!

I wonder if we should rename the "--auto" argument in "--selection". "--auto auto" does not feel good.

Gui13 commented 10 years ago

I find '--auto' or '-a' easier to read than '--selection auto'. If there was multiple choices, I'd say go for it, but here it is just a matter of activating an option or not (like ls -l). I'd be incluned for '--auto-selection' but it is a bit long. Your call, that's your repo :)

There's also the problem of passing the arguments to the subprocess: you only keep the "gui" option, but all the options should be passed (auto, lang, verbose). I'm not sure how to automate this though..

emericg commented 10 years ago

Allright, with the "Multigui merge" the CLI is now fully working!