ratoaq2 / knowit

Know better your media files
MIT License
29 stars 5 forks source link

Failure to download some of the episodes and series #44

Open Aissasa opened 2 years ago

Aissasa commented 2 years ago

Greetings, so I'm new to the whole arr suite of apps, and after struggling with some issues that were caused by my setup (Nvidia shield running a plex media server on a network shared drive), and fixing them by not running Sonarr, Radarr and Bazarr as services (I stopped the service for bazarr and now launch the py script instead using a bat file and it works fine), and that allowed me to access my network shared drives, however, I noticed that it fails in some cases. I could be mistaken, but most of the episodes and the series it fails to download subs for are titles that have some characters like apostrophe, columns, interrogation points etc. or the it could be that the path is a bit too long, does anyone know what could cause this issue?

Here's a snippet of some of the cases it fails on:

+-------------------------------------------------------+
|      Please report any bug or feature request at      |
|       https://github.com/ratoaq2/knowit/issues.       |
+-------------------------------------------------------+) trying to get video information for this file: \\192.168.1.92\Storage1\Media\Anime\Series\KonoSuba – God's blessing on this wonderful world!! (2016) [tvdb-303867]\Season 01\KonoSuba – God's blessing on this wonderful world!! (2016) - S01E09 - 009 - Gods Blessing on This Wonderful Shop! [HDTV-1080p][10bit][x265][AAC 2.0][EN+JA].mkv
2022-08-31 00:53:40,496 - root                             (4a28) :  ERROR (utils:53) - BAZARR Error (+-------------------------------------------------------+
|                     KnowIt 0.4.0                      |
+-------------------------------------------------------+
|                      pymediainfo                      |
|                                                       |
|                                                       |
|         C:\Extra Tools\FFmpeg\bin\ffprobe.EXE         |
|  v2022-05-26-git-0dcbe1c1aa-full_build-www.gyan.dev   |
|                                                       |
|                                                       |
|                        enzyme                         |
|                         0.4.1                         |
+-------------------------------------------------------+
|                   provider: ffmpeg                    |
|     ffmpeg: C:\Extra Tools\FFmpeg\bin\ffprobe.EXE     |
|                   profile: default                    |
+-------------------------------------------------------+
Traceback (most recent call last):
  File "c:\programdata\bazarr\bazarr\../libs\knowit\api.py", line 59, in know
    result = provider.describe(video_path, context)
  File "c:\programdata\bazarr\bazarr\../libs\knowit\providers\ffmpeg.py", line 218, in describe
    data = self.executor.extract_info(video_path)
  File "c:\programdata\bazarr\bazarr\../libs\knowit\providers\ffmpeg.py", line 79, in extract_info
    json_dump = self._execute(filename)
  File "c:\programdata\bazarr\bazarr\../libs\knowit\providers\ffmpeg.py", line 113, in _execute
    return check_output([self.location, '-v', 'quiet', '-print_format', 'json',
  File "C:\Users\Aissa\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:\Users\Aissa\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['C:\\Extra Tools\\FFmpeg\\bin\\ffprobe.EXE', '-v', 'quiet', '-print_format', 'json', '-show_format', '-show_streams', '-sexagesimal', "\\\\192.168.1.92\\Storage1\\Media\\Anime\\Series\\KonoSuba – God's blessing on this wonderful world!! (2016) [tvdb-303867]\\Season 02\\KonoSuba – God's blessing on this wonderful world!! (2016) - S02E10 - 020 - Gods Blessing on This Wonderful Party! [HDTV-1080p][10bit][x265][AAC 2.0][EN+JA].mkv"]' returned non-zero exit status 1.

+-------------------------------------------------------+
|      Please report any bug or feature request at      |
|       https://github.com/ratoaq2/knowit/issues.       |
+-------------------------------------------------------+) trying to get video information for this file: \\192.168.1.92\Storage1\Media\Anime\Series\My Teen Romantic Comedy SNAFU (2013) [tvdb-267435]\Season 01\My Teen Romantic Comedy SNAFU (2013) - S01E10 - 010 - The Distance Between Them Remains Unchanged as the Festival is Becoming a Carnival [HDTV-1080p][10bit][x265][AAC 2.0][EN+JA].mkv
2022-08-31 00:52:48,460 - root                             (4a28) :  ERROR (utils:53) - BAZARR Error (+-------------------------------------------------------+
|                     KnowIt 0.4.0                      |
+-------------------------------------------------------+
|                      pymediainfo                      |
|                                                       |
|                                                       |
|         C:\Extra Tools\FFmpeg\bin\ffprobe.EXE         |
|  v2022-05-26-git-0dcbe1c1aa-full_build-www.gyan.dev   |
|                                                       |
|                                                       |
|                        enzyme                         |
|                         0.4.1                         |
+-------------------------------------------------------+
|                   provider: ffmpeg                    |
|     ffmpeg: C:\Extra Tools\FFmpeg\bin\ffprobe.EXE     |
|                   profile: default                    |
+-------------------------------------------------------+
Traceback (most recent call last):
  File "c:\programdata\bazarr\bazarr\../libs\knowit\api.py", line 59, in know
    result = provider.describe(video_path, context)
  File "c:\programdata\bazarr\bazarr\../libs\knowit\providers\ffmpeg.py", line 218, in describe
    data = self.executor.extract_info(video_path)
  File "c:\programdata\bazarr\bazarr\../libs\knowit\providers\ffmpeg.py", line 79, in extract_info
    json_dump = self._execute(filename)
  File "c:\programdata\bazarr\bazarr\../libs\knowit\providers\ffmpeg.py", line 113, in _execute
    return check_output([self.location, '-v', 'quiet', '-print_format', 'json',
  File "C:\Users\Aissa\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:\Users\Aissa\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['C:\\Extra Tools\\FFmpeg\\bin\\ffprobe.EXE', '-v', 'quiet', '-print_format', 'json', '-show_format', '-show_streams', '-sexagesimal', '\\\\192.168.1.92\\Storage1\\Media\\Anime\\Series\\My Teen Romantic Comedy SNAFU (2013) [tvdb-267435]\\Season 01\\My Teen Romantic Comedy SNAFU (2013) - S01E11 - 011 - And So the Curtain on Each Stage Rises and the Festival is Festivaling Its Very Best [HDTV-1080p][10bit][x265][AAC 2.0][EN+JA].mkv']' returned non-zero exit status 1.
blackthroat commented 2 years ago

I'm seeing this in my bazarr logs as well.

+-------------------------------------------------------+
|      Please report any bug or feature request at      |
|       https://github.com/ratoaq2/knowit/issues.       |
+-------------------------------------------------------+) trying to get video information for this file: /tv/The Whitest Kids U Know/Season 3/The Whitest Kids U'Know - S03E18 - Edge of Space, Daddy with a Donkey, T-Shirt, The Hippo Song SDTV.avi
2022-09-05 10:07:03,221 - root                             (7f35e9e11b38) :  INFO (series:148) - BAZARR Finished searching for missing Series Subtitles. Check History for more information.
2022-09-05 10:34:55,783 - root                             (7f35ea017b38) :  INFO (upgrade:257) - BAZARR Finished searching for Subtitles to upgrade. Check History for more information.
2022-09-05 12:05:42,860 - root                             (7f35ea21db38) :  ERROR (signalr_client:215) - BAZARR SignalR client for Radarr connection as been lost. Trying to reconnect...
2022-09-05 12:06:01,382 - root                             (7f35d8921b38) :  INFO (signalr_client:196) - BAZARR SignalR client for Radarr is connected and waiting for events.
2022-09-05 12:34:44,275 - root                             (7f35ea017b38) :  INFO (movies:135) - BAZARR Finished searching for missing Movies Subtitles. Check History for more information.
2022-09-05 13:07:04,808 - root                             (7f35ea017b38) :  ERROR (utils:53) - BAZARR Error (+-------------------------------------------------------+
|                     KnowIt 0.4.0                      |
+-------------------------------------------------------+
|                      pymediainfo                      |
|                                                       |
|                                                       |
|                   /usr/bin/ffprobe                    |
|                        v4.4.1                         |
|                                                       |
|                                                       |
|                        enzyme                         |
|                         0.4.1                         |
+-------------------------------------------------------+
|                   provider: ffmpeg                    |
|               ffmpeg: /usr/bin/ffprobe                |
|                   profile: default                    |
+-------------------------------------------------------+
Traceback (most recent call last):
  File "/app/bazarr/bin/bazarr/../libs/knowit/api.py", line 59, in know
    result = provider.describe(video_path, context)
  File "/app/bazarr/bin/bazarr/../libs/knowit/providers/ffmpeg.py", line 218, in describe
    data = self.executor.extract_info(video_path)
  File "/app/bazarr/bin/bazarr/../libs/knowit/providers/ffmpeg.py", line 79, in extract_info
    json_dump = self._execute(filename)
  File "/app/bazarr/bin/bazarr/../libs/knowit/providers/ffmpeg.py", line 113, in _execute
    return check_output([self.location, '-v', 'quiet', '-print_format', 'json',
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/ffprobe', '-v', 'quiet', '-print_format', 'json', '-show_format', '-show_streams', '-sexagesimal', "/tv/The Whitest Kids U Know/Season 3/The Whitest Kids U'Know - S03E18 - Edge of Space, Daddy with a Donkey, T-Shirt, The Hippo Song SDTV.avi"]' returned non-zero exit status 1.
0xN0BADC0FF33 commented 1 year ago

@Aissasa: I think it's exceeding the 256 characters limit

@blackthroat:

You have ' in your file name, that can cause this kind of error

Alistair1231 commented 1 year ago

What could this be about?

26/10/2022 21:03:47|INFO    |root                            |BAZARR Log file emptied|
26/10/2022 21:03:57|ERROR   |root                            |BAZARR error when trying to analyze this .mkv file: /storage/downloads/qbittorrent/_Plex/TV/Better Call Saul/S04/Better.Call.Saul.S04E01.Smoke.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.mkv|'Traceback (most recent call last):
  File "/app/bazarr/bin/bazarr/../libs/knowit/api.py", line 59, in know
    result = provider.describe(video_path, context)
  File "/app/bazarr/bin/bazarr/../libs/knowit/providers/ffmpeg.py", line 218, in describe
    data = self.executor.extract_info(video_path)
  File "/app/bazarr/bin/bazarr/../libs/knowit/providers/ffmpeg.py", line 79, in extract_info
    json_dump = self._execute(filename)
  File "/app/bazarr/bin/bazarr/../libs/knowit/providers/ffmpeg.py", line 113, in _execute
    return check_output([self.location, \'-v\', \'quiet\', \'-print_format\', \'json\',
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command \'[\'/usr/bin/ffprobe\', \'-v\', \'quiet\', \'-print_format\', \'json\', \'-show_format\', \'-show_streams\', \'-sexagesimal\', \'/storage/downloads/qbittorrent/_Plex/TV/Better Call Saul/S04/Better.Call.Saul.S04E01.Smoke.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.mkv\']\' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/bazarr/bin/bazarr/subtitles/indexer/series.py", line 37, in store_subtitles
    subtitle_languages = embedded_subs_reader(reversed_path,
  File "/app/bazarr/bin/bazarr/subtitles/tools/embedded_subs_reader.py", line 28, in embedded_subs_reader
    data = parse_video_metadata(file, file_size, episode_file_id, movie_file_id, use_cache=use_cache)
  File "/app/bazarr/bin/bazarr/subtitles/tools/embedded_subs_reader.py", line 109, in parse_video_metadata
    data["ffprobe"] = know(video_path=file, context={"provider": "ffmpeg", "ffmpeg": ffprobe_path})
  File "/app/bazarr/bin/bazarr/../libs/knowit/api.py", line 65, in know
    raise KnowitException(debug_info(context=context, exc_info=True))
knowit.api.KnowitException: +-------------------------------------------------------+
|                     KnowIt 0.4.0                      |
+-------------------------------------------------------+
|                      pymediainfo                      |
|                                                       |
|                                                       |
|                   /usr/bin/ffprobe                    |
|                        v4.4.1                         |
|                                                       |
|                                                       |
|                        enzyme                         |
|                         0.4.1                         |
+-------------------------------------------------------+
|                   provider: ffmpeg                    |
|               ffmpeg: /usr/bin/ffprobe                |
|                   profile: default                    |
+-------------------------------------------------------+
Traceback (most recent call last):
  File "/app/bazarr/bin/bazarr/../libs/knowit/api.py", line 59, in know
    result = provider.describe(video_path, context)
  File "/app/bazarr/bin/bazarr/../libs/knowit/providers/ffmpeg.py", line 218, in describe
    data = self.executor.extract_info(video_path)
  File "/app/bazarr/bin/bazarr/../libs/knowit/providers/ffmpeg.py", line 79, in extract_info
    json_dump = self._execute(filename)
  File "/app/bazarr/bin/bazarr/../libs/knowit/providers/ffmpeg.py", line 113, in _execute
    return check_output([self.location, \'-v\', \'quiet\', \'-print_format\', \'json\',
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command \'[\'/usr/bin/ffprobe\', \'-v\', \'quiet\', \'-print_format\', \'json\', \'-show_format\', \'-show_streams\', \'-sexagesimal\', \'/storage/downloads/qbittorrent/_Plex/TV/Better Call Saul/S04/Better.Call.Saul.S04E01.Smoke.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.mkv\']\' returned non-zero exit status 1.

+-------------------------------------------------------+
|      Please report any bug or feature request at      |
|       https://github.com/ratoaq2/knowit/issues.       |
+-------------------------------------------------------+'|

Of note, it's not an issue with the other files in the folder:

/storage/downloads/qbittorrent/_Plex/TV/Better Call Saul/ ll S04
total 5.4G
-rw-r--r-- 1 upoodsboady upoodsboady 518M Sep 13 22:42  Better.Call.Saul.S04E01.Smoke.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.mkv
-rw-r--r-- 1 upoodsboady upoodsboady 538M Sep 13 22:41  Better.Call.Saul.S04E02.Breathe.INTERNAL.1080p.10bit.WEBRip.6CH.x265.HEVC-PSA.mkv
-rw-r--r-- 1 upoodsboady upoodsboady  34K Oct 25 22:00  Better.Call.Saul.S04E02.Breathe.INTERNAL.1080p.10bit.WEBRip.6CH.x265.HEVC-PSA.nl.srt
-rw-r--r-- 1 upoodsboady upoodsboady 633M Sep 13 22:41  Better.Call.Saul.S04E03.Something.Beautiful.INTERNAL.1080p.10bit.WEBRip.6CH.x265.HEVC-PSA.mkv
-rw-r--r-- 1 upoodsboady upoodsboady  27K Oct 25 22:01  Better.Call.Saul.S04E03.Something.Beautiful.INTERNAL.1080p.10bit.WEBRip.6CH.x265.HEVC-PSA.nl.srt
-rw-r--r-- 1 upoodsboady upoodsboady 478M Sep 13 22:42  Better.Call.Saul.S04E04.Talk.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.mkv
-rw-r--r-- 1 upoodsboady upoodsboady  28K Oct 25 22:03  Better.Call.Saul.S04E04.Talk.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.nl.srt
-rw-r--r-- 1 upoodsboady upoodsboady 594M Sep 13 22:42  Better.Call.Saul.S04E05.Quite.a.Ride.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.mkv
-rw-r--r-- 1 upoodsboady upoodsboady  31K Oct 25 22:05  Better.Call.Saul.S04E05.Quite.a.Ride.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.nl.srt
-rw-r--r-- 1 upoodsboady upoodsboady 444M Sep 13 22:41 'Better.Call.Saul.S04E06.Pi'$'\303\261''ata.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.mkv'
-rw-r--r-- 1 upoodsboady upoodsboady  38K Oct 25 22:07 'Better.Call.Saul.S04E06.Pi'$'\303\261''ata.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.nl.srt'
-rw-r--r-- 1 upoodsboady upoodsboady 516M Sep 13 22:41  Better.Call.Saul.S04E07.Something.Stupid.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.mkv
-rw-r--r-- 1 upoodsboady upoodsboady  30K Oct 25 22:07  Better.Call.Saul.S04E07.Something.Stupid.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.nl.srt
-rw-r--r-- 1 upoodsboady upoodsboady 567M Sep 13 22:41  Better.Call.Saul.S04E08.Coushatta.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.mkv
-rw-r--r-- 1 upoodsboady upoodsboady  40K Oct 25 22:07  Better.Call.Saul.S04E08.Coushatta.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.nl.srt
-rw-r--r-- 1 upoodsboady upoodsboady 527M Sep 13 22:42  Better.Call.Saul.S04E09.Wiedersehen.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.mkv
-rw-r--r-- 1 upoodsboady upoodsboady  42K Oct 25 22:08  Better.Call.Saul.S04E09.Wiedersehen.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.nl.srt
-rw-r--r-- 1 upoodsboady upoodsboady 715M Sep 13 22:42  Better.Call.Saul.S04E10.Winner.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.mkv
-rw-r--r-- 1 upoodsboady upoodsboady  50K Oct 25 22:10  Better.Call.Saul.S04E10.Winner.1080p.10bit.WEBRi.6CH.x265.HEVC-PSA.nl.srt
ratoaq2 commented 1 year ago

Underneath, knowit is calling ffprobe (or mediainfo, or mkvmerge). If there's an issue with the media file (e.g.: out of spec or corruption), it's possible that ffprobe will exit with error.

In cases like this you should try to run ffprobe against that file directly to verify if that's the case.

Kcchouette commented 1 year ago

@ratoaq2 Maybe instead of doing a return subprocess.check_output("").decode() you should do:

ret = subprocess.run("", capture_output=True)
if(ret.returncode ==0) {
  return ret.stduout.decode()
}