From da11f21e54ac60f67a50c1ae74bf4e8e2b35903b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Tue, 5 Dec 2017 21:05:49 -0500 Subject: [PATCH] Implementing series paging --- bazarr.py | 14 ++++++++++++-- views/series.tpl | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/bazarr.py b/bazarr.py index 1fc02cbf4..bcbf288d9 100644 --- a/bazarr.py +++ b/bazarr.py @@ -100,12 +100,22 @@ def series(): db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30) db.create_function("path_substitution", 1, path_replace) c = db.cursor() - c.execute("SELECT tvdbId, title, path_substitution(path), languages, hearing_impaired, sonarrSeriesId, poster FROM table_shows ORDER BY title") + + c.execute("SELECT COUNT(*) FROM table_shows") + missing_count = c.fetchone() + missing_count = missing_count[0] + page = request.GET.page + if page == "": + page = "1" + offset = (int(page) - 1) * 15 + max_page = (missing_count / 15) + 1 + + c.execute("SELECT tvdbId, title, path_substitution(path), languages, hearing_impaired, sonarrSeriesId, poster FROM table_shows ORDER BY title ASC LIMIT 15 OFFSET ?", (offset,)) data = c.fetchall() c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1") languages = c.fetchall() c.close() - output = template('series', rows=data, languages=languages, base_url=base_url) + output = template('series', rows=data, languages=languages, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url) return output @route(base_url + 'edit_series/', method='POST') diff --git a/views/series.tpl b/views/series.tpl index 2b3d6fe7d..3d2cfcb4a 100644 --- a/views/series.tpl +++ b/views/series.tpl @@ -43,6 +43,11 @@ #divdetails { min-height: 250px; } + .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; } @@ -123,6 +128,35 @@ %end +
+
+
+
+ + + {{page}} / {{max_page}} + + +
+
Total records: {{missing_count}}
+
+