Skip to content

ajeddeloh/musicPrinter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a program to print formatted music metadata. It uses libavformat to
extract the metadata, and thus will work on a large variety of files. It also
searches the steam metadata as well as the container metadata (as some 
malformatted music files have their metadata in weird places)

Still in development, some features not implemented yet.

Usage:
$ muprint [OPTIONS] format_string filename

The format string is similar to printf's format string. It uses % to denote
metadata chunks from the loaded file. %% is used to denote a literal %. each
metadata chunk is composed of an optional modifier character followed by a type
character. The modifier characters change the allowed characters, causing the 
illegal characters to be ignored or replaced with the character specified by
the -r option. If you need more advanced replace options, use another program
like tr.

MODIFIERS:
v - allow all printing (visible) ascii characters (as defined by isprint(3))
p - allow all characters in the POSIX.1-2008 portable filesystem character set
    (that is: all alphanumeric characters plus period (.), underscore(_) and
    hyphen (-). Does NOT enforce that the first character should not be hyphen
u - allow all characters that are valid characters in unix filenames (i.e. not
    '\0' and '/')
c - allows a custom set of characters, specified by the -c flag

TYPES:
t - The track title
T - The track number, does not currently support padding
d - The disc number, does not currently support padding
b - The album
A - The album artist
a - The artist
e - The file's original extension
f - The original file basename (not including extension) 
% - a literal %

examples:
/media/Music/%pA/%pb/%d-%T-%t.%e would be 
/media/<album artist>/<album>/<artist>/<disc>-<track>-<title>.<extension>
with all characters not in the metadata that are not in the posix portable
filesystem character set to be ignored/replaced

OPTIONS:
-c <characters> specifies what the custom character whitelist should be. Just
    a string of characters e.g. "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-s <original type><subsitition string> specifies what to replace a metadata
    element with if not found. Defaults to "unknown". Other metadata elements
    are valid. For example, you can replace all album artists with the artist
    using -s "A%a". Multiple substitutions for the same metadata type are
    allowed and the last one added will take precedence. If the substition
    string contains metadata types that are unknown it is ignored. This allows
    chains of subsitions (e.g. replace X with Y if y exists, otherwise replace
    with Z)
-r <single char> replace non-whitelisted characters with this one instead of
    deleting them

BUILDING:
You need libavformat and libavutil. Other than that its straight up C11 with
POSIX.1-200809L extensions, so just running
$ make
should work. If you're debuging there's also 
$ make debug
which turns on -g for you

CONTACT:
andrew.jeddeloh.HATESSPAM@gmail.com
remember, I hate spam, so just remove that part.

About

Prints music metadata using format strings

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published