diff --git a/README.md b/README.md index 03c7a2b..b4b913d 100644 --- a/README.md +++ b/README.md @@ -222,15 +222,20 @@ Options: -c, --config PATH Override the config file location. --help Show this message and exit. - Commands: - cache Manage the read cache. - collages Manage collages. - config Utilites for configuring Rosé. - fs Manage the virtual filesystem. - playlists Manage playlists. - releases Manage releases. - rules Run metadata upda + artists Manage artists. + cache Manage the read cache. + collages Manage collages. + config Utilites for configuring Rosé. + descriptors Manage descriptors. + fs Manage the virtual filesystem. + genres Manage genres. + labels Manage labels. + playlists Manage playlists. + releases Manage releases. + rules Run metadata update rules on the entire library. + tracks Manage tracks. + version Print version. ``` > [!NOTE] diff --git a/docs/AVAILABLE_COMMANDS.md b/docs/AVAILABLE_COMMANDS.md index 089857d..9085a15 100644 --- a/docs/AVAILABLE_COMMANDS.md +++ b/docs/AVAILABLE_COMMANDS.md @@ -64,6 +64,18 @@ resource they effect. Most commands are of the structure `rose {resource} {actio - `playlists remove-track`: Remove a track from a playlist. - `playlists set-cover`: Set the cover art for a playlist. Replaces any existing cover art. - `playlists delete-cover`: Remove the cover art of a playlist. +- artists/ + - `artists print`: Print a single artist's metadata and releases in JSON. + - `artists print-all`: Print all artists' metadata and releases in JSON. +- genres/ + - `genres print`: Print a single genre's metadata and releases in JSON. + - `genres print-all`: Print all genres' metadata and releases in JSON. +- labels/ + - `labels print`: Print a single label's metadata and releases in JSON. + - `labels print-all`: Print all labels' metadata and releases in JSON. +- descriptors/ + - `descriptors print`: Print a single descriptor's metadata and releases in JSON. + - `descriptors print-all`: Print all descriptors' metadata and releases in JSON. - rules/ _(see [Improving Your Music Metadata](./METADATA_TOOLS.md))_ - `rules run`: Run an ad hoc rule in the command line interface. You can also easily test rules with the `--dry-run` flag. diff --git a/rose/config.py b/rose/config.py index 7e4e6b0..d16caa1 100644 --- a/rose/config.py +++ b/rose/config.py @@ -564,9 +564,10 @@ def parse(cls, config_path_override: Path | None = None) -> Config: dfs_state.append((child_accessor, v)) continue unrecognized_accessors.append(accessor) - logger.warning( - f"Unrecognized options found in configuration file: {', '.join(unrecognized_accessors)}" - ) + if unrecognized_accessors: + logger.warning( + f"Unrecognized options found in configuration file: {', '.join(unrecognized_accessors)}" + ) return Config( music_source_dir=music_source_dir, diff --git a/rose_cli/cli.py b/rose_cli/cli.py index d0a590e..16365e5 100644 --- a/rose_cli/cli.py +++ b/rose_cli/cli.py @@ -52,11 +52,19 @@ update_cache, ) from rose_cli.dump import ( + dump_all_artists, dump_all_collages, + dump_all_descriptors, + dump_all_genres, + dump_all_labels, dump_all_playlists, dump_all_releases, dump_all_tracks, + dump_artist, dump_collage, + dump_descriptor, + dump_genre, + dump_label, dump_playlist, dump_release, dump_track, @@ -523,6 +531,86 @@ def delete_cover_playlist(ctx: Context, playlist: str) -> None: delete_playlist_cover_art(ctx.config, playlist) +@cli.group() +def artists() -> None: + """Manage artists.""" + + +@artists.command(name="print") +@click.argument("artist", type=str, nargs=1) +@click.pass_obj +def print_artist(ctx: Context, artist: str) -> None: + """Print a artist (in JSON). Accepts a artist's name.""" + click.echo(dump_artist(ctx.config, artist)) + + +@artists.command(name="print-all") +@click.pass_obj +def print_all_artists(ctx: Context) -> None: + """Print all artists (in JSON).""" + click.echo(dump_all_artists(ctx.config)) + + +@cli.group() +def genres() -> None: + """Manage genres.""" + + +@genres.command(name="print") +@click.argument("genre", type=str, nargs=1) +@click.pass_obj +def print_genre(ctx: Context, genre: str) -> None: + """Print a genre (in JSON). Accepts a genre's name.""" + click.echo(dump_genre(ctx.config, genre)) + + +@genres.command(name="print-all") +@click.pass_obj +def print_all_genres(ctx: Context) -> None: + """Print all genres (in JSON).""" + click.echo(dump_all_genres(ctx.config)) + + +@cli.group() +def labels() -> None: + """Manage labels.""" + + +@labels.command(name="print") +@click.argument("label", type=str, nargs=1) +@click.pass_obj +def print_label(ctx: Context, label: str) -> None: + """Print a label (in JSON). Accepts a label's name.""" + click.echo(dump_label(ctx.config, label)) + + +@labels.command(name="print-all") +@click.pass_obj +def print_all_labels(ctx: Context) -> None: + """Print all labels (in JSON).""" + click.echo(dump_all_labels(ctx.config)) + + +@cli.group() +def descriptors() -> None: + """Manage descriptors.""" + + +@descriptors.command(name="print") +@click.argument("descriptor", type=str, nargs=1) +@click.pass_obj +def print_descriptor(ctx: Context, descriptor: str) -> None: + """Print a descriptor (in JSON). Accepts a descriptor's name.""" + click.echo(dump_descriptor(ctx.config, descriptor)) + + +@descriptors.command(name="print-all") +@click.pass_obj +def print_all_descriptors(ctx: Context) -> None: + """Print all descriptors (in JSON).""" + click.echo(dump_all_descriptors(ctx.config)) + + @cli.group() def rules() -> None: """Run metadata update rules on the entire library."""