diff --git a/README.md b/README.md index cd1c12b..cf7e589 100644 --- a/README.md +++ b/README.md @@ -131,10 +131,10 @@ The following options are common between both the `archive` and `download` comma The following options apply only to the `download` command. This command downloads the files and resources linked to in the submission, or a text submission itself, to the disk in the specified directory. -- `--exclude-id` +- `--skip-id` - This will skip the download of any submission with the ID provided - Can be specified multiple times -- `--exclude-id-file` +- `--skip-id-file` - This will skip the download of any submission with any of the IDs in the files provided - Can be specified multiple times - Format is one ID per line diff --git a/bdfr/__main__.py b/bdfr/__main__.py index 03a6e1d..bafa93c 100644 --- a/bdfr/__main__.py +++ b/bdfr/__main__.py @@ -45,14 +45,14 @@ def cli(): @cli.command('download') -@click.option('--exclude-id', default=None, multiple=True) -@click.option('--exclude-id-file', default=None, multiple=True) @click.option('--file-scheme', default=None, type=str) @click.option('--folder-scheme', default=None, type=str) @click.option('--make-hard-links', is_flag=True, default=None) @click.option('--max-wait-time', type=int, default=None) @click.option('--no-dupes', is_flag=True, default=None) @click.option('--search-existing', is_flag=True, default=None) +@click.option('--skip-id', default=None, multiple=True) +@click.option('--skip-id-file', default=None, multiple=True) @click.option('--skip-format', default=None, multiple=True) @click.option('--skip-domain', default=None, multiple=True) @click.option('--skip-subreddit', default=None, multiple=True) diff --git a/bdfr/configuration.py b/bdfr/configuration.py index 8ca94a0..8cb8f10 100644 --- a/bdfr/configuration.py +++ b/bdfr/configuration.py @@ -13,8 +13,8 @@ class Configuration(Namespace): self.authenticate = False self.config = None self.directory: str = '.' - self.exclude_id = [] - self.exclude_id_file = [] + self.skip_id = [] + self.skip_id_file = [] self.limit: Optional[int] = None self.link: list[str] = [] self.log: Optional[str] = None diff --git a/bdfr/downloader.py b/bdfr/downloader.py index 663a9b0..6fa37d6 100644 --- a/bdfr/downloader.py +++ b/bdfr/downloader.py @@ -460,8 +460,8 @@ class RedditDownloader: def _read_excluded_ids(self) -> set[str]: out = [] - out.extend(self.args.exclude_id) - for id_file in self.args.exclude_id_file: + out.extend(self.args.skip_id) + for id_file in self.args.skip_id_file: id_file = Path(id_file).resolve().expanduser() if not id_file.exists(): logger.warning(f'ID exclusion file at {id_file} does not exist') diff --git a/scripts/README.md b/scripts/README.md index 4bb098b..51e51bb 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -9,7 +9,7 @@ Due to the verboseness of the logs, a great deal of information can be gathered ## Extract all Successfully Downloaded IDs -This script is contained [here](extract_successful_ids.sh) and will result in a file that contains the IDs of everything that was successfully downloaded without an error. That is, a list will be created of submissions that, with the `--exclude-id-file` option, can be used so that the BDFR will not attempt to redownload these submissions/comments. This is likely to cause a performance increase, especially when the BDFR run finds many resources. +This script is contained [here](extract_successful_ids.sh) and will result in a file that contains the IDs of everything that was successfully downloaded without an error. That is, a list will be created of submissions that, with the `--skip-id-file` option, can be used so that the BDFR will not attempt to redownload these submissions/comments. This is likely to cause a performance increase, especially when the BDFR run finds many resources. The script can be used with the following signature: diff --git a/tests/test_downloader.py b/tests/test_downloader.py index b6e8f32..fd56994 100644 --- a/tests/test_downloader.py +++ b/tests/test_downloader.py @@ -456,7 +456,7 @@ def test_excluded_ids(test_ids: tuple[str], test_excluded: tuple[str], expected_ def test_read_excluded_submission_ids_from_file(downloader_mock: MagicMock, tmp_path: Path): test_file = tmp_path / 'test.txt' test_file.write_text('aaaaaa\nbbbbbb') - downloader_mock.args.exclude_id_file = [test_file] + downloader_mock.args.skip_id_file = [test_file] results = RedditDownloader._read_excluded_ids(downloader_mock) assert results == {'aaaaaa', 'bbbbbb'} diff --git a/tests/test_integration.py b/tests/test_integration.py index d52a527..419464f 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -299,7 +299,7 @@ def test_cli_download_use_default_config(tmp_path: Path): @pytest.mark.reddit @pytest.mark.skipif(not does_test_config_exist, reason='A test config file is required for integration tests') @pytest.mark.parametrize('test_args', ( - ['-l', 'm2601g', '--exclude-id', 'm2601g'], + ['-l', 'm2601g', '--skip-id', 'm2601g'], )) def test_cli_download_links_exclusion(test_args: list[str], tmp_path: Path): runner = CliRunner()