The Auto-Ellipsis Script (AES)

1.0 Introduction

The presence of multiple full-stops in a music file’s name can throw some software ‘out’. It can interpret them in ways that fundamentally stop the software working properly.

I have therefore written a little utility that scans a folder full of FLAC files and if it spots ‘..’ or ‘…’ in any of the file names, it will replace them with a single character which looks like three dots, but is actually a single character called an ellipsis.

See if you spot the difference between this:

...

..and this..

Visually, perhaps, you might not notice too much difference: they both look like lots of dots. But if you use your mouse to highlight each in turn, you’ll find the first is made up of three separate ‘full stop’ characters and the second is made of a single character, which merely takes the form of looking like three dots. The fact that it’s a single character, however, prevents it from breaking various software utilities!

2.0 The Script

To automate the replacement of two or three separate ‘dots’ into a single ellipsis, I’ve written the Auto-Ellipsis Script (AES), which you can download from here.

Download it to your $HOME/Downloads folder as normal and then issue these commands to ‘install’ it:

sudo mv $HOME/Downloads/aes.sh /usr/bin 
sudo chmod +x /usr/bin/aes.sh 
sudo ln -s /usr/bin/aes.sh /usr/bin/aes

That is, as root, you move the downloaded file into the /usr/bin folder (where it will then be in your environment’s PATH). You make it executable. Finally, you create a link to the new executable that lacks the “.sh” extension, so that you can invoke the program just by typing “aes”, rather than “aes.sh”.

Since AES is simply a Bash shell script, you are encouraged to open the downloaded file in the text editor of your choice, to satisfy yourself that it does what it claims it will do and nothing else.

3.0 Running AES

To run AES, you simply cd to a folder full of FLACs, any one or more of which have the problematic ‘multiple dots’ filenames. You then run the script by typing the command aes and the file names are all fixed.

Here, for example, is a before shot:

Notice that files 9 and 12 have three dot names.

I therefore simply ‘cd’ to this folder, type aes and this happens:

Now, you’ll be hard-pressed to tell the difference! Files 9 and 12 still have three dots in them -but they are now proper single-character ellipses, not three separate full stops.

Here’s a slightly more obvious example:

That file has two full stops in its name. Run the AES script against it, however:

…and now it appears to have three! But that’s because two-dots are also replaced with the single ellipsis character (which always appears as three dots).

AES will also check the TITLE metadata for a FLAC track that it’s about to physically rename: if the two- or three-dot characters appear there as well, they are replaced there as well, so that the TITLE metadata continues to follow the physical file name (and vice versa).

Note that if you have four or more consecutive dots in a file name, AES will deal with them by seeing them as either 2 or 3 dot groups. For example, 7 dots would be seen as 3+3+1: the two 3-dot groups get replaced by ellipses; the solo dot at the end is retained. That’s OK though, because programs tend not to mind single dots in filenames (they all have at least one of them anyway, after all, just before the file extension!). So a filename that ends up containing ellipsis-ellipsis-single dot will not break software.

AES provides no feedback or interactivity: it simply sees the contents of a folder and modifies file names and metadata tags if necessary, dumping you back at a command line prompt when it’s done.

4.0 Getting AES to Auto-Fix Everything

AES has no ‘bulk fixing’ capability. It fixes whatever is in the directory you are running it in. It is not particularly difficult, however, to incorporate AES inside a Bash script that does race through your entire music collection, fixing all faux-ellipses it finds along the way. Here’s one such script:

#!/bin/bash

MUSICDIR="$1"
cd "$MUSICDIR"
shopt -s globstar
for f in **/*.flac; do
if [[ "$f" == *".."* ]]; then
  NEWDIR=$(dirname "$f")
  cd "$MUSICDIR/$NEWDIR"
  aes
fi
done

exit 0

Save that as script somewhere (let’s call it ‘$HOME/Desktop/fixdots.sh’ and then run it specifying the root of your music collection, for example:

$HOME/Desktop/fixdots.sh /music/classical

The script will then trawl through that folder and all its sub-folders, running aes every time it finds a file name that contains at least two consecutive full stops. Obviously, you might want to test this out on a few copied directories first and assure yourself you know what it will do, before letting it rip through your main music library!

Author

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

License

AES is copyright © Howard Rogers 2021 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, complaints or suggestions to [email protected].