Clojure library designed to make it easy to manipulate/cleanup bad mp3 tag with UTF-8 support.
Design with simplicity in mind so out of the box it can do the following:
- Set the file name as title of the mp3 track
- Set the track index to current position in the list e.g. track/track-total based on the current position
- Set common tags shared by all the files (e.g. same artist, album, genre, etc)
Built on top of the two useful library
- claudio (Clojure)
- jaudiotagger (Java)
Will be provided the easy way to run this later for now please see below.
Available via clojars.org/clj-audiotagger
- Leiningen
[clj-audiotagger "0.2.0"]
- Gradle
compile "clj-audiotagger:clj-audiotagger:0.2.0"
- Maven
<dependency>
<groupId>clj-audiotagger</groupId>
<artifactId>clj-audiotagger</artifactId>
<version>0.2.0</version>
</dependency>
- Java SDK
- Clojure
- Leiningen
- Clone the repository
# clone the repository
mkdir -p ~/projects
# clone the repository
git clone git@github.com:agilecreativity/clj-audiotagger.git ~/projects
# Generate the standalone binary (to be installed to `~/bin`)
mkdir -p ~/bin
# Now build the standalone executable using [lein-bin]
lein bin
You should get output like the following:
$lein bin
Created /home/bchoomnuan/codes/others/clj-audiotagger/target/clj-audiotagger-0.2.0.jar
Created /home/bchoomnuan/codes/others/clj-audiotagger/target/clj-audiotagger-0.2.0-standalone.jar
Creating standalone executable: /home/bchoomnuan/codes/others/clj-audiotagger/target/clj-audiotagger
Copying binary to #object[java.io.File 0x3cc79c02 /home/bchoomnuan/bin]
Note that the executable is called clj-audiotagger
and is automatically copied to ~/bin/clj-audiotagger
Assume that the ~/bin
is in your $PATH
# Run the command without any options will print default usage
~/bin/clj-audiotagger`
# Or if ~/bin is your executable path you could just type
clj-audiotagger
Which should produce something like:
Update mp3 id3 tag using simple rules.
Usage: clj_audiotagger [options]
-b, --base-dir DIR . The staring directory
-f, --file-name-as-title Use file name as title
-t, --position-as-track-order Use position as track order
-u, --set-shared-tags Update shared tags
-c, --cover COVER_FILE The shared cover file that will be updated to
-h, --help
Options:
--base-dir DIR starting directory
--cover COVER_FILE the shared cover file if any
--filename-as-title
--position-as-track-order
--set-shared-tags tags
title TITLE
album ALBUM
artist ARTIST
genre GENRE
year YEAR
comment COMMENT
Please refer to the manual page for more information.
- To rename all the mp3 files to the filename try
clj-audiotagger --base-dir ~/media/mp3s --file-name-as-title
- To update the play index try
# long version
clj-audiotagger --base-dir ~/media/mp3s --position-as-track-order
# Or short version
clj-audiotagger -b ~/media/mp3s -t
- To update the common attributes of a given list of files
e.g. Good use-case if have the media sharing the same type of attribute (artist, album, year)
# Using short version of the command
clj-audiotagger -b ~/media/mp3s -u album "Metallica Greatest Hits" artist "Metallica" comment "My fav band"
for list of the attribute please see claudio for attribute you can set.
The common values are:
title TITLE
album ALBUM
artist ARTIST
genre GENRE
year YEAR
comment COMMENT
- To update the cover image for all files in a given directory (both jpg and png are supported)
# If you have the png file
clj-audiotagger -b ~/media/mp3s \
-u album "Metallica Greatest Hits" artist "Metallica" comment "My fav band" \
-c music/metallica-cover.png
# If you have the jpg file
clj-audiotagger -b ~/media/mp3s \
-u album "Continuum" artist "John Mayer" \
-c music/john-mayer.jpg
- Add documentation on how to run it with lein-bin
- Add the ability to update of cover image for a file
Some links I found useful while developing this library
- claudio - read/write MP3 ID3 tags with Clojure
- jaudiotagger - most recent version of the original Java library
- fs - file system library by Anthony Grimes
- Fleetdb project
- Mixing Java and Clojure project
- Good example on Java interop with Clojure
- Working with file in Clojure
- Java interop with Clojure
- Mp3 cover art
- Random links related to embedded cover art
- sample media with cover art
- Good way to list Java's medthod from Clojure's REPL
- List of PRs related to jaudiotagger
- List of GUI player for Arch Linux
Copyright © 2016 Burin Choomnuan
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.