User Tools

Site Tools


wiki:software:ccdt

The Classical CD Tagger (CCDT)

1.0 What is CCDT?

If you've ripped an Audio CD using the Classical CD Ripper (CCDR), then you already possess FLAC files on your hard disk that have been tagged with metadata describing the Composer, the name of the composition involved and its genre: those 'core' tags are part of CCDR's fundamental functionality.

But CCDR won't have been able to write meaningful metadata into the track name, performer(s) and Album Art tags: so, all your ripped music will be called things like “track01.flac” without a lot to distinguish it from the “track01.flac” that was ripped earlier for the other Symphony or Concerto on that CD of yours.

CCDT therefore steps into the picture in order to be able to complete the set of tag metadata that completely describes a piece of classical music.

2.0 What does CCDT do?

CCDT runs entirely as a command-line tool, from a terminal session window. It will prompt you to supply Track titles, Performers and Album Art metadata. You can supply just one of those three things; any choice of two of them; or all three in one sitting, as you prefer.

Whatever you type in, it writes as Vorbis Comments -the correct form of tag for a FLAC file (we don't believe in ripping classical music to MP3 files, which need ID3 tags to store their metadata).

It won't fetch any data from the Internet (since it's always wrong as far as classical music is concerned). What you type in, typos and all, is what gets stored in the relevant tags.

At the end of the tagging process, CCDT will open the music files it's just processed in either Easytag or Puddletag GUI metadata tagging tools, just so you can review what it's done and correct any minor mishaps that may have been made at the command line. If you don't have one or other of those GUI tools installed, of course, then CCDT skips this last step. (Incidentally, if you have both programs installed, CCDT will launch Easytag in preference to Puddletag, for reasons explained here). Both GUI tools are capable of writing proper Vorbis Comments tags to FLAC files.

3.0 Obtaining CCDT

CCDT is supplied as a simple Bash script (so you can open it in a text editor and make sure it's not doing anything it's not supposed to do!), and can be obtained simply by clicking this link.

Once downloaded and saved somewhere, it just needs to be turned into an executable script by issuing the command:

chmod +x ccdt.sh

You can then invoke the application by issuing the command:

./ccdt.sh

To make launching the program easier and a tiny bit faster, I then do the following two things (which are entirely optional):

sudo mv ccdt.sh /usr/bin/ccdt.sh
sudo ln -s /usr/bin/ccdt.sh /usr/bin/ccdt

The first of these commands moves the shell script into the /usr/bin directory, so that it's in your PATH and can therefore be invoked from anywhere on the file system, rather than only in a specific directory.

The second command creates a symbolic link in the /usr/bin directory called just “ccdt”, so that you can launch the program by typing just:

ccdt

…rather than having to remember the “.sh” bit at the end.

If you choose not to do either of these things, then you will only be able to launch the program by first cd-ing to a directory containing music files and then typing the exact and full path+filename to the executable (so you'd end up having to type something like '/home/username/Downloads/ccdt.sh', for example).

CCDT technically depends on having metaflac installed before it can do its 'thing', so it will begin by checking that is installed on your system. If it can't find it, it will prompt you to install it and quit.

CCDT must be launched in a folder that contains FLAC files (otherwise, there's nothing for it to do!). If it doesn't detect the existence of any files with a .flac extension when launched, it will give you a warning about the need for FLACs to exist and then quit.

4.0 Example of Use

Let us suppose I have downloaded ccdt.sh to /home/hjr/Downloads. Assume I have NOT copied it to /usr/bin or created a symbolic link to it. Finally, assume I have previously ripped audio tracks to /home/hjr/Music/Symphony_No.1.

Here's how I would then tag those files:

cd /home/hjr/Music/Symphony_No.1
/home/hjr/Downloads/ccdt.sh

That is, I would first physically locate myself within the directory containing the Symphony's files. I would then have to spell out the full path and filename of the CCDR shell script.

I could alternatively specify the script's path using relative naming, like so:

../../Downloads/ccdt.sh

A set of two periods (..) each mean “move up one directory from my current directory”. So given I'm in /home/hjr/Music/Symphony_No.1, the two sets of dots takes me to /home/hjr -from which I can then reference the Downloads directory and the shell script it contains relatively.

Now suppose that I HAVE moved the shell script to /usr/bin and HAVE created the symbolic link to it. The same outcome would be obtained with these commands:

cd /home/hjr/Music/Symphony_No.1
ccdt

The need to move to the place where the music files exist is still there, but because the shell script is now in my path and has been aliased to a short-form name that lacks the “.sh” extension, I can launch the program much more simply and without having to spell out full paths or relative paths at all.

5.0 A Worked Example

As an example of how to use CCDT, let's assumed you've ripped a CD of Vaughan Williams music, and whatever ripping tool you used has decided to apply Internet-acquired metadata to it, causing the file names to be as shown here:

From this, we can see that the CD actually contained music from two symphonies. They've been ripped into a single directory -which is the first mistake that needs to be corrected!

5.1 Setting Album Properties

So, using your file manager's innate capabilities, create two sub-folders for each symphony (remembering that the conductor's suname -in this case “Manze”- is used as a 'distinguishing artist' component of the folder name, so that this Symphony No. 9 doesn't conflict with that recorded by Adrian Boult, for example). You end up with this sort of thing:

And within one of those folders:

In short, you get the tracks sorted out physically, with each “work” being located within its own, properly named folder. Once that's done, we can start the business of tagging.

Just change directory to one of these music files and invoke the CCDT program:

In my case, I stored ccdt.sh in /usr/bin (so it's in my path) and I created a symbolic link to it (so I can invoke it with just “ccdt” without having to remember to type the “.sh” bit). Once you invoke it in a directory full of FLAC files, the main program menu is shown:

The basic principle behind CCDT is that you work your way down the list of menu options in order. You don't strictly have to do that: you can, for example, set a Genre before you set the Composer name. But it makes sense to do so!

Hopefully, the menu options are mostly self-explanatory: the 'Composer' should be set as the full, usual name of the composer of the work in question. In this case, “Ralph Vaughan Williams” would be correct. So I type 1 then [Enter]:

You will note in this simple case that CCDT prompts you in white and whatever you type appears in yellow. Sometimes CCDT will display useful information in bright, bold-white (see the “You are in…” display at the top of the screen, which is an ever-present reminder of the name of the directory or folder you were in when you invoked CCDT). Sometimes (but hopefully rarely!) you will see messages displayed in red if there's an error or warning status associated with an action.

Anyway, in this case, after typing in the composer name, you just press [Enter]. The new tag is immediately applied to all the FLAC files in your current working directory and you are returned to the main menu.

Setting the composition name is the second task, so type 2 and [Enter}:

Fundamentally, this isn't any more difficult to complete than anything else: just type the data in, press [Enter], done. But the 'work name' being prompted for is not what you might think it is. Remember that according to the Dizwell Classical Music Tagging guidelines, a 'work' is not just the name of a composition, but also includes a 'distinguishing artist name' so that you can distinguish one recording of a work from another. What that 'distinguishing artist name' is, is something you get to decide -but, most often, it will be the conductor of the orchestra.

Thus in this case, it's not enough to say it's “Symphony No. 7”, but that it's “Symphony No. 7 conducted by Andrew Manze”… And guess what? You already specified that stuff when you physically created the sub-folders for each work's files to be stored in. Thus, the name of the directory you're in will (should!) already be the work+artist combo we're after.

If that's true for you too, note that there's a special shortcut you can take to cause the physical directory name to be 'pasted in' as the composition name: Ctrl+Shift+V should do the trick (unless you've copied something into your PC's clipboard after you invoked CCDT: in that case, your clipboard's contents will be pasted in as the composition name, which probably isn't right! Note this copy-paste-directory-name functionality only works if the xclip tool is installed (which should be easy to do: sudo apt install xclip will work on Ubuntu, for example; sudo pacman -S xclip does the job on Arch. You won't be warned if xclip isn't installed: the Ctrl+Shift+V functionality just won't work if it isn't.

Anyway: I'm not using the Ctrl+Shift+V shortcut to paste in the directory name in the last screenshot. Instead, I'm doing it the old-fashioned way: I'm highlighting the “You are in…” information at the top of the screen. Once highlighted, I can copy-and-paste that data in, like so:

Since I've pasted the data in as user-input, it appears yellow, of course.

The other 'Album Properties' all work in much the same way: press the number+Enter to select an option, type the relevant data in, then press [Enter] to submit it -at which point, the files are updated and you are returned to the main menu.

5.2 Setting Track Properties

The 'Track Properties' options are a little more involved. For starters, Option 7 will let you re-number the tracks in a folder. In my case, whilst the five movements of Symphony No. 7 were already correctly tagged as tracks 1 to 5, the four movements of Symphony No. 9 were tagged as tracks 6 to 9. But that's not correct, since Symphony No. 9 ought to have tracks 1, 2, 3 and 4: the fact that it was supplied as the second part of a single CD doesn't make that requirement go away!

So, for Symphony No. 7, I'd press 7 [Enter] and then just press [Enter] again:

The tracks are then tagged with numbers 1 to 5, but no actual re-numbering takes place. Note the warning in red shown in that screenshot: if you just press Enter when asked 'what starting track number do you want', CCDT assumes you want to start at 1 and supplies that as the starting number for you.

It gets more interesting when I process Symphony No. 9, though:

Notice that the 'You are in' display tells me I've switched to processing Symphony No. 9. This time, when asked, I have typed in that I want to start numbering tracks at '1' (it's shown in yellow, because I entered it; and there's no red warning message, since CCDT isn't having to assume anything this time round). The rest of the display then shows the four movements of the symphony each being tagged with ever-incrementing track numbers, so that the final movement ends up (correctly) assigned to track number 4.

Note that you must take option 7, even if you don't need to re-number tracks, because it's the only way that audio files get a TRACKNUMBER tag assigned to them. It's just that if you do need to renumber tracks, option 7 is also the way to achieve that.

Finally, note track 8's functionality:

The track naming functionality first checks if the track in question already has been assigned a TITLE tag. If it has, then it displays the current setting in red before asking if you want to change it; if not (i.e., there's no TITLE data at all for an audio file), then you are simply prompted to start typing the name of the track.

If you press [Enter] at the prompt shown, you are accepting the default option of saying 'N'o to altering the existing TITLE. The default option is shown as a capital letter. So, to change this track (to remove the album name it currently includes, for example -something all-too-common as far as digital classical music is concerned!), you need to type 'y' and then fill in the correct name when prompted:

Again, the 'y' and the new TITLE name appear in yellow, because they are both bits of user-supplied input.

Once you have supplied the TITLE information for the first track, CCDT immediately repeats the same sort of prompts for the next (if there is one):

So, if there are many tracks to a work, there will be lots of these prompt-response sections displayed on the screen. Old ones scroll off up the screen as new ones appear.

As you supply new TITLES for each of the tracks, the physical file names will be changed to match. So, for example, here's what my Symphony No. 9 files used to be called:

And here's what they are called now:

I didn't rename these files in a file manager or at the command line with 'mv' commands; CCDT renamed them all by itself based on (a) the TRACKNUMBER tag I'd assigned them using Option 7; and (b) the TITLE tag I'd assigned them using Option 8.

For this reason, it's highly desirable to set the TRACKNUMBERS before you set the TITLES -because there's no telling what order tracks will be numbered in, if you've changed their TITLES beforehand. (For example, if you have files physically named 1.flac, 2.flac, 3.flac and you set their TITLES to, respectively, zebedee.flac, florence.flac and arnold.flac, then when you come to set the TRACKNUMBERS, though you start at 1, that will be applied to arnold.flac (since it now appears first alphabetically). Track 2 will be florence.flac (because it's second alphabetically), so that will end up being correct, by sheer luck, as it originally started out as '2.flac'. Lastly, zebedee.flac will be numbered as track 3, because it's now alphabetically last in the list -even though it was originally 1.flac. So, files 1, 2, 3 eventually become numbered 3, 2, 1 because their track names changed and implied a different sort-order to what they had originally.

In short, applying names to files before you assign track numbers to them is not a good idea! Always apply track numbers first.

Note that applying track numbers and track titles are the only things which affect the physical naming of files on your hard disk. CCDT doesn't rename things because you change the composer name or performer details, for example.

5.3 Metadata Options

Finally, CCDT provides two ways of checking what you've done and cleaning things up after you've done it. Option 9 simply displays the tag metadata for the first file found in the directory:

For the most part, you want to see data which you have obviously typed in and non which you haven't! From the above display, you can tell a few things:

1) I've forgotten to supply a list of performers for this work: the COMMENT= tag is empty. But the TITLE, TRACKNUMBER, COMPOSER, ARTIST and ALBUM tags are all present. (Whether they are correct or not is another matter!)

2) There are some 'foreign' tags present: WAVEFORMEXTENSIBLE_CHANNEL_MASK is not a tag that ought to be present, and indicates that this FLAC file was actually ripped in a completely different format and only later converted to being FLAC.

3) The TRACKTOTAL tag is empty. You know this is TRACK 1, because the TRACKNUMBER tag tells you… but you don't know if it's track 1 of 5, or 1 of 14, or 1 of whatever!

Note that you simply press a key to make this display of tag metadata disappear and return to the main menu.

If you now select Option 10 from the main menu “Clean tag metadata”, some of these issues will be resolved for you. This option essentially runs the Dizwell Tag Cleaner against all the FLAC files in the current directory. That means 'foreign' tags will be erased; it also means TRACKTOTAL should be correctly calculated and filled in for you:

Notice how TRACKTOTAL is now correctly shown as '4' and the WAVEFORM.. tag has disappeared. Obviously, cleaning tags in this way can't invent information which wasn't already there: thus COMMENT+ is still blank, because the cleaner has no way of magicking the performers for this work out of thin air!

5.4 Quitting

When you've completed all the tagging data for a set of tracks, you should quit the CCDT application cleanly by pressing 'q' and [Enter]:

When you cleanly quit, the CCDT cleans the metadata for all the files in the directory automatically. That is, it effectively takes Option 10 for you and then exits. This means that you don't generally need to take Option 10 as a routine part of tagging your files: quitting will do the same job for you anyway. (But option 10 is there for if you want to clean, without actually tagging or re-tagging, any metadata).

Quitting CCDT also causes a small temporary file to be written to your home directory that stores the details of whatever metadata you supplied in the session now ending. If you supplied Composer, Performer, Year of Recording and so on… all those bits of information will be remembered. This means that when you next run CCDT, those bits of information will already be displayed as options that can be applied to your next set of tracks just by pressing [Enter].

For example: I just tagged Symphony No. 7 as having been written by Ralph Vaughan Williams. Look what happens when I then go on to tag Symphony No. 9's tracks:

This time, note that 'Ralph Vaughan Williams' appears in bold, bright white inside a pair of square brackets: he's now the default composer, remembered from my last CCDT session. If I just press [Enter] at this point, Symphony No. 9 will be tagged with exactly the same Composer/Artist information. I needn't type anything at this point, therefore: just press [Enter] and the hard work will be done for you!

Remembering data supplied in one session and presenting it as default options for the next session can be really useful. It means you tag up one symphony laboriously, but the second symphony on the same CD can be tagged largely by doing nothing but selecting an option, pressing [Enter] and then selecting the next option.

This is why remembering data supplied in a session is the default behaviour. But it's a behaviour that can be switched off (starting with CCDT version 2.05 and above). Why might you want to not remember data supplied in a CCDT session?

Well, let's say you realise that you can't spell “Giovanni Gabrieli” correctly and you've just noticed that one of his works was tagged “Giovanni Gabrielli” (two ells in the surname… this is a real-world example!). So you go back to the folder containing the files that have been tagged erroneously and you want to re-launch CCDT to correct the typo. But… if you now only supply 'Giovanni Gabrieli' as the correctly-spelled composer name, you would not have supplied performers, genre, album art or recording year data… so those things would be 'remembered' for next time as… blank.

So, sometimes, you might want to run CCDT in 'don't remember anything' mode. To do this (only version 2.05 and above), just launch CCDT with a --nostore flag. This will put CCDT into 'no memory' mode, as shown in the program header:

That “no memory mode” notice in red, over on the right-hand side of the header, warns you that no metadata at all which you supply in the current CCDT session will be remembered for future use, including blanks. Put another way, the fact that you didn't supply a piece of metadata for something won't be remembered, either.

So, imagine this workload:

  1. You tag CD1 of a Gabrieli work, with a list of performers that stretches as long as your arm. But you mis-spell the composer's surname
  2. You realise the spelling mistake in the composer name
  3. You run ccdt --nostore and correct the composer name in CD1, but type nothing else
  4. You now rip CD2 of the same Gabrieli work… the long list of performers is offered to you as the default selection for the 'Set Performers' menu item, so you can just press [Enter] to accept it

Now imagine the alternative workload (which would have applied in versions of CCDT prior to 2.05):

  1. You tag CD1 of a Gabrieli work, with a list of performers that stretches as long as your arm. But you mis-spell the composer's surname
  2. You realise the spelling mistake in the composer name
  3. You run ccdt and correct the composer name in CD1, but type nothing else
  4. You now rip CD2 of the same Gabrieli work… and have to type the long list of performers, the recording year, the album art path/filename and so on back in again from scratch.

Without “--nostore”, the CCDT run at Step 3 remembers “blank” for all metadata except the composer name. So the new CCDT session at Step 4 can offer you nothing by way of defaults to accept.

But with “--nostore”, the CCDT run at Step 3 doesn't remember that you supplied almost no metadata, so the new run at Step 4 can offer you as defaults the stuff you typed in at Step 1 (including the mis-spelled composer name: so make sure to correct it on the second run through!)

In short: You will run “ccdt” most often, but “ccdt --nostore” is handy on the rare occasions when you want to correct a minor error in just one piece of metadata, without the non-provision of other metadata during that run being 'remembered' as the defaults for the next run.

5.5 In Conclusion

CCDT works especially well when there's bulk tagging to be done -for example, when you need to tag a boxed set of all of Vaughan Williams' symphonies. The composer is the same throughout; so are the performers (probably); the Album Art is quite often the same too. So if you type the data in laboriously for the first symphony, it's just a lot of pressing [Enter] subsequently to knock all the other symphonies into shape relatively quickly! (This comes in handy for Mozart rather more than, say, Vaughan Williams… but even typing 'Ralph Vaughan Williams' eight times more than you need to is a slog that CCDT can spare you from!!)

Even for small tagging jobs, though, CCDT works well to make you supply the required information, and only the required information! By stepping through the menus in the correct order, you miss nothing out and add nothing extraneous.

The built-in tag cleaning when you quit cleanly also makes sure your metadata is neat and tidy -and performs a check that your audio data is still 'clean' and hasn't become corrupted. That's a valuable thing to know about your media files in itself!

Above all, perhaps, CCDT requires nothing but an ability to type: there's no point-and-click-and-miss to get things bent out of shape!

It is hoped, therefore, that you'll find CCDT helpful and useful.

Author

CCDT was devised and written by Howard Rogers ([email protected]).

License

CCDT is copyright © Howard Rogers 2019, but is made available freely under the GPL v2.0 only. That license may be downloaded here.

Bugs Tracking, Feature Requests, Comments

There is no formal mechanism for reporting and tracking bugs, feature requests or general comments. But you are very welcome to email your comments to [email protected]

wiki/software/ccdt.txt · Last modified: 2019/07/05 12:21 by dizwell