diff --git a/bazarr.py b/bazarr.py index ff0dd8407..c83f801e0 100644 --- a/bazarr.py +++ b/bazarr.py @@ -1,4 +1,4 @@ -bazarr_version = '0.1.1' +bazarr_version = '0.1.2' from bottle import route, run, template, static_file, request, redirect import bottle @@ -292,12 +292,6 @@ def check_update(): @route(base_url + 'system') def system(): - db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db')) - c = db.cursor() - c.execute("SELECT * FROM table_scheduler") - tasks = c.fetchall() - c.close() - logs = [] for line in reversed(open(os.path.join(os.path.dirname(__file__), 'data/log/bazarr.log')).readlines()): logs.append(line.rstrip()) @@ -388,7 +382,7 @@ def system(): elif job.trigger.__str__().startswith('cron'): task_list.append([job.name, get_time_from_cron(job.trigger.fields), pretty.date(job.next_run_time.replace(tzinfo=None)), job.id]) - return template('system', tasks=tasks, logs=logs, base_url=base_url, task_list=task_list, bazarr_version=bazarr_version) + return template('system', logs=logs, base_url=base_url, task_list=task_list, bazarr_version=bazarr_version) @route(base_url + 'execute/') def execute_task(taskid): diff --git a/get_episodes.py b/get_episodes.py index f586d2e18..f8ad5ab34 100644 --- a/get_episodes.py +++ b/get_episodes.py @@ -36,7 +36,7 @@ def update_all_episodes(): url_sonarr_api_episode = protocol_sonarr + "://" + config_sonarr[0] + ":" + str(config_sonarr[1]) + base_url_sonarr + "/api/episode?seriesId=" + str(seriesId[0]) + "&apikey=" + apikey_sonarr r = requests.get(url_sonarr_api_episode) for episode in r.json(): - if episode['hasFile']: + if episode['hasFile'] and episode['episodeFile']['size'] > 20480: # Add shows in Sonarr to current shows list current_episodes_sonarr.append(episode['id']) @@ -60,15 +60,6 @@ def update_all_episodes(): # Close database connection c.close() - - #Cleanup variables to free memory - del current_episodes_db - del current_episodes_db_list - del seriesIdList - del r - del current_episodes_sonarr - del deleted_items - del c # Store substitles for all episodes full_scan_subtitles() @@ -110,7 +101,7 @@ def add_new_episodes(): url_sonarr_api_episode = protocol_sonarr + "://" + config_sonarr[0] + ":" + str(config_sonarr[1]) + base_url_sonarr + "/api/episode?seriesId=" + str(seriesId[0]) + "&apikey=" + apikey_sonarr r = requests.get(url_sonarr_api_episode) for episode in r.json(): - if episode['hasFile']: + if episode['hasFile'] and episode['episodeFile']['size'] > 20480: # Add shows in Sonarr to current shows list current_episodes_sonarr.append(episode['id']) @@ -132,15 +123,6 @@ def add_new_episodes(): # Close database connection c.close() - - #Cleanup variables to free memory - del current_episodes_db - del current_episodes_db_list - del seriesIdList - del r - del current_episodes_sonarr - del deleted_items - del c # Store substitles from episodes we've just added new_scan_subtitles() diff --git a/get_subtitle.py b/get_subtitle.py index 605a7c60a..f5f9015c5 100644 --- a/get_subtitle.py +++ b/get_subtitle.py @@ -26,16 +26,6 @@ def download_subtitle(path, language, hi, providers): except: return None - del video - del best_subtitles - try: - del result - del downloaded_provider - del downloaded_language - del message - except: - pass - def series_download_subtitles(no): conn_db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db')) c_db = conn_db.cursor() @@ -75,16 +65,6 @@ def wanted_download_subtitles(path): list_missing_subtitles(episode[3]) history_log(1, episode[3], episode[2], message) - del conn_db - del c_db - del episodes_details - del enabled_providers - del providers_list - try: - del message - except: - pass - def wanted_search_missing_subtitles(): db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db')) db.create_function("path_substitution", 1, path_replace) @@ -95,8 +75,4 @@ def wanted_search_missing_subtitles(): c.close() for episode in data: - wanted_download_subtitles(episode[0]) - - del db - del c - del data + wanted_download_subtitles(episode[0]) \ No newline at end of file