Make your music mix from multiple sources wih flexibility.
This python 2 script takes the contents of several directories containing Music and merges it into another directory or into a .m3u file.
The merge is done to take a file from each SOURCE directory, and place them in the DEST directory.
For example musisort -d Ddir Dir1 Dir2 Dir3
is done as folow :
Dir1 Dir2 Dir3 Ddir
-------------------------------------------------
file11.mp3 file21.mp3 file31.mp3 01_file11.mp3
file12.mp3 file22.mp3 file32.mp3 02_file21.mp3
file13.mp3 file33.mp3 03_file31.mp3
file33.mp3 04_file12.mp3
file34.mp3 05_file22.mp3
file35.mp3 06_file32.mp3
07_file13.mp3
08_file21.mp3
10_file33.mp3
11_file11.mp3
12_file22.mp3
13_file34.mp3
14_file12.mp3
15_file21.mp3
16_file35.mp3
usage: musisort [-h] [-V] [-1] [-s] [-f] [-u | -e] [-v] [-d DEST]
[-r [REPEAT [REPEAT ...]]] [-j [JUMBLE [JUMBLE ...]]]
[-a ARTIST] [-t ALBUM] [-i TITLE] [-m FILE_NAME] [-z]
SOURCES [SOURCES ...]
positional arguments:
SOURCES Input directory(s). Only music files
(* .mp3, * .flac, * .ogg, * .aac) of the
SOURCES directories are treated.
optional arguments:
-h, --help show this help message and exit
-V, --version show program's version number and exit
-1, --once Do not complete DEST by duplicating the
SOURCES if there are not enough of them.
-s, --stack Stack files instead of inserting them.
Start with all files from SOURCES1
continues with those of SOURCES2, etc.
-f, --force Forces the DEST files to be overwritten.
-u, --utf Encoding of names in UTF-8 format.
-e, --latin Encoding of names in LATIN-1 format.
-v, --verbose Display of additional information. May be
repeated to display more information.
-d DEST, --dest DEST Destination of sorting. If DEST is a directory, the
SOURCE files are copied to it. If this
parameter is absent, the current directory is
taken. If this directory does not exist, use
the --force option to create it. If this directory
contains files, use the --force option to
replace them. If DEST is a .m3u or .m3u8 file
a playlist will be created based on the extension.
If this file exists, use the --force option to
replace it
-r [REPEAT [REPEAT ...]], --repeat [REPEAT [REPEAT ...]]
Repeat the input directories. Each
digit represents the number of times a
SOURCES directory must be repeted again.
By default, only one time.
If you want to repeat only the second
directory 3 times, for example, you must
specified 1 for the first REPEAT (-r 1 3).
-j [JUMBLE [JUMBLE ...]], --jumble [JUMBLE [JUMBLE ...]]
Scramble input directories. Each number
represents the SOURCES directory number to mix.
Directories not specified in this list are
sorted by filename.
tags:
List of tags to modify. Allows you to reassign the value of "Tags".
This option is a string composed of several
characters. %a=artist, %t=album title, %n=track number,
%i=song title, %s=sequence number generated by the program.
It starts with 1 and is incremented for each file. This
makes it possible to respect the sort order. The other characters are
interpreted as such. (These options have no effect in case of writing
a .m3u or .m3u8 file).
-a ARTIST, --artist ARTIST
New value for the 'artist' tag.
-t ALBUM, --album ALBUM
New value for the tag 'album title'. By default
"Musisort".
-i TITLE, --title TITLE
New value for the tag 'name of the song'.
Defaults to "%s_%i - %a".
-m FILE_NAME, --file-name FILE_NAME
New value for file name. The
file will retain its extension.
Default to "%s_%i - %a".
-z, --clear_tags Specifies whether the "Tags" of DEST files should
Be cleared before storing new Tags.
Just put the scrypt in /usr/local/bin
fo rexemple and make it executable.
media-libs/mutagen (https://github.com/quodlibet/mutagen)
- Translate from French.
- Make pyhton3 compatible.