Skip to content

Commit

Permalink
Add example INI file for the new configuration parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef-Friedrich committed Jun 11, 2022
1 parent e54f049 commit 88e381e
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 21 deletions.
12 changes: 9 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ Usage

.. code-block:: text
usage: audiorenamer [-h] [-d] [-s FIELD_SKIP] [-v] [-E] [-r]
[-p BACKUP_FOLDER] [-B] [-C | -M | -n] [-A | -D] [-F]
usage: audiorenamer [-h] [-d] [-v] [-E] [-r] [-p BACKUP_FOLDER] [-B]
[-C | -M | -n] [-A | -D] [-s FIELD_SKIP] [-F]
[-m ALBUM_MIN] [-e EXTENSION]
[--genre-classical GENRE_CLASSICAL] [-k] [-S]
[-c FORMAT_STRING] [-f FORMAT_STRING]
Expand Down Expand Up @@ -623,9 +623,9 @@ Usage
optional arguments:
-h, --help show this help message and exit
-d, --dry-run Don’t rename or copy the audio files.
-v, --version show program's version number and exit
-s FIELD_SKIP, --field-skip FIELD_SKIP
Skip renaming if field is empty.
-v, --version show program's version number and exit
metadata actions:
-E, --enrich-metadata
Expand All @@ -634,6 +634,12 @@ Usage
The audio file must have the tag field “mb_trackid”.
The give audio file is not renamed.
-r, --remap-classical
Remap some fields to fit better for classical music:
“composer” becomes “artist”, “work” becomes “album”,
from the “title” the work prefix is removed
(“Symphonie No. 9: I. Allegro” -> “I. Allegro”) and
“track” becomes the movement number. All overwritten
fields are safed in the “comments” field.
rename:
-p BACKUP_FOLDER, --backup-folder BACKUP_FOLDER
Expand Down
22 changes: 13 additions & 9 deletions audiorename/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,6 @@ def parse_args(argv):
action='store_true'
)

# field_skip
parser.add_argument(
'-s',
'--field-skip',
help='Skip renaming if field is empty.',
default=False
)

# version
parser.add_argument(
'-v',
Expand Down Expand Up @@ -284,7 +276,11 @@ def parse_args(argv):
metadata_actions.add_argument(
'-r',
'--remap-classical',
help='',
help='Remap some fields to fit better for classical music: \
“composer” becomes “artist”, “work” becomes “album”, from the \
“title” the work prefix is removed (“Symphonie No. 9: I. Allegro” \
-> “I. Allegro”) and “track” becomes the movement number. All \
overwritten fields are safed in the “comments” field.',
action='store_true'
)

Expand Down Expand Up @@ -380,6 +376,14 @@ def parse_args(argv):

filters = parser.add_argument_group('filters')

# field_skip
parser.add_argument(
'-s',
'--field-skip',
help='Skip renaming if field is empty.',
default=False
)

# album_complete
filters.add_argument(
'-F',
Expand Down
13 changes: 7 additions & 6 deletions audiorename/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,13 @@ def enrich_metadata(self) -> None:
self.mb_workhierarchy_ids = '/'.join(wh_ids)

def remap_classical(self) -> None:
"""Remap some fields to fit better for classical music. For example
``composer`` becomes ``artist`` and ``work`` becomes ``album``.
All overwritten fields are safed in the ``comments`` field. No
combined properties (like ``ar_combined_composer``) are used and
therefore some code duplications are done on purpose to avoid circular
endless loops.
"""Remap some fields to fit better for classical music:
``composer`` becomes ``artist``, ``work`` becomes ``album``, from the
``title`` the work prefix is removed (``Symphonie No. 9: I. Allegro``
-> ``I. Allegro``) and ``track`` becomes the movement number. All
overwritten fields are safed in the ``comments`` field. No combined
properties (like ``ar_combined_composer``) are used and therefore some
code duplications are done on purpose to avoid circular endless loops.
"""
safe = []

Expand Down
12 changes: 9 additions & 3 deletions doc/source/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Comande line interface

.. code-block:: text
usage: audiorenamer [-h] [-d] [-s FIELD_SKIP] [-v] [-E] [-r]
[-p BACKUP_FOLDER] [-B] [-C | -M | -n] [-A | -D] [-F]
usage: audiorenamer [-h] [-d] [-v] [-E] [-r] [-p BACKUP_FOLDER] [-B]
[-C | -M | -n] [-A | -D] [-s FIELD_SKIP] [-F]
[-m ALBUM_MIN] [-e EXTENSION]
[--genre-classical GENRE_CLASSICAL] [-k] [-S]
[-c FORMAT_STRING] [-f FORMAT_STRING]
Expand Down Expand Up @@ -560,9 +560,9 @@ Comande line interface
optional arguments:
-h, --help show this help message and exit
-d, --dry-run Don’t rename or copy the audio files.
-v, --version show program's version number and exit
-s FIELD_SKIP, --field-skip FIELD_SKIP
Skip renaming if field is empty.
-v, --version show program's version number and exit
metadata actions:
-E, --enrich-metadata
Expand All @@ -571,6 +571,12 @@ Comande line interface
The audio file must have the tag field “mb_trackid”.
The give audio file is not renamed.
-r, --remap-classical
Remap some fields to fit better for classical music:
“composer” becomes “artist”, “work” becomes “album”,
from the “title” the work prefix is removed
(“Symphonie No. 9: I. Allegro” -> “I. Allegro”) and
“track” becomes the movement number. All overwritten
fields are safed in the “comments” field.
rename:
-p BACKUP_FOLDER, --backup-folder BACKUP_FOLDER
Expand Down
48 changes: 48 additions & 0 deletions example-config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[metadata actions]
enrich_metadata = False
remap_classical = False

[rename]
backup_folder = None
best_format = None

[rename move actions]
copy = False
move = False
no_rename = False

[rename cleaning actions]
backup = False
delete = False

[filters]
album_complete = False
album_min = False
extension = False
genre_classical = False
field_skip = False

[formats]
classical = False
shell-friendly = False
no_soundtrack = False

[format strings]
compilation = False
format = False
soundtrack = False
format-classical = False

[output]
color = False
no-color = False
debug = False
job-info = False
mb-track-listing = False
one-line = False
stats = False
verbose = False

[target]
source_as_target = False
target = False

0 comments on commit 88e381e

Please sign in to comment.