Added dedicated minimum score settings for movie and episode #95

pull/119/merge
Louis Vézina 6 years ago
parent 55be0aad60
commit 9857368c95

@ -758,6 +758,7 @@ def save_settings():
else: else:
settings_general_embedded = 'True' settings_general_embedded = 'True'
settings_general_minimum_score = request.forms.get('settings_general_minimum_score') settings_general_minimum_score = request.forms.get('settings_general_minimum_score')
settings_general_minimum_score_movies = request.forms.get('settings_general_minimum_score_movies')
settings_general_use_postprocessing = request.forms.get('settings_general_use_postprocessing') settings_general_use_postprocessing = request.forms.get('settings_general_use_postprocessing')
if settings_general_use_postprocessing is None: if settings_general_use_postprocessing is None:
settings_general_use_postprocessing = 'False' settings_general_use_postprocessing = 'False'
@ -778,7 +779,7 @@ def save_settings():
before = c.execute("SELECT ip, port, base_url, log_level, path_mapping, use_sonarr, use_radarr, path_mapping_movie FROM table_settings_general").fetchone() before = c.execute("SELECT ip, port, base_url, log_level, path_mapping, use_sonarr, use_radarr, path_mapping_movie FROM table_settings_general").fetchone()
after = (unicode(settings_general_ip), int(settings_general_port), unicode(settings_general_baseurl), unicode(settings_general_loglevel), unicode(settings_general_pathmapping), unicode(settings_general_use_sonarr), unicode(settings_general_use_radarr), unicode(settings_general_pathmapping_movie)) after = (unicode(settings_general_ip), int(settings_general_port), unicode(settings_general_baseurl), unicode(settings_general_loglevel), unicode(settings_general_pathmapping), unicode(settings_general_use_sonarr), unicode(settings_general_use_radarr), unicode(settings_general_pathmapping_movie))
c.execute("UPDATE table_settings_general SET ip = ?, port = ?, base_url = ?, path_mapping = ?, log_level = ?, branch=?, auto_update=?, single_language=?, minimum_score=?, use_scenename=?, use_postprocessing=?, postprocessing_cmd=?, use_sonarr=?, use_radarr=?, path_mapping_movie=?, page_size=?, use_embedded_subs=?", (unicode(settings_general_ip), int(settings_general_port), unicode(settings_general_baseurl), unicode(settings_general_pathmapping), unicode(settings_general_loglevel), unicode(settings_general_branch), unicode(settings_general_automatic), unicode(settings_general_single_language), unicode(settings_general_minimum_score), unicode(settings_general_scenename), unicode(settings_general_use_postprocessing), unicode(settings_general_postprocessing_cmd), unicode(settings_general_use_sonarr), unicode(settings_general_use_radarr), unicode(settings_general_pathmapping_movie), unicode(settings_page_size), unicode(settings_general_embedded))) c.execute("UPDATE table_settings_general SET ip = ?, port = ?, base_url = ?, path_mapping = ?, log_level = ?, branch=?, auto_update=?, single_language=?, minimum_score=?, use_scenename=?, use_postprocessing=?, postprocessing_cmd=?, use_sonarr=?, use_radarr=?, path_mapping_movie=?, page_size=?, use_embedded_subs=?, minimum_score_movie=?", (unicode(settings_general_ip), int(settings_general_port), unicode(settings_general_baseurl), unicode(settings_general_pathmapping), unicode(settings_general_loglevel), unicode(settings_general_branch), unicode(settings_general_automatic), unicode(settings_general_single_language), unicode(settings_general_minimum_score), unicode(settings_general_scenename), unicode(settings_general_use_postprocessing), unicode(settings_general_postprocessing_cmd), unicode(settings_general_use_sonarr), unicode(settings_general_use_radarr), unicode(settings_general_pathmapping_movie), unicode(settings_page_size), unicode(settings_general_embedded), unicode(settings_general_minimum_score_movies)))
conn.commit() conn.commit()
if after != before: if after != before:
configured() configured()

@ -51,8 +51,9 @@ def get_general_settings():
movie_default_hi = general_settings[22] movie_default_hi = general_settings[22]
page_size = general_settings[23] page_size = general_settings[23]
use_embedded_subs = general_settings[24] use_embedded_subs = general_settings[24]
minimum_score_movie = general_settings[25]
return [ip, port, base_url, path_mappings, log_level, branch, automatic, single_language, minimum_score, use_scenename, use_postprocessing, postprocessing_cmd, use_sonarr, use_radarr, path_mappings_movie, serie_default_enabled, serie_default_language, serie_default_hi, movie_default_enabled,movie_default_language, movie_default_hi, page_size, use_embedded_subs] return [ip, port, base_url, path_mappings, log_level, branch, automatic, single_language, minimum_score, use_scenename, use_postprocessing, postprocessing_cmd, use_sonarr, use_radarr, path_mappings_movie, serie_default_enabled, serie_default_language, serie_default_hi, movie_default_enabled,movie_default_language, movie_default_hi, page_size, use_embedded_subs, minimum_score_movie]
def path_replace(path): def path_replace(path):
for path_mapping in path_mappings: for path_mapping in path_mappings:
@ -131,4 +132,5 @@ movie_default_enabled = result[18]
movie_default_language = result[19] movie_default_language = result[19]
movie_default_hi = result[20] movie_default_hi = result[20]
page_size = result[21] page_size = result[21]
use_embedded_subs = result[22] use_embedded_subs = result[22]
minimum_score_movie = result[23]

@ -18,9 +18,10 @@ region.configure('dogpile.cache.memory')
def download_subtitle(path, language, hi, providers, providers_auth, sceneName, type): def download_subtitle(path, language, hi, providers, providers_auth, sceneName, type):
if type == 'series': if type == 'series':
type_of_score = 359 type_of_score = 359
minimum_score = float(get_general_settings()[8]) / 100 * type_of_score
elif type == 'movies': elif type == 'movies':
type_of_score = 119 type_of_score = 119
minimum_score = float(get_general_settings()[8]) / 100 * type_of_score minimum_score = float(get_general_settings()[23]) / 100 * type_of_score
use_scenename = get_general_settings()[9] use_scenename = get_general_settings()[9]
use_postprocessing = get_general_settings()[10] use_postprocessing = get_general_settings()[10]
postprocessing_cmd = get_general_settings()[11] postprocessing_cmd = get_general_settings()[11]

@ -56,6 +56,13 @@ if os.path.exists(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
else: else:
c.execute('UPDATE table_settings_general SET minimum_score="0"') c.execute('UPDATE table_settings_general SET minimum_score="0"')
try:
c.execute('alter table table_settings_general add column "minimum_score_movie" "text"')
except:
pass
else:
c.execute('UPDATE table_settings_general SET minimum_score_movie="0"')
try: try:
c.execute('alter table table_settings_general add column "use_scenename" "text"') c.execute('alter table table_settings_general add column "use_scenename" "text"')
except: except:

@ -812,7 +812,7 @@
<div class="middle aligned row"> <div class="middle aligned row">
<div class="right aligned four wide column"> <div class="right aligned four wide column">
<label>Minimum score</label> <label>Minimum score for episodes</label>
</div> </div>
<div class="two wide column"> <div class="two wide column">
<div class='field'> <div class='field'>
@ -823,7 +823,27 @@
</div> </div>
<div class="collapsed column"> <div class="collapsed column">
<div class="collapsed center aligned column"> <div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Minimum score for a subtitle to be downloaded (0 to 100)." data-inverted=""> <div class="ui basic icon" data-tooltip="Minimum score for an episode subtitle to be downloaded (0 to 100)." data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Minimum score for movies</label>
</div>
<div class="two wide column">
<div class='field'>
<div class="ui input">
<input name="settings_general_minimum_score_movies" type="number" min="0" max="100" step="5" onkeydown="return false" value="{{settings_general[25]}}">
</div>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Minimum score for a movie subtitle to be downloaded (0 to 100)." data-inverted="">
<i class="help circle large icon"></i> <i class="help circle large icon"></i>
</div> </div>
</div> </div>

Loading…
Cancel
Save