Add --ignore to ignore user

This commit is contained in:
Jay R. Wren 2021-10-30 22:19:46 -04:00 committed by Serene-Arc
parent 4a86482756
commit dd8d74ee25
5 changed files with 9 additions and 0 deletions

View File

@ -78,6 +78,9 @@ The following options are common between both the `archive` and `download` comma
- Can be specified multiple times
- Disables certain modules from being used
- See [Disabling Modules](#disabling-modules) for more information and a list of module names
- `--ignore`
- This will add a user to ignore
- Can be specified multiple times
- `--include-id-file`
- This will add any submission with the IDs in the files provided
- Can be specified multiple times

View File

@ -17,6 +17,7 @@ _common_options = [
click.option('--authenticate', is_flag=True, default=None),
click.option('--config', type=str, default=None),
click.option('--disable-module', multiple=True, default=None, type=str),
click.option('--ignore-user', type=str, multiple=True, default=None),
click.option('--include-id-file', multiple=True, default=None),
click.option('--log', type=str, default=None),
click.option('--saved', is_flag=True, default=None),

View File

@ -28,6 +28,8 @@ class Archiver(RedditConnector):
def download(self):
for generator in self.reddit_lists:
for submission in generator:
if submission.author.name in self.args.ignore_user:
continue
logger.debug(f'Attempting to archive submission {submission.id}')
self.write_entry(submission)

View File

@ -17,5 +17,7 @@ class RedditCloner(RedditDownloader, Archiver):
def download(self):
for generator in self.reddit_lists:
for submission in generator:
if submission.author.name in self.args.ignore_user:
continue
self._download_submission(submission)
self.write_entry(submission)

View File

@ -18,6 +18,7 @@ class Configuration(Namespace):
self.exclude_id_file = []
self.file_scheme: str = '{REDDITOR}_{TITLE}_{POSTID}'
self.folder_scheme: str = '{SUBREDDIT}'
self.ignore_user = []
self.include_id_file = []
self.limit: Optional[int] = None
self.link: list[str] = []