mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-02-23 06:16:36 +08:00
Switching episodes page to peewee.
This commit is contained in:
parent
9336473f0b
commit
874984d529
4 changed files with 206 additions and 132 deletions
|
@ -124,8 +124,8 @@ class TableHistory(BaseModel):
|
|||
language = TextField(null=True)
|
||||
provider = TextField(null=True)
|
||||
score = TextField(null=True)
|
||||
sonarr_episode_id = ForeignKeyField(TableEpisodes, field='sonarr_episode_id' column_name='sonarrEpisodeId')
|
||||
sonarr_series_id = ForeignKeyField(TableShows, field='sonarr_series_id' column_name='sonarrSeriesId')
|
||||
sonarr_episode_id = ForeignKeyField(TableEpisodes, field='sonarr_episode_id', column_name='sonarrEpisodeId')
|
||||
sonarr_series_id = ForeignKeyField(TableShows, field='sonarr_series_id', column_name='sonarrSeriesId')
|
||||
timestamp = IntegerField()
|
||||
video_path = TextField(null=True)
|
||||
|
||||
|
@ -138,7 +138,7 @@ class TableHistoryMovie(BaseModel):
|
|||
description = TextField()
|
||||
language = TextField(null=True)
|
||||
provider = TextField(null=True)
|
||||
radarr_id = ForeignKeyField(TableMovies, field='radarr_id' column_name='radarrId')
|
||||
radarr_id = ForeignKeyField(TableMovies, field='radarr_id', column_name='radarrId')
|
||||
score = TextField(null=True)
|
||||
timestamp = IntegerField()
|
||||
video_path = TextField(null=True)
|
||||
|
|
245
bazarr/main.py
245
bazarr/main.py
|
@ -23,7 +23,8 @@ import operator
|
|||
from get_args import args
|
||||
from init import *
|
||||
from update_db import *
|
||||
from database import TableEpisodes, TableShows, TableMovies, TableHistory, TableHistoryMovie, TableSettingsLanguages, path_substitution
|
||||
from database import TableEpisodes, TableShows, TableMovies, TableHistory, TableHistoryMovie, TableSettingsLanguages, \
|
||||
System, path_substitution
|
||||
from notifier import update_notifier
|
||||
from logger import configure_logging, empty_log
|
||||
|
||||
|
@ -82,11 +83,10 @@ else:
|
|||
bottle.ERROR_PAGE_TEMPLATE = bottle.ERROR_PAGE_TEMPLATE.replace('if DEBUG and', 'if')
|
||||
|
||||
# Reset restart required warning on start
|
||||
conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
||||
c = conn.cursor()
|
||||
c.execute("UPDATE system SET configured = 0, updated = 0")
|
||||
conn.commit()
|
||||
c.close()
|
||||
System.update({
|
||||
System.configured: 0,
|
||||
System.updated: 0
|
||||
}).execute()
|
||||
|
||||
# Load languages in database
|
||||
load_language_in_db()
|
||||
|
@ -207,12 +207,12 @@ def restart():
|
|||
@custom_auth_basic(check_credentials)
|
||||
def wizard():
|
||||
authorize()
|
||||
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
||||
c = db.cursor()
|
||||
settings_languages = c.execute("SELECT * FROM table_settings_languages ORDER BY name").fetchall()
|
||||
|
||||
# Get languages list
|
||||
settings_languages = TableSettingsLanguages.select().order_by(TableSettingsLanguages.name)
|
||||
# Get providers list
|
||||
settings_providers = sorted(provider_manager.names())
|
||||
c.close()
|
||||
|
||||
|
||||
return template('wizard', bazarr_version=bazarr_version, settings=settings,
|
||||
settings_languages=settings_languages, settings_providers=settings_providers,
|
||||
base_url=base_url)
|
||||
|
@ -223,9 +223,6 @@ def wizard():
|
|||
def save_wizard():
|
||||
authorize()
|
||||
|
||||
conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
||||
c = conn.cursor()
|
||||
|
||||
settings_general_ip = request.forms.get('settings_general_ip')
|
||||
settings_general_port = request.forms.get('settings_general_port')
|
||||
settings_general_baseurl = request.forms.get('settings_general_baseurl')
|
||||
|
@ -381,9 +378,15 @@ def save_wizard():
|
|||
settings.betaseries.token = request.forms.get('settings_betaseries_token')
|
||||
|
||||
settings_subliminal_languages = request.forms.getall('settings_subliminal_languages')
|
||||
c.execute("UPDATE table_settings_languages SET enabled = 0")
|
||||
# Disable all languages in DB
|
||||
TableSettingsLanguages.update({TableSettingsLanguages.enabled: 0})
|
||||
for item in settings_subliminal_languages:
|
||||
c.execute("UPDATE table_settings_languages SET enabled = '1' WHERE code2 = ?", (item,))
|
||||
# Enable each desired language in DB
|
||||
TableSettingsLanguages.update(
|
||||
{TableSettingsLanguages.enabled: 1}
|
||||
).where(
|
||||
TableSettingsLanguages.code2 == item
|
||||
).execute()
|
||||
|
||||
settings_serie_default_enabled = request.forms.get('settings_serie_default_enabled')
|
||||
if settings_serie_default_enabled is None:
|
||||
|
@ -429,9 +432,6 @@ def save_wizard():
|
|||
with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle:
|
||||
settings.write(handle)
|
||||
|
||||
conn.commit()
|
||||
c.close()
|
||||
|
||||
configured()
|
||||
redirect(base_url)
|
||||
|
||||
|
@ -607,53 +607,76 @@ def series():
|
|||
@custom_auth_basic(check_credentials)
|
||||
def serieseditor():
|
||||
authorize()
|
||||
single_language = settings.general.getboolean('single_language')
|
||||
|
||||
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
||||
db.create_function("path_substitution", 1, path_replace)
|
||||
c = db.cursor()
|
||||
# Get missing count
|
||||
missing_count = TableShows().select().count()
|
||||
|
||||
c.execute("SELECT COUNT(*) FROM table_shows")
|
||||
missing_count = c.fetchone()
|
||||
missing_count = missing_count[0]
|
||||
|
||||
c.execute(
|
||||
"SELECT tvdbId, title, path_substitution(path), languages, hearing_impaired, sonarrSeriesId, poster, audio_language, forced FROM table_shows ORDER BY title ASC")
|
||||
data = c.fetchall()
|
||||
c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1")
|
||||
languages = c.fetchall()
|
||||
c.close()
|
||||
output = template('serieseditor', bazarr_version=bazarr_version, rows=data, languages=languages,
|
||||
missing_count=missing_count, base_url=base_url, single_language=single_language,
|
||||
current_port=settings.general.port)
|
||||
return output
|
||||
# Get movies list
|
||||
data = TableShows.select(
|
||||
TableShows.tvdb_id,
|
||||
TableShows.title,
|
||||
fn.path_substitution(TableShows.path).alias('path'),
|
||||
TableShows.languages,
|
||||
TableShows.hearing_impaired,
|
||||
TableShows.sonarr_series_id,
|
||||
TableShows.poster,
|
||||
TableShows.audio_language,
|
||||
TableShows.forced
|
||||
).order_by(
|
||||
TableShows.sort_title.asc()
|
||||
)
|
||||
|
||||
# Get languages list
|
||||
languages = TableSettingsLanguages.select(
|
||||
TableSettingsLanguages.code2,
|
||||
TableSettingsLanguages.name
|
||||
).where(
|
||||
TableSettingsLanguages.enabled == 1
|
||||
)
|
||||
|
||||
return template('serieseditor', bazarr_version=bazarr_version, rows=data, languages=languages,
|
||||
missing_count=missing_count, base_url=base_url,
|
||||
single_language=settings.general.getboolean('single_language'), current_port=settings.general.port)
|
||||
|
||||
|
||||
@route(base_url + 'search_json/<query>', method='GET')
|
||||
@custom_auth_basic(check_credentials)
|
||||
def search_json(query):
|
||||
authorize()
|
||||
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
||||
c = db.cursor()
|
||||
|
||||
|
||||
query = '%' + query + '%'
|
||||
search_list = []
|
||||
|
||||
if settings.general.getboolean('use_sonarr'):
|
||||
c.execute("SELECT title, sonarrSeriesId, year FROM table_shows WHERE title LIKE ? ORDER BY title",
|
||||
('%' + query + '%',))
|
||||
series = c.fetchall()
|
||||
# Get matching series
|
||||
series = TableShows.select(
|
||||
TableShows.title,
|
||||
TableShows.sonarr_series_id,
|
||||
TableShows.year
|
||||
).where(
|
||||
TableShows.title ** query
|
||||
).order_by(
|
||||
TableShows.title.asc()
|
||||
)
|
||||
for serie in series:
|
||||
search_list.append(dict([('name', re.sub(r'\ \(\d{4}\)', '', serie[0]) + ' (' + serie[2] + ')'),
|
||||
('url', base_url + 'episodes/' + str(serie[1]))]))
|
||||
search_list.append(dict([('name', re.sub(r'\ \(\d{4}\)', '', serie.title) + ' (' + serie.year + ')'),
|
||||
('url', base_url + 'episodes/' + str(serie.sonarr_series_id))]))
|
||||
|
||||
if settings.general.getboolean('use_radarr'):
|
||||
c.execute("SELECT title, radarrId, year FROM table_movies WHERE title LIKE ? ORDER BY title",
|
||||
('%' + query + '%',))
|
||||
movies = c.fetchall()
|
||||
# Get matching movies
|
||||
movies = TableMovies.select(
|
||||
TableMovies.title,
|
||||
TableMovies.radarr_id,
|
||||
TableMovies.year
|
||||
).where(
|
||||
TableMovies.title ** query
|
||||
).order_by(
|
||||
TableMovies.title.asc()
|
||||
)
|
||||
for movie in movies:
|
||||
search_list.append(dict([('name', re.sub(r'\ \(\d{4}\)', '', movie[0]) + ' (' + movie[2] + ')'),
|
||||
('url', base_url + 'movie/' + str(movie[1]))]))
|
||||
c.close()
|
||||
|
||||
search_list.append(dict([('name', re.sub(r'\ \(\d{4}\)', '', movie.title) + ' (' + movie.year + ')'),
|
||||
('url', base_url + 'movie/' + str(movie.radarr_id))]))
|
||||
|
||||
response.content_type = 'application/json'
|
||||
return dict(items=search_list)
|
||||
|
||||
|
@ -687,14 +710,17 @@ def edit_series(no):
|
|||
hi = "True"
|
||||
else:
|
||||
hi = "False"
|
||||
|
||||
conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
||||
c = conn.cursor()
|
||||
c.execute("UPDATE table_shows SET languages = ?, hearing_impaired = ?, forced = ? WHERE sonarrSeriesId LIKE ?",
|
||||
(str(lang), hi, forced, no))
|
||||
conn.commit()
|
||||
c.close()
|
||||
|
||||
|
||||
result = TableShows.update(
|
||||
{
|
||||
TableShows.languages: lang,
|
||||
TableShows.hearing_impaired: hi,
|
||||
TableShows.forced: forced
|
||||
}
|
||||
).where(
|
||||
TableShows.sonarr_series_id ** no
|
||||
).execute()
|
||||
|
||||
list_missing_subtitles(no)
|
||||
|
||||
redirect(ref)
|
||||
|
@ -712,23 +738,35 @@ def edit_serieseditor():
|
|||
hi = request.forms.get('hearing_impaired')
|
||||
forced = request.forms.get('forced')
|
||||
|
||||
conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
||||
c = conn.cursor()
|
||||
|
||||
for serie in series:
|
||||
if str(lang) != "[]" and str(lang) != "['']":
|
||||
if str(lang) == "['None']":
|
||||
lang = 'None'
|
||||
else:
|
||||
lang = str(lang)
|
||||
c.execute("UPDATE table_shows SET languages = ? WHERE sonarrSeriesId LIKE ?", (lang, serie))
|
||||
TableShows.update(
|
||||
{
|
||||
TableShows.languages: lang
|
||||
}
|
||||
).where(
|
||||
TableShows.sonarr_series_id % serie
|
||||
).execute()
|
||||
if hi != '':
|
||||
c.execute("UPDATE table_shows SET hearing_impaired = ? WHERE sonarrSeriesId LIKE ?", (hi, serie))
|
||||
TableShows.update(
|
||||
{
|
||||
TableShows.hearing_impaired: hi
|
||||
}
|
||||
).where(
|
||||
TableShows.sonarr_series_id % serie
|
||||
).execute()
|
||||
if forced != '':
|
||||
c.execute("UPDATE table_shows SET forced = ? WHERE sonarrSeriesId LIKE ?", (forced, serie))
|
||||
|
||||
conn.commit()
|
||||
c.close()
|
||||
TableShows.update(
|
||||
{
|
||||
TableShows.forced: forced
|
||||
}
|
||||
).where(
|
||||
TableShows.sonarr_series_id % serie
|
||||
).execute()
|
||||
|
||||
for serie in series:
|
||||
list_missing_subtitles(serie)
|
||||
|
@ -740,29 +778,60 @@ def edit_serieseditor():
|
|||
@custom_auth_basic(check_credentials)
|
||||
def episodes(no):
|
||||
authorize()
|
||||
# single_language = settings.general.getboolean('single_language')
|
||||
|
||||
series_details = TableShows.select(
|
||||
TableShows.title,
|
||||
TableShows.overview,
|
||||
TableShows.poster,
|
||||
TableShows.fanart,
|
||||
TableShows.hearing_impaired,
|
||||
TableShows.tvdb_id,
|
||||
TableShows.audio_language,
|
||||
TableShows.languages,
|
||||
fn.path_substitution(TableShows.path).alias('path'),
|
||||
TableShows.forced
|
||||
).where(
|
||||
TableShows.sonarr_series_id ** str(no)
|
||||
).limit(1)
|
||||
for series in series_details:
|
||||
series_details = series
|
||||
break
|
||||
|
||||
tvdbid = series.tvdb_id
|
||||
|
||||
conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
||||
conn.create_function("path_substitution", 1, path_replace)
|
||||
c = conn.cursor()
|
||||
|
||||
series_details = []
|
||||
series_details = c.execute(
|
||||
"SELECT title, overview, poster, fanart, hearing_impaired, tvdbid, audio_language, languages, path_substitution(path), forced FROM table_shows WHERE sonarrSeriesId LIKE ?",
|
||||
(str(no),)).fetchone()
|
||||
tvdbid = series_details[5]
|
||||
|
||||
episodes = c.execute(
|
||||
"SELECT title, path_substitution(path), season, episode, subtitles, sonarrSeriesId, missing_subtitles, sonarrEpisodeId, scene_name, monitored, failedAttempts FROM table_episodes WHERE sonarrSeriesId LIKE ? ORDER BY episode ASC",
|
||||
(str(no),)).fetchall()
|
||||
episodes = TableEpisodes.select(
|
||||
TableEpisodes.title,
|
||||
fn.path_substitution(TableEpisodes.path).alias('path'),
|
||||
TableEpisodes.season,
|
||||
TableEpisodes.episode,
|
||||
TableEpisodes.subtitles,
|
||||
TableEpisodes.sonarr_series_id,
|
||||
TableEpisodes.missing_subtitles,
|
||||
TableEpisodes.sonarr_episode_id,
|
||||
TableEpisodes.scene_name,
|
||||
TableEpisodes.monitored,
|
||||
TableEpisodes.failed_attempts
|
||||
).where(
|
||||
TableEpisodes.sonarr_series_id % no
|
||||
).order_by(
|
||||
TableEpisodes.season.desc(),
|
||||
TableEpisodes.episode.desc()
|
||||
)
|
||||
|
||||
number = len(episodes)
|
||||
languages = c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1").fetchall()
|
||||
c.close()
|
||||
episodes = reversed(sorted(episodes, key=operator.itemgetter(2)))
|
||||
|
||||
languages = TableSettingsLanguages.select(
|
||||
TableSettingsLanguages.code2,
|
||||
TableSettingsLanguages.name
|
||||
).where(
|
||||
TableSettingsLanguages.enabled == 1
|
||||
)
|
||||
|
||||
#episodes = reversed(sorted(episodes, key=operator.itemgetter(season)))
|
||||
seasons_list = []
|
||||
for key, season in itertools.groupby(episodes, operator.itemgetter(2)):
|
||||
for key, season in itertools.groupby(episodes.dicts(), lambda x: x['season']):
|
||||
seasons_list.append(list(season))
|
||||
|
||||
|
||||
return template('episodes', bazarr_version=bazarr_version, no=no, details=series_details,
|
||||
languages=languages, seasons=seasons_list, url_sonarr_short=url_sonarr_short, base_url=base_url,
|
||||
tvdbid=tvdbid, number=number, current_port=settings.general.port)
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
<meta name="msapplication-config" content="{{base_url}}static/browserconfig.xml">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
<title>{{details[0]}} - Bazarr</title>
|
||||
<title>{{details.title}} - Bazarr</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #1b1c1d;
|
||||
background-image: url("{{base_url}}image_proxy{{details[3]}}");
|
||||
background-image: url("{{base_url}}image_proxy{{details.fanart}}");
|
||||
background-repeat: no-repeat;
|
||||
background-attachment: fixed;
|
||||
background-size: cover;
|
||||
|
@ -92,7 +92,7 @@
|
|||
%from config import settings
|
||||
%from helper import path_replace
|
||||
%single_language = settings.general.getboolean('single_language')
|
||||
<div style="display: none;"><img src="{{base_url}}image_proxy{{details[3]}}"></div>
|
||||
<div style="display: none;"><img src="{{base_url}}image_proxy{{details.fanart}}"></div>
|
||||
<div id='loader' class="ui page dimmer">
|
||||
<div id="loader_text" class="ui indeterminate text loader">Loading...</div>
|
||||
</div>
|
||||
|
@ -102,14 +102,14 @@
|
|||
<div id="divdetails" class="ui container">
|
||||
<div class="ui stackable grid">
|
||||
<div class="three wide column">
|
||||
<img class="ui image" style="max-height:250px;" src="{{base_url}}image_proxy{{details[2]}}">
|
||||
<img class="ui image" style="max-height:250px;" src="{{base_url}}image_proxy{{details.poster}}">
|
||||
</div>
|
||||
|
||||
<div class="thirteen wide column">
|
||||
<div class="ui stackable grid">
|
||||
<div class="ui row">
|
||||
<div class="twelve wide left aligned column">
|
||||
<h2>{{details[0]}}</h2>
|
||||
<h2>{{details.title}}</h2>
|
||||
</div>
|
||||
|
||||
<div class="four wide right aligned column">
|
||||
|
@ -117,7 +117,7 @@
|
|||
<button id="scan_disk" class="ui button" data-tooltip="Scan disk for subtitles"><i class="ui inverted large compact refresh icon"></i></button>
|
||||
<button id="search_missing_subtitles" class="ui button" data-tooltip="Download missing subtitles"><i class="ui inverted huge compact search icon"></i></button>
|
||||
<%
|
||||
subs_languages = ast.literal_eval(str(details[7]))
|
||||
subs_languages = ast.literal_eval(str(details.languages))
|
||||
subs_languages_list = []
|
||||
if subs_languages is not None:
|
||||
for subs_language in subs_languages:
|
||||
|
@ -125,18 +125,18 @@
|
|||
end
|
||||
end
|
||||
%>
|
||||
<button id="config" class="ui button" data-tooltip="Edit series" data-tvdbid="{{details[5]}}" data-title="{{details[0]}}" data-poster="{{details[2]}}" data-audio="{{details[6]}}" data-languages="{{!subs_languages_list}}" data-hearing-impaired="{{details[4]}}" data-forced="{{details[9]}}"><i class="ui inverted large compact configure icon"></i></button>
|
||||
<button id="config" class="ui button" data-tooltip="Edit series" data-tvdbid="{{details.tvdb_id}}" data-title="{{details.title}}" data-poster="{{details.poster}}" data-audio="{{details.audio_language}}" data-languages="{{!subs_languages_list}}" data-hearing-impaired="{{details.hearing_impaired}}" data-forced="{{details.forced}}"><i class="ui inverted large compact configure icon"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui row">
|
||||
<p>{{details[1]}}</p>
|
||||
<p>{{details.overview}}</p>
|
||||
</div>
|
||||
|
||||
<div class="ui row">
|
||||
<div class="ui tiny inverted label" style='background-color: #777777;'>{{details[6]}}</div>
|
||||
<div class="ui tiny inverted label" style='background-color: #35c5f4;'>{{details[8]}}</div>
|
||||
<div class="ui tiny inverted label" style='background-color: #777777;'>{{details.audio_language}}</div>
|
||||
<div class="ui tiny inverted label" style='background-color: #35c5f4;'>{{details.path}}</div>
|
||||
<div class="ui tiny inverted label" style='background-color: #35c5f4;'>{{number}} files</div>
|
||||
</div>
|
||||
|
||||
|
@ -147,8 +147,8 @@
|
|||
</div>
|
||||
|
||||
<div class="ui row" style="padding-top: 0em;">
|
||||
<div class="ui tiny inverted label" style='background-color: #777777;'>Hearing-impaired: {{details[4]}}</div>
|
||||
<div class="ui tiny inverted label" style='background-color: #777777;'>Forced: {{details[9]}}</div>
|
||||
<div class="ui tiny inverted label" style='background-color: #777777;'>Hearing-impaired: {{details.hearing_impaired}}</div>
|
||||
<div class="ui tiny inverted label" style='background-color: #777777;'>Forced: {{details.forced}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -162,7 +162,7 @@
|
|||
%else:
|
||||
%for season in seasons:
|
||||
<div id="fondblanc" class="ui container">
|
||||
%missing_subs = len([i for i in season if i[6] != "[]"])
|
||||
%missing_subs = len([i for i in season if i['missing_subtitles'] != "[]"])
|
||||
%total_subs = len(season)
|
||||
%subs_label = ''
|
||||
%if subs_languages is not None:
|
||||
|
@ -174,7 +174,12 @@
|
|||
% end
|
||||
% subs_label = subs_label + ' circular label">' + str(total_subs - missing_subs) + ' / ' + str(total_subs) + '</div>'
|
||||
%end
|
||||
<h1 class="ui header">Season {{season[0][2]}}{{!subs_label}}</h1>
|
||||
% season_number = None
|
||||
% for season_temp in season:
|
||||
% season_number = season_temp['season']
|
||||
% break
|
||||
% end
|
||||
<h1 class="ui header">Season {{season_number}}{{!subs_label}}</h1>
|
||||
<div class="ui accordion">
|
||||
<div class="title">
|
||||
<div class="ui one column stackable center aligned page grid">
|
||||
|
@ -200,22 +205,22 @@
|
|||
%for episode in season:
|
||||
<tr>
|
||||
<td class="collapsing">
|
||||
%if episode[9] == 'True':
|
||||
%if episode['monitored'] == 'True':
|
||||
<span data-tooltip="Episode monitored in Sonarr" data-inverted='' data-position="top left"><i class="bookmark icon"></i></span>
|
||||
%else:
|
||||
<span data-tooltip="Episode unmonitored in Sonarr" data-inverted='' data-position="top left"><i class="bookmark outline icon"></i></span>
|
||||
%end
|
||||
</td>
|
||||
<td>{{episode[3]}}</td>
|
||||
<td>{{episode['episode']}}</td>
|
||||
<td>
|
||||
% if episode[8] is not None:
|
||||
<span data-tooltip="Scenename is: {{episode[8]}}" data-inverted='' data-position="top left"><i class="info circle icon"></i></span>
|
||||
% if episode['scene_name'] is not None:
|
||||
<span data-tooltip="Scenename is: {{episode['scene_name']}}" data-inverted='' data-position="top left"><i class="info circle icon"></i></span>
|
||||
% end
|
||||
<span data-tooltip="Path is: {{episode[1]}}" data-inverted='' data-position="top left">{{episode[0]}}</span>
|
||||
<span data-tooltip="Path is: {{episode['path']}}" data-inverted='' data-position="top left">{{episode['title']}}</span>
|
||||
</td>
|
||||
<td>
|
||||
%if episode[4] is not None:
|
||||
% actual_languages = ast.literal_eval(episode[4])
|
||||
%if episode['subtitles'] is not None:
|
||||
% actual_languages = ast.literal_eval(episode['subtitles'])
|
||||
% actual_languages.sort()
|
||||
%else:
|
||||
% actual_languages = '[]'
|
||||
|
@ -228,7 +233,7 @@
|
|||
% forced = False
|
||||
%end
|
||||
%if language[1] is not None:
|
||||
<a data-episodePath="{{episode[1]}}" data-subtitlesPath="{{path_replace(language[1])}}" data-language="{{alpha3_from_alpha2(str(language[0]))}}" data-sonarrSeriesId={{episode[5]}} data-sonarrEpisodeId={{episode[7]}} class="remove_subtitles ui tiny label">
|
||||
<a data-episodePath="{{episode['path']}}" data-subtitlesPath="{{path_replace(language[1])}}" data-language="{{alpha3_from_alpha2(str(language[0]))}}" data-sonarrSeriesId={{episode['sonarr_series_id']}} data-sonarrEpisodeId={{episode['sonarr_episode_id']}} class="remove_subtitles ui tiny label">
|
||||
{{!'<span class="ui" data-tooltip="Forced" data-inverted=""><i class="exclamation icon"></i></span>' if forced else ''}}{{language[0].split(':')[0]}}
|
||||
<i class="delete icon"></i>
|
||||
</a>
|
||||
|
@ -245,24 +250,24 @@
|
|||
<td>
|
||||
%try:
|
||||
<%
|
||||
if episode[6] is not None:
|
||||
missing_languages = ast.literal_eval(episode[6])
|
||||
if episode['missing_subtitles'] is not None:
|
||||
missing_languages = ast.literal_eval(episode['missing_subtitles'])
|
||||
missing_languages.sort()
|
||||
end
|
||||
if missing_languages is not None:
|
||||
from get_subtitle import search_active
|
||||
for language in missing_languages:
|
||||
if episode[10] is not None and settings.general.getboolean('adaptive_searching') and language in episode[10]:
|
||||
for lang in ast.literal_eval(episode[10]):
|
||||
if episode['failed_attempts'] is not None and settings.general.getboolean('adaptive_searching') and language in episode['failed_attempts']:
|
||||
for lang in ast.literal_eval(episode['failed_attempts']):
|
||||
if language in lang:
|
||||
if search_active(lang[1]):
|
||||
%>
|
||||
<a data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{details[4]}}" data-forced="{{"True" if len(language.split(':')) > 1 else "False"}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="get_subtitle ui tiny label">
|
||||
<a data-episodePath="{{episode['path']}}" data-scenename="{{episode['scene_name']}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{details.hearing_impaired}}" data-forced="{{"True" if len(language.split(':')) > 1 else "False"}}" data-sonarrSeriesId="{{episode['sonarr_series_id']}}" data-sonarrEpisodeId="{{episode['sonarr_episode_id']}}" class="get_subtitle ui tiny label">
|
||||
{{language}}
|
||||
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
|
||||
</a>
|
||||
%else:
|
||||
<a data-tooltip="Automatic searching delayed (adaptive search)" data-position="top right" data-inverted="" data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{details[4]}}" data-forced="{{"True" if len(language.split(':')) > 1 else "False"}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="get_subtitle ui tiny label">
|
||||
<a data-tooltip="Automatic searching delayed (adaptive search)" data-position="top right" data-inverted="" data-episodePath="{{episode['path']}}" data-scenename="{{episode['scene_name']}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{details.hearing_impaired}}" data-forced="{{"True" if len(language.split(':')) > 1 else "False"}}" data-sonarrSeriesId="{{episode['sonarr_series_id']}}" data-sonarrEpisodeId="{{episode['sonarr_episode_id']}}" class="get_subtitle ui tiny label">
|
||||
{{language}}
|
||||
<i style="margin-left:3px; margin-right:0" class="search red icon"></i>
|
||||
</a>
|
||||
|
@ -270,7 +275,7 @@
|
|||
%end
|
||||
%end
|
||||
%else:
|
||||
<a data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{details[4]}}" data-forced="{{"True" if len(language.split(':')) > 1 else "False"}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="get_subtitle ui tiny label">
|
||||
<a data-episodePath="{{episode['path']}}" data-scenename="{{episode['scene_name']}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{details.hearing_impaired}}" data-forced="{{"True" if len(language.split(':')) > 1 else "False"}}" data-sonarrSeriesId="{{episode['sonarr_series_id']}}" data-sonarrEpisodeId="{{episode['sonarr_episode_id']}}" class="get_subtitle ui tiny label">
|
||||
{{language}}
|
||||
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
|
||||
</a>
|
||||
|
@ -283,7 +288,7 @@
|
|||
</td>
|
||||
<td>
|
||||
%if subs_languages is not None:
|
||||
<a data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{subs_languages_list}}" data-hi="{{details[4]}}" data-forced="{{details[9]}}" data-series_title="{{details[0]}}" data-season="{{episode[2]}}" data-episode="{{episode[3]}}" data-episode_title="{{episode[0]}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="manual_search ui tiny label"><i class="ui user icon" style="margin-right:0px" ></i></a>
|
||||
<a data-episodePath="{{episode['path']}}" data-scenename="{{episode['scene_name']}}" data-language="{{subs_languages_list}}" data-hi="{{details.hearing_impaired}}" data-forced="{{details.forced}}" data-series_title="{{details.title}}" data-season="{{episode['season']}}" data-episode="{{episode['episode']}}" data-episode_title="{{episode['title']}}" data-sonarrSeriesId="{{episode['sonarr_series_id']}}" data-sonarrEpisodeId="{{episode['sonarr_episode_id']}}" class="manual_search ui tiny label"><i class="ui user icon" style="margin-right:0px" ></i></a>
|
||||
%end
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -329,7 +334,7 @@
|
|||
<option value="None">None</option>
|
||||
%end
|
||||
%for language in languages:
|
||||
<option value="{{language[0]}}">{{language[1]}}</option>
|
||||
<option value="{{language.code2}}">{{language.name}}</option>
|
||||
%end
|
||||
</select>
|
||||
</div>
|
||||
|
@ -445,7 +450,7 @@
|
|||
forced: $(this).attr("data-forced"),
|
||||
sonarrSeriesId: $(this).attr('data-sonarrSeriesId'),
|
||||
sonarrEpisodeId: $(this).attr('data-sonarrEpisodeId'),
|
||||
title: "{{!details[0].replace("'", "\\'")}}"
|
||||
title: "{{!str(details.title).replace("'", "\\'")}}"
|
||||
};
|
||||
|
||||
$('#loader_text').text("Downloading subtitle to disk...");
|
||||
|
@ -522,7 +527,7 @@
|
|||
forced: forced,
|
||||
sonarrSeriesId: sonarrSeriesId,
|
||||
sonarrEpisodeId: sonarrEpisodeId,
|
||||
title: "{{!details[0].replace("'", "\'")}}"
|
||||
title: "{{!str(details.title).replace("'", "\'")}}"
|
||||
};
|
||||
|
||||
$('#search_result').DataTable( {
|
||||
|
@ -614,7 +619,7 @@
|
|||
hi: hi,
|
||||
sonarrSeriesId: sonarrSeriesId,
|
||||
sonarrEpisodeId: sonarrEpisodeId,
|
||||
title: "{{!details[0].replace("'", "\\'")}}"
|
||||
title: "{{!str(details.title).replace("'", "\\'")}}"
|
||||
};
|
||||
|
||||
$('#loader_text').text("Downloading subtitle to disk...");
|
||||
|
|
|
@ -74,22 +74,22 @@
|
|||
<tr class="selectable">
|
||||
<td class="collapsing">
|
||||
<div class="ui checkbox">
|
||||
<input id='{{row[5]}}' type="checkbox" class="selected">
|
||||
<input id='{{row.sonarr_series_id}}' type="checkbox" class="selected">
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
<td><a href="{{base_url}}episodes/{{row[5]}}">{{row[1]}}</a></td>
|
||||
<td>{{row[7]}}</td>
|
||||
<td><a href="{{base_url}}episodes/{{row.sonarr_series_id}}">{{row.title}}</a></td>
|
||||
<td>{{row.audio_language}}</td>
|
||||
<td>
|
||||
%subs_languages = ast.literal_eval(str(row[3]))
|
||||
%subs_languages = ast.literal_eval(str(row.languages))
|
||||
%if subs_languages is not None:
|
||||
%for subs_language in subs_languages:
|
||||
<div class="ui tiny label">{{subs_language}}</div>
|
||||
%end
|
||||
%end
|
||||
</td>
|
||||
<td>{{!"" if row[4] is None else row[4]}}</td>
|
||||
<td>{{!"" if row[8] is None else row[8]}}</td>
|
||||
<td>{{!"" if row.hearing_impaired is None else row.hearing_impaired}}</td>
|
||||
<td>{{!"" if row.forced is None else row.forced}}</td>
|
||||
</tr>
|
||||
%end
|
||||
</tbody>
|
||||
|
@ -105,7 +105,7 @@
|
|||
<option value="">No change</option>
|
||||
<option value="None">None</option>
|
||||
%for language in languages:
|
||||
<option value="{{language[0]}}">{{language[1]}}</option>
|
||||
<option value="{{language.code2}}">{{language.name}}</option>
|
||||
%end
|
||||
</select>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue