Add progress bar for series and seasons #62

This commit is contained in:
morpheus65535 2018-04-22 22:08:22 -04:00
parent 67587bf167
commit 7b341d1219
3 changed files with 46 additions and 2 deletions

View File

@ -153,8 +153,12 @@ def series():
data = c.fetchall()
c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1")
languages = c.fetchall()
c.execute("SELECT table_shows.sonarrSeriesId, COUNT(table_episodes.missing_subtitles) FROM table_shows LEFT JOIN table_episodes ON table_shows.sonarrSeriesId=table_episodes.sonarrSeriesId WHERE table_episodes.missing_subtitles IS NOT '[]' GROUP BY table_shows.sonarrSeriesId")
missing_subtitles_list = c.fetchall()
c.execute("SELECT table_shows.sonarrSeriesId, COUNT(table_episodes.missing_subtitles) FROM table_shows LEFT JOIN table_episodes ON table_shows.sonarrSeriesId=table_episodes.sonarrSeriesId GROUP BY table_shows.sonarrSeriesId")
total_subtitles_list = c.fetchall()
c.close()
output = template('series', __file__=__file__, bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, single_language=single_language)
output = template('series', __file__=__file__, bazarr_version=bazarr_version, rows=data, missing_subtitles_list=missing_subtitles_list, total_subtitles_list=total_subtitles_list, languages=languages, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, single_language=single_language)
return output
@route(base_url + 'serieseditor')

View File

@ -122,7 +122,9 @@
%else:
%for season in seasons:
<div id="fondblanc" class="ui container">
<h1 class="ui header">Season {{season[0][2]}}</h1>
%missing_subs = len([i for i in season if i[6] != "[]"])
%total_subs = len(season)
<h1 class="ui header">Season {{season[0][2]}}<div class="ui tiny {{!'green' if missing_subs == 0 else 'yellow'}} circular label">{{!total_subs - missing_subs}} / {{total_subs}}</div></h1>
<div class="ui accordion">
<div class="title">
<div class="ui one column stackable center aligned page grid">

View File

@ -39,6 +39,7 @@
}
.fast.backward, .backward, .forward, .fast.forward { pointer-events: auto; }
.fast.backward.disabled, .backward.disabled, .forward.disabled, .fast.forward.disabled { pointer-events: none; }
.ui.progress:last-child {margin: 0 0 0em !important;}
</style>
</head>
<body>
@ -59,6 +60,7 @@
<th>Audio language</th>
<th>Subtitles languages</th>
<th>Hearing-impaired</th>
<th class="two wide">Subtitles</th>
<th></th>
</tr>
</thead>
@ -86,6 +88,24 @@
%end
</td>
<td>{{!"" if row[4] == None else row[4]}}</td>
<td>
%for total_subtitles in total_subtitles_list:
% if total_subtitles[0] == row[5]:
% total_subs = total_subtitles[1]
% end
%end
%missing_subs = 0
%for missing_subtitles in missing_subtitles_list:
% if missing_subtitles[0] == row[5]:
% missing_subs = missing_subtitles[1]
% end
%end
<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[4] == None else ""}}>
<%
subs_languages_list = []
@ -252,4 +272,22 @@
})
$('#series_languages').dropdown();
$('.progress').progress({
label: 'ratio',
text: {
ratio: '{value} / {total}'
},
showActivity: false
});
$( ".progress" ).each(function() {
if ($(this).progress('is complete') != true) {
$(this).progress('set warning');
}
if ($(this).progress('get total') == 0) {
$(this).progress('set success');
$(this).progress('set bar label', '0 / 0');
}
});
</script>