From 7b341d12196de3356406539538ef4fbd8326a75d Mon Sep 17 00:00:00 2001 From: morpheus65535 <5130500+morpheus65535@users.noreply.github.com> Date: Sun, 22 Apr 2018 22:08:22 -0400 Subject: [PATCH] Add progress bar for series and seasons #62 --- bazarr.py | 6 +++++- views/episodes.tpl | 4 +++- views/series.tpl | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/bazarr.py b/bazarr.py index bea01bd84..ea32f7efb 100644 --- a/bazarr.py +++ b/bazarr.py @@ -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') diff --git a/views/episodes.tpl b/views/episodes.tpl index 6e22f0389..3633ef236 100644 --- a/views/episodes.tpl +++ b/views/episodes.tpl @@ -122,7 +122,9 @@ %else: %for season in seasons:
-

Season {{season[0][2]}}

+ %missing_subs = len([i for i in season if i[6] != "[]"]) + %total_subs = len(season) +

Season {{season[0][2]}}
{{!total_subs - missing_subs}} / {{total_subs}}

diff --git a/views/series.tpl b/views/series.tpl index 022fc1797..4f9e183ab 100644 --- a/views/series.tpl +++ b/views/series.tpl @@ -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;} @@ -59,6 +60,7 @@ Audio language Subtitles languages Hearing-impaired + Subtitles @@ -86,6 +88,24 @@ %end {{!"" if row[4] == None else row[4]}} + + %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 +
+
+
+
+
+ <% 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'); + } + }); \ No newline at end of file