I got an e-mail from Paul a month or so ago, asking politely if I’d look over his tmsu program. I’m glad I did; it’s one of the niftier things I’ve come across for file management in the past year or so.
tmsu is a tagging tool, and a lot more. That might not sound too impressive at first (it didn’t to me), but I’ve had it installed for the past week or so, and I’m quickly becoming addicted to it.
What’s that mean — a tagging tool? Well, no doubt you’ve seen posts on this site that have tags at the bottom; I try to add tags that are vaguely related to the content, so you (or I) can search on topic very easily. You can even enter it from the address bar, and get a list of posts on that tag.
tmsu does much the same for files, plus more. Here’s an example. I have a folder of files that are all jazz music files, in ogg format. I can tag a file with “jazz” and “music” like this.
kmandla@6m47421: ~/downloads/Revolution Void/Increase the Dosage$ ls
01 Invisible Walls.ogg 05 The Modern Divide.ogg 09 Accelerated Lifestyle.ogg
02 Factum par Fictio.ogg 06 Double the Daily Dose.ogg 10 Headphonetic.ogg
03 Habitual Ritual.ogg 07 Weekend Amnesia.ogg 11 Nebulous Notions.ogg
04 Effects of Elevation.ogg 08 Obscure Terrain.ogg
kmandla@6m47421: ~/downloads/Revolution Void/Increase the Dosage$ tmsu tag "01 Invisible Walls.ogg" music jazz
No reply from tmsu, but that just means all went well. Now I can find exact files that have that tag, just by asking tmsu.
kmandla@6m47421: ~/downloads/Revolution Void/Increase the Dosage$ tmsu files jazz
./01 Invisible Walls.ogg
tmsu knows where I am in the folder tree, and shows the location relative to that. If I move elsewhere, tmsu’s reply changes to reflect it.
tmsu can also tell me what tags are applied to a file.
kmandla@6m47421: ~$ tmsu tags downloads/Revolution\ Void/Increase\ the\ Dosage/01\ Invisible\ Walls.ogg
excellent jazz music
kmandla@6m47421: ~$
So, what’s so great about that? Well, it means I can tag a file with anything — dates, genres, contributing artists, release date, operating system, file format, program version, codebase, first initial, creator, download site, language, subtitles, video quality, personal ratings, prices, origin — you name it. And not just music files — anything. Plus, you’re not beholden to a rating system, application or specific mark as a tag. Tag it with whatever you like, not just what id3v9.1a says is a legitimate category for an mp3 file. π
Here’s a rough example, using personal ratings of excellent, very-good, good, and poor, which is just arbitrary. I’ve abbreviated the lists considerably, of course.
kmandla@6m47421: ~$ tmsu files excellent
./downloads/Revolution Void/Increase the Dosage/01 Invisible Walls.ogg
...
./downloads/Revolution Void/Increase the Dosage/11 Nebulous Notions.ogg
kmandla@6m47421: ~$ tmsu files poor
./downloads/Revolution Void/Let 1,000 Flowers Bloom/01 Sympathy for Mr Vertigo.ogg
...
./downloads/Revolution Void/Let 1,000 Flowers Bloom/28 Ye Ye Ye.ogg
Those would all show up if I asked for “jazz” or “music” too, because I added those tags as well.
Now, if that didn’t grab you, here’s where tmsu suddenly changes from mild-mannered scientist into a giant green unstoppable mountain of muscle.
tmsu can mount a folder as a virtual filesystem, and create symbolic links that point back to the original file. Take a look.
kmandla@6m47421: ~$ tmsu mount temp/
kmandla@6m47421: ~$ ls temp/
queries tags
The tags folder is probably the most obvious one: Inside that folder are all the tags you’ve created, and links back to their target files.
kmandla@6m47421: ~$ ls temp/tags/
alternative excellent good hip-hop jazz music poor rap rock soul very-good
kmandla@6m47421: ~$ ls temp/tags/excellent/
01 Invisible Walls.410.ogg 05 The Modern Divide.413.ogg 09 Accelerated Lifestyle.405.ogg music
02 Factum par Fictio.404.ogg 06 Double the Daily Dose.412.ogg 10 Headphonetic.414.ogg
03 Habitual Ritual.406.ogg 07 Weekend Amnesia.408.ogg 11 Nebulous Notions.407.ogg
04 Effects of Elevation.409.ogg 08 Obscure Terrain.411.ogg jazz
The numbers are file IDs, and the additional tag folders — “jazz” and “music” — point back to still more links. So I can sift even further into specific sequences of tags by following the folders, and for example, find “excellent/jazz/music”. π
That’s pretty cool, and if you have a massive collection of music or photos to manage, it will save you gobs of time and effort. But wait, there’s more. …
That other folder, queries … what about that? Let me show you first, and then we’ll try to puzzle it through.
kmandla@6m47421: ~$ ls temp/queries
kmandla@6m47421: ~$ ls temp/queries/excellent
01 Invisible Walls.410.ogg 05 The Modern Divide.413.ogg 09 Accelerated Lifestyle.405.ogg
...
04 Effects of Elevation.409.ogg 08 Obscure Terrain.411.ogg
kmandla@6m47421: ~$ ls temp/queries/
excellent
I abbreviated again, as you can see. My ls
command created a folder inside queries, and inside there are links to everything that matches my request. Magical, on-the-fly searching and linking.
I haven’t tried using tmsu in conjunction with many graphical programs, but I believe you could create a folder inside queries from within a file selection dialog, and get the same results. I’d be interested to see how that works.
I haven’t found many shortcomings with tmsu; it appears to be very well thought out, and behaves in a very Unixy way. My biggest stumbling block was a way to tag an entire folder of files with spaces in their names; the spaces were confusing tmsu and my use of quotes wasn’t helping matters.
In the end I solved it in a similarly Unixy way, by drafting find into service:
find downloads/Revolution\ Void/ -type f -exec tmsu tag "{}" music jazz \;
And that was more than enough to get the job done.
I only have about 8Gb of music that I keep, and I don’t have much in the way of photos except for family snapshots. tmsu has made me think about how I store those though, and made me wonder if the endless branches of folders are really helping.
I would strongly recommend experimenting with tmsu if you have large masses of files that need quicker access than through a file tree, or even just as a way of managing a flat folder of files without resorting things into subfolders. Check it out for a few minutes at least, and see if it can make things easier for you. π