kelciour / playphrase

Search and play phrases from movies and audiobooks
173 stars 26 forks source link

PlayPhrase returns None #9

Closed kelciour closed 4 years ago

kelciour commented 4 years ago

D:\Movies\English\playphrase>playphrase -i "D:\Movies\English\E_H_2020.mkv" -v -s "Grandpa" None

Originally posted by @raj6996 in https://github.com/kelciour/playphrase/issues/6#issuecomment-703132850

kelciour commented 4 years ago

@raj6996 what the output of playphrase -i "D:\Movies\English\E_H_2020.mkv" _init_? And take a look at "D:\Movies\English\". The script should be able to find "E_H_2020.srt" and write a new file, E_H_2020.txt, that will be used to search for phrases.

kelciour commented 4 years ago

@raj6996 Ignore the previous comment. Try this one at first,

playphrase -i "D:\Movies\English\" _init_

and then

playphrase -i "D:\Movies\English\" -v -s "Grandpa"

raj6996 commented 4 years ago
D:\Movies\English\playphrase>playphrase -i "D:\Movies\English\" _init_
Usage: playphrase -i <media_dir> <phrase>

Init: playphrase -i <media_dir> _init_

Additional options:
-ph, --phrases GAP_BETWEEN_PHRASES   move start time of the clip to the beginning of the current phrase. Value is optional (default=1.25 seconds)
-l, --limit        maximum duration of the phrase (default=60 seconds)
-p, --padding      padding in seconds to add to the start and end of each clip (default=0.0 seconds)
-e, --ending       play only matching lines (or phrases)
-r, --randomize    randomize the clips
-o, --output       name of the file in which output  of 'grep' command will be written
-d, --demo         only show grep results
-a, --audio        create audio fragments
-v, --video        create video fragments
-vs, --video-sub   create video fragments with hardcoded subtitles
-s, --subtitles    create subtitles for fragments
-m, --mpv-options OPTIONS   mpv player options

D:\Movies\English\playphrase>playphrase -i "D:\Movies\English\E_H_2020.mkv" -v -s "Grandpa"
None

D:\Movies\English\playphrase>

no file create E_H_2020.txt
but I used bat script it works to make this txt file. something really strange for me.

Phrase: _init_
D:\Movies\English\E_H_20.srt
Phrase: grandpa
WARNING: number of '.srt' and '.txt' files doesn't match. Maybe you need to use 'playphrase <media_dir> _init_'.
Number of clips: 1
Phrase:
kelciour commented 4 years ago

I'm not sure what happened, but init should be wrapped with underscores, i.e. it should be _init_, not just init, e.g. playphrase -i "D:\Movies\English" _init_

And the srt file and the video file should have the exact same name.

kelciour commented 4 years ago

Ah, okay, this is just the markdown syntax, though it's strange that it didn't work and you see usage instructions instead of something else, at least it should output D:\Movies\English\E_H_20.srt

kelciour commented 4 years ago

If you have a folder "D:\Movies\English" with the following files,

at first, run playphrase -i "D:\Movies\English" _init_ and it should output srt filenames that were converted to txt,

D:\Movies\English\E_H_2020.srt

and the folder will look something like this,

After that, playphrase -i "D:\Movies\English" grandpa should work and the script will try to find grandpa in E_H_2020.txt.

raj6996 commented 4 years ago

actually it github issue, _ change to italic. I edited with quoted on previous post. I also put subcut lua script. Here is screenshot. https://imgur.com/ZFSUPO7

kelciour commented 4 years ago

Thank you. Please remove the last \ from the path to the media folder, i.e. try playphrase -i "D:\Movies\English" _init_

raj6996 commented 4 years ago

Though it created TXT file, but same issue happened. None?

kelciour commented 4 years ago

It looks like grep command doesn't work for some reason. Though it's strange that it works from the bat file. I'll update the code and get back to you.

kelciour commented 4 years ago

I've uploaded a new release and it should be fixed now - https://github.com/kelciour/playphrase/releases/tag/v1.2.4