From 2bfb99f72050d3e88840dfc28355cef5e5c986d9 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 21 Nov 2019 04:57:16 +0100 Subject: Use list instead of object for plugin list command --- automedia.py | 10 ++++------ plugins/manganelo.py | 2 +- plugins/readms.py | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/automedia.py b/automedia.py index 492791f..6d463ce 100755 --- a/automedia.py +++ b/automedia.py @@ -343,7 +343,7 @@ def add_html(name, url, html_config_dir, start_after): items = plugin_list(plugin_path, url, None) if items: found_start_after = False - for item in reversed(items["items"]): + for item in reversed(items): title = item["name"].strip() if start_after and title == start_after: found_start_after = True @@ -500,9 +500,8 @@ def sync_html(tracked_html, download_dir, session_id): # Program should print the names of each item (chapter for manga) after "latest", sorted by newest to oldest # along with the urls to them. - # Only get the items before the one called @latest. The printed data should be in json format: - # { - # "items": [ + # Only get the items before the one called @latest. The printed data should be in this json format: + # [ # { # "name": "Example name", # "url": "https://example.com" @@ -512,7 +511,6 @@ def sync_html(tracked_html, download_dir, session_id): # "url": "https://another.url.com" # } # ] - # } # ./program list url latest # Note: @latest argument here is optional items = plugin_list(plugin_entry, tracked_html.link, tracked_html.latest) @@ -525,7 +523,7 @@ def sync_html(tracked_html, download_dir, session_id): # A file called ".finished" should be added to the download directory when the download has finished. # ./program download url download_dir latest = None - for item in reversed(items["items"]): + for item in reversed(items): url = item["url"] name = item["name"].replace("/", "_") item_dir = os.path.join(download_dir, tracked_html.title, name) diff --git a/plugins/manganelo.py b/plugins/manganelo.py index 531fa8d..f5ae49f 100755 --- a/plugins/manganelo.py +++ b/plugins/manganelo.py @@ -55,7 +55,7 @@ def list_chapters(url, latest): if latest and element_text == latest: break chapters.append({ "name": element_text, "url": element.attrib.get("href").strip() }) - print(json.dumps({ "items": chapters })) + print(json.dumps(chapters)) def download_chapter(url, download_dir): response = requests.get(url) diff --git a/plugins/readms.py b/plugins/readms.py index 0ebbe13..a5343b8 100755 --- a/plugins/readms.py +++ b/plugins/readms.py @@ -55,7 +55,7 @@ def list_chapters(url, latest): if latest and element_text == latest: break chapters.append({ "name": element_text, "url": "https://readms.net" + element.attrib.get("href").strip() }) - print(json.dumps({ "items": chapters })) + print(json.dumps(chapters)) def download_chapter(url, download_dir): in_progress_filepath = os.path.join(download_dir, ".in_progress") -- cgit v1.2.3