mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-02-14 18:04:43 +08:00
Continuing development
This commit is contained in:
parent
7000343ddc
commit
f4890d3dd3
11 changed files with 247 additions and 29 deletions
93
bazarr.py
93
bazarr.py
|
@ -127,12 +127,16 @@ def image_proxy(url):
|
||||||
url_sonarr_short = get_sonarr_settings()[1]
|
url_sonarr_short = get_sonarr_settings()[1]
|
||||||
apikey = get_sonarr_settings()[2]
|
apikey = get_sonarr_settings()[2]
|
||||||
url_image = url_sonarr_short + '/' + url + '?apikey=' + apikey
|
url_image = url_sonarr_short + '/' + url + '?apikey=' + apikey
|
||||||
img_pil = Image.open(BytesIO(requests.get(url_sonarr_short + '/api' + url_image.split(url_sonarr)[1]).content))
|
try:
|
||||||
img_buffer = BytesIO()
|
img_pil = Image.open(BytesIO(requests.get(url_sonarr_short + '/api' + url_image.split(url_sonarr)[1]).content))
|
||||||
img_pil.tobytes()
|
except:
|
||||||
img_pil.save(img_buffer, img_pil.format)
|
return None
|
||||||
img_buffer.seek(0)
|
else:
|
||||||
return send_file(img_buffer, ctype=img_pil.format)
|
img_buffer = BytesIO()
|
||||||
|
img_pil.tobytes()
|
||||||
|
img_pil.save(img_buffer, img_pil.format)
|
||||||
|
img_buffer.seek(0)
|
||||||
|
return send_file(img_buffer, ctype=img_pil.format)
|
||||||
|
|
||||||
@route(base_url + 'image_proxy_movies/<url:path>', method='GET')
|
@route(base_url + 'image_proxy_movies/<url:path>', method='GET')
|
||||||
def image_proxy_movies(url):
|
def image_proxy_movies(url):
|
||||||
|
@ -140,8 +144,13 @@ def image_proxy_movies(url):
|
||||||
url_radarr = get_radarr_settings()[0]
|
url_radarr = get_radarr_settings()[0]
|
||||||
url_radarr_short = get_radarr_settings()[1]
|
url_radarr_short = get_radarr_settings()[1]
|
||||||
apikey = get_radarr_settings()[2]
|
apikey = get_radarr_settings()[2]
|
||||||
url_image = url_radarr_short + '/' + url + '?apikey=' + apikey
|
try:
|
||||||
img_pil = Image.open(BytesIO(requests.get(url_radarr_short + '/api' + url_image.split(url_radarr)[1]).content))
|
url_image = (url_radarr_short + '/' + url + '?apikey=' + apikey).replace('/fanart.jpg', '/banner.jpg')
|
||||||
|
img_pil = Image.open(BytesIO(requests.get(url_radarr_short + '/api' + url_image.split(url_radarr)[1]).content))
|
||||||
|
except:
|
||||||
|
url_image = url_radarr_short + '/' + url + '?apikey=' + apikey
|
||||||
|
img_pil = Image.open(BytesIO(requests.get(url_radarr_short + '/api' + url_image.split(url_radarr)[1]).content))
|
||||||
|
|
||||||
img_buffer = BytesIO()
|
img_buffer = BytesIO()
|
||||||
img_pil.tobytes()
|
img_pil.tobytes()
|
||||||
img_pil.save(img_buffer, img_pil.format)
|
img_pil.save(img_buffer, img_pil.format)
|
||||||
|
@ -198,20 +207,26 @@ def serieseditor():
|
||||||
output = template('serieseditor', __file__=__file__, bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, base_url=base_url, single_language=single_language)
|
output = template('serieseditor', __file__=__file__, bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, base_url=base_url, single_language=single_language)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
@route(base_url + 'series_json/<query>', method='GET')
|
@route(base_url + 'search_json/<query>', method='GET')
|
||||||
def series_json(query):
|
def search_json(query):
|
||||||
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
|
|
||||||
c.execute("SELECT title, sonarrSeriesId FROM table_shows WHERE title LIKE ? ORDER BY title", ('%'+query+'%',))
|
c.execute("SELECT title, sonarrSeriesId FROM table_shows WHERE title LIKE ? ORDER BY title", ('%'+query+'%',))
|
||||||
data = c.fetchall()
|
series = c.fetchall()
|
||||||
|
|
||||||
series_list = []
|
c.execute("SELECT title, radarrId FROM table_movies WHERE title LIKE ? ORDER BY title", ('%' + query + '%',))
|
||||||
for serie in data:
|
movies = c.fetchall()
|
||||||
series_list.append(dict([('name', serie[0]), ('url', base_url + 'episodes/' + str(serie[1]))]))
|
|
||||||
|
search_list = []
|
||||||
|
for serie in series:
|
||||||
|
search_list.append(dict([('name', serie[0]), ('url', base_url + 'episodes/' + str(serie[1]))]))
|
||||||
|
|
||||||
|
for movie in movies:
|
||||||
|
search_list.append(dict([('name', movie[0]), ('url', base_url + 'movie/' + str(movie[1]))]))
|
||||||
|
|
||||||
response.content_type = 'application/json'
|
response.content_type = 'application/json'
|
||||||
return dict(items=series_list)
|
return dict(items=search_list)
|
||||||
|
|
||||||
|
|
||||||
@route(base_url + 'edit_series/<no:int>', method='POST')
|
@route(base_url + 'edit_series/<no:int>', method='POST')
|
||||||
|
@ -335,7 +350,7 @@ def movie(no):
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
|
|
||||||
movies_details = []
|
movies_details = []
|
||||||
movies_details = c.execute("SELECT title, overview, poster, fanart, hearing_impaired, tmdbid, audio_language, languages, path_substitution(path) FROM table_movies WHERE radarrId LIKE ?", (str(no),)).fetchone()
|
movies_details = c.execute("SELECT title, overview, poster, fanart, hearing_impaired, tmdbid, audio_language, languages, path_substitution(path), subtitles FROM table_movies WHERE radarrId LIKE ?", (str(no),)).fetchone()
|
||||||
tmdbid = movies_details[5]
|
tmdbid = movies_details[5]
|
||||||
|
|
||||||
languages = c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1").fetchall()
|
languages = c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1").fetchall()
|
||||||
|
@ -343,6 +358,36 @@ def movie(no):
|
||||||
|
|
||||||
return template('movie', __file__=__file__, bazarr_version=bazarr_version, no=no, details=movies_details, languages=languages, url_radarr_short=url_radarr_short, base_url=base_url, tmdbid=tmdbid)
|
return template('movie', __file__=__file__, bazarr_version=bazarr_version, no=no, details=movies_details, languages=languages, url_radarr_short=url_radarr_short, base_url=base_url, tmdbid=tmdbid)
|
||||||
|
|
||||||
|
@route(base_url + 'edit_movie/<no:int>', method='POST')
|
||||||
|
def edit_movie(no):
|
||||||
|
ref = request.environ['HTTP_REFERER']
|
||||||
|
|
||||||
|
lang = request.forms.getall('languages')
|
||||||
|
if len(lang) > 0:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
lang = 'None'
|
||||||
|
|
||||||
|
if str(lang) == "['']":
|
||||||
|
lang = '[]'
|
||||||
|
|
||||||
|
hi = request.forms.get('hearing_impaired')
|
||||||
|
|
||||||
|
if hi == "on":
|
||||||
|
hi = "True"
|
||||||
|
else:
|
||||||
|
hi = "False"
|
||||||
|
|
||||||
|
conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
||||||
|
c = conn.cursor()
|
||||||
|
c.execute("UPDATE table_movies SET languages = ?, hearing_impaired = ? WHERE radarrId LIKE ?", (str(lang), hi, no))
|
||||||
|
conn.commit()
|
||||||
|
c.close()
|
||||||
|
|
||||||
|
list_missing_subtitles_movies(no)
|
||||||
|
|
||||||
|
redirect(ref)
|
||||||
|
|
||||||
@route(base_url + 'scan_disk/<no:int>', method='GET')
|
@route(base_url + 'scan_disk/<no:int>', method='GET')
|
||||||
def scan_disk(no):
|
def scan_disk(no):
|
||||||
ref = request.environ['HTTP_REFERER']
|
ref = request.environ['HTTP_REFERER']
|
||||||
|
@ -351,6 +396,14 @@ def scan_disk(no):
|
||||||
|
|
||||||
redirect(ref)
|
redirect(ref)
|
||||||
|
|
||||||
|
@route(base_url + 'scan_disk_movie/<no:int>', method='GET')
|
||||||
|
def scan_disk_movie(no):
|
||||||
|
ref = request.environ['HTTP_REFERER']
|
||||||
|
|
||||||
|
movies_scan_subtitles(no)
|
||||||
|
|
||||||
|
redirect(ref)
|
||||||
|
|
||||||
@route(base_url + 'search_missing_subtitles/<no:int>', method='GET')
|
@route(base_url + 'search_missing_subtitles/<no:int>', method='GET')
|
||||||
def search_missing_subtitles(no):
|
def search_missing_subtitles(no):
|
||||||
ref = request.environ['HTTP_REFERER']
|
ref = request.environ['HTTP_REFERER']
|
||||||
|
@ -359,6 +412,14 @@ def search_missing_subtitles(no):
|
||||||
|
|
||||||
redirect(ref)
|
redirect(ref)
|
||||||
|
|
||||||
|
@route(base_url + 'search_missing_subtitles_movie/<no:int>', method='GET')
|
||||||
|
def search_missing_subtitles_movie(no):
|
||||||
|
ref = request.environ['HTTP_REFERER']
|
||||||
|
|
||||||
|
movies_download_subtitles(no)
|
||||||
|
|
||||||
|
redirect(ref)
|
||||||
|
|
||||||
@route(base_url + 'history')
|
@route(base_url + 'history')
|
||||||
def history():
|
def history():
|
||||||
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
||||||
|
|
|
@ -44,14 +44,25 @@ def update_movies():
|
||||||
except:
|
except:
|
||||||
fanart = ""
|
fanart = ""
|
||||||
|
|
||||||
|
if 'sceneName' in movie['movieFile']:
|
||||||
|
sceneName = movie['movieFile']['sceneName']
|
||||||
|
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
|
||||||
|
if movie['path'][0] == "/":
|
||||||
|
separator = "/"
|
||||||
|
else:
|
||||||
|
separator == "\\"
|
||||||
|
|
||||||
# Update or insert movies list in database table
|
# Update or insert movies list in database table
|
||||||
try:
|
try:
|
||||||
c.execute('''INSERT INTO table_movies(title, path, tmdbId, languages,`hearing_impaired`, radarrId, overview, poster, fanart, `audio_language`) VALUES (?,?,?,(SELECT languages FROM table_movies WHERE tmdbId = ?),(SELECT `hearing_impaired` FROM table_movies WHERE tmdbId = ?), ?, ?, ?, ?, ?)''', (movie["title"], os.path.join(movie["path"], movie['movieFile']['relativePath']), movie["tmdbId"], movie["tmdbId"], movie["tmdbId"], movie["id"], overview, poster, fanart, profile_id_to_language(movie['qualityProfileId'])))
|
c.execute('''INSERT INTO table_movies(title, path, tmdbId, languages,`hearing_impaired`, radarrId, overview, poster, fanart, `audio_language`, sceneName) VALUES (?,?,?,(SELECT languages FROM table_movies WHERE tmdbId = ?),(SELECT `hearing_impaired` FROM table_movies WHERE tmdbId = ?), ?, ?, ?, ?, ?, ?)''', (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))
|
||||||
except:
|
except:
|
||||||
c.execute('''UPDATE table_movies SET title = ?, path = ?, tmdbId = ?, radarrId = ?, overview = ?, poster = ?, fanart = ?, `audio_language` = ? WHERE tmdbid = ?''', (movie["title"],os.path.join(movie["path"], movie['movieFile']['relativePath']),movie["tmdbId"],movie["id"],overview,poster,fanart,profile_id_to_language(movie['qualityProfileId']),movie["tmdbId"]))
|
c.execute('''UPDATE table_movies SET title = ?, path = ?, tmdbId = ?, radarrId = ?, overview = ?, poster = ?, fanart = ?, `audio_language` = ?, sceneName = ? WHERE tmdbid = ?''', (movie["title"],movie["path"] + separator + movie['movieFile']['relativePath'],movie["tmdbId"],movie["id"],overview,poster,fanart,profile_id_to_language(movie['qualityProfileId']),sceneName,movie["tmdbId"]))
|
||||||
|
|
||||||
# Delete movies not in radarr anymore
|
# Delete movies not in radarr anymore
|
||||||
deleted_items = []
|
deleted_items = []
|
||||||
|
|
|
@ -10,7 +10,7 @@ from bs4 import UnicodeDammit
|
||||||
from get_general_settings import *
|
from get_general_settings import *
|
||||||
from list_subtitles import *
|
from list_subtitles import *
|
||||||
from utils import *
|
from utils import *
|
||||||
from notifier import send_notifications
|
from notifier import send_notifications, send_notifications_movie
|
||||||
|
|
||||||
# configure the cache
|
# configure the cache
|
||||||
region.configure('dogpile.cache.memory')
|
region.configure('dogpile.cache.memory')
|
||||||
|
@ -129,6 +129,40 @@ def series_download_subtitles(no):
|
||||||
send_notifications(no, episode[2], message)
|
send_notifications(no, episode[2], message)
|
||||||
list_missing_subtitles(no)
|
list_missing_subtitles(no)
|
||||||
|
|
||||||
|
|
||||||
|
def movies_download_subtitles(no):
|
||||||
|
conn_db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
||||||
|
c_db = conn_db.cursor()
|
||||||
|
movie = c_db.execute("SELECT path, missing_subtitles, radarrId, sceneName, hearing_impaired FROM table_movies WHERE radarrId = ?", (no,)).fetchone()
|
||||||
|
enabled_providers = c_db.execute("SELECT * FROM table_settings_providers WHERE enabled = 1").fetchall()
|
||||||
|
c_db.close()
|
||||||
|
|
||||||
|
providers_list = []
|
||||||
|
providers_auth = {}
|
||||||
|
if len(enabled_providers) > 0:
|
||||||
|
for provider in enabled_providers:
|
||||||
|
providers_list.append(provider[0])
|
||||||
|
try:
|
||||||
|
if provider[2] is not '' and provider[3] is not '':
|
||||||
|
provider_auth = providers_auth.append(provider[0])
|
||||||
|
provider_auth.update({'username': providers[2], 'password': providers[3]})
|
||||||
|
else:
|
||||||
|
providers_auth = None
|
||||||
|
except:
|
||||||
|
providers_auth = None
|
||||||
|
else:
|
||||||
|
providers_list = None
|
||||||
|
providers_auth = None
|
||||||
|
|
||||||
|
for language in ast.literal_eval(movie[1]):
|
||||||
|
message = download_subtitle(path_replace(movie[0]), str(pycountry.languages.lookup(language).alpha_3), movie[4], providers_list, providers_auth, movie[3])
|
||||||
|
if message is not None:
|
||||||
|
store_subtitles_movie(path_replace(movie[0]))
|
||||||
|
history_log_movie(1, no, message)
|
||||||
|
send_notifications_movie(no, message)
|
||||||
|
list_missing_subtitles_movies(no)
|
||||||
|
|
||||||
|
|
||||||
def wanted_download_subtitles(path):
|
def wanted_download_subtitles(path):
|
||||||
conn_db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
conn_db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
||||||
c_db = conn_db.cursor()
|
c_db = conn_db.cursor()
|
||||||
|
|
|
@ -145,6 +145,43 @@ def list_missing_subtitles(*no):
|
||||||
conn_db.commit()
|
conn_db.commit()
|
||||||
c_db.close()
|
c_db.close()
|
||||||
|
|
||||||
|
|
||||||
|
def list_missing_subtitles_movies(*no):
|
||||||
|
query_string = ''
|
||||||
|
try:
|
||||||
|
query_string = " WHERE table_movies.radarrId = " + str(no[0])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
conn_db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
||||||
|
c_db = conn_db.cursor()
|
||||||
|
movies_subtitles = c_db.execute("SELECT radarrId, subtitles, languages FROM table_movies" + query_string).fetchall()
|
||||||
|
c_db.close()
|
||||||
|
|
||||||
|
missing_subtitles_global = []
|
||||||
|
|
||||||
|
for movie_subtitles in movies_subtitles:
|
||||||
|
actual_subtitles = []
|
||||||
|
desired_subtitles = []
|
||||||
|
missing_subtitles = []
|
||||||
|
if movie_subtitles[1] != None:
|
||||||
|
actual_subtitles = ast.literal_eval(movie_subtitles[1])
|
||||||
|
if movie_subtitles[2] != None:
|
||||||
|
desired_subtitles = ast.literal_eval(movie_subtitles[2])
|
||||||
|
actual_subtitles_list = []
|
||||||
|
if desired_subtitles == None:
|
||||||
|
missing_subtitles_global.append(tuple(['[]', movie_subtitles[0]]))
|
||||||
|
else:
|
||||||
|
for item in actual_subtitles:
|
||||||
|
actual_subtitles_list.append(item[0])
|
||||||
|
missing_subtitles = list(set(desired_subtitles) - set(actual_subtitles_list))
|
||||||
|
missing_subtitles_global.append(tuple([str(missing_subtitles), movie_subtitles[0]]))
|
||||||
|
|
||||||
|
conn_db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
||||||
|
c_db = conn_db.cursor()
|
||||||
|
c_db.executemany("UPDATE table_movies SET missing_subtitles = ? WHERE radarrId = ?", (missing_subtitles_global))
|
||||||
|
conn_db.commit()
|
||||||
|
c_db.close()
|
||||||
|
|
||||||
def full_scan_subtitles():
|
def full_scan_subtitles():
|
||||||
conn_db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
conn_db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
||||||
c_db = conn_db.cursor()
|
c_db = conn_db.cursor()
|
||||||
|
@ -174,6 +211,19 @@ def series_scan_subtitles(no):
|
||||||
|
|
||||||
list_missing_subtitles(no)
|
list_missing_subtitles(no)
|
||||||
|
|
||||||
|
|
||||||
|
def movies_scan_subtitles(no):
|
||||||
|
conn_db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
||||||
|
c_db = conn_db.cursor()
|
||||||
|
movies = c_db.execute("SELECT path FROM table_movies WHERE radarrId = ?", (no,)).fetchall()
|
||||||
|
c_db.close()
|
||||||
|
|
||||||
|
for movie in movies:
|
||||||
|
store_subtitles_movie(path_replace(movie[0]))
|
||||||
|
|
||||||
|
list_missing_subtitles_movies(no)
|
||||||
|
|
||||||
|
|
||||||
def new_scan_subtitles():
|
def new_scan_subtitles():
|
||||||
conn_db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
conn_db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
||||||
c_db = conn_db.cursor()
|
c_db = conn_db.cursor()
|
||||||
|
@ -182,3 +232,6 @@ def new_scan_subtitles():
|
||||||
|
|
||||||
for episode in episodes:
|
for episode in episodes:
|
||||||
store_subtitles(path_replace(episode[0]))
|
store_subtitles(path_replace(episode[0]))
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
full_scan_subtitles()
|
24
notifier.py
24
notifier.py
|
@ -26,6 +26,14 @@ def get_episode_name(sonarrEpisodeId):
|
||||||
|
|
||||||
return data[0]
|
return data[0]
|
||||||
|
|
||||||
|
def get_movies_name(radarrId):
|
||||||
|
conn_db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
||||||
|
c_db = conn_db.cursor()
|
||||||
|
data = c_db.execute('SELECT title FROM table_movies WHERE radarrId = ?', (radarrId,)).fetchone()
|
||||||
|
c_db.close()
|
||||||
|
|
||||||
|
return data[0]
|
||||||
|
|
||||||
def send_notifications(sonarrSeriesId, sonarrEpisodeId, message):
|
def send_notifications(sonarrSeriesId, sonarrEpisodeId, message):
|
||||||
providers = get_notifier_providers()
|
providers = get_notifier_providers()
|
||||||
series = get_series_name(sonarrSeriesId)
|
series = get_series_name(sonarrSeriesId)
|
||||||
|
@ -41,3 +49,19 @@ def send_notifications(sonarrSeriesId, sonarrEpisodeId, message):
|
||||||
title='Bazarr notification',
|
title='Bazarr notification',
|
||||||
body=series + ' - ' + episode + ' : ' + message,
|
body=series + ' - ' + episode + ' : ' + message,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def send_notifications_movie(radarrId, message):
|
||||||
|
providers = get_notifier_providers()
|
||||||
|
movie = get_movies_name(radarrId)
|
||||||
|
|
||||||
|
apobj = apprise.Apprise()
|
||||||
|
|
||||||
|
for provider in providers:
|
||||||
|
if provider[1] is not None:
|
||||||
|
apobj.add(provider[1])
|
||||||
|
|
||||||
|
apobj.notify(
|
||||||
|
title='Bazarr notification',
|
||||||
|
body=movie + ' : ' + message,
|
||||||
|
)
|
|
@ -88,7 +88,12 @@ if os.path.exists(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
c.execute('CREATE TABLE "table_movies" ( `tmdbId` TEXT NOT NULL UNIQUE, `title` TEXT NOT NULL, `path` TEXT NOT NULL UNIQUE, `languages` TEXT, `subtitles` TEXT, `missing_subtitles` TEXT, `hearing_impaired` TEXT, `radarrId` INTEGER NOT NULL UNIQUE, `overview` TEXT, `poster` TEXT, `fanart` TEXT, "audio_language" "text", `sceceName` TEXT, PRIMARY KEY(`tmdbId`) )')
|
c.execute('CREATE TABLE "table_movies" ( `tmdbId` TEXT NOT NULL UNIQUE, `title` TEXT NOT NULL, `path` TEXT NOT NULL UNIQUE, `languages` TEXT, `subtitles` TEXT, `missing_subtitles` TEXT, `hearing_impaired` TEXT, `radarrId` INTEGER NOT NULL UNIQUE, `overview` TEXT, `poster` TEXT, `fanart` TEXT, "audio_language" "text", `sceneName` TEXT, PRIMARY KEY(`tmdbId`) )')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
c.execute('CREATE TABLE "table_history_movie" ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, `action` INTEGER NOT NULL, `radarrId` INTEGER NOT NULL, `timestamp` INTEGER NOT NULL, `description` TEXT NOT NULL )')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
14
utils.py
14
utils.py
|
@ -15,3 +15,17 @@ def history_log(action, sonarrSeriesId, sonarrEpisodeId, description):
|
||||||
|
|
||||||
# Close database connection
|
# Close database connection
|
||||||
db.close()
|
db.close()
|
||||||
|
|
||||||
|
|
||||||
|
def history_log_movie(action, radarrId, description):
|
||||||
|
# Open database connection
|
||||||
|
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
||||||
|
c = db.cursor()
|
||||||
|
|
||||||
|
history = c.execute('''INSERT INTO table_history_movie(action, radarrId, timestamp, description) VALUES (?, ?, ?, ?)''', (action, radarrId, time.time(), description))
|
||||||
|
|
||||||
|
# Commit changes to DB
|
||||||
|
db.commit()
|
||||||
|
|
||||||
|
# Close database connection
|
||||||
|
db.close()
|
||||||
|
|
|
@ -114,7 +114,7 @@
|
||||||
$('.ui.search')
|
$('.ui.search')
|
||||||
.search({
|
.search({
|
||||||
apiSettings: {
|
apiSettings: {
|
||||||
url: '{{base_url}}series_json/{query}',
|
url: '{{base_url}}search_json/{query}',
|
||||||
onResponse: function(results) {
|
onResponse: function(results) {
|
||||||
var response = {
|
var response = {
|
||||||
results : []
|
results : []
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
background-color: #1b1c1d;
|
background-color: #1b1c1d;
|
||||||
background-image: url("{{base_url}}image_proxy{{details[3]}}");
|
background-image: url("{{base_url}}image_proxy_movies{{details[3]}}");
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-attachment: fixed;
|
background-attachment: fixed;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
%import pycountry
|
%import pycountry
|
||||||
%from get_general_settings import *
|
%from get_general_settings import *
|
||||||
%single_language = get_general_settings()[7]
|
%single_language = get_general_settings()[7]
|
||||||
<div style="display: none;"><img src="{{base_url}}image_proxy{{details[3]}}"></div>
|
<div style="display: none;"><img src="{{base_url}}image_proxy_movies{{details[3]}}"></div>
|
||||||
<div id='loader' class="ui page dimmer">
|
<div id='loader' class="ui page dimmer">
|
||||||
<div class="ui indeterminate text loader">Loading...</div>
|
<div class="ui indeterminate text loader">Loading...</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -102,6 +102,22 @@
|
||||||
%end
|
%end
|
||||||
</p>
|
</p>
|
||||||
<div style='clear:both;'></div>
|
<div style='clear:both;'></div>
|
||||||
|
|
||||||
|
<div id="fondblanc" class="ui container">
|
||||||
|
<h1 class="ui header">Subtitles</h1>
|
||||||
|
<table class="ui very basic single line selectable table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Existing subtitles</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>{{details[9]}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -167,11 +183,11 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$('#scan_disk').click(function(){
|
$('#scan_disk').click(function(){
|
||||||
window.location = '{{base_url}}scan_disk/{{no}}';
|
window.location = '{{base_url}}scan_disk_movie/{{no}}';
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#search_missing_subtitles').click(function(){
|
$('#search_missing_subtitles').click(function(){
|
||||||
window.location = '{{base_url}}search_missing_subtitles/{{no}}';
|
window.location = '{{base_url}}search_missing_subtitles_movie/{{no}}';
|
||||||
})
|
})
|
||||||
|
|
||||||
$('.remove_subtitles').click(function(){
|
$('.remove_subtitles').click(function(){
|
||||||
|
@ -221,7 +237,7 @@
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
$('a, i').click(function(){
|
$('a, .menu .item, button:not(#config, .cancel)').click(function(){
|
||||||
$('#loader').addClass('active');
|
$('#loader').addClass('active');
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@
|
||||||
$('.config').click(function(){
|
$('.config').click(function(){
|
||||||
sessionStorage.scrolly=$(window).scrollTop();
|
sessionStorage.scrolly=$(window).scrollTop();
|
||||||
|
|
||||||
$('#movies_form').attr('action', '{{base_url}}edit_movies/' + $(this).data("no"));
|
$('#movies_form').attr('action', '{{base_url}}edit_movie/' + $(this).data("no"));
|
||||||
|
|
||||||
$("#movies_title").html($(this).data("title"));
|
$("#movies_title").html($(this).data("title"));
|
||||||
$("#movies_poster").attr("src", "{{base_url}}image_proxy_movies" + $(this).data("poster"));
|
$("#movies_poster").attr("src", "{{base_url}}image_proxy_movies" + $(this).data("poster"));
|
||||||
|
|
|
@ -473,7 +473,7 @@
|
||||||
<div class="ui grid">
|
<div class="ui grid">
|
||||||
<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>Use Sonarr scene naming</label>
|
<label>Use scene name when available</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="one wide column">
|
<div class="one wide column">
|
||||||
<div id="settings_scenename" class="ui toggle checkbox" data-scenename={{settings_general[11]}}>
|
<div id="settings_scenename" class="ui toggle checkbox" data-scenename={{settings_general[11]}}>
|
||||||
|
|
Loading…
Reference in a new issue