diff --git a/bazarr/database.py b/bazarr/database.py index 6c15dc658..e6142b34a 100644 --- a/bazarr/database.py +++ b/bazarr/database.py @@ -10,25 +10,22 @@ database = Sqlite3Worker(os.path.join(args.config_dir, 'db', 'bazarr.db'), max_q class SqliteDictConverter: def __init__(self): - pass + self.keys_insert = tuple() + self.keys_update = tuple() + self.values = tuple() + self.question_marks = tuple() def convert(self, values_dict): - self.keys = str() - self.values = str() - self.items = str() - if type(values_dict) is dict: - for key, value in values_dict.items(): - self.keys += key + ", " - if type(value) is not string_types: - value = str(value) - else: - value = "\"" + value + "\"" - self.values += value + ", " - self.items += key + "=" + value + ", " - self.keys = self.keys.rstrip(", ") - self.values = self.values.rstrip(", ") - self.items = self.items.rstrip(", ") + temp_keys = list() + temp_values = list() + for item in values_dict.items(): + temp_keys.append(item[0]) + temp_values.append(item[1]) + self.keys_insert = ','.join(temp_keys) + self.keys_update = ','.join([k + '=?' for k in temp_keys]) + self.values = tuple(temp_values) + self.question_marks = ','.join(list('?'*len(values_dict))) return self else: pass diff --git a/bazarr/get_episodes.py b/bazarr/get_episodes.py index 060aa72bd..51f4ad5e1 100644 --- a/bazarr/get_episodes.py +++ b/bazarr/get_episodes.py @@ -26,7 +26,7 @@ def sync_episodes(): # Get current episodes id in DB current_episodes_db = database.execute("SELECT sonarrEpisodeId, path, sonarrSeriesId FROM table_episodes") - current_episodes_db_list = [x.sonarr_episode_id for x in current_episodes_db] + current_episodes_db_list = [x['sonarrEpisodeId'] for x in current_episodes_db] current_episodes_sonarr = [] episodes_to_update = [] @@ -36,11 +36,11 @@ def sync_episodes(): # Get sonarrId for each series from database seriesIdList = database.execute("SELECT sonarrSeriesId, title FROM table_shows") - seriesIdListLength = seriesIdList.count() + seriesIdListLength = len(seriesIdList) for i, seriesId in enumerate(seriesIdList, 1): notifications.write(msg='Getting episodes data from Sonarr...', queue='get_episodes', item=i, length=seriesIdListLength) # Get episodes data for a series from Sonarr - url_sonarr_api_episode = url_sonarr + "/api/episode?seriesId=" + str(seriesId['sonarr_series_id']) + "&apikey=" + apikey_sonarr + url_sonarr_api_episode = url_sonarr + "/api/episode?seriesId=" + str(seriesId['sonarrSeriesId']) + "&apikey=" + apikey_sonarr try: r = requests.get(url_sonarr_api_episode, timeout=60, verify=False) r.raise_for_status() @@ -136,18 +136,19 @@ def sync_episodes(): for updated_episode in episodes_to_update_list: query = dict_converter.convert(updated_episode) - database.execute("UPDATE table_episodes SET ? WHERE sonarrEpisodeId=?", - (query.items, updated_episode['sonarr_episode_id'])) - altered_episodes.append([updated_episode['sonarr_episode_id'], + database.execute('''UPDATE table_shows SET ''' + query.keys_update + ''' WHERE sonarrSeriesId = ?''', + query.values + (updated_episode['sonarrSeriesId'],)) + altered_episodes.append([updated_episode['sonarrEpisodeId'], updated_episode['path'], - updated_episode['sonarr_series_id']]) + updated_episode['sonarrSeriesId']]) # Insert new episodes in DB for added_episode in episodes_to_add: query = dict_converter.convert(added_episode) - database.execute("INSERT OR IGNORE INTO table_episodes(?) VALUES(?)", - (query.keys, query.values)) - altered_episodes.append([added_episode['sonarr_episode_id'], + database.execute( + '''INSERT OR IGNORE INTO table_episodes(''' + query.keys_insert + ''') VALUES(''' + query.question_marks + + ''')''', query.values) + altered_episodes.append([added_episode['sonarrEpisodeId'], added_episode['path']]) # Remove old episodes from DB diff --git a/bazarr/get_movies.py b/bazarr/get_movies.py index 9e907820d..f67082334 100644 --- a/bazarr/get_movies.py +++ b/bazarr/get_movies.py @@ -54,7 +54,7 @@ def update_movies(): # Get current movies in DB current_movies_db = database.execute("SELECT tmdbId, path, radarrId FROM table_movies") - current_movies_db_list = [x['tmdb_id'] for x in current_movies_db] + current_movies_db_list = [x['tmdbId'] for x in current_movies_db] current_movies_radarr = [] movies_to_update = [] @@ -132,31 +132,31 @@ def update_movies(): current_movies_radarr.append(unicode(movie['tmdbId'])) if unicode(movie['tmdbId']) in current_movies_db_list: - movies_to_update.append({'radarr_id': movie["id"], + movies_to_update.append({'radarrId': movie["id"], 'title': unicode(movie["title"]), 'path': unicode(movie["path"] + separator + movie['movieFile']['relativePath']), - 'tmdb_id': unicode(movie["tmdbId"]), + 'tmdbId': unicode(movie["tmdbId"]), 'poster': unicode(poster), 'fanart': unicode(fanart), 'audio_language': unicode(profile_id_to_language(movie['qualityProfileId'], audio_profiles)), - 'scene_name': sceneName, + 'sceneName': sceneName, 'monitored': unicode(bool(movie['monitored'])), 'year': unicode(movie['year']), - 'sort_title': unicode(movie['sortTitle']), - 'alternative_titles': unicode(alternativeTitles), + 'sortTitle': unicode(movie['sortTitle']), + 'alternativeTitles': unicode(alternativeTitles), 'format': unicode(format), 'resolution': unicode(resolution), 'video_codec': unicode(videoCodec), 'audio_codec': unicode(audioCodec), 'overview': unicode(overview), - 'imdb_id': unicode(imdbId), + 'imdbId': unicode(imdbId), 'movie_file_id': movie['movieFile']['id']}) else: if movie_default_enabled is True: - movies_to_add.append({'radarr_id': movie["id"], + movies_to_add.append({'radarrId': movie["id"], 'title': movie["title"], 'path': movie["path"] + separator + movie['movieFile']['relativePath'], - 'tmdb_id': movie["tmdbId"], + 'tmdbId': movie["tmdbId"], 'languages': movie_default_language, 'subtitles': '[]', 'hearing_impaired': movie_default_hi, @@ -164,37 +164,41 @@ def update_movies(): 'poster': poster, 'fanart': fanart, 'audio_language': profile_id_to_language(movie['qualityProfileId'], audio_profiles), - 'scene_name': sceneName, + 'sceneName': sceneName, 'monitored': unicode(bool(movie['monitored'])), - 'sort_title': movie['sortTitle'], + 'sortTitle': movie['sortTitle'], 'year': movie['year'], - 'alternative_titles': alternativeTitles, + 'alternativeTitles': alternativeTitles, 'format': format, 'resolution': resolution, 'video_codec': videoCodec, 'audio_codec': audioCodec, - 'imdb_id': imdbId, + 'imdbId': imdbId, 'forced': movie_default_forced, 'movie_file_id': movie['movieFile']['id']}) else: - movies_to_add.append({'radarr_id': movie["id"], + movies_to_add.append({'radarrId': movie["id"], 'title': movie["title"], 'path': movie["path"] + separator + movie['movieFile']['relativePath'], - 'tmdb_id': movie["tmdbId"], + 'tmdbId': movie["tmdbId"], + 'languages': None, + 'subtitles': '[]', + 'hearing_impaired': None, 'overview': overview, 'poster': poster, 'fanart': fanart, 'audio_language': profile_id_to_language(movie['qualityProfileId'], audio_profiles), - 'scene_name': sceneName, + 'sceneName': sceneName, 'monitored': unicode(bool(movie['monitored'])), - 'sort_title': movie['sortTitle'], + 'sortTitle': movie['sortTitle'], 'year': movie['year'], - 'alternative_titles': alternativeTitles, + 'alternativeTitles': alternativeTitles, 'format': format, 'resolution': resolution, 'video_codec': videoCodec, 'audio_codec': audioCodec, - 'imdb_id': imdbId, + 'imdbId': imdbId, + 'forced': None, 'movie_file_id': movie['movieFile']['id']}) else: logging.error( @@ -215,21 +219,22 @@ def update_movies(): for updated_movie in movies_to_update_list: query = dict_converter.convert(updated_movie) - database.execute("UPDATE table_movies SET ? WHERE radarrId=?", - (query.items, updated_movie['radarr_id'])) - altered_movies.append([updated_movie['tmdb_id'], + database.execute('''UPDATE table_movies SET ''' + query.keys_update + ''' WHERE radarrId = ?''', + query.values + (updated_movie['radarrId'],)) + altered_movies.append([updated_movie['tmdbId'], updated_movie['path'], - updated_movie['radarr_id'], + updated_movie['radarrId'], updated_movie['monitored']]) # Insert new movies in DB for added_movie in movies_to_add: - query = dict_converter.convert(updated_movie) - database.execute("INSERT OR IGNORE INTO table_movies(?) VALUES(?)", - (query.keys, query.values)) - altered_movies.append([added_movie['tmdb_id'], + query = dict_converter.convert(added_movie) + database.execute( + '''INSERT OR IGNORE INTO table_movies(''' + query.keys_insert + ''') VALUES(''' + + query.question_marks + ''')''', query.values) + altered_movies.append([added_movie['tmdbId'], added_movie['path'], - added_movie['radarr_id'], + added_movie['radarrId'], added_movie['monitored']]) # Remove old movies from DB diff --git a/bazarr/get_series.py b/bazarr/get_series.py index 5a37da8a7..ee7c98f9f 100644 --- a/bazarr/get_series.py +++ b/bazarr/get_series.py @@ -133,13 +133,15 @@ def update_series(): for updated_series in series_to_update_list: query = dict_converter.convert(updated_series) - database.execute("""UPDATE table_shows SET {0} WHERE sonarrSeriesId=?""".format(query.items), - (updated_series['sonarrSeriesId'],)) + database.execute('''UPDATE table_shows SET ''' + query.keys_update + ''' WHERE sonarrSeriesId = ?''', + query.values + (updated_series['sonarrSeriesId'],)) # Insert new series in DB for added_series in series_to_add: query = dict_converter.convert(added_series) - database.execute("""INSERT OR IGNORE INTO table_shows({0}) VALUES({1})""".format(query.keys, query.values)) + database.execute( + '''INSERT OR IGNORE INTO table_shows(''' + query.keys_insert + ''') VALUES(''' + + query.question_marks + ''')''', query.values) list_missing_subtitles(no=added_series['sonarrSeriesId']) # Remove old series from DB diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py index 97788c04d..221417c49 100644 --- a/bazarr/get_subtitle.py +++ b/bazarr/get_subtitle.py @@ -574,7 +574,7 @@ def series_download_subtitles(no): notifications.write(msg='Searching for Series Subtitles...', queue='get_subtitle', item=i, length=count_episodes_details) result = download_subtitle(path_replace(episode['path']), - str(alpha3_from_alpha2(language.split(':'))), + str(alpha3_from_alpha2(language.split(':')[0])), series_details['hearing_impaired'], "True" if len(language.split(':')) > 1 else "False", providers_list, @@ -589,7 +589,7 @@ def series_download_subtitles(no): language_code = result[2] + ":forced" if forced else result[2] provider = result[3] score = result[4] - store_subtitles(path_replace(episode.path)) + store_subtitles(path_replace(episode['path'])) history_log(1, no, episode['sonarrEpisodeId'], message, path, language_code, provider, score) send_notifications(no, episode['sonarrEpisodeId'], message) else: @@ -661,8 +661,11 @@ def movies_download_subtitles(no): providers_list = get_providers() providers_auth = get_providers_auth() - - count_movie = len(ast.literal_eval(movie['missing_subtitles'])) + + if ast.literal_eval(movie['missing_subtitles']): + count_movie = len(ast.literal_eval(movie['missing_subtitles'])) + else: + count_movie = 0 for i, language in enumerate(ast.literal_eval(movie['missing_subtitles']), 1): if providers_list: @@ -712,7 +715,7 @@ def wanted_download_subtitles(path, l, count_episodes): providers_auth = get_providers_auth() for episode in episodes_details: - attempt = episode['failed_attempts'] + attempt = episode['failedAttempts'] if type(attempt) == unicode: attempt = ast.literal_eval(attempt) for language in ast.literal_eval(episode['missing_subtitles']): @@ -725,7 +728,7 @@ def wanted_download_subtitles(path, l, count_episodes): attempt.append([language, time.time()]) database.execute("UPDATE table_episodes SET failedAttempts=? WHERE sonarrEpisodeId=?", - (unicode(attempt), episode['sonarrEpisdoeId'])) + (unicode(attempt), episode['sonarrEpisodeId'])) for i in range(len(attempt)): if attempt[i][0] == language: @@ -750,7 +753,7 @@ def wanted_download_subtitles(path, l, count_episodes): score = result[4] store_subtitles(path_replace(episode['path'])) history_log(1, episode['sonarrSeriesId'], episode['sonarrEpisodeId'], message, path, language_code, provider, score) - send_notifications(episode['sonarrSeriesId'], episode['sonarrSeriesId'], message) + send_notifications(episode['sonarrSeriesId'], episode['sonarrEpisodeId'], message) else: logging.debug( 'BAZARR Search is not active for episode ' + episode['path'] + ' Language: ' + attempt[i][0]) @@ -765,7 +768,7 @@ def wanted_download_subtitles_movie(path, l, count_movies): providers_auth = get_providers_auth() for movie in movies_details: - attempt = movie['failed_attempts'] + attempt = movie['failedAttempts'] if type(attempt) == unicode: attempt = ast.literal_eval(attempt) for language in ast.literal_eval(movie['missing_subtitles']): diff --git a/bazarr/main.py b/bazarr/main.py index be4ee07fd..dc634f5a2 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -575,7 +575,7 @@ def serieseditor(): authorize() # Get missing count - missing_count = len(database.execute("SELECT COUNT(*) FROM table_shows")) + missing_count = database.execute("SELECT COUNT(*) as count FROM table_shows", only_one=True)['count'] # Get series list data = database.execute("SELECT tvdbId, title, path, languages, hearing_impaired, sonarrSeriesId, poster, " @@ -751,7 +751,7 @@ def movies(): def movieseditor(): authorize() - missing_count = len(database.execute("SELECT COUNT(*) FROM table_movies")) + missing_count = database.execute("SELECT COUNT(*) as count FROM table_movies", only_one=True)['count'] data = database.execute("SELECT tmdbId, title, path, languages, hearing_impaired, radarrId, poster, " "audio_language, forced FROM table_movies ORDER BY sortTitle ASC") @@ -935,13 +935,14 @@ def historyseries(): thisyear.append(datetime.fromtimestamp(stat['timestamp']).date()) stats = [len(today), len(thisweek), len(thisyear), total] - data = database.execute("SELECT table_history.action, table_shows.title, " - "table_episodes.season || 'x' || table_episodes.episode, table_episodes.title, " + data = database.execute("SELECT table_history.action, table_shows.title as seriesTitle, " + "table_episodes.season || 'x' || table_episodes.episode as episode_number, " + "table_episodes.title as episodeTitle, " "table_history.timestamp, table_history.description, table_history.sonarrSeriesId, " "table_episodes.path, table_shows.languages, table_history.language, table_history.score, " "table_shows.forced FROM table_history LEFT JOIN table_shows on " "table_shows.sonarrSeriesId = table_history.sonarrSeriesId LEFT JOIN table_episodes on " - "table_episodes.sonarrEpisodeId = table_history.sonarrEpisodeId WHERE table_history.title " + "table_episodes.sonarrEpisodeId = table_history.sonarrEpisodeId WHERE table_episodes.title " "is not NULL ORDER BY timestamp DESC LIMIT ? OFFSET ?", (page_size, offset)) upgradable_episodes_not_perfect = [] @@ -960,7 +961,7 @@ def historyseries(): else: series_monitored_only_query_string = '' - upgradable_episodes = database.execute("SELECT video_path, MAX(timestamp), score FROM table_history " + upgradable_episodes = database.execute("SELECT video_path, MAX(timestamp) as timestamp, score FROM table_history " "INNER JOIN table_episodes on table_episodes.sonarrEpisodeId = " "table_history.sonarrEpisodeId WHERE action IN (" + ','.join(map(str, query_actions)) + ") AND timestamp > ? AND " @@ -1037,7 +1038,7 @@ def historymovies(): else: query_actions = [1, 3] - upgradable_movies = database.execute("SELECT video_path, MAX(timestamp), score FROM table_history_movie " + upgradable_movies = database.execute("SELECT video_path, MAX(timestamp) as timestamp, score FROM table_history_movie " "INNER JOIN table_movies on table_movies.radarrId=" "table_history_movie.radarrId WHERE action IN (" + ','.join(map(str, query_actions)) + @@ -1077,8 +1078,8 @@ def wantedseries(): else: monitored_only_query_string = '' - missing_count = len(database.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'" + - monitored_only_query_string)) + missing_count = database.execute("SELECT COUNT(*) as count FROM table_episodes WHERE missing_subtitles != '[]'" + + monitored_only_query_string, only_one=True)['count'] page = request.GET.page if page == "": page = "1" @@ -1086,8 +1087,9 @@ def wantedseries(): offset = (int(page) - 1) * page_size max_page = int(math.ceil(missing_count / (page_size + 0.0))) - data = database.execute("SELECT table_shows.title, table_episodes.season || 'x' || table_episodes.episode, " - "table_episodes.title, table_episodes.missing_subtitles, table_episodes.sonarrSeriesId, " + data = database.execute("SELECT table_shows.title as seriesTitle, " + "table_episodes.season || 'x' || table_episodes.episode as episode_number, " + "table_episodes.title as episodeTitle, table_episodes.missing_subtitles, table_episodes.sonarrSeriesId, " "table_episodes.path, table_shows.hearing_impaired, table_episodes.sonarrEpisodeId, " "table_episodes.scene_name, table_episodes.failedAttempts FROM table_episodes " "INNER JOIN table_shows on table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId " @@ -1110,8 +1112,8 @@ def wantedmovies(): else: monitored_only_query_string = '' - missing_count = len(database.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'" + - monitored_only_query_string)) + missing_count = database.execute("SELECT COUNT(*) as count FROM table_movies WHERE missing_subtitles != '[]'" + + monitored_only_query_string, only_one=True)['count'] page = request.GET.page if page == "": page = "1" diff --git a/bazarr/notifier.py b/bazarr/notifier.py index 9bb226c4c..5798b590c 100644 --- a/bazarr/notifier.py +++ b/bazarr/notifier.py @@ -61,6 +61,7 @@ def get_episode_name(sonarrEpisodeId): def get_movies_name(radarrId): data = database.execute("SELECT title FROM table_movies WHERE radarrId=?", (radarrId,), only_one=True) + return data['title'] diff --git a/views/historymovies.tpl b/views/historymovies.tpl index 16d548ba0..27981f3c3 100644 --- a/views/historymovies.tpl +++ b/views/historymovies.tpl @@ -58,58 +58,58 @@ %for row in rows: - %if row.action == 0: + %if row['action'] == 0:
- %elif row.action == 1: + %elif row['action'] == 1:
- %elif row.action == 2: + %elif row['action'] == 2:
- %elif row.action == 3: + %elif row['action'] == 3:
- %elif row[0] == 4: + %elif row['action'] == 4:
%end - {{row.title}} + {{row['title']}} -
- {{pretty.date(int(row.timestamp))}} +
+ {{pretty.date(int(row['timestamp']))}}
- % upgradable_criteria = (row.timestamp, row.video_path, row.score) + % upgradable_criteria = (row['timestamp'], row['video_path'], row['score']) % if upgradable_criteria in upgradable_movies: - % if row.languages != "None": - % desired_languages = ast.literal_eval(str(row.languages)) - % if row.forced == "True": + % if row['languages'] != "None": + % desired_languages = ast.literal_eval(str(row['languages'])) + % if row['forced'] == "True": % forced_languages = [l + ":forced" for l in desired_languages] - % elif row.forced == "Both": + % elif row['forced'] == "Both": % forced_languages = [l + ":forced" for l in desired_languages] + desired_languages % else: % forced_languages = desired_languages % end - % if row.languages and row.language and row.language in forced_languages: + % if row['languages'] and row['language'] and row['language'] in forced_languages:
- {{row.description}} + {{row['description']}}
% else: - {{row.description}} + {{row['description']}} % end % end % else: - {{row.description}} + {{row['description']}} % end diff --git a/views/historyseries.tpl b/views/historyseries.tpl index b08604ae4..4bbf05360 100644 --- a/views/historyseries.tpl +++ b/views/historyseries.tpl @@ -60,71 +60,71 @@ %for row in rows: - %if row.action == 0: + %if row['action'] == 0:
- %elif row.action == 1: + %elif row['action'] == 1:
- %elif row.action == 2: + %elif row['action'] == 2:
- %elif row.action == 3: + %elif row['action'] == 3:
- %elif row.action == 4: + %elif row['action'] == 4:
%end - {{row.seriesTitle}} + {{row['seriesTitle']}} - %if row.episode_number is not None: - % episode = row.episode_number.split('x') + %if row['episode_number'] is not None: + % episode = row['episode_number'].split('x') {{episode[0] + 'x' + episode[1].zfill(2)}} %end - %if row.episodeTitle is not None: - {{row.episodeTitle}} + %if row['episodeTitle'] is not None: + {{row['episodeTitle']}} %else: Deleted episode %end -
- {{pretty.date(int(row.timestamp))}} +
+ {{pretty.date(int(row['timestamp']))}}
- % upgradable_criteria = (row.timestamp, row.path, row.score) + % upgradable_criteria = (row['timestamp'], row['path'], row['score']) % if upgradable_criteria in upgradable_episodes: - % if row.languages != "None": - % desired_languages = ast.literal_eval(str(row.languages)) - % if row.forced == "True": + % if row['languages'] != "None": + % desired_languages = ast.literal_eval(str(row['languages'])) + % if row['forced'] == "True": % forced_languages = [l + ":forced" for l in desired_languages] - % elif row.forced == "Both": + % elif row['forced'] == "Both": % forced_languages = [l + ":forced" for l in desired_languages] + desired_languages % else: % forced_languages = desired_languages % end - % if row.language in forced_languages: + % if row['language'] in forced_languages:
- {{row.description}} + {{row['description']}}
% else: - {{row.description}} + {{row['description']}} % end % end % else: - {{row.description}} + {{row['description']}} % end diff --git a/views/menu.tpl b/views/menu.tpl index fdab271da..e83ca35a2 100644 --- a/views/menu.tpl +++ b/views/menu.tpl @@ -74,8 +74,8 @@ % monitored_only_query_string_radarr = "" %end - % wanted_series = len(database.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string_sonarr)) - % wanted_movies = len(database.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string_radarr)) + % wanted_series = database.execute("SELECT COUNT(*) as count FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string_sonarr, only_one=True)['count'] + % wanted_movies = database.execute("SELECT COUNT(*) as count FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string_radarr, only_one=True)['count'] % from get_providers import list_throttled_providers % throttled_providers_count = len(eval(str(settings.general.throtteled_providers)))
diff --git a/views/movie.tpl b/views/movie.tpl index e5c552564..b63605dd3 100644 --- a/views/movie.tpl +++ b/views/movie.tpl @@ -232,8 +232,8 @@ forced_bool = False end - if details['failed_attempts'] is not None and settings.general.getboolean('adaptive_searching') and missing_subs_language in details['failed_attempts']: - for lang in ast.literal_eval(details['failed_attempts']): + if details['failedAttempts'] is not None and settings.general.getboolean('adaptive_searching') and missing_subs_language in details['failedAttempts']: + for lang in ast.literal_eval(details['failedAttempts']): if missing_subs_language in lang: if search_active(lang[1]): %> diff --git a/views/movieseditor.tpl b/views/movieseditor.tpl index bc4618d73..e32285732 100644 --- a/views/movieseditor.tpl +++ b/views/movieseditor.tpl @@ -74,22 +74,22 @@
- +
- {{row.title}} - {{row.audio_language}} + {{row['title']}} + {{row['audio_language']}} - %subs_languages = ast.literal_eval(str(row.languages)) + %subs_languages = ast.literal_eval(str(row['languages'])) %if subs_languages is not None: %for subs_language in subs_languages:
{{subs_language}}
%end %end - {{!"" if row.hearing_impaired == None else row.hearing_impaired}} - {{!"" if row.forced is None else row.forced}} + {{!"" if row['hearing_impaired'] == None else row['hearing_impaired']}} + {{!"" if row['forced'] is None else row['forced']}} %end @@ -105,7 +105,7 @@ %for language in languages: - + %end
diff --git a/views/serieseditor.tpl b/views/serieseditor.tpl index aeafd2375..35a19a102 100644 --- a/views/serieseditor.tpl +++ b/views/serieseditor.tpl @@ -74,22 +74,22 @@
- +
- {{row.title}} - {{row.audio_language}} + {{row['title']}} + {{row['audio_language']}} - %subs_languages = ast.literal_eval(str(row.languages)) + %subs_languages = ast.literal_eval(str(row['languages'])) %if subs_languages is not None: %for subs_language in subs_languages:
{{subs_language}}
%end %end - {{!"" if row.hearing_impaired is None else row.hearing_impaired}} - {{!"" if row.forced is None else row.forced}} + {{!"" if row['hearing_impaired'] is None else row['hearing_impaired']}} + {{!"" if row['forced'] is None else row['forced']}} %end @@ -105,7 +105,7 @@ %for language in languages: - + %end
diff --git a/views/settings_notifications.tpl b/views/settings_notifications.tpl index 90417b150..e56f8fb3c 100644 --- a/views/settings_notifications.tpl +++ b/views/settings_notifications.tpl @@ -10,19 +10,19 @@ %for notifier in settings_notifier:
- +
-
- +
+
-
- -
Test Notification
+
+ +
Test Notification
diff --git a/views/settings_subtitles.tpl b/views/settings_subtitles.tpl index a57c7712d..5d8126526 100644 --- a/views/settings_subtitles.tpl +++ b/views/settings_subtitles.tpl @@ -414,9 +414,9 @@ %enabled_languages = [] %for language in settings_languages: - - %if language.enabled == True: - % enabled_languages.append(str(language.code2)) + + %if language['enabled'] == True: + % enabled_languages.append(str(language['code2'])) %end %end diff --git a/views/wanted.tpl b/views/wanted.tpl index d7b5a6f17..7284aada9 100644 --- a/views/wanted.tpl +++ b/views/wanted.tpl @@ -60,8 +60,8 @@ % episodes_missing_subtitles_clause_movie = "" %end - % wanted_series = len(database.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'" + episodes_missing_subtitles_clause)) - % wanted_movies = len(database.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'" + episodes_missing_subtitles_clause_movie)) + % wanted_series = database.execute("SELECT COUNT(*) as count FROM table_episodes WHERE missing_subtitles != '[]'" + episodes_missing_subtitles_clause, only_one=True)['count'] + % wanted_movies = database.execute("SELECT COUNT(*) as count FROM table_movies WHERE missing_subtitles != '[]'" + episodes_missing_subtitles_clause_movie, only_one=True)['count']
Loading...
diff --git a/views/wantedmovies.tpl b/views/wantedmovies.tpl index 43704fc48..4a239ff0b 100644 --- a/views/wantedmovies.tpl +++ b/views/wantedmovies.tpl @@ -59,10 +59,10 @@ %end %for row in rows: - {{row.title}} + {{row['title']}} <% - missing_languages = ast.literal_eval(row.missing_subtitles) + missing_languages = ast.literal_eval(row['missing_subtitles']) if missing_languages is not None: from get_subtitle import search_active from config import settings @@ -72,18 +72,18 @@ else: forced = False end - if row.failed_attempts is not None and settings.general.getboolean('adaptive_searching') and language in row.failed_attempts: - for lang in ast.literal_eval(row.failed_attempts): + if row['failedAttempts'] is not None and settings.general.getboolean('adaptive_searching') and language in row['failedAttempts']: + for lang in ast.literal_eval(row['failedAttempts']): if language in lang: active = search_active(lang[1]) if active: %> - + {{language}} %else: - + {{language}} @@ -91,7 +91,7 @@ %end %end %else: - + {{language}} diff --git a/views/wantedseries.tpl b/views/wantedseries.tpl index 1637ca5ca..9e784558e 100644 --- a/views/wantedseries.tpl +++ b/views/wantedseries.tpl @@ -54,22 +54,22 @@ %import time %import pretty - %if rows.count() == 0: + %if len(rows) == 0: No Missing Subtitles. %end %for row in rows: - {{row.seriesTitle}} + {{row['seriesTitle']}} - <%episode = str(row.episode_number).split('x')%> + <%episode = str(row['episode_number']).split('x')%> {{episode[0] + 'x' + episode[1].zfill(2)}} - {{row.episodeTitle}} + {{row['episodeTitle']}} <% - missing_languages = ast.literal_eval(row.missing_subtitles) + missing_languages = ast.literal_eval(row['missing_subtitles']) if missing_languages is not None: from get_subtitle import search_active from config import settings @@ -79,18 +79,18 @@ else: forced = False end - if row.failed_attempts is not None and settings.general.getboolean('adaptive_searching') and language in row.failed_attempts: - for lang in ast.literal_eval(row.failed_attempts): + if row['failedAttempts'] is not None and settings.general.getboolean('adaptive_searching') and language in row['failedAttempts']: + for lang in ast.literal_eval(row['failedAttempts']): if language in lang: active = search_active(lang[1]) if active: %> - + {{language}} %else: - + {{language}} @@ -98,7 +98,7 @@ %end %end %else: - + {{language}}