pull/884/head
Louis Vézina 5 years ago
parent 57f125d87b
commit db88156dc1

@ -44,10 +44,10 @@ class Series(Resource):
seriesId = request.args.get('id')
row_count = database.execute("SELECT COUNT(*) as count FROM table_shows", only_one=True)['count']
if seriesId:
result = database.execute("SELECT * FROM table_shows WHERE sonarrSeriesId=? LIMIT ? OFFSET ?",
(length, start), (seriesId,))
result = database.execute("SELECT * FROM table_shows WHERE sonarrSeriesId=? ORDER BY sortTitle ASC LIMIT ? "
"OFFSET ?", (length, start), (seriesId,))
else:
result = database.execute("SELECT * FROM table_shows LIMIT ? OFFSET ?", (length, start))
result = database.execute("SELECT * FROM table_shows ORDER BY sortTitle ASC LIMIT ? OFFSET ?", (length, start))
for item in result:
# Parse audio language
if item['audio_language']:
@ -129,10 +129,11 @@ class Movies(Resource):
moviesId = request.args.get('id')
row_count = database.execute("SELECT COUNT(*) as count FROM table_movies", only_one=True)['count']
if moviesId:
result = database.execute("SELECT * FROM table_movies WHERE radarrId=? LIMIT ? OFFSET ?", (length, start),
(moviesId,))
result = database.execute("SELECT * FROM table_movies WHERE radarrId=? ORDER BY sortTitle ASC LIMIT ? "
"OFFSET ?", (length, start), (moviesId,))
else:
result = database.execute("SELECT * FROM table_movies LIMIT ? OFFSET ?", (length, start))
result = database.execute("SELECT * FROM table_movies ORDER BY sortTitle ASC LIMIT ? OFFSET ?",
(length, start))
for item in result:
# Parse audio language
if item['audio_language']:

