|
|
@ -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']:
|
|
|
|
|
|
|
|
sceneName = movie['movieFile']['sceneName']
|
|
|
|
if 'sceneName' in movie['movieFile']:
|
|
|
|
else:
|
|
|
|
sceneName = movie['movieFile']['sceneName']
|
|
|
|
sceneName = None
|
|
|
|
else:
|
|
|
|
|
|
|
|
sceneName = None
|
|
|
|
|
|
|
|
|
|
|
|
# Add movies in radarr to current movies list
|
|
|
|
# Add movies in radarr to current movies list
|
|
|
|
current_movies_radarr.append(unicode(movie['tmdbId']))
|
|
|
|
current_movies_radarr.append(unicode(movie['tmdbId']))
|
|
|
|
|
|
|
|
|
|
|
|
# Detect file separator
|
|
|
|
# Detect file separator
|
|
|
|
if movie['path'][0] == "/":
|
|
|
|
if movie['path'][0] == "/":
|
|
|
|
separator = "/"
|
|
|
|
separator = "/"
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
separator = "\\"
|
|
|
|
separator = "\\"
|
|
|
|
|
|
|
|
|
|
|
|
if unicode(movie['tmdbId']) in current_movies_db_list:
|
|
|
|
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"]))
|
|
|
|
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']))))
|
|
|
|
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)
|
|
|
|