Home
Name Modified Size InfoDownloads / Week
custom.py 2022-04-20 1.3 kB
LICENSE 2022-04-20 35.1 kB
README.md 2022-04-20 5.8 kB
taggerman 2022-04-20 13.2 kB
Totals: 4 Items   55.4 kB 0

Taggerman

Taglib based Command-line audio file tag editor in Python

Description

Taggerman is another command line tag editor. It supports all formats that Taglib support. The main difference between the others and this one is that it lets you use the files actual tag as a selector. You can, for example, change the tags of all files where genre is set to "Porg Rock" to "Prog Rock". Regexp can also be used. It's a audio tags power-tool!

Installation

The only dependency is Tagpy. It can be installed with apt-get install python3-tagpy or with Pip install tagpy Make sure the taggerman program is executable and in your path and you should be good to go

Usage

taggerman [options]

Options

[directory] (optional, default=.)

Directory to scan for audio files.
If empty, the TAGGERMAN_DIRECTORY environment variable will be used.
If also empty, the current directory will be used.

-c / --conditions (optional, default=Match All)

Conditions to match files. Multiple conditions are separated and 'and' or 'or' and parenthesis can also be used.

Each condition is a tagname, an comparator and a value: i.e. genre=J-Pop

Comparator can be :

      =  equality
      ~  regexp
      >  after (for year and date tags)
      <  before (for year and date tags)
      !  part of (multi-tag)

Special values:

      -empty-  will match an empty tag

-a / --actions (optional, default=echo)

Actions to perform on the matched files

Multiple actions are separated by ";" i.e. "artist=Perfume;genre=J-Pop"

Actions can be:

      echo  Print out the filename
      print  Print out the a formated view of the matched files>
      show x  Print out the content of tag x i.e. "show title"
      format x  Print out the formated string x i.e, 'format "[{year}] {title:<25} ({artist})"'
      tagname=value  Set tagname to value i.e. "artist=BiSH"
      tagname>value  Add value to tagname (multi-tag)
      tagname<value  Remove value to tagname (multi-tag)
      reset x  Reset of tag x (i.e. reset genre will empty the genre tag)

Multi-Tag

Multi-tag is mostly used for the genre tag and the most widely recognised method by media players is to separate by ";". This is what this program do by default. It can be use for just any tag, but it probably wont be understood by media players outside of the genre tag.

The multi-tag separator can be customized with the TAGGERMAN_MULTITAG_SEPARATOR environment variable.

Custom action

In addition to the build-in, custom actions can be created and saved in ~/.config/taggerman/custom.py

Any function defined in this file will be called with 3 args: filename, tagref and the args passed to the function.

If the function want to perform something that is beyond it's scope, you can specify further actions in the return value.

Only "save" is supported at this point but watch out for more.

Example: Returning the value { 'save':True } will have the tags be saved (unless --test was provided or interactively is -i is provided)

-e / --elseAction

Same as --actions but is triggered on file NOT matching the conditions.

-s / --silent

Do not display the banner and the working indicator. (do this if you plan to pipe the output)

-t / --test

Destructive action (thoses that write on file) will not be performed but will just print out what it would have been done.

-i / --interactive

User is prompted with a confirm dialog when a file a about to be modified.

-v / --verbose (optional)

Verbose will make the program print out more stuff as it work. Probably useless unless you want to debug something.

Environment Variables

TAGGERMAN_DIRECTORY

Default directory to use. Default to the current directory. Yes, the default has a default.

TAGGERMAN_PRINT_FORMAT

The format to use for printing. Default is [{year:>4}] {artist:25}| {title:20}| {album:25}| {genre:20}

TAGGERMAN_FILE_FORMAT_REGEXP

Regexp to match audio files. Default to '\.(mp3|mpc|mpp|mp4|ogg|flac|asf|aiff)$'

TAGGERMAN_MULTITAG_SEPARATOR

Separator for multi-tagging. Default to ';'.

Usage Examples

List all audio files in current directory and below:

%> taggerman

Print all files in and below the ~/Music/Perfume directory and set their tags genre to "J-Pop" and artist to "Perfume"

%> taggerman ~/Music/Perfume -a "print; genre=J-Pop; artist=Perfume"

Set the genre of all file om ~/Music to "J-Pop" if their genre is either "Jpop", "Japanese Pop" or match the regexp "^Domestic".

%> taggerman ~/Music -c 'genre=Jpop or genre="Japanese Pop" or genre~"^Domestic"' -a "genre=J-Pop"

Fix the genres tag on your Genesis collection

%> taggerman ~/Music -c 'artist="Genesis" and year<1980' -a 'genre="progressive Rock"' -e 'genre="Pop Rock"

Support/Contact

Mastodon : https://octodon.social/@kingu_platypus_gidora Twitter : https://twitter.com/Ghidorah Facebook : https://www.facebook.com/Taggerman-108364908521084 Email : tronconneuse@gmail.com

License

GPL

Project status

Beta. Testing needed.

Source: README.md, updated 2022-04-20