Skip to main content

Easy CLI audio metadata manipulator

Project description

EzAudioMeta

Build Status Build Status

Python Script that allows you to re-name meta data fields from audio files in a directory.

The usage so far:

Requirements:

  • Python 3.9.1: Maaaaybe it might work in lower versions, but can't guarantee anything. I made use of f-strings where i could, so i'd recommend Python 3.6 at the very least-
  • mutagen 1.45.1 (and it's dependencies)
  • Click 7.1.2.

Usage:

For direct usage:

py main.py --file path/to/audio/file [options]

Installing from pip:

pip install EzAudioMeta

ezaudio --file path/to/audio/file [options]

Options:

Each option represents a tag to be set. All tags must be either text or a number. Note that numbers can also be parsed from text, so if you pass tracknumber tag as "15", it will work just fine. For safety, all text should be encased between double quotes.

  --file TEXT
  --files-directory TEXT
  --from-file TEXT
  --album TEXT
  --albumartist TEXT
  --artist TEXT
  --comment TEXT
  --compilation INTEGER
  --composer TEXT
  --discnumber INTEGER
  --genre TEXT
  --lyrics TEXT
  --totaldiscs INTEGER
  --totaltracks INTEGER
  --tracknumber INTEGER
  --tracktitle TEXT
  --year INTEGER
  --isrc TEXT
  --parse-title-capitalize TEXT  Parses the 'tracktitle' from the actual file
                                 name. The track title is capitalized as a
                                 title. You must provide a valid regex
                                 expresion. Ej. (?<=\d\d\s).+(?=\.flac).

  --parse-title-as-is TEXT       Parses the 'tracktitle' from the actual file
                                 name. The track title is left as is with no
                                 capitalization or processing. You must
                                 provide a valid regex expresion. Ej.
                                 (?<=\d\d\s).+(?=\.flac).

  --parse-title-clean TEXT       Parses the 'tracktitle' from the actual file
                                 name. The track title has all '-', '_' and
                                 multiple whitespacesremoved and trimmed, and
                                 then is title capitalized. You must provide a
                                 valid regex expresion. Ej.
                                 (?<=\d\d\s).+(?=\.flac).

  --parse-track-number TEXT      Parses the 'tracknumber' from the actual file
                                 name. You must provide a valid regex
                                 expresion. Ej. \d+(?=.+\.mp3).
  --help                 Show this message and exit.

Single file as an example:

py main.py --file "track 01.mp3" --tracktitle "Track Title"
--tracknumber "12" --album "Album Name"

Directory as an example:

py main.py --files-directory "path/to/files" --artist "Artist" --album "Album Name" --genre "Genre" --year 1966

Note: Files are file system dependant, so if you are in windows: path\to\file and in linux: path/to/file. This script does distinguish between OSes (Windows and Linux so far)

Using --from-file:

This options lets you load the options from a text file, line by line, something like this:

file=value
files-directory=value
album=value
albumartist=value
artist=value

Please note that you shouldn't use file and files-directory together. Also note that all options are missing the -- at the beginning, and there is an = for separation.

You should call the script like this:

py main.py --from-file "path/to/your/text/file.txt"

Parsing track titles from file name using Regex.

EzAudioMeta allows to parse the 'tracktitle' tag from the actual file name using regular expressions. Usage is as follows

py main.py --from-file "path/to/your/text/file.txt" --parse-title-capitalize "(?<=\d\d\s).+(?=\.flac)"

Given an audio file 01 my_track_title.flac, the expected result should be:

  • --parse-title-capitalize: My_Track_Title
  • --parse-title-as-is: my_track_title
  • --parse-title-clean: My Track Title

Parsing track number from file using regex.

Ypu can also get the track number from the audio file using regex:

py main.py --file "path\to\39_audio_test_file_3.mp3" --parse-track-number "\d+(?=.+\1.mp3)"

track number gets tagged as 39. If no match is found, 0 i assigned by default.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

EzAudioMeta-0.2.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

EzAudioMeta-0.2-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file EzAudioMeta-0.2.tar.gz.

File metadata

  • Download URL: EzAudioMeta-0.2.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.1

File hashes

Hashes for EzAudioMeta-0.2.tar.gz
Algorithm Hash digest
SHA256 d1de63733b3e70c5c7a2f8eceb401f0338d8d69d13a7f18e65a6fc8c65462342
MD5 6425115ca014f55c02b719f6c7246a5c
BLAKE2b-256 86a9444e1d77aa7eb84af95822746213ef8139ca0afe443a949aca5ca1195622

See more details on using hashes here.

File details

Details for the file EzAudioMeta-0.2-py3-none-any.whl.

File metadata

  • Download URL: EzAudioMeta-0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.1

File hashes

Hashes for EzAudioMeta-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b9b1e47bcaef6d3e3f51bf0bcc1764786c80f1a6d5e3f898db261f28f9179d6a
MD5 759461cbf1ab0482c93039cabe8916c6
BLAKE2b-256 3f4b32941e902ec291457916bd0e27c1b51cace018e928b269539661028f3efd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page