@ -883,167 +883,16 @@ def search_missing_subtitles_movie(no):
redirect(ref)
@app.route('/history')
# @custom_auth_basic(check_credentials)
def history():
return render_template('history.html', bazarr_version=bazarr_version, base_url=base_url, current_port=settings.general.port)
@app.route('/historyseries')
# @custom_auth_basic(check_credentials)
def historyseries():
row_count = database.execute("SELECT COUNT(*) as count FROM table_history LEFT JOIN table_shows on "
"table_history.sonarrSeriesId = table_shows.sonarrSeriesId WHERE "
"table_shows.title is not NULL", only_one=True)['count']
page = request.data
if page == "":
page = "1"
page_size = int(settings.general.page_size)
offset = (int(page) - 1) * page_size
max_page = int(math.ceil(row_count / (page_size + 0.0)))
now = datetime.now()
today = []
thisweek = []
thisyear = []
stats = database.execute("SELECT timestamp FROM table_history WHERE action != 0")
total = len(stats)
for stat in stats:
if now - timedelta(hours=24) <= datetime.fromtimestamp(stat['timestamp']) <= now:
today.append(datetime.fromtimestamp(stat['timestamp']).date())
if now - timedelta(weeks=1) <= datetime.fromtimestamp(stat['timestamp']) <= now:
thisweek.append(datetime.fromtimestamp(stat['timestamp']).date())
if now - timedelta(weeks=52) <= datetime.fromtimestamp(stat['timestamp']) <= now:
thisyear.append(datetime.fromtimestamp(stat['timestamp']).date())
stats = [len(today), len(thisweek), len(thisyear), total]
data = database.execute("SELECT table_history.action, table_shows.title as seriesTitle, "
"table_episodes.season || 'x' || table_episodes.episode as episode_number, "
"table_episodes.title as episodeTitle, "
"table_history.timestamp, table_history.description, table_history.sonarrSeriesId, "
"table_episodes.path, table_shows.languages, table_history.language, table_history.score, "
"table_shows.forced FROM table_history LEFT JOIN table_shows on "
"table_shows.sonarrSeriesId = table_history.sonarrSeriesId LEFT JOIN table_episodes on "
"table_episodes.sonarrEpisodeId = table_history.sonarrEpisodeId WHERE table_episodes.title "
"is not NULL ORDER BY timestamp DESC LIMIT ? OFFSET ?", (page_size, offset))
upgradable_episodes_not_perfect = []
if settings.general.getboolean('upgrade_subs'):
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()
if settings.general.getboolean('upgrade_manual'):
query_actions = [1, 2, 3]
else:
query_actions = [1, 3]
if settings.sonarr.getboolean('only_monitored'):
series_monitored_only_query_string = " AND monitored='True'"
else:
series_monitored_only_query_string = ''
upgradable_episodes = database.execute("SELECT video_path, MAX(timestamp) as timestamp, score FROM table_history "
"INNER JOIN table_episodes on table_episodes.sonarrEpisodeId = "
"table_history.sonarrEpisodeId WHERE action IN (" +
','.join(map(str, query_actions)) + ") AND timestamp > ? AND "
"score is not null" + series_monitored_only_query_string + " GROUP BY "
"table_history.video_path, table_history.language",
(minimum_timestamp,))
for upgradable_episode in upgradable_episodes:
if upgradable_episode['timestamp'] > minimum_timestamp:
try:
int(upgradable_episode['score'])
except ValueError:
pass
else:
if int(upgradable_episode['score']) < 360:
upgradable_episodes_not_perfect.append(upgradable_episode)
return render_template('historyseries.html', bazarr_version=bazarr_version, rows=data, row_count=row_count,
page=page, max_page=max_page, stats=stats, base_url=base_url, page_size=page_size,
current_port=settings.general.port, upgradable_episodes=upgradable_episodes_not_perfect)
return render_template('historyseries.html')
@app.route('/historymovies')
# @custom_auth_basic(check_credentials)
def historymovies():
row_count = database.execute("SELECT COUNT(*) as count FROM table_history_movie LEFT JOIN table_movies ON "
"table_history_movie.radarrId=table_movies.radarrId "
"WHERE table_movies.title is not NULL", only_one=True)['count']
page = request.data
if page == "":
page = "1"
page_size = int(settings.general.page_size)
offset = (int(page) - 1) * page_size
max_page = int(math.ceil(row_count / (page_size + 0.0)))
now = datetime.now()
today = []
thisweek = []
thisyear = []
stats = database.execute("SELECT timestamp FROM table_history_movie WHERE action != 0")
total = len(stats)
for stat in stats:
if now - timedelta(hours=24) <= datetime.fromtimestamp(stat['timestamp']) <= now:
today.append(datetime.fromtimestamp(stat['timestamp']).date())
if now - timedelta(weeks=1) <= datetime.fromtimestamp(stat['timestamp']) <= now:
thisweek.append(datetime.fromtimestamp(stat['timestamp']).date())
if now - timedelta(weeks=52) <= datetime.fromtimestamp(stat['timestamp']) <= now:
thisyear.append(datetime.fromtimestamp(stat['timestamp']).date())
stats = [len(today), len(thisweek), len(thisyear), total]
data = database.execute("SELECT table_history_movie.action, table_movies.title, table_history_movie.timestamp, "
"table_history_movie.description, table_history_movie.radarrId, "
"table_history_movie.video_path, table_movies.languages, table_history_movie.language, "
"table_history_movie.score, table_movies.forced FROM table_history_movie "
"LEFT JOIN table_movies on table_movies.radarrId = table_history_movie.radarrId "
"ORDER BY timestamp DESC LIMIT ? OFFSET ?", (page_size, offset,))
upgradable_movies = []
upgradable_movies_not_perfect = []
if settings.general.getboolean('upgrade_subs'):
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()
if settings.radarr.getboolean('only_monitored'):
movies_monitored_only_query_string = ' AND table_movies.monitored = "True"'
else:
movies_monitored_only_query_string = ""
if settings.general.getboolean('upgrade_manual'):
query_actions = [1, 2, 3]
else:
query_actions = [1, 3]
upgradable_movies = database.execute("SELECT video_path, MAX(timestamp) as timestamp, score FROM table_history_movie "
"INNER JOIN table_movies on table_movies.radarrId="
"table_history_movie.radarrId WHERE action IN (" +
','.join(map(str, query_actions)) +
") AND timestamp > ? AND score is not NULL" +
movies_monitored_only_query_string + " GROUP BY video_path, language",
(minimum_timestamp,))
for upgradable_movie in upgradable_movies:
if upgradable_movie['timestamp'] > minimum_timestamp:
try:
int(upgradable_movie['score'])
except ValueError:
pass
else:
if int(upgradable_movie['score']) < 120:
upgradable_movies_not_perfect.append(upgradable_movie)
return render_template('historymovies.html', bazarr_version=bazarr_version, rows=data, row_count=row_count,
page=page, max_page=max_page, stats=stats, base_url=base_url, page_size=page_size,
current_port=settings.general.port, upgradable_movies=upgradable_movies_not_perfect)
return render_template('historymovies.html')
@app.route('/wanted')

@ -1,44 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Server-side processing datatables test</title>
<script src="https://code.jquery.com/jquery-3.3.1.js" type="text/javascript"></script>
<script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="https://cdn.datatables.net/1.10.20/js/dataTables.material.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/material-design-lite/1.1.0/material.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.20/css/dataTables.material.min.css">
</head>
<body>
<table id="example" class="mdl-data-table" style="width:100%">
<thead>
<tr>
<th>action</th>
<th>title</th>
<th>timestamp</th>
<th>description</th>
</tr>
</thead>
</table>
</body>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#example').DataTable( {
"processing": true,
"serverSide": true,
"ajax": "http://localhost:6767/api/history_movies",
"columns": [
{ "data": "action" },
{ "data": "title" },
{ "data": "timestamp" },
{ "data": "description" }
]
} );
var source = new EventSource('/event');
source.onmessage = function (event) {
table.ajax.reload(null, false);
};
} );
</script>
</html>

@ -129,10 +129,13 @@
<li><a href="{{ url_for('movies') }}"><i class="fas fa-film"></i><span
class="hide-menu"> Movies</span></a>
</li>
<li><a href="{{ url_for('history') }}"><i class="fas fa-clock"></i><span class="hide-menu"> History</span></a>
<li><a href="#"><i class="fas fa-clock"></i><span class="hide-menu"> History</span></a>
<ul aria-expanded="false" class="collapse">
<li><a href="{{ url_for('historyseries') }}"> Series</a></li>
<li><a href="{{ url_for('historymovies') }}"> Movies</a></li>
</ul>
</li>
<li><a href="#"><i
class="fas fa-exclamation-triangle"></i><span class="hide-menu"> Wanted</span></a>
<li><a href="#"><i class="fas fa-exclamation-triangle"></i><span class="hide-menu"> Wanted</span></a>
<ul aria-expanded="false" class="collapse">
<li><a href="/"> Missing</a></li>
<li><a href="/"> Cutoff Unmet</a></li>

@ -1,231 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script src="{{base_url}}static/jquery/jquery-latest.min.js"></script>
<script src="{{base_url}}static/semantic/semantic.min.js"></script>
<script src="{{base_url}}static/jquery/tablesort.js"></script>
<link rel="stylesheet" href="{{base_url}}static/semantic/semantic.min.css">
<link rel="apple-touch-icon" sizes="120x120" href="{{base_url}}static/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="{{base_url}}static/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="{{base_url}}static/favicon-16x16.png">
<link rel="manifest" href="{{base_url}}static/manifest.json">
<link rel="mask-icon" href="{{base_url}}static/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="{{base_url}}static/favicon.ico">
<meta name="msapplication-config" content="{{base_url}}static/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<title>History - Bazarr</title>
<style>
body {
background-color: #272727;
}
.fast.backward, .backward, .forward, .fast.forward {
cursor: pointer;
}
.fast.backward, .backward, .forward, .fast.forward { pointer-events: auto; }
.fast.backward.disabled, .backward.disabled, .forward.disabled, .fast.forward.disabled { pointer-events: none; }
#bottommenu {
background-color: #333333;
box-shadow: 0 0 10px 1px #333;
padding: 10px;
}
.label, .value {
color: white !important;
}
</style>
</head>
<body>
<div id='loader' class="ui page dimmer">
<div id="loader_text" class="ui indeterminate text loader">Loading...</div>
</div>
{% extends '_main.html' %}
<div class="ui container">
<table id="tablehistory" class="ui very basic selectable table">
<thead>
<tr>
<th></th>
<th>Name</th>
<th>Date</th>
<th>Description</th>
</tr>
</thead>
<tbody>
%import ast
%import time
%import pretty
%for row in rows:
<tr class="selectable">
<td class="collapsing">
%if row['action'] == 0:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been erased." data-inverted="" data-position="top left">
<i class="ui trash icon"></i>
</div>
%elif row['action'] == 1:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been downloaded." data-inverted="" data-position="top left">
<i class="ui download icon"></i>
</div>
%elif row['action'] == 2:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been manually downloaded." data-inverted="" data-position="top left">
<i class="ui user icon"></i>
</div>
%elif row['action'] == 3:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been upgraded." data-inverted="" data-position="top left">
<i class="ui recycle icon"></i>
</div>
%elif row['action'] == 4:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been manually uploaded." data-inverted="" data-position="top left">
<i class="ui cloud upload icon"></i>
</div>
%end
</td>
<td>
<a href="{{base_url}}movie/{{row['radarrId']}}">{{row['title']}}</a>
</td>
<td class="collapsing">
<div class="ui inverted" data-tooltip="{{time.strftime('%Y/%m/%d %H:%M', time.localtime(row['timestamp']))}}" data-inverted="" data-position="top left">
{{pretty.date(int(row['timestamp']))}}
</div>
</td>
<td>
% upgradable_criteria = dict([('timestamp', row['timestamp']), ('video_path', row['video_path']), ('score', row['score'])])
% if upgradable_criteria in upgradable_movies:
% if row['languages'] != "None":
% desired_languages = ast.literal_eval(str(row['languages']))
% if row['forced'] == "True":
% forced_languages = [l + ":forced" for l in desired_languages]
% elif row['forced'] == "Both":
% forced_languages = [l + ":forced" for l in desired_languages] + desired_languages
% else:
% forced_languages = desired_languages
% end
% if row['languages'] and row['language'] and row['language'] in forced_languages:
<div class="ui inverted basic compact icon" data-tooltip="This Subtitle file is eligible for an upgrade." data-inverted="" data-position="top left">
<i class="ui green recycle icon upgrade"></i>{{row['description']}}
</div>
% else:
{{row['description']}}
% end
% end
% else:
{{row['description']}}
% end
</td>
</tr>
%end
</tbody>
</table>
%try: page_size
%except NameError: page_size = "25"
%end
%if page_size != -1:
<div class="ui grid">
<div class="three column row">
<div class="column"></div>
<div class="center aligned column">
<i class="\\
%if page == '1':
disabled\\
%end
fast backward icon"></i>
<i class="\\
%if page == '1':
disabled\\
%end
backward icon"></i>
{{page}} / {{max_page}}
<i class="\\
%if int(page) == int(max_page):
disabled\\
%end
forward icon"></i>
<i class="\\
%if int(page) == int(max_page):
disabled\\
%end
fast forward icon"></i>
</div>
<div class="right floated right aligned column">Total Records: {{row_count}}</div>
</div>
</div>
%end
</div>
<div id='bottommenu' class="ui fluid inverted bottom fixed five item menu">
<div class="ui small statistics">
<div class="statistic">
<div class="text value">
<br>
Movies
<br>
Statistics
</div>
<div class="label">
</div>
</div>
<div class="statistic">
<div class="value">
{{stats[0]}}
</div>
<div class="label">
In 24 Hours
</div>
</div>
<div class="statistic">
<div class="value">
{{stats[1]}}
</div>
<div class="label">
In One Week
</div>
</div>
<div class="statistic">
<div class="value">
{{stats[2]}}
</div>
<div class="label">
In One Year
</div>
</div>
<div class="statistic">
<div class="value">
{{stats[3]}}
</div>
<div class="label">
Total
</div>
</div>
</div>
</div>
{% block title %}History (Series) - Bazarr{% endblock %}
<br><br><br><br>
</body>
</html>
{% block head %}
{% endblock head %}
<script>
if (sessionStorage.scrolly) {
$(window).scrollTop(sessionStorage.scrolly);
sessionStorage.clear();
}
$('a').on('click', function(){
sessionStorage.scrolly=$(window).scrollTop();
{% block body %}
<table id="history_movies" class="mdl-data-table" style="width:100%">
<thead>
<tr>
<th>action</th>
<th>title</th>
<th>timestamp</th>
<th>description</th>
</tr>
</thead>
</table>
{% endblock body %}
$('#loader').addClass('active');
});
$('.fast.backward').on('click', function(){
loadURLmovies(1);
});
$('.backward:not(.fast)').on('click', function(){
loadURLmovies({{int(page)-1}});
});
$('.forward:not(.fast)').on('click', function(){
loadURLmovies({{int(page)+1}});
});
$('.fast.forward').on('click', function(){
loadURLmovies({{int(max_page)}});
});
{% block tail %}
<script>
$(document).ready(function() {
var table = $('#history_movies').DataTable( {
"processing": true,
"serverSide": true,
"searching": false,
"ordering": false,
"lengthChange": false,
"ajax": "/api/history_movies",
"columns": [
{ "data": "action" },
{ "data": "title" },
{ "data": "timestamp" },
{ "data": "description" }
]
} );
} );
</script>
{% endblock tail %}

