musicfix

music file renamer and tagger
git clone git://git.2f30.org/musicfix.git
Log | Files | Refs | README | LICENSE

README (3626B)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Description

Musicfix is a music file renamer and tagger with consistency concerns.
It has a release-centered logic and gets data from the Discogs.com site.
First configure the target music directory (`mdir` config attribute).
Next browse the site and locate your album.  Change to the album's
directory.  Ensure the files are ordered and provide the release id
to the program.  Enjoy!


# Dependencies

  * System packages: taglib
  * Ruby gems: stringex taglib-ruby


# Usage

    $ musicfix        
    Usage: musicfix [fake] relid [tracks]
           musicfix [fake] dump relid [relfile]
           musicfix [fake] load [relfile]
           musicfix [fake] tags [relfile]

The common path is to just give the release id:

    $ musicfix 1234

More sophisticated track selection can be performed by providing
a tracks selector command line argument of the form:

    "1--3,5,8"
    "A2--A4,B3"
    "1-8--1-9,1-10--1-11"

Alternatively, YAML metadata files can be used (`release.yaml` by default)
in order to dump information from Discogs.com and/or load the information
from file.  This way you can generate a base release file, edit to
your needs, and then use it for tagging and renaming.  The fake prefix
on all commands results in no files to be copied/written and no cover
artwork to be downloaded.  For example:

    $ musicfix dump 1234
    $ musicfix fake load
    $ musicfix load

You may also generate a release file using the existing audio file tags
and use that file instead:

    $ musicfix tags
    $ musicfix load

The release metadata is saved together with the music files by default,
and the load command looks for any YAML files in the current directory
(if there is no relfile specified and `release.yaml` does not exist).
This is useful for renaming files again using a new naming scheme.


# Configuration

In the simplest case no configuration is needed!  The music files are
copied to the ~/music directory, which is created if needed.  If you
want to change that, create a `~/.musicfixrc` configuration file
containing:

    mdir: ~/music/fixed

Furthermore, templates are used for the naming of music files, the
cover artwork image and the release metadata file.  The defaults are:

    track: '"#{mdir}/#{fba}-#{my}-#{fb}-#{fv}/#{d}#{fn}-#{fa}-#{ft}.#{x}"'
    image: '"#{mdir}/#{fba}-#{my}-#{fb}-#{fv}/#{zz}-#{fba}-#{fb}_cover.jpg"'
    rdata: '"#{mdir}/#{fba}-#{my}-#{fb}-#{fv}/#{zz}-#{fba}-#{fb}_release.yaml"'

To run a shell command upon completion use the `after` attribute.
For example, to update the MPD database:

    after: '"mpc update #{fba}-#{my}-#{fb}-#{fv}"'

The variables used in the templates are explained below.
The 'f' prefix means "normalized for filename".

Use everywhere:

    [f]b: album name
    [f]ba: album artist
    y: release year
    my: master release year
    g: genre style
    [f]v: release format

Only for track naming:

    [f]a: track artist
    [f]t: track title
    [f]n: track number, may have letters (vinyls)
    d: disc number
    tn: track number counter
    x: file extension in lowercase

Only for image and rdata naming:

    zz: zeros that match d + n width

Only for image naming:

    i: the index in the list


# Cover artwork support

From March 2015 and onwards cover artwork images are resources restricted
to authenticated clients.  The easiest way to do this and the one supported
by musicfix is to create a Discogs account and generate a personal access
token from the developers settings.  Add the token in `~/.musicfixrc` like
this:

    token: abcxyz123456

You'll get no cover artwork without adding your personal access token.