GithubHelp home page GithubHelp logo

node-musicnamer's Introduction

musicnamer

Organize your music collection

Rename music files based on their tags. By default, musicnamer will take your music files and rename them to a format like:

:artist/:album/:trackno - :title.:ext

This package is not meant to be used as a Node module, but rather as a command line tool

Usage

Invocation of musicnamer is simple: just run the program with files as arguments and it will do its thing on them.

~$ musicnamer -h
Usage: musicnamer.js file1.mp3 file2.mp3 file3.mp3 ...

given a list of files from the command line, rename them
based on their id3 tags

-f, --format     custom format line to use (defaults to :artist/:album/:trackno - :title.:ext)
-h, --help       print this message and exit
-i, --init       create a config file at /Users/dave.eddy/.musicnamer.json
-j, --json       output json, assumes --dry-run and --tags
-n, --dry-run    don't actually rename files, just print what actions would be taken
-t, --tags       just print the tags from the files processesd, assumes --dry-run
-u, --updates    check for available updates
-v, --version    print the version number and exit

Examples

To invoke musicnamer, simply pass a file over the command line as an argument

dave @ [ bahamas10 :: (SunOS) ] ~ $ musicnamer somesong.mp3
warn: error reading ~/.musicnamer.json, running with default config
warn: invoke with --init to create the config file

processing: somesong.mp3
moving: /home/dave/somesong.mp3
->  to: BEING/Arrival/12 - The Singularity (Cosmists II).mp3

Music namer renamed the file for us. What effectively happened here is this

mkdir -p "BEING/Arrival"
mv somesong.mp3 "BEING/Arrival/12 - The Singularity (Cosmists II).mp3"

NOTE: musicnamer renames files relative to your current directory.

We can see the error message above complaining because the config file was not found/ unreadable. We can fix this warning with this:

dave @ [ bahamas10 :: (SunOS) ] ~ $ musicnamer --init
writing config to /home/dave/.musicnamer.json

More details on the configuration file can be found in the Configuration section below.

Now let's say we wanted to rename a bunch of files, but were worried about modifying them without testing. You can run musicnamer with a dry run option to show what action would have been taken.

dave @ [ bahamas10 :: (SunOS) ] ~ $ musicnamer --dry-run somesong.mp3
moving: somesong.mp3
->  to: BEING/Arrival/12 - The Singularity (Cosmists II).mp3
no action taken

As you can see, the warning message no longer shows because we have created a config file. Also, musicnamer just printed out what it would have done, but didn't actually call rename(2) on any of the files or make any new directories.

You can also test out files to get a glimpse into how musicnamer sees your files. There is a command line switch to have musicnamer print out the tags of files without renaming them.

dave @ [ bahamas10 :: (SunOS) ] ~ $ musicnamer --tags music/*.mp3
processing: song.mp3
{ title: 'Stimulus',
  artist: [ 'The Omega Experiment' ],
  albumartist: [],
  album: 'The Omega Experiment',
  year: '2012',
  track: { no: 2, of: 0 },
  genre: [],
  disk: { no: 0, of: 0 },
  picture:
   [ { format: '浩条⽥灪来cover\u0000',
       data: <Buffer 00 ff db 00 43 00 02 01 01 01 01 01 02 01 01 01 02 02 02 02 02 04 03 02 02 02 02 05 04 04 03 04 06 05 06 06 06 05 06 06 06 07 09 08 06 07 09 07 06 06 08 ...> } ] }
processing: song2.mp3
{ title: 'Motion',
  artist: [ 'The Omega Experiment' ],
  albumartist: [],
  album: 'The Omega Experiment',
  year: '2012',
  track: { no: 3, of: 0 },
  genre: [],
  disk: { no: 0, of: 0 },
  picture:
   [ { format: '浩条⽥灪来cover\u0000',
       data: <Buffer 00 ff db 00 43 00 02 01 01 01 01 01 02 01 01 01 02 02 02 02 02 04 03 02 02 02 02 05 04 04 03 04 06 05 06 06 06 05 06 06 06 07 09 08 06 07 09 07 06 06 08 ...> } ] }

This output is good to look for debugging information, without making any modifications to the filesystem.

Configuration

musicnamer --init will create a config file in ~/.musicnamer.json. This config file has a key called format, which has the format to use when renaming files.

~$ cat ~/.musicnamer.json
{
  "format": ":artist/:album/:trackno - :title.:ext"
}

The --init option will write out the default format value to the config file, this is the format that will be used if the config file is not present.

Possible options for variables are:

  • :artist: artist name
  • :album: album name
  • :trackno: track number
  • :title: track title
  • :ext: file extension
  • :year: track year

Format can also be passed in from the command line like: --format 'format string'

Installation

npm install -g musicnamer

Credits

License

MIT License

node-musicnamer's People

Contributors

bahamas10 avatar michaelrhodes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

node-musicnamer's Issues

The album information is always required?

I configured my .musicnamer.json file to use this format: :artist/:title.:ext – that doesn't require an album name but I cannot rename a file without the album information because of this line.

BTW thank you for this great tool, it feels so good to get rid of Mp3tag :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.