Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

metadator

A CLI tool for bulk editing audio file metadata.

Installation

Linux

git clone https://github.com/sitenee/metadator.git
cd metadator

pip install -r requirements.txt

or by using venv (recommended)

git clone https://github.com/sitenee/metadator.git
cd metadator

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Windows (PowerShell)

git clone https://github.com/sitenee/metadator.git
cd metadator

pip install -r requirements.txt

or by using venv (recommended)

git clone https://github.com/sitenee/metadator.git
cd metadator

python -m venv venv
venv\Scripts\Activate.ps1
pip install -r requirements.txt

Usage

metadator -p PATH -n NESTED -m MODE -f FIELD -v VALUE -c COVER

You can also check simplified usage instructions with :

metadator -h

PATH

PATH specifies where operations are performed. Metadator accepts both folders and files as PATH. If left empty, works in current working directory. When working in folder, script finds all suitable music files, and perform chosen operation on all files.

metadator -p "music-folder" -mg

This line prints all tags values for all files in "music-folder". PATH also accepts muliple values at once, like this :

metadator -p "music-folder", "Poles 1469.mp3" -mg

That line will print all tags both for files from "music-folder", and file "Poles 1469.mp3".

NESTED

You can use -n to perform any action, in selected folder and all it's subfolders.

metadator -p "music-folder" -mg -n

This line will print all tags for all files in "music-folder", and all it's subfolders.

In given tree :

music-all/
├── Rap
│   ├── Artist 1
│   └── Artist 2
│       ├── Album 1
│       └── Ep 1
└── Jazz
    ├── Artist 1
    └── Artist 2

Assuming that current working directory is "music-all", line :

metadator -mw -f "artist" -v "Frank Sinatra" -n

Would change value of tag "artist" in every file, in every folder above, to "Frank Sinatra".

FIELD, VALUE and COVER

This variables works different depending on which mode is in use. In some modes you can use only part of those variables. Check what exatly those variables do in exact modes in descriptions below.

MODE

metadator operates in modes [ -m ]: get, write, replace, search empty

get [ -mg ]

allows use of -c or -f, not both

  • -c - gets cover of file
  • -f - pick field to get value

Without passing any arguments, metadator prints all found tag values in specified files :

metadator -mg

In this case for all files in current working directory.

With -c you can get cover of file/files and save it to file :

metadator -p "I Try.mp3" -mg -c "i_try_cover"

Line above will get cover of "I Try.mp3", and save it to file with correct extenstion, in this case "i_try_cover.jpg".

With -f you can get values for specific tag

metadator -mg -f "artist"

This can be usefull to compare values between files, or/and check if the tag value is not empty.

write [ -mw ]

  • -c - overwrites cover, other variables can't be used with -c
  • -f - decides which tag to overwrite
  • -v - value that will be put into tag

With -c you can set covers :

metadator -p "Poles 1469.mp3" -mw -c "cover.jpg"

Line above will set "cover.jpg" as "Poles 1469.mp3" cover (also work for whole folders). If file/files have suitable cover, but in wrong aspect ratio, you can use -c [crop], to crop cover to square (at center), as in line below :

metadator -p "Love Scars.mp3" -mw -c [crop]

Besides writing covers, this mode writes value to tags :

metadator -mw -f "artist" -v "Kanye West"

Line above changes value of tag "artist", to "Kanye West", in all music files found in current working directory.

Write mode, also allows you to copy values from tag to tag, by using [tagname] :

metadator -mw -f "albumartist" -v [artist]

Line above would copy value from tag "artist", to tag "albumartist" for each separate file found in current working directory. If in this path would be 2 files with values :

  • "Limitless.mp3" -> artist: "Trippie Redd", albumartist: empty
  • "blow it.mp3" -> artist: "UncleBac", albumartist: empty

Tag values would change to :

  • "Limitless.mp3" -> artist: "Trippie Redd", albumartist: "Trippie Redd"
  • "blow it.mp3" -> artist: "UncleBac", albumartist: "UncleBac"

replace [ -mr ]

  • -f - pick tag in which to replace string
  • -v - states value to be raplaced with

This mode allows you to replace some part of string value in selected tag. For example. If downloaded file has value of "artist" tag like this :

|

| | artist: Lil Tecca | Trippie Redd

|

But Navidrome expect format "Artst1; Artist2" for handling multiple artists, you can execute line :

metadator -mr -f "artist" -v " | " "; "

Which will replace substring " | " with "; ", changing value of tag "artist" to :

|

| | artist: Lil Tecca; Trippie Redd

|

search empty [ -ms ]

allows only -f variable

This mode searches for files with empty specified tags, giving you the list of paths.

For example, if mode get used like this :

metadator -mg

Searched through all files in current working directory and found, that part of files, have tag "artist" with empty value, you can execute :

metadator -ms -f "artist"

Which will return list of paths like :

/home/user/music/song1.mp3
/home/user/music/song4.mp3

About

A CLI tool for bulk editing audio file metadata.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages