Rename --skip to --skip-format
This commit is contained in:
@@ -161,7 +161,7 @@ The following options apply only to the `download` command. This command downloa
|
|||||||
- `--skip-domain`
|
- `--skip-domain`
|
||||||
- This adds domains to the download filter i.e. submissions coming from these domains will not be downloaded
|
- This adds domains to the download filter i.e. submissions coming from these domains will not be downloaded
|
||||||
- Can be specified multiple times
|
- Can be specified multiple times
|
||||||
- `--skip`
|
- `--skip-format`
|
||||||
- This adds file types to the download filter i.e. submissions with one of the supplied file extensions will not be downloaded
|
- This adds file types to the download filter i.e. submissions with one of the supplied file extensions will not be downloaded
|
||||||
- Can be specified multiple times
|
- Can be specified multiple times
|
||||||
- `--skip-subreddit`
|
- `--skip-subreddit`
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ def cli():
|
|||||||
@click.option('--max-wait-time', type=int, default=None)
|
@click.option('--max-wait-time', type=int, default=None)
|
||||||
@click.option('--no-dupes', is_flag=True, default=None)
|
@click.option('--no-dupes', is_flag=True, default=None)
|
||||||
@click.option('--search-existing', is_flag=True, default=None)
|
@click.option('--search-existing', is_flag=True, default=None)
|
||||||
@click.option('--skip', default=None, multiple=True)
|
@click.option('--skip-format', default=None, multiple=True)
|
||||||
@click.option('--skip-domain', default=None, multiple=True)
|
@click.option('--skip-domain', default=None, multiple=True)
|
||||||
@click.option('--skip-subreddit', default=None, multiple=True)
|
@click.option('--skip-subreddit', default=None, multiple=True)
|
||||||
@_add_common_options
|
@_add_common_options
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Configuration(Namespace):
|
|||||||
self.search_existing: bool = False
|
self.search_existing: bool = False
|
||||||
self.file_scheme: str = '{REDDITOR}_{TITLE}_{POSTID}'
|
self.file_scheme: str = '{REDDITOR}_{TITLE}_{POSTID}'
|
||||||
self.folder_scheme: str = '{SUBREDDIT}'
|
self.folder_scheme: str = '{SUBREDDIT}'
|
||||||
self.skip: list[str] = []
|
self.skip_format: list[str] = []
|
||||||
self.skip_domain: list[str] = []
|
self.skip_domain: list[str] = []
|
||||||
self.skip_subreddit: list[str] = []
|
self.skip_subreddit: list[str] = []
|
||||||
self.sort: str = 'hot'
|
self.sort: str = 'hot'
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ class RedditDownloader:
|
|||||||
return RedditTypes.SortType.HOT
|
return RedditTypes.SortType.HOT
|
||||||
|
|
||||||
def _create_download_filter(self) -> DownloadFilter:
|
def _create_download_filter(self) -> DownloadFilter:
|
||||||
return DownloadFilter(self.args.skip, self.args.skip_domain)
|
return DownloadFilter(self.args.skip_format, self.args.skip_domain)
|
||||||
|
|
||||||
def _create_authenticator(self) -> SiteAuthenticator:
|
def _create_authenticator(self) -> SiteAuthenticator:
|
||||||
return SiteAuthenticator(self.cfg_parser)
|
return SiteAuthenticator(self.cfg_parser)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ def test_determine_directories(tmp_path: Path, downloader_mock: MagicMock):
|
|||||||
(['.test'], ['test.com'],),
|
(['.test'], ['test.com'],),
|
||||||
))
|
))
|
||||||
def test_create_download_filter(skip_extensions: list[str], skip_domains: list[str], downloader_mock: MagicMock):
|
def test_create_download_filter(skip_extensions: list[str], skip_domains: list[str], downloader_mock: MagicMock):
|
||||||
downloader_mock.args.skip = skip_extensions
|
downloader_mock.args.skip_format = skip_extensions
|
||||||
downloader_mock.args.skip_domain = skip_domains
|
downloader_mock.args.skip_domain = skip_domains
|
||||||
result = RedditDownloader._create_download_filter(downloader_mock)
|
result = RedditDownloader._create_download_filter(downloader_mock)
|
||||||
|
|
||||||
|
|||||||
@@ -166,8 +166,8 @@ def test_cli_download_search_existing(test_args: list[str], tmp_path: Path):
|
|||||||
@pytest.mark.reddit
|
@pytest.mark.reddit
|
||||||
@pytest.mark.skipif(not does_test_config_exist, reason='A test config file is required for integration tests')
|
@pytest.mark.skipif(not does_test_config_exist, reason='A test config file is required for integration tests')
|
||||||
@pytest.mark.parametrize('test_args', (
|
@pytest.mark.parametrize('test_args', (
|
||||||
['--subreddit', 'tumblr', '-L', '25', '--skip', 'png', '--skip', 'jpg'],
|
['--subreddit', 'tumblr', '-L', '25', '--skip-format', 'png', '--skip-format', 'jpg'],
|
||||||
['--subreddit', 'MaliciousCompliance', '-L', '25', '--skip', 'txt'],
|
['--subreddit', 'MaliciousCompliance', '-L', '25', '--skip-format', 'txt'],
|
||||||
))
|
))
|
||||||
def test_cli_download_download_filters(test_args: list[str], tmp_path: Path):
|
def test_cli_download_download_filters(test_args: list[str], tmp_path: Path):
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
|
|||||||
Reference in New Issue
Block a user