Skip to content

Conversation

@EkriirkE
Copy link
Contributor

When downloading content from specific sources, sorted by new, exit the script when 5+ already-downloaded items are encountered. Do not keep downloading past this point.
Does not apply pinned posts towards the "already downloaded" counter.

Warns if used without sorting by new.

@Serene-Arc
Copy link
Owner

Hi! Thanks for the PR. We do have a formatting requirement. If you could do those for your PRs, I'll do the review for them. This seems like a good feature, so thank you.

@Serene-Arc Serene-Arc changed the base branch from master to development November 28, 2024 03:07
@EkriirkE
Copy link
Contributor Author

Ok great, I' not sure how to interpret the checklist results (the Details are all empty errors). Was the only thing the spaces between assign/compares? (committed)

@ccollins476ad
Copy link

Ok great, I' not sure how to interpret the checklist results (the Details are all empty errors). Was the only thing the spaces between assign/compares? (committed)

I think you just have to run tox. I use your implementation of --stop-on-exist quite often and would love to see it merged into master! When I run tox on your branch, I get this diff:

index e62c930..af38a9f 100644
--- a/bdfr/downloader.py
+++ b/bdfr/downloader.py
@@ -114,8 +114,8 @@ class RedditDownloader(RedditConnector):
                 if self.args.stop_on_exist and not submission.stickied:
                     self.existcount += 1
                 if self.existcount >= 5:
-                        logger.warning("Prevously-downloaded threshold met, exiting")
-                        exit(0)
+                    logger.warning("Prevously-downloaded threshold met, exiting")
+                    exit(0)
                 continue
             elif not self.download_filter.check_resource(res):
                 logger.debug(f"Download filter removed {submission.id} file with URL {submission.url}")
@@ -162,7 +162,7 @@ class RedditDownloader(RedditConnector):
     @staticmethod
     def scan_existing_files(directory: Path) -> dict[str, Path]:
         files = []
-        for (dirpath, _dirnames, filenames) in os.walk(directory):
+        for dirpath, _dirnames, filenames in os.walk(directory):
             files.extend([Path(dirpath, file) for file in filenames])
         logger.info(f"Calculating hashes for {len(files)} files")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants