Presenting drop2beets : automatic import of files dropped in a folder

Hello beets,

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.

The script, installer and examples are in https://github.com/martinkirch/drop2beets

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 ?

Martin

1 Like

Wahoo, that’s very cool!

About your question on autotagging:

  • 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.
  • If you instead are interested in using beets’s autotagger as a library, that’s a little trickier but still possible. Here are the key lines that invoke the autotagger pipeline: https://github.com/beetbox/beets/blob/a907dac16c685a013686cc10a6e092a7ca21ddcd/beets/ui/commands.py#L925-L926

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 :

Hello,

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

Is there something like an official application to be added to community plug-ins listed on https://beets.readthedocs.io/en/stable/plugins/index.html#other-plugins ?

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!!

Bumping the topic to announce that the plug-in is now published on pypi, so one can install it with pip install drop2beets.

Enjoy !

2 Likes

Hello,

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.