You are not logged in.

#1 2013-12-09 09:50:44

Ambrevar
Member
Registered: 2011-08-14
Posts: 212
Website

Musish - a dynamic and extensible music library organizer (in CLI!)

Note: this program is deprecated and has been superseeded by Demlo.

Musish organizes your music library automatically and dynamically. It runs a user-defined script using variable such as tags and file properties. This way it yields virtually unlimited customization power to the user.

Example: your music library is a a perfect definition of "chaos".

  • No folder structure.

  • Tags are not homogeneous, some entries are filled, other not, it varies from file to file.

  • Some files have bad audio quality.

  • Audio codecs are not always the same. Some file are CBR/VBR, lossless/lossy, ...

  • mp3's ID3 tags is a nightmare.

  • Covers are sometimes embedded in tags, you have a lot of bad quality covers.

A few scripts are already provided and they give a good example of what you can do. You can choose to use them, to rewrite them, or to write a new script from scratch. You can preview the changes, and once you are done you call the program over you music library, it will process everything in one single run!

  • Move all files according to a unique, yet dynamic folder hierarchy. For instance, setting
      filename="$library/$artist/${album:+${date:+$date - }$album/}${track:+$track - }$title.$ext"
    will move the "john doe - 1. intro.mp3" to "/home/$USER/musics/John Doe/2013 - Great Album/01 - Intro.ogg".

  • Case checking: a powerful gawk script that will turn everything to title case. It supports special cases such as Roman numerals, McDonald, etc. It also supports a list of exceptions (e.g. AC-DC).

  • Encoding: you can conditionally re-encode you files. For instance, if the input is lossless, you can encode to FLAC, if it is lossy, you can encode to OGG. You can choose to only re-encode files with some particular encoding settings. You can set the desired bitrate, etc.

  • Covers: automatically remove embedded covers, remove duplicates, remove files beyond/below a quality threshold, etc.

  • Different kinds of music: classic, OST, and band musics have usually different kings of tags and folder structure. You can manage different audio libraries easily by setting the corresponding "library" variables.

This program is completely written in POSIX Shell + gawk. This leads to a lightweight codebase (less than 1000 lines), and near universal portability.

Dependencies:

  • ffmpeg

  • POSIX awk

  • POSIX shell

Optional:

  • cuetools

  • jshon

AUR package: git version

Official web page: https://bitbucket.org/ambrevar/musish

Please file bug reports on the issue tracker, not on this forum, thanks!

Warning: this program has been tested for a while, but some bugs might still be floating around. Make sure to backup your data before proceeding.

Last edited by Ambrevar (2014-09-11 09:32:49)

Offline

#2 2013-12-09 14:11:25

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: Musish - a dynamic and extensible music library organizer (in CLI!)

I'm looking over the man page right now, and these two things jump out:

Its only big dependency is the transcoder, which should be FFmpeg-compatible, e.g. ffmpeg or libav...

Options

...
    -n     Skip encoding.
...

And the default configuration:

 if command -v ffmpeg >/dev/null; then
                  transcoder=ffmpeg
              else
                  transcoder=libav
              fi

              ## Default script.
              script="default"

              ## Root of all output files.
              library="$HOME/musics"

              ## Extension to process when parsing input folder.
              extensions="aac ape flac ogg mp3 mp4 mpc wav wv"

              ## Terminal output. Turn it off when not redirecting to stdout.
              use_colors=false
              use_formatting=false

Musish doesn't really automatically transcode by default, does it? Transcoding lossy files is bad mojo.

Offline

#3 2013-12-09 14:48:50

Ambrevar
Member
Registered: 2011-08-14
Posts: 212
Website

Re: Musish - a dynamic and extensible music library organizer (in CLI!)

FFmpeg is always run, at least for the metadata editing part (i.e. tags). It does not necessarily means that the audio track will be changed.

If no script is provided, the file is not reencoded. Actually it is not modified at all. This is the 'raw default' behaviour with -s "".
However the default configuration file sets a "default" script that is run by default. This script does always transcode. This is a debatable choice: maybe I should remove the default script and let the user choose his/her own default script. What do you think?

Regarding the lossy trancoding, the rules are as follows: if the output format is the same as the input and bitrate is still the same, we do not transcode. But for some reasons you may want to lower the bitrate (e.g. smaller file size), in which case we do transcode.

Another major reason for lossy transcoding: switching from mp3 to a decent format (ogg, aac...). An mp3 music library is a nightmare to maintain (different ID3 version, CBR/VBR, etc.).

The man page definitely needs some clarifications. Feel free to comment! smile

Last edited by Ambrevar (2013-12-09 14:49:52)

Offline

#4 2014-01-08 11:14:50

Ambrevar
Member
Registered: 2011-08-14
Posts: 212
Website

Re: Musish - a dynamic and extensible music library organizer (in CLI!)

Hello again!

I've added some new features and fixed bugs here and there.

  • The default configuration does not run any script. The program does not do anything meaningful if not configured. This way the user will not get into any "unexpected" behaviour.

  • Now we can redirect the (unformatted) preview to a file, edit its content with our favorite editor, and use it as input for Musish to tag and move files accordingly. So, basically this has 2 big consequences:

    • We can tag/move audio files with Vim/Emacs/TextAdept/Whatever!

    • Musish can be interfaced with any other program, both ways (X calls Musish or Musish calls X).

  • Audio files attached to a .cue file will be ignored. Those kind of files are hard to process automatically, and for now this would only result in garbage, so I chose to ignore them. I'll implement support for .cue files later.

  • I've slightly updated the man page. I've added some useful examples at the end.

I've been testing it for a while now and it is quite stable. Still, there might be some (big) bugs left, so do not run it on critical data, backup your musics first!

Feel free to leave any comment. Thanks!

Offline

#5 2014-01-22 12:44:54

Ambrevar
Member
Registered: 2011-08-14
Posts: 212
Website

Re: Musish - a dynamic and extensible music library organizer (in CLI!)

New version, new features:

  • Support for cue sheets (external or embedded).

  • Extensible format support (both container and codec).

  • Using ffprobe to fetch tags. More reliable (support for tags with linebreaks) and 2-10 times faster.

  • gawk is no longer required, everything is POSIX.

  • A ton a bug fixes, of course.

Offline

Board footer

Powered by FluxBB