Import singles to Beets as soon as they are dropped in a folder
Project description
drop2beets
A Beets plug-in that imports singles as soon as they are dropped in a folder.
You can provide a function to set meta-data
or custom attributes depending on the sub-folder in which the file has been dropped.
The examples
folder contains some examples of on_item
functions you may
adapt to your needs.
We use Beets' auto-tagger in quiet mode, and inotify to detect dropped files.
Get started
You'll need Python3 and an existing Beets library. Run:
pip install drop2beets
Enable and configure the plug-in by running beet config -e
and set at least
the path to the "dropbox" folder.
plugins: drop2beets
drop2beets:
dropbox_path: ~/beets-dropbox
We advise you configure Beets to always move files out of the Dropbox,
and set quiet_fallback
:
import:
move: yes
copy: no
quiet_fallback: asis
quiet_fallback
tells Beets what to do when the auto-tagger is not sure about
the song's identifiaction.
Set it to skip
to abort the importation in case of ambiguity,
or asis
to import using tags as they are in the incoming file.
This will avoid surprises in case of ambiguous matches,
because this script invokes Beet's auto-tagger in quiet mode (as beet import -q
)
after your custom function.
This function is on_item
. It is written in Python,
and lets you set some tags depending of which sub-folder the file is dropped in.
If you want one, define it in the configuration from this template:
drop2beets:
on_item: |
def on_item(item, path):
"""
Parameters:
item: the beets Item that we're about to import
path: its sub-folders path in our dropbox ; if the items has been dropped at the root, then it's empty.
Returns:
A dict of custom attributes (according to path, maybe) ; return None if you don't want to import the file right now.
"""
return {}
Now you're ready to test by calling beet dropbox
on the command line and
dropping a few files in the folder.
Hit Ctrl+C to close the script.
For a longer-term installation, configure a log file path
drop2beets:
log_path: ~/drop2beets/log.log
Linux users can install this as a user-lever systemd service by running beet install_dropbox
(in a shell where the virtual environment is activated).
Note that you'll have to restart the service when you update the on_item
function.
Examples wanted !
I'd be happy to include your own variations of this script or the on_item
function
in the examples folder,
feel free to post them in
Issues or
Pull Requests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file drop2beets-2.0.1.tar.gz
.
File metadata
- Download URL: drop2beets-2.0.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Linux/6.8.6-200.fc39.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd8fdd336f77ed0ed79e2051f7282d9ddb5caa2507f3b2e850afce18c2bca216 |
|
MD5 | e318264508012d70fa78c016e864cb73 |
|
BLAKE2b-256 | c762e6ca2c0cf3a7466f3c7bc30681150b1438672c7f9907a5df4d1a0c3128e8 |
File details
Details for the file drop2beets-2.0.1-py3-none-any.whl
.
File metadata
- Download URL: drop2beets-2.0.1-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Linux/6.8.6-200.fc39.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aab02ea7afe9ffd7b9354f91aefe4b0f9e90b96c9e2b63cd7e0b7f3c49c8dc92 |
|
MD5 | 26813e624d6cbba4150e49ff63560245 |
|
BLAKE2b-256 | 7bf0a2a0bee3068fde3d503109330499fd2d6fd9baa7db05a112419b1dc91cfe |