mirror of
https://github.com/morpheus65535/bazarr
synced 2025-02-22 22:10:42 +00:00
Merge branch 'development' of https://github.com/morpheus65535/bazarr into halali
This commit is contained in:
commit
f78c04ba17
1 changed files with 36 additions and 33 deletions
|
@ -50,41 +50,44 @@ def update_movies():
|
||||||
for movie in r.json():
|
for movie in r.json():
|
||||||
if movie['hasFile'] is True:
|
if movie['hasFile'] is True:
|
||||||
if 'movieFile' in movie:
|
if 'movieFile' in movie:
|
||||||
try:
|
if movie['movieFile']['relativePath'] is not None:
|
||||||
overview = unicode(movie['overview'])
|
try:
|
||||||
except:
|
overview = unicode(movie['overview'])
|
||||||
overview = ""
|
except:
|
||||||
try:
|
overview = ""
|
||||||
poster_big = movie['images'][0]['url']
|
try:
|
||||||
poster = os.path.splitext(poster_big)[0] + '-500' + os.path.splitext(poster_big)[1]
|
poster_big = movie['images'][0]['url']
|
||||||
except:
|
poster = os.path.splitext(poster_big)[0] + '-500' + os.path.splitext(poster_big)[1]
|
||||||
poster = ""
|
except:
|
||||||
try:
|
poster = ""
|
||||||
fanart = movie['images'][1]['url']
|
try:
|
||||||
except:
|
fanart = movie['images'][1]['url']
|
||||||
fanart = ""
|
except:
|
||||||
|
fanart = ""
|
||||||
|
|
||||||
if 'sceneName' in movie['movieFile']:
|
if 'sceneName' in movie['movieFile']:
|
||||||
sceneName = movie['movieFile']['sceneName']
|
sceneName = movie['movieFile']['sceneName']
|
||||||
else:
|
|
||||||
sceneName = None
|
|
||||||
|
|
||||||
# Add movies in radarr to current movies list
|
|
||||||
current_movies_radarr.append(unicode(movie['tmdbId']))
|
|
||||||
|
|
||||||
# Detect file separator
|
|
||||||
if movie['path'][0] == "/":
|
|
||||||
separator = "/"
|
|
||||||
else:
|
|
||||||
separator = "\\"
|
|
||||||
|
|
||||||
if unicode(movie['tmdbId']) in current_movies_db_list:
|
|
||||||
movies_to_update.append((movie["title"],movie["path"] + separator + movie['movieFile']['relativePath'],movie["tmdbId"],movie["id"],overview,poster,fanart,profile_id_to_language(movie['qualityProfileId']),sceneName,unicode(bool(movie['monitored'])),movie["tmdbId"]))
|
|
||||||
else:
|
|
||||||
if movie_default_enabled is True:
|
|
||||||
movies_to_add.append((movie["title"], movie["path"] + separator + movie['movieFile']['relativePath'], movie["tmdbId"], movie_default_language, '[]', movie_default_hi, movie["id"], overview, poster, fanart, profile_id_to_language(movie['qualityProfileId']), sceneName, unicode(bool(movie['monitored']))))
|
|
||||||
else:
|
else:
|
||||||
movies_to_add.append((movie["title"], movie["path"] + separator + movie['movieFile']['relativePath'], movie["tmdbId"], movie["tmdbId"], movie["tmdbId"], movie["id"], overview, poster, fanart, profile_id_to_language(movie['qualityProfileId']), sceneName, unicode(bool(movie['monitored']))))
|
sceneName = None
|
||||||
|
|
||||||
|
# Add movies in radarr to current movies list
|
||||||
|
current_movies_radarr.append(unicode(movie['tmdbId']))
|
||||||
|
|
||||||
|
# Detect file separator
|
||||||
|
if movie['path'][0] == "/":
|
||||||
|
separator = "/"
|
||||||
|
else:
|
||||||
|
separator = "\\"
|
||||||
|
|
||||||
|
if unicode(movie['tmdbId']) in current_movies_db_list:
|
||||||
|
movies_to_update.append((movie["title"],movie["path"] + separator + movie['movieFile']['relativePath'],movie["tmdbId"],movie["id"],overview,poster,fanart,profile_id_to_language(movie['qualityProfileId']),sceneName,unicode(bool(movie['monitored'])),movie["tmdbId"]))
|
||||||
|
else:
|
||||||
|
if movie_default_enabled is True:
|
||||||
|
movies_to_add.append((movie["title"], movie["path"] + separator + movie['movieFile']['relativePath'], movie["tmdbId"], movie_default_language, '[]', movie_default_hi, movie["id"], overview, poster, fanart, profile_id_to_language(movie['qualityProfileId']), sceneName, unicode(bool(movie['monitored']))))
|
||||||
|
else:
|
||||||
|
movies_to_add.append((movie["title"], movie["path"] + separator + movie['movieFile']['relativePath'], movie["tmdbId"], movie["tmdbId"], movie["tmdbId"], movie["id"], overview, poster, fanart, profile_id_to_language(movie['qualityProfileId']), sceneName, unicode(bool(movie['monitored']))))
|
||||||
|
else:
|
||||||
|
logging.error('BAZARR Radarr returned a movie without a file path: ' + movie["path"] + separator + movie['movieFile']['relativePath'])
|
||||||
|
|
||||||
# Update or insert movies in DB
|
# Update or insert movies in DB
|
||||||
db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30)
|
db = sqlite3.connect(os.path.join(config_dir, 'db/bazarr.db'), timeout=30)
|
||||||
|
|
Loading…
Reference in a new issue