antiboredom / videogrep

automatic video supercuts with python
https://antiboredom.github.io/videogrep
Other
3.33k stars 257 forks source link

add support for folders in videogrep --input #49

Closed fishmongr closed 2 years ago

fishmongr commented 7 years ago

This fixes support for passing a folder path to videogrep --input which the documentation says already should be supported. As an added benefit it also does a recursive search against nested folders for SRT files so you can successfully do searches against your entire library of videos no matter how they are organized.

As a small tweak it also adds the filename to the print output when using the --demo flag so when you have a lot of results you can tell which results came from where.

fishmongr commented 7 years ago

Whoops continued to pull in commits on this one. Fixed #27 and #23 and #51

DarkCeptor44 commented 4 years ago

This is from an older branch but I tried it and got this error:

$ videogrep --input folder --output test.mp4 --search "word" --search-type word
Traceback (most recent call last):
  File "c:\program files\python38\lib\runpy.py", line 184, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "c:\program files\python38\lib\runpy.py", line 154, in _get_module_details
    code = loader.get_code(mod_name)
  File "<frozen importlib._bootstrap_external>", line 916, in get_code
  File "<frozen importlib._bootstrap_external>", line 846, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "H:\Programacao\Python\videogreptest\env\lib\site-packages\videogrep\videogrep.py",
 line 199
    print "{0}:\t{2} to {3}:\t{1}".format(os.path.basename(file), line, start, end)
          ^
SyntaxError: invalid syntax
fishmongr commented 4 years ago

You have to replace “folder” with a path. I’m not at a computer to double check but you could try “./“ for the present working directory.

On Sat, Apr 11, 2020 at 11:33 AM Murilo Pagliuso notifications@github.com wrote:

This is from an older branch but I tried it and got this error:

$ videogrep --input folder --output test.mp4 --search "word" --search-type word Traceback (most recent call last): File "c:\program files\python38\lib\runpy.py", line 184, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error) File "c:\program files\python38\lib\runpy.py", line 154, in _get_module_details code = loader.get_code(mod_name) File "", line 916, in get_code File "", line 846, in source_to_code File "", line 219, in _call_with_frames_removed File "H:\Programacao\Python\videogreptest\env\lib\site-packages\videogrep\videogrep.py", line 199 print "{0}:\t{2} to {3}:\t{1}".format(os.path.basename(file), line, start, end) ^ SyntaxError: invalid syntax

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/antiboredom/videogrep/pull/49#issuecomment-612485245, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADYHLGVOT57E2DJ6RGEDLLRMCZWRANCNFSM4DWUWOHA .

DarkCeptor44 commented 4 years ago

I did use it with real folders and real files, I just replaced every argument with pseudo-stuff. The problem is your code seems to be for Python 2 and the current version is Python 3, the print should be print().

fishmongr commented 4 years ago

I did use it with real folders and real files, I just replaced every argument with pseudo-stuff. The problem is your code seems to be for Python 2 and the current version is Python 3, the print should be print().

ah right, that would be it!