Expand fromfilename to albums that have tags?

#1

I have some albums that look like this:

E:\import\Pink Floyd - The Dark Side of the Moon [Blu-Ray 4.0] (1973) [16-48 FLAC] (10 items)
Tagging:
Pink Floyd - The Dark Side of the Moon
URL:
https://musicbrainz.org/release/be701edc-c9c7-484a-9ed2-aeef051c19be
(Similarity: 93.3%) (tracks, catalognum, label) (CD, 2016, US, Pink Floyd Records, 88875170912)

  • Breathe -> Breathe (In the Air) (id, title)
  • Money (6:49) -> Money (6:23) (length)
  • Us and Them (7:27) -> Us and Them (7:49) (length)

Often, they are so popular that the MusicBrainz backend has little hope of picking out the correct reissue. But the folder path has more info - in this case, it has the correct medium and an original release date. I have other folders with a date of the reissue, and others with a catalog number that may not be reflected in the tags. I’ve seen Beets match an original vinyl release when the folder name included a CD catalog number for a reissue.

It does not appear that the Beets core is philosophically aligned with grabbing info from file paths. That’s why fromfilename exists. But, as documented, that plugin only operates when your tracks are missing tags.

Fromfilename also does not seem to care about folder paths, only the filename itself.

Should I spin out my own plugin, or could I add some functionality to fromfilename? It could read a config value for when it should be invoked: either when_missing, or always.

#2

Hmm; good question! I guess there are two real options to explore here:

  • Adding an option to the fromfilename plugin to let the filenames override the built-in tags. This sounds like a very reasonable addition! It does worry me a little that it could be a “deal with the devil”: some albums might be better matched via metadata, and some might be better matched with filenames. It’s hard for those things to coexist. But that doesn’t mean it’s not worth adding the option. Go for it!
  • Does that album have some of that information (year, etc.) in the metadata tags? It’s possible that we just need to do a better job of using that metadata in the initial search.
#3

It has barcode, catalognumber, discID, edition, and label. I definitely have albums where the metadata is sparse but the folder path has a proper catalog number and release medium.

It does worry me a little that it could be a “deal with the devil”: some albums might be better matched via metadata, and some might be better matched with filenames.

If I were to implement this, I would only enable the feature on some folders I know have good folder naming. Overall I’m more willing to use the metadata.

#4

Cool. It seems like the first thing—that is, investigating how to productively use the list of metadata you listed above, when it’s available—would be a good place to start. I don’t think we currently use the catalog number to search, for example, although we do use it to match on the returned album entries. Doing that could be really helpful if we can do it in a sensible way.

The reason I suggest starting there, instead of with hacking on fromfilename, is that the latter will benefit from the former: without a pathway for using a (metadata) catalog number in a search, it will be pretty hard to make fromfilename do any better than metadata searching.