Fixed misc bugs
This commit is contained in:
+5
-2
@@ -153,7 +153,7 @@ class RedditDownloader(RedditConnector):
|
||||
if destination.exists():
|
||||
# Check if we already have this file's hash
|
||||
if destination in self.master_hash_list.values():
|
||||
logger.debug(f"File {destination} from submission {submission.id} already exists, continuing")
|
||||
logger.info(f"File {destination.name} from submission {submission.id} already exists")
|
||||
continue
|
||||
else:
|
||||
# File exists but not in our hash list - calculate its hash
|
||||
@@ -166,6 +166,7 @@ class RedditDownloader(RedditConnector):
|
||||
self.url_list[res.url] = existing_file_hash
|
||||
|
||||
logger.debug(f"Added hash for existing file: {existing_file_hash}")
|
||||
logger.info(f"File {destination.name} from submission {submission.id} already exists")
|
||||
files_processed += 1
|
||||
if self.args.no_dupes:
|
||||
self._save_hash_list()
|
||||
@@ -185,7 +186,6 @@ class RedditDownloader(RedditConnector):
|
||||
)
|
||||
return
|
||||
resource_hash = res.hash.hexdigest()
|
||||
destination.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Simple-check: URL-based duplicate detection (fast path)
|
||||
if self.args.simple_check and hasattr(res, 'url') and res.url in self.url_list:
|
||||
@@ -213,6 +213,9 @@ class RedditDownloader(RedditConnector):
|
||||
if self.args.no_dupes:
|
||||
self._save_hash_list()
|
||||
return
|
||||
|
||||
# Only create folder if we're actually going to write the file (not a duplicate)
|
||||
destination.parent.mkdir(parents=True, exist_ok=True)
|
||||
try:
|
||||
with destination.open("wb") as file:
|
||||
file.write(res.content)
|
||||
|
||||
Reference in New Issue
Block a user