antiboredom / videogrep

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

No subtitle files were found! #60

Closed raj6996 closed 2 years ago

raj6996 commented 6 years ago

C:\Python37>python C:\Python37\myvideogrep.py -i "C:\A" --search "Not you" -o "C:\test.mp4"python C:\Python37\myvideogrep.py -i "C:\A" --search "Not you" -o "C:\test.mp4" usage: myvideogrep.py [-h] --input [INPUTFILE [INPUTFILE ...]] [--search SEARCH] [--search-type {re,pos,hyper,fragment,franken,word}] [--use-transcript] [--use-vtt] [--max-clips MAXCLIPS] [--output OUTPUTFILE] [--export-clips] [--demo] [--randomize] [--youtube YOUTUBE] [--padding PADDING] [--resyncsubs SYNC] [--transcribe] [--ngrams NGRAMS] myvideogrep.py: error: unrecognized arguments: C:\Python37\myvideogrep.py

C:\Python37>python C:\Python37\myvideogrep.py -i "G:\I" -s "All" -st word -o test.mp4 [!] No subtitle files were found. Traceback (most recent call last): File "C:\Python37\myvideogrep.py", line 3, in videogrep.main() File "C:\Python37\lib\site-packages\videogrep\videogrep.py", line 528, in main videogrep(args.inputfile, args.outputfile, args.search, args.searchtype, args.maxclips, args.padding, args.demo, args.randomize, args.sync, args.use_transcript, args.use_vtt, args.export_clips) File "C:\Python37\lib\site-packages\videogrep\videogrep.py", line 456, in videogrep composition = compose_from_srts(srts, search, searchtype) File "C:\Python37\lib\site-packages\videogrep\videogrep.py", line 317, in compose_from_srts for srt in srts: TypeError: 'bool' object is not iterable

After long time fixing #57, I got this new error like this>

48

will any Windows Users fix this issue, it will be helpful for me. thanks.

denny64 commented 5 years ago

@raj6996 any luck on this?

raj6996 commented 5 years ago

No man...

livinglife2x commented 5 years ago

videogrep.py line 278 to 287

`for f in inputfile:
        filename = f.split('.')
        filename[-1] = 'srt'
        srt = '.'.join(filename)
        if os.path.isfile(srt):
            srts.append(srt)

    if len(srts) == 0:
        print("[!] No subtitle files were found.")
        return False

splitting by '.' change it to '/' or modify the above function to fetch sub titles automatically from the folder.

inimaz commented 4 years ago

I had the same issue. This mostly comes when there are "." in the name of the file. An ugly workaround might be to always have the video and subtitle files at the source directory.

What I do is to change the working directory

MAIN_DIRECTORY = os.getcwd() #Save main directory

os.chdir(RESOURCES_DIRECTORY ) #Change directory

# YOUR CODE

os.chdir(MAIN_DIRECTORY) # Change back to main directory

Once the PR above is merged, you will not need this and you can use right away filenames like "./resources/my_filename.mp4"

antiboredom commented 2 years ago

this should now be fixed in the new beta