From 508448229b7f3924a7185cd8732cb93e82abf677 Mon Sep 17 00:00:00 2001 From: dave Date: Sat, 17 Aug 2019 23:34:26 -0700 Subject: [PATCH] show some counts in ui --- mediaweb/__init__.py | 7 ++++--- templates/index.html | 3 ++- templates/sortform.html | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mediaweb/__init__.py b/mediaweb/__init__.py index 3187262..32fa084 100644 --- a/mediaweb/__init__.py +++ b/mediaweb/__init__.py @@ -202,7 +202,7 @@ class MediaWeb(object): pmap = client.pathmap fname = get_fname(torrent) - in_library_path = os.path.join(match.dest.dir, match.subdest, fname) # path relative from the library's root + in_library_path = os.path.join(match.dest.dir, match.subdest, fname) # path relative from the library's root client_full_path = os.path.join(torrent["save_path"], fname) # absolute storage path in deluge assert client_full_path[0:len(pmap[0])] == pmap[0] # sanity check: deluge's path must starts with our pathmap @@ -234,7 +234,7 @@ class MediaWeb(object): torrent = client.rpc.core.get_torrent_status(thash, []) # TODO reduce to needed fields self.execute_move(tkey, torrent, self.cache.moves[tkey]) - self.rpc.refresh() + self.cache.refresh() # TODO summary display of results return f"autosorted: {repr(tkeys)}" @@ -314,7 +314,8 @@ def main(): tpl_dir = os.path.join(APPROOT, "templates") tpl = Environment(loader=FileSystemLoader(tpl_dir), autoescape=select_autoescape(['html', 'xml'])) - tpl.filters.update(tsortbyname=tsortbyname) + tpl.filters.update(tsortbyname=tsortbyname, + len=len, ) def validate_password(realm, user, passw): return user == passw # lol diff --git a/templates/index.html b/templates/index.html index bb3dca9..1cae1fa 100644 --- a/templates/index.html +++ b/templates/index.html @@ -21,7 +21,7 @@ {% for torid, tor in torrents.items()|tsortbyname %}{% if tor.is_finished %} - + {{ torid[0:8] }} {{ tor.name }}
@@ -79,6 +79,7 @@
Library information +

Shows ({{ shows|len }})

diff --git a/templates/sortform.html b/templates/sortform.html index 50e4120..065c54c 100644 --- a/templates/sortform.html +++ b/templates/sortform.html @@ -45,7 +45,10 @@
name

- {% if score > 0 %}show more (S={{ score }}%){% endif %} +
+ {% if score > 0 %}show more (S={{ score }}%){% endif %} + {{ matches|len }} +