From c7520a0d26ba18dfb240258dc1ec8cf4913a291a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 2 Feb 2020 00:56:52 +0100 Subject: Ignore in progress media for open media script --- README.md | 4 ++-- automedia.py | 4 ++-- open_media.py | 7 ++++++- requirements.txt | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a85dee1..900ef3e 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ Run automedia without any options to see all options. 2. Automatically remove torrents that have finished seeding, to reduce memory usage and startup time of transmission. # Requirements ## System -transmission-cli, notify-send (optional) +wget, transmission-cli, notify-send (optional) ## Python -feedparser, transmissionrpc +feedparser, transmissionrpc, lxml # Requirements when using read_manga.py ## System rofi, sxiv diff --git a/automedia.py b/automedia.py index 2d8f300..e319f47 100755 --- a/automedia.py +++ b/automedia.py @@ -505,8 +505,8 @@ def resume_tracked_html(plugin_entry, download_dir, tracked_html, session_id): invalid_session = True if invalid_session: - if not only_show_finished_notification: - show_notification("Resuming", "Resuming download for item {} with plugin {}".format(item, tracked_html.plugin)) + #if not only_show_finished_notification: + show_notification("Resuming", "Resuming download for item {} with plugin {}".format(os.path.join(tracked_html.title, item), tracked_html.plugin)) with open(os.path.join(item_dir, ".session_id"), "w") as file: file.write(session_id) plugin_download(plugin_entry, url, item_dir) diff --git a/open_media.py b/open_media.py index 6073782..6328b16 100755 --- a/open_media.py +++ b/open_media.py @@ -48,7 +48,12 @@ def main(): exit(2) downloaded_list = get_downloaded_list() - downloaded_list = [item for item in downloaded_list if os.path.exists(os.path.join(download_dir, item))] + filtered_downloaded_list = [] + for item in downloaded_list: + media_path = os.path.join(download_dir, item) + if os.path.exists(media_path) and not os.path.exists(os.path.join(media_path, ".in_progress")): + filtered_downloaded_list.append(item) + downloaded_list = filtered_downloaded_list seen_filepath = os.path.expanduser("~/.config/automedia/seen") seen_list = [] diff --git a/requirements.txt b/requirements.txt index 2951ed3..b1d48ea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ feedparser transmissionrpc +lxml -- cgit v1.2.3