kelciour/playphrase

it's not working on MacOs

ngoanle opened this issue · 2 comments

ngoanle@ngoans-MacBook-Pro playphrase-master % python3.9 playphrase.py -i /Users/ngoanle/Documents/english init
/Users/ngoanle/Documents/english/2 Fast 2 Furious.srt
/Users/ngoanle/Documents/english/All the Devil's Men.srt
ngoanle@ngoans-MacBook-Pro playphrase-master % python3.9 playphrase.py -i /Users/ngoanle/Documents/english go home
Usage: playphrase -i <media_dir>

Init: playphrase -i <media_dir> init

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

ngoanle@ngoans-MacBook-Pro playphrase-master % python3.9 playphrase.py -i /Users/ngoanle/Documents/english go
grep: invalid option -- z
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]

ngoanle@ngoans-MacBook-Pro playphrase-master % ./videogrep.sh
Phrase: time
Number of clips: 24
Traceback (most recent call last):
File "/Users/ngoanle/Documents/playphrase-master/playphrase.py", line 594, in
main(args["media_dir"], args["search_phrase"], args["phrase_mode"], args["phrases_gap"], args["padding"], args["limit"], args["output_dir"], args["grep_file"], args["ending_mode"], args["randomize_mode"], args["demo_mode"], args["mpv_options"], args["audio_mode"], args["video_mode"], args["video_with_sub_mode"], args["subtitles_mode"])
File "/Users/ngoanle/Documents/playphrase-master/playphrase.py", line 413, in main
play_clips(clips, ending_mode, mpv_options)
File "/Users/ngoanle/Documents/playphrase-master/playphrase.py", line 241, in play_clips
p = subprocess.check_call(cmd) # start mpv player in idle mode
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['mpv', '--idle=once', '--no-terminal', '--force-window=no', '--input-file=mpv-pipe']' returned non-zero exit status 1.
Phrase:

Could you please help me? Thank you

Thank you.

The first issue, I guess, can be temporarily fixed by using double quotes, i.e. python playphrase.py -i ... "go home"

But at the moment there's no fix for the second issue. The script is no longer working with mpv 0.33 since input-file option was removed and support for input-ipc-server to make it work again is yet to be added.

For now, it might work after installing mpv 0.32 maybe with brew cask install https://raw.githubusercontent.com/Homebrew/homebrew-cask/d784d8c5cd205ff746c1108ecf638c2fbfb8b00e/Casks/mpv.rb

after I reinstall mpv 0.32 with brew cask install https://raw.githubusercontent.com/Homebrew/homebrew-cask/d784d8c5cd205ff746c1108ecf638c2fbfb8b00e/Casks/mpv.rb

It still has some problems:

ngoanle@ngoans-MacBook-Pro ~ % cd /Users/ngoanle/Documents/playphrase-master
ngoanle@ngoans-MacBook-Pro playphrase-master % ./videogrep.sh
Phrase: init
/Users/ngoanle/Documents/english/2 Fast 2 Furious.srt
/Users/ngoanle/Documents/english/All the Devil's Men.srt
Phrase: home
Number of clips: 38
2020-12-13 22:05:47.728 mpv[35270:692470] This NSLayoutConstraint is being configured with a constant that exceeds internal limits. A smaller value will be substituted, but this problem should be fixed. Break on BOOL _NSLayoutConstraintNumberExceedsLimit(void) to debug. This will be logged only once. This may break in the future.
2020-12-13 22:05:47.734 mpv[35270:692470] Warning: Expected min height of view: (<NSButton: 0x7fccccd9e4c0>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.
2020-12-13 22:05:47.734 mpv[35270:692470] Warning: Expected min height of view: (<NSButton: 0x7fccccdb39c0>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.
2020-12-13 22:05:47.734 mpv[35270:692470] Warning: Expected min height of view: (<NSButton: 0x7fccccdb67a0>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.