@ -1,246 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script src="{{base_url}}static/jquery/jquery-latest.min.js"></script>
<script src="{{base_url}}static/semantic/semantic.min.js"></script>
<script src="{{base_url}}static/jquery/tablesort.js"></script>
<link rel="stylesheet" href="{{base_url}}static/semantic/semantic.min.css">
<link rel="apple-touch-icon" sizes="120x120" href="{{base_url}}static/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="{{base_url}}static/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="{{base_url}}static/favicon-16x16.png">
<link rel="manifest" href="{{base_url}}static/manifest.json">
<link rel="mask-icon" href="{{base_url}}static/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="{{base_url}}static/favicon.ico">
<meta name="msapplication-config" content="{{base_url}}static/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<title>History - Bazarr</title>
<style>
body {
background-color: #272727;
}
.fast.backward, .backward, .forward, .fast.forward {
cursor: pointer;
}
.fast.backward, .backward, .forward, .fast.forward { pointer-events: auto; }
.fast.backward.disabled, .backward.disabled, .forward.disabled, .fast.forward.disabled { pointer-events: none; }
#bottommenu {
background-color: #333333;
box-shadow: 0 0 10px 1px #333;
padding: 10px;
}
.label, .value {
color: white !important;
}
</style>
</head>
<body>
<div id='loader' class="ui page dimmer">
<div id="loader_text" class="ui indeterminate text loader">Loading...</div>
</div>
{% extends '_main.html' %}
<div class="ui container">
<table id="tablehistory" class="ui very basic selectable table">
<thead>
<tr>
<th></th>
<th>Name</th>
<th>Episode</th>
<th>Episode Title</th>
<th>Date</th>
<th>Description</th>
</tr>
</thead>
<tbody>
%import ast
%import time
%import pretty
%for row in rows:
<tr class="selectable">
<td class="collapsing">
%if row['action'] == 0:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been erased." data-inverted="" data-position="top left">
<i class="ui trash icon"></i>
</div>
%elif row['action'] == 1:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been downloaded." data-inverted="" data-position="top left">
<i class="ui download icon"></i>
</div>
%elif row['action'] == 2:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been manually downloaded." data-inverted="" data-position="top left">
<i class="ui user icon"></i>
</div>
%elif row['action'] == 3:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been upgraded." data-inverted="" data-position="top left">
<i class="ui recycle icon"></i>
</div>
%elif row['action'] == 4:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been manually uploaded." data-inverted="" data-position="top left">
<i class="ui cloud upload icon"></i>
</div>
%end
</td>
<td>
<a href="{{base_url}}episodes/{{row['sonarrSeriesId']}}">{{row['seriesTitle']}}</a>
</td>
<td class="collapsing">
%if row['episode_number'] is not None:
% episode = row['episode_number'].split('x')
{{episode[0] + 'x' + episode[1].zfill(2)}}
%end
</td>
<td>
%if row['episodeTitle'] is not None:
{{row['episodeTitle']}}
%else:
<em>Deleted episode</em>
%end
</td>
<td class="collapsing">
<div class="ui inverted" data-tooltip="{{time.strftime('%Y/%m/%d %H:%M', time.localtime(row['timestamp']))}}" data-inverted="" data-position="top left">
{{pretty.date(int(row['timestamp']))}}
</div>
</td>
<td>
% upgradable_criteria = dict([('timestamp', row['timestamp']), ('video_path', row['path']), ('score', row['score'])])
% if upgradable_criteria in upgradable_episodes:
% if row['languages'] != "None":
% desired_languages = ast.literal_eval(str(row['languages']))
% if row['forced'] == "True":
% forced_languages = [l + ":forced" for l in desired_languages]
% elif row['forced'] == "Both":
% forced_languages = [l + ":forced" for l in desired_languages] + desired_languages
% else:
% forced_languages = desired_languages
% end
% if row['language'] in forced_languages:
<div class="ui inverted basic compact icon" data-tooltip="This Subtitle file is eligible for an upgrade." data-inverted="" data-position="top left">
<i class="ui green recycle icon upgrade"></i>{{row['description']}}
</div>
% else:
{{row['description']}}
% end
% end
% else:
{{row['description']}}
% end
</td>
</tr>
%end
</tbody>
</table>
%try: page_size
%except NameError: page_size = "25"
%end
%if page_size != -1:
<div class="ui grid">
<div class="three column row">
<div class="column"></div>
<div class="center aligned column">
<i class="\\
%if page == '1':
disabled\\
%end
fast backward icon"></i>
<i class="\\
%if page == '1':
disabled\\
%end
backward icon"></i>
{{page}} / {{max_page}}
<i class="\\
%if int(page) == int(max_page):
disabled\\
%end
forward icon"></i>
<i class="\\
%if int(page) == int(max_page):
disabled\\
%end
fast forward icon"></i>
</div>
<div class="right floated right aligned column">Total Records: {{row_count}}</div>
</div>
</div>
%end
</div>
<div id='bottommenu' class="ui fluid inverted bottom fixed five item menu">
<div class="ui small statistics">
<div class="statistic">
<div class="text value">
<br>
Series
<br>
Statistics
</div>
<div class="label">
</div>
</div>
<div class="statistic">
<div class="value">
{{stats[0]}}
</div>
<div class="label">
In 24 Hours
</div>
</div>
<div class="statistic">
<div class="value">
{{stats[1]}}
</div>
<div class="label">
In One Week
</div>
</div>
<div class="statistic">
<div class="value">
{{stats[2]}}
</div>
<div class="label">
In One Year
</div>
</div>
<div class="statistic">
<div class="value">
{{stats[3]}}
</div>
<div class="label">
Total
</div>
</div>
</div>
</div>
{% block title %}History (Series) - Bazarr{% endblock %}
<br><br><br><br>
</body>
</html>
{% block head %}
{% endblock head %}
<script>
if (sessionStorage.scrolly) {
$(window).scrollTop(sessionStorage.scrolly);
sessionStorage.clear();
}
$('a').on('click', function(){
sessionStorage.scrolly=$(window).scrollTop();
{% block body %}
<table id="history_series" class="mdl-data-table" style="width:100%">
<thead>
<tr>
<th>Action</th>
<th>Name</th>
<th>Episode</th>
<th>Episode Title</th>
<th>Date</th>
<th>Description</th>
</tr>
</thead>
</table>
{% endblock body %}
$('#loader').addClass('active');
});
$('.fast.backward').on('click', function(){
loadURLseries(1);
});
$('.backward:not(.fast)').on('click', function(){
loadURLseries({{int(page)-1}});
});
$('.forward:not(.fast)').on('click', function(){
loadURLseries({{int(page)+1}});
});
$('.fast.forward').on('click', function(){
loadURLseries({{int(max_page)}});
});
{% block tail %}
<script>
$(document).ready(function() {
var table = $('#history_series').DataTable( {
"processing": true,
"serverSide": true,
"searching": false,
"ordering": false,
"lengthChange": false,
"ajax": "/api/history_series",
"columns": [
{ "data": "action" },
{ "data": "seriesTitle" },
{ "data": "episode_number" },
{ "data": "episodeTitle" },
{ "data": "timestamp" },
{ "data": "description" }
]
} );
} );
</script>
{% endblock tail %}

