Part of my library is a bunch of singles I’m always tagging using a flexible attribute. I finally found a way to automatize this. It’s a Python script watching a folder with inotify : as soon as a file is dropped in a folder, it’s imported to beets and the flexible attribute is set depending on the dropped-in sub-folder name.
However the current script does not search/match the file against databases, so tags are not corrected and imported as they are in the file. I’m curious to know if something in the beets API could help to complete this ?
First, this is a hard problem because, inevitably, you may want user interaction to do autotagging. Sometimes, there’s no good match, and then it’s hard for a fully automated system to know what to do.
The easiest way, however, would be to invoke beets as a command-line application, e.g., using Python’s subprocess module. Use the -q switch to ensure that no user interaction will be required.
Thanks, that’s what I was looking for ! I discovered by the way the highly relevant quiet_fallback parameter…
I know this use case is unnatural for Beets, but I really wanted to allow a free-form router function new_item(item, dropbox_path), so I’m sticking to a Python implem. I’m now testing a new variant, integrated as a plug-in and calling directly import_files so it’s the closest as possible to beet imp -q. It’s currently in this branch :
drop2beets is now a proper plug-in. The flexattr function can be provided from the configuration and it includes a systemd service installer. It’s all explained in the README down here : https://github.com/martinkirch/drop2beets
Neat! There’s no official application process, but we’d be happy to do it—the way to take care of that is just to open a pull request to add a bullet to that page. Thanks!!
this seems like a good spot to show a little plugin I developed in the past few days trying to achieve something similar. I called it beets-watch because it’s based on/uses watchdog to make it more platform independent. I didn’t really intend to make it public as python isn’t really my strong suit, but seeing as you’re trying to achieve something similar with drop2beets, I thought I’d share my attempt. Any suggestions and comments are welcome and if I find the time I’ll improve the readme and provide a proper package/ci.