Context Based on File Date

I’ve got about 400 albums out of 9,000 that have a unique meaning to me based on the file date. In short, long ago, in the early days of creating a digital library I paid a service to rip a bunch of CDs for me. Over the years I’ve used that date visually to tell one “release” form another and know if it was one of my originals. We I get around to normalizing my entire collection I will lose that date in all those files as they are updated.

Hoping someone can nudge me in the right direction with an idea. The online docs here:

Seem to suggest the Context might be an option for me. I also read somewhere that I can bring my filed into the DB without changing any data on the files themselves. Any thoughts on where to start with identifying these 400 albums and giving them some special designation that I could then put in my directory level path?


I would look into fromfilename plugin. It may not do what you want, but it’s in the right direction. If you can program Python, you can read the attributes easily. Heck, you could use any programming language to get the date attributes into the filename, then use fromfilename.

1 Like

Can you clarify what you mean by “file date”? Does that mean the modification date reported by the filesystem?

If so, you might be interested in this plugin that attempts to use that timestamp (typically called the “mtime”):

1 Like

In this case they are the same. The ripping service sent me back a HDD and they have been on my system ever since.

Maybe I’m overthinking it, but I have lots of version of the same album. Original, reissue, remaster, deluxe edition, etc. I’d just like to find a way when I’m importing and everything is getting consistently named/tagged to know this particular album was from that original group of 400-ish albums.


It seems like you’re looking at the modification time (mtime), so the ImportAdded plugin is likely what you want.

1 Like

Had no idea this was offered by this plugin. Maybe it should have a new name or even split in two with a common library/set of functions between them?

I’ll give it a look. Thanks a lot. Appreciate all the recent help. Beets is a fantastic time suck.


It appears I have the plugin working correctly. I was able to import an album then query for added and mtime.

This is each track for one of the 400 albums showing “added - mtime”


However I can’t seem to access added or mtime during the import from an inline plugin I’m working on to format the path the way I want it. Below is partial error when importing.

Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/beetsplug/", line 120, in _fun c_func return func() File "inline", line 2, in __INLINE_FUNC__ NameError: name 'mtime' is not defined

The more I think about it. Wouldn’t the stuff done in the ImportAdded plugin happen at the DB level to write those values. Meaning they are not available during the time of import and path creation? Am I understanding this correctly?

This repo may point you in the right direction re: using inline along with plugins. IIRC the plugin must proactively expose a field for inline to use. No idea if it works, I think it does, but verify that the orig_date stuff works before you go changing it.

Thanks so much for the help/advice the last few weeks. Using Import Added plugin got me where I need to be…not what I originally was after but “good enough”. In the past I used the file date just to recall if it was one of my original 400-ish.

preserve_mtimes: yes # After importing files, re-set their mtimes to their original value. Default: no.
preserve_write_mtimes: yes # After writing files, re-set their mtimes to their original value. Default: no.

Seems to do what I needed. After processing/tagging/copying to my directory specified it sets the file dats back to what they originally were. So my original 400 have the file date from back on 2012 and album art date has the date the files were processed by Beets. Kind of a crude solution but better than nothing. I tried to writ an inline plugin to actually denote the 400 in the actual directory created by Beets, but not luck there. I can live with what I have. Maybe down the road I’ll revisit this.