@ -12,7 +12,7 @@
<tr>
<th>Monitored</th>
<th>Name</th>
<th>Path</th>
<th>Path exist</th>
<th>Audio Language</th>
<th>Subtitles Languages</th>
<th>Hearing-Impaired</th>
@ -35,7 +35,7 @@
"columns": [
{ "data": "monitored" },
{ "data": "title" },
{ "data": "mapped_path" },
{ "data": "exist" },
{ "data": "audio_language.name" },
{ "data": "languages[, ].code2" },
{ "data": "hearing_impaired" },

@ -1,272 +1,45 @@
{% extends '_main.html' %}
{% block title %}Series - Bazarr{% endblock %}
{% block head %}
<style>
#fondblanc {
background-color: #ffffff;
border-radius: 0;
box-shadow: 0 0 5px 5px #ffffff;
margin-top: 32px;
margin-bottom: 3em;
padding: 2em 3em 2em 3em;
overflow-x: auto;
}
#tableseries {
padding-top: 1em;
}
#divdetails {
min-height: 250px;
}
.ui.progress:last-child {
margin: 0 0 0 !important;
}
{% block head %}
.ui.progress .bar > .progress {
right: auto;
left: .5em;
color: rgba(0, 0, 0, 0.60);
}
</style>
{% endblock head %}
{% block body %}
<div class="page-wrapper">
<div id="fondblanc" class="container-fluid">
<div class="ui basic buttons">
<button id="serieseditor" class="ui button"><i class="configure icon"></i>Series Editor</button>
</div>
<table id="tableseries" class="ui very basic selectable stackable table">
<thead>
<tr>
<th>Name</th>
<th>Path</th>
<th>Audio Language</th>
<th>Subtitle Language(s)</th>
<th>Hearing-Impaired</th>
<th>Forced</th>
<th class="two wide">Subtitles</th>
<th></th>
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr class="selectable">
<td><a href="{{ base_url }}episodes/{{ row['sonarrSeriesId'] }}">{{ row['title'] }}</a></td>
<td>
{% if os.path.isdir(row['path']) %}
<span data-tooltip="This path seems to be valid." data-inverted=""
data-position="top left"><i
class="checkmark icon"></i></span>
{% else %}
<span data-tooltip="This path doesn't seem to be valid." data-inverted=""
data-position="top left"><i class="warning sign icon"></i></span>
{% endif %}
{{ row['path'] }}
</td>
<td>{{ row['audio_language'] }}</td>
<td>
{% set subs_languages = ast.literal_eval(str(row['languages'])) %}
{% if subs_languages != None %}
{% for subs_language in subs_languages %}
<div class="ui tiny label">{{ subs_language }}</div>
{% endfor %}
{% endif %}
</td>
<td>{% if row['hearing_impaired'] == None %}
{% else %}
{{ row['hearing_impaired']|safe }}
{% endif %}
</td>
<td>{{ row['forced'] }}</td>
<td>
{% set total_subs = 0 %}
{% set missing_subs = 0 %}
{% if total_subtitles_list %}
{% for total_subtitles in total_subtitles_list %}
{% if total_subtitles['sonarrSeriesId'] == row['sonarrSeriesId'] %}
{% set total_subs = total_subtitles['missing_subtitles'] %}
{% endif %}
{% endfor %}
{% for missing_subtitles in missing_subtitles_list %}
{% if missing_subtitles['sonarrSeriesId'] == row['sonarrSeriesId'] %}
{% set missing_subs = missing_subtitles['missing_subtitles'] %}
{% endif %}
{% endfor %}
{% endif %}
<div class="ui progress" data-value="{{ total_subs - missing_subs }}"
data-total="{{ total_subs }}">
<div class="bar">
<div class="progress"></div>
</div>
</div>
</td>
<td {{ "style='background-color: #e8e8e8;'" if row['hearing_impaired']|safe == None else "" }}>
{% set subs_languages_list = [] %}
{% if subs_languages != None %}
{% for subs_language in subs_languages %}
{{ subs_languages_list.append(subs_language) }}
{% endfor %}
{% endif %}
<div class="config ui inverted basic compact icon" data-tooltip="Edit Series"
data-inverted=""
data-position="top right" data-no="{{ row['sonarrSeriesId'] }}"
data-title="{{ row['title'] }}" data-poster="{{ row['poster'] }}"
data-languages="{{ subs_languages_list|safe }}"
data-hearing-impaired="{{ row['hearing_impaired'] }}" data-forced="{{ row['forced'] }}"
data-audio="{{ row['audio_language'] }}">
<i class="ui black configure icon"></i>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="ui small modal">
<i class="close icon"></i>
<div class="header">
<div id="series_title"></div>
</div>
<div class="content">
<form name="series_form" id="series_form" action="" method="post" class="ui form">
<div id="divdetails" class="ui grid">
<div class="four wide column">
<img id="series_poster" class="ui image" src="">
</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned five wide column">
<label>Audio Language</label>
</div>
<div class="nine wide column">
<div id="series_audio_language"></div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned five wide column">
<label>Subtitle Language(s)</label>
</div>
<div class="nine wide column">
<select name="languages" id="series_languages"
{{ 'multiple="" ' if single_language|safe == False else '' }}class="ui fluid selection dropdown">
<option value="">Languages</option>
{% if single_language %}
<option value="None">None</option>
{% endif %}
{% for language in languages %}
<option value="{{ language['code2'] }}">{{ language['name'] }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned five wide column">
<label>Hearing-Impaired</label>
</div>
<div class="nine wide column">
<div id="series_hearing-impaired_div" class="ui toggle checkbox">
<input name="hearing_impaired" id="series_hearing-impaired" type="checkbox">
<label></label>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned five wide column">
<label>Forced</label>
</div>
<div class="nine wide column">
<select name="forced" id="series_forced" class="ui fluid selection dropdown">
<option value="False">False</option>
<option value="True">True</option>
<option value="Both">Both</option>
</select>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="actions">
<button class="ui cancel button">Cancel</button>
<button type="submit" name="save" value="save" form="series_form" class="ui blue approve button">Save
</button>
</div>
</div>
</div>
{% block body %}
<table id="series" class="mdl-data-table" style="width:100%">
<thead>
<tr>
<th>Name</th>
<th>Path exist</th>
<th>Audio Language</th>
<th>Subtitles Languages</th>
<th>Hearing-Impaired</th>
<th>Forced</th>
</tr>
</thead>
</table>
{% endblock body %}
{% block tail %}
<script>
if (sessionStorage.scrolly) {
$(window).scrollTop(sessionStorage.scrolly);
sessionStorage.clear();
}
$('a, button:not(.cancel)').on('click', function () {
$('#loader').addClass('active');
});
$('#serieseditor').on('click', function () {
window.location = '{{base_url}}serieseditor';
});
{#$('.modal')#}
{# .modal({#}
{# autofocus: false#}
{# });#}
$('.config').on('click', function () {
sessionStorage.scrolly = $(window).scrollTop();
$('#series_form').attr('action', '{{base_url}}edit_series/' + $(this).data("no"));
$("#series_title").html($(this).data("title"));
$("#series_poster").attr("src", "{{base_url}}image_proxy" + $(this).data("poster"));
$("#series_audio_language").html($(this).data("audio"));
$('#series_languages').dropdown('clear');
const languages_array = eval($(this).data("languages"));
$('#series_languages').dropdown('set selected', languages_array);
$('#series_forced').dropdown('clear');
$('#series_forced').dropdown('set selected', $(this).data("forced"));
if ($(this).data("hearing-impaired") === "True") {
$("#series_hearing-impaired_div").checkbox('check');
} else {
$("#series_hearing-impaired_div").checkbox('uncheck');
}
$('.small.modal').modal('show');
});
$('.progress').progress({
label: 'ratio',
text: {
ratio: '{value} / {total}'
},
showActivity: false
});
$(".progress").each(function () {
if ($(this).progress('is complete') !== true) {
$(this).addClass('yellow');
}
if ($(this).progress('get total') == 0) {
$(this).progress('update progress', '99');
$(this).addClass('grey disabled');
$(this).progress('set bar label', '0 / 0');
}
});
</script>
{% block tail %}
<script>
$(document).ready(function() {
var table = $('#series').DataTable( {
"processing": true,
"serverSide": true,
"searching": false,
"ordering": false,
"lengthChange": false,
"ajax": "/api/series",
"columns": [
{ "data": "title" },
{ "data": "exist" },
{ "data": "audio_language.name" },
{ "data": "languages[, ].code2" },
{ "data": "hearing_impaired" },
{ "data": "forced" }
]
} );
} );
</script>
{% endblock tail %}

Loading…
Cancel
Save