Hellowlol / bw_plex

binge watching for plex
MIT License
366 stars 23 forks source link

[REQ] using Quote's on the path names #54

Closed Mirabis closed 6 years ago

Mirabis commented 6 years ago

Hi,

Please see below:

2018-09-15 20:27:03,482 :: bw_plex :: DEBUG :: plex.py:933 :: Failed to find ratingkey 408454 in the db
2018-09-15 20:27:03,497 :: bw_plex :: DEBUG :: plex.py:811 :: Found Family.Guy.s15e19
2018-09-15 20:27:03,497 :: bw_plex :: DEBUG :: plex.py:816 :: Download the first 10 minutes of Family.Guy.s15e19 as .wav
2018-09-15 20:27:03,497 :: bw_plex :: DEBUG :: plex.py:657 :: Checking if we can reach Family.Guy.s15e19 directly
2018-09-15 20:27:03,497 :: bw_plex :: DEBUG :: plex.py:667 :: Found \\20.0.0.5\Media\TV\Family Guy\Season 15\Family.Guy.S15E19.WEBDL-720p.AAC.2.0.x264-HEAT.mp4
2018-09-15 20:27:03,497 :: bw_plex :: DEBUG :: misc.py:351 :: calling ffmpeg with ffmpeg -i \\20.0.0.5\Media\TV\Family Guy\Season 15\Family.Guy.S15E19.WEBDL-720p.AAC.2.0.x264-HEAT.mp4 -ac 1 -ar 11025 -ss 0 -t 600 -acodec pcm_s16le c:\users\admini~1\appdata\local\temp\2\offset_ie1wyt.wav
2018-09-15 20:27:03,513 :: bw_plex :: ERROR :: plex.py:48 :: There was an exception in task
Traceback (most recent call last):
  File "c:\users\administrator\src\bw-plex\bw_plex\plex.py", line 43, in inner
    return func(*args)
  File "c:\users\administrator\src\bw-plex\bw_plex\plex.py", line 818, in task
    trim=CONFIG['tv'].get('check_for_theme_sec', 600))
  File "c:\users\administrator\src\bw-plex\bw_plex\misc.py", line 353, in convert_and_trim
    psox = subprocess.Popen(cmd, stderr=subprocess.PIPE)
  File "c:\python27\lib\subprocess.py", line 394, in __init__
    errread, errwrite)
  File "c:\python27\lib\subprocess.py", line 644, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

ffmpeg is in my path, so decided to run the command myself and received:

\\20.0.0.5\Media\TV\Family: No such file or directory

Family[space]Guy seems to break the script as it is not using quote's for the path. Quickly browsing through the misc.py it seems we need to add quotes around [afile].

Hellowlol commented 6 years ago

Thanks :)

Mirabis commented 6 years ago

After updating the code to use quote's I got the following:

2018-09-15 20:50:40,785 :: bw_plex :: DEBUG :: plex.py:811 :: Found Humans.s03e05
2018-09-15 20:50:40,785 :: bw_plex :: DEBUG :: plex.py:816 :: Download the first 10 minutes of Humans.s03e05 as .wav
2018-09-15 20:50:40,785 :: bw_plex :: DEBUG :: plex.py:657 :: Checking if we can reach Humans.s03e05 directly
2018-09-15 20:50:40,785 :: bw_plex :: DEBUG :: plex.py:667 :: Found \\20.0.0.5\Media\TV\Humans\Season 03\Humans.S03E05.WEBDL-720p.AAC.2.0.h264-KiNGS.mp4
2018-09-15 20:50:40,785 :: bw_plex :: DEBUG :: misc.py:352 :: calling ffmpeg with ffmpeg -i "\\20.0.0.5\Media\TV\Humans\Season 03\Humans.S03E05.WEBDL-720p.AAC.2.0.h264-KiNGS.mp4" -ac 1 -ar 11025 -ss 0 -t 600 -acodec pcm_s16le c:\users\admini~1\appdata\local\temp\2\offset_ej1ngo.wav
2018-09-15 20:50:40,973 :: bw_plex :: ERROR :: misc.py:358 :: ffmpeg version N-91247-g648361c2fa Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.0 (Rev2, Built by MSYS2 project)
  configuration:  --disable-autodetect --enable-amf --enable-bzlib --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-iconv --enable-lzma --enable-nvenc --enable-zlib --enable-sdl2 --disable-debug --enable-ffnvcodec --enable-nvdec --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libx264 --enable-libx265 --enable-fontconfig --enable-libass --enable-libbluray --enable-libfreetype --enable-libmfx --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libwavpack --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libshine --enable-gpl --enable-avisynth --enable-libxvid --enable-libaom --enable-version3 --enable-chromaprint --enable-decklink --enable-frei0r --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libfdk-aac --enable-libflite --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libkvazaar --enable-libmodplug --enable-libopenh264 --enable-libopenmpt --enable-librtmp --enable-librubberband --enable-libssh --enable-libtesseract --enable-libxavs --enable-libzmq --enable-libzvbi --enable-opengl --enable-libvmaf --enable-libcodec2 --enable-libsrt --enable-ladspa --enable-openssl --extra-cflags=-fopenmp --extra-libs=-lgomp --extra-cflags=-DLIBTWOLAME_STATIC --extra-libs=-lstdc++ --extra-cflags=-DLIBSSH_STATIC --extra-ldflags='-Wl,--allow-multiple-definition' --extra-cflags=-DCACA_STATIC --extra-cflags=-DMODPLUG_STATIC --extra-cflags=-DCHROMAPRINT_NODLL --extra-libs=-lstdc++ --extra-cflags=-DZMQ_STATIC --extra-libs=-lpsapi --extra-cflags=-DLIBXML_STATIC --disable-w32threads --extra-cflags=-DKVZ_STATIC_LIB --enable-nonfree
  libavutil      56. 18.102 / 56. 18.102
  libavcodec     58. 19.105 / 58. 19.105
  libavformat    58. 17.100 / 58. 17.100
  libavdevice    58.  4.100 / 58.  4.100
  libavfilter     7. 25.100 /  7. 25.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
"\\20.0.0.5\Media\TV\Humans\Season 03\Humans.S03E05.WEBDL-720p.AAC.2.0.h264-KiNGS.mp4": Invalid argument
None
2018-09-15 20:50:40,973 :: bw_plex :: ERROR :: plex.py:48 :: There was an exception in task
Traceback (most recent call last):
  File "c:\users\administrator\src\bw-plex\bw_plex\plex.py", line 43, in inner
    return func(*args)
  File "c:\users\administrator\src\bw-plex\bw_plex\plex.py", line 818, in task
    trim=CONFIG['tv'].get('check_for_theme_sec', 600))
  File "c:\users\administrator\src\bw-plex\bw_plex\misc.py", line 359, in convert_and_trim
    raise Exception("FFMpeg failed")
Exception: FFMpeg failed

Not exactly sure why.. running with debug mode on. Manually running the command it says it ran, has no issues and correctly finishes the ffmpeg process.

Hellowlol commented 6 years ago

Seems ffmpeg complains about a invalid argument.

Hellowlol commented 6 years ago

@Mirabis This should be fixed with the latest commit.