1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-25 17:17:12 +00:00

Fixed episodes or movies importation skipped when Sonarr/Radarr improperly report that media file size is null.

This commit is contained in:
morpheus65535 2022-07-27 22:58:26 -04:00
parent 414900c24e
commit 81e13e1eac
3 changed files with 20 additions and 3 deletions

View file

@ -1,5 +1,6 @@
# coding=utf-8
import os
import logging
from peewee import IntegrityError
@ -69,7 +70,12 @@ def update_movies(send_event=True):
if movie['hasFile'] is True:
if 'movieFile' in movie:
if movie['movieFile']['size'] > 20480:
try:
bazarr_file_size = \
os.path.getsize(path_mappings.path_replace_movie(movie['movieFile']['path']))
except OSError:
bazarr_file_size = 0
if movie['movieFile']['size'] > 20480 or bazarr_file_size > 20480:
# Add movies in radarr to current movies list
current_movies_radarr.append(str(movie['tmdbId']))

View file

@ -1,5 +1,6 @@
# coding=utf-8
import os
import logging
from peewee import IntegrityError
@ -71,7 +72,12 @@ def sync_episodes(series_id=None, send_event=True):
if 'hasFile' in episode:
if episode['hasFile'] is True:
if 'episodeFile' in episode:
if episode['episodeFile']['size'] > 20480:
try:
bazarr_file_size = \
os.path.getsize(path_mappings.path_replace(episode['episodeFile']['path']))
except OSError:
bazarr_file_size = 0
if episode['episodeFile']['size'] > 20480 or bazarr_file_size > 20480:
# Add episodes in sonarr to current episode list
current_episodes_sonarr.append(episode['id'])

View file

@ -4,6 +4,7 @@ import os
from app.database import TableShows
from sonarr.info import get_sonarr_info
from utilities.path_mappings import path_mappings
from .converter import SonarrFormatVideoCodec, SonarrFormatAudioCodec
@ -79,7 +80,11 @@ def episodeParser(episode):
if 'hasFile' in episode:
if episode['hasFile'] is True:
if 'episodeFile' in episode:
if episode['episodeFile']['size'] > 20480:
try:
bazarr_file_size = os.path.getsize(path_mappings.path_replace(episode['episodeFile']['path']))
except OSError:
bazarr_file_size = 0
if episode['episodeFile']['size'] > 20480 or bazarr_file_size > 20480:
if 'sceneName' in episode['episodeFile']:
sceneName = episode['episodeFile']['sceneName']
else: