mirror of
https://github.com/morpheus65535/bazarr
synced 2025-02-23 14:31:06 +00:00
Initial development on subtitles upgrade
This commit is contained in:
parent
681af94333
commit
27f906fe71
3 changed files with 21 additions and 2 deletions
|
@ -37,7 +37,8 @@ defaults = {
|
|||
'multithreading': 'True',
|
||||
'chmod': '0640',
|
||||
'subfolder': 'current',
|
||||
'subfolder_custom': ''
|
||||
'subfolder_custom': '',
|
||||
'days_to_upgrade_subs': '7'
|
||||
},
|
||||
'auth': {
|
||||
'type': 'None',
|
||||
|
|
|
@ -700,3 +700,15 @@ def refine_from_db(path, video):
|
|||
if data[6]: video.audio_codec = data[6]
|
||||
|
||||
return video
|
||||
|
||||
|
||||
def upgrade_subtitles():
|
||||
days_to_upgrade_subs = settings.general.days_to_upgrade_subs
|
||||
minimum_timestamp = ((datetime.now() - timedelta(days=int(days_to_upgrade_subs))) - datetime(1970,1,1)).total_seconds()
|
||||
|
||||
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
||||
c = db.cursor()
|
||||
data = c.execute("SELECT * FROM table_history WHERE timestamp > ? AND score is not null", (minimum_timestamp,)).fetchall()
|
||||
db.close()
|
||||
|
||||
return data
|
||||
|
|
|
@ -62,7 +62,7 @@ if not args.no_update:
|
|||
from list_subtitles import store_subtitles, store_subtitles_movie, series_scan_subtitles, movies_scan_subtitles, \
|
||||
list_missing_subtitles, list_missing_subtitles_movies
|
||||
from get_subtitle import download_subtitle, series_download_subtitles, movies_download_subtitles, \
|
||||
wanted_download_subtitles, wanted_search_missing_subtitles, manual_search, manual_download_subtitle
|
||||
wanted_download_subtitles, wanted_search_missing_subtitles, manual_search, manual_download_subtitle, upgrade_subtitles
|
||||
from utils import history_log, history_log_movie
|
||||
from scheduler import *
|
||||
from notifier import send_notifications, send_notifications_movie
|
||||
|
@ -1088,6 +1088,12 @@ def wanted_search_missing_subtitles_list():
|
|||
redirect(ref)
|
||||
|
||||
|
||||
@route(base_url + 'upgrade_subtitles')
|
||||
@custom_auth_basic(check_credentials)
|
||||
def upgrade_subtitles_route():
|
||||
return dict(data=upgrade_subtitles())
|
||||
|
||||
|
||||
@route(base_url + 'settings')
|
||||
@custom_auth_basic(check_credentials)
|
||||
def _settings():
|
||||
|
|
Loading…
Reference in a new issue