From 3a5fd8161ca47d0a3d4125ad4f6d151e3b247e6c Mon Sep 17 00:00:00 2001 From: Zemoj Date: Wed, 18 Jul 2018 16:12:39 -0700 Subject: [PATCH] Dont overwrite Existing Files Fix for issue #11 without adding new features. --- simpleextractor/core.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/simpleextractor/core.py b/simpleextractor/core.py index 2d57f5d..ef7cb27 100644 --- a/simpleextractor/core.py +++ b/simpleextractor/core.py @@ -170,7 +170,12 @@ def _on_torrent_finished(self, torrent_id): except Exception, e: log.error("EXTRACTOR: Error creating destination folder: %s", e) return - + + # Dont Overwrite Existing Files + if os.stat(dest).st_size > 0 + log.error("EXTRACTOR: Extract failed: %s already exists (%s)", fpath, torrent_id) + continue + def on_extract_success(result, torrent_id, fpath): # XXX: Emit an event log.info("EXTRACTOR: Extract successful: %s (%s)", fpath, torrent_id)