emericg / OpenSubtitlesDownload

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

suggestion : downloading subtitles for movies within a directory recursively #30

Closed abjdiat closed 5 years ago

abjdiat commented 6 years ago

thank you for the amazing software. I would like to ask for a new feature . the script takes ( file name/s ) as input in the same directory. i know it is possible for the feature im requesting to be done with some bash scripting but if it built-in would much easier to use. is it possible to add -d (directory path ) argument to the options so the script will look for movies within the directory and sub-directories . i think the feature will be very handy for any one with big movies collection with lots of folders and sub-folders.

Thank you

panosl commented 6 years ago

@abjdiat this did the trick for me:

find . -type f -name '*.mkv' -exec osd {} \;

p.s. osd is a symlink to OpenSubtitlesDownload.py

armyanov commented 6 years ago

@panosl Hi!

Noob here, how do I use that? Should I replace some code in the script with that? Sorry I really have no experience scripting, but i really need this function in the script.

p.s. I also have other video extensions, not just .mkv

Thanks!

mhertz commented 6 years ago

@armyanov

Examples to copy/paste into terminal (,possibly amend) and run:

find video -type f \( -name '*.mkv' -o -name '*.mp4' -o -name '*.avi' \) -exec OpenSubtitlesDownload.py {} \;

Change 'video' to the name/path of your video-dir, and add extra options if needed after OpenSubtitlesDownload.py, e.g. for other than english subs('-l dan' for danish subs for example).

You could also instead of 'find' use e.g.:

shopt s globstar extglob; OpenSubtitlesDownload.py video/**/*(*.mkv|*.mp4|*.avi)

OpenSubtitlesDownload also checks mimetypes by itself and excludes non-video files, so it's also possible to just:

shopt s globstar; OpenSubtitlesDownload.py video/**/*

emericg commented 6 years ago

Ok guys looks like that feature will become the v4.0. I won't be starting right away but it's probably the most requested feature so, I'll do it :)

thiagoalz commented 5 years ago

See #40 :D

emericg commented 5 years ago

Merged on master, thanks to @thiagoalz ! We can finally close this one :+1: