aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rwxr-xr-xautomedia.py9
-rwxr-xr-xplugins/manganelo.py3
-rwxr-xr-xplugins/readms.py3
4 files changed, 8 insertions, 10 deletions
diff --git a/README.md b/README.md
index 2a8c075..bf250c5 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
# TODO
-Periodically check and remove in_progress files and their directories. This can happen if the computer crashes while adding rss.
+1. Periodically check and remove in_progress files and their directories. This can happen if the computer crashes while adding rss.
+2. Automatically remove torrents that have finished seeding, to reduce memory usage and startup time of transmission.
# Requirements
## System
transmission-cli
diff --git a/automedia.py b/automedia.py
index 4d6f140..171108b 100755
--- a/automedia.py
+++ b/automedia.py
@@ -327,14 +327,12 @@ def resume_tracked_html(plugin_entry, download_dir, tracked_html, session_id):
item_session_id = file.read()
if item_session_id != session_id:
invalid_session = True
- plugin_download(plugin_entry, url, item_dir)
- show_notification("Resuming", "Resuming download for item {} with plugin {}".format(item, tracked_html.plugin))
except FileNotFoundError as e:
invalid_session = True
- plugin_download(plugin_entry, url, item_dir)
- show_notification("Resuming", "Resuming download for item {} with plugin {}".format(item, tracked_html.plugin))
if invalid_session:
+ plugin_download(plugin_entry, url, item_dir)
+ show_notification("Resuming", "Resuming download for item {} with plugin {}".format(item, tracked_html.plugin))
with open(os.path.join(item_dir, "session_id"), "w") as file:
file.write(session_id)
except FileNotFoundError as e:
@@ -377,9 +375,6 @@ 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
- if len(items["items"]) > 0:
- latest = items["items"][0]["name"].replace("/", "_")
-
for item in reversed(items["items"]):
url = item["url"]
name = item["name"].replace("/", "_")
diff --git a/plugins/manganelo.py b/plugins/manganelo.py
index 1526e6f..25114fa 100755
--- a/plugins/manganelo.py
+++ b/plugins/manganelo.py
@@ -73,7 +73,8 @@ def download_chapter(url, download_dir):
image_name = str(img_number) + ext
image_path = os.path.join(download_dir, image_name)
print("Downloading {} to {}".format(image_source, image_path))
- download_file(image_source, image_path)
+ if not download_file(image_source, image_path):
+ exit(1)
img_number += 1
with open(os.path.join(download_dir, "finished"), "w") as file:
diff --git a/plugins/readms.py b/plugins/readms.py
index d88deb1..878a043 100755
--- a/plugins/readms.py
+++ b/plugins/readms.py
@@ -79,7 +79,8 @@ def download_chapter(url, download_dir):
image_name = str(img_number) + ext
image_path = os.path.join(download_dir, image_name)
print("Downloading {} to {}".format(image_source, image_path))
- download_file(image_source, image_path)
+ if not download_file(image_source, image_path):
+ exit(1)
next_pages = tree.xpath('//div[@class="page"]//a/@href')
if len(next_pages) != 1: