emericg / OpenSubtitlesDownload

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

Check files in folder recursively #46

Closed louietyj closed 4 years ago

louietyj commented 4 years ago

As title

Test Plan

C:\Users\louie\Downloads>dir /b /s /a:-D c:\users\louie\desktop\dummy
c:\users\louie\desktop\dummy\Supergirl.S05E01.HDTV.x264-SVA[rarbg]\RARBG.txt
c:\users\louie\desktop\dummy\Supergirl.S05E01.HDTV.x264-SVA[rarbg]\RARBG_DO_NOT_MIRROR.exe
c:\users\louie\desktop\dummy\Supergirl.S05E01.HDTV.x264-SVA[rarbg]\Supergirl.S05E01.HDTV.x264-SVA.mkv
c:\users\louie\desktop\dummy\Supergirl.S05E01.HDTV.x264-SVA[rarbg]\supergirl.s05e01.hdtv.x264-sva.nfo
C:\Users\louie\Downloads>OpenSubtitlesDownload.py --cli c:\users\louie\desktop\dummy

>> Title: "Supergirl" Event Horizon
>> Filename: Supergirl.S05E01.HDTV.x264-SVA.mkv
>> Available subtitles:
[1] "Supergirl.S05E01.720p.HDTV.x264-AVS.srt"
[2] "Supergirl.S05E01.720p.HDTV.x264-AVS-HI.srt" > "HI"
[0] Cancel search
>> Enter your choice (0-2):
emericg commented 4 years ago

Hi! Not checking files recursively was actually a feature, because if you launch it on the wrong directory you won't be able to stop the application to go through ALL of your files, at least if your are using the GUI.

Any idea on how to mitigate that?

louietyj commented 4 years ago

Hello! I'm on Windows so I'm not too sure what the GUI looks like, but if the concern is with too many files, you could set an explicit warning on the UI? On the shell we can ctrl-C so it's fine.

emericg commented 4 years ago

The explicit warning would be already too late, the first process search every folder and dispatch new instances for every file found. So that's why doing this on C: can quickly get out of control ^^

I think the best course of action would be limiting the depth of recursion to like two or three level, but the quickest course of action would probably be to limit recursion to CLI mode (because no new instances are spawned and ctrl-c is possible).

emericg commented 4 years ago

Allright I merged this but made it recurse only when using the CLI