drop2beets


Namedrop2beets JSON
Version 2.0.1 PyPI version JSON
download
home_pagehttps://github.com/martinkirch/drop2beets
SummaryImport singles to Beets as soon as they are dropped in a folder
upload_time2024-04-21 16:41:22
maintainerNone
docs_urlNone
authorMartin Kirchgessner
requires_python<4.0,>=3.7
licenseWTFPL
keywords watch beets music import
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # drop2beets

A [Beets](http://beets.io/) 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](https://github.com/martinkirch/drop2beets/tree/master/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](https://pypi.org/project/inotify/) to detect dropped files.

## Get started

You'll need Python3 and an existing Beets library.
Run:

```bash
pip install drop2beets
```

Enable and configure the plug-in by running `beet config -e` and set at least
the path to the "dropbox" folder.

```yaml
plugins: drop2beets
drop2beets:
    dropbox_path: ~/beets-dropbox
```

We advise you configure Beets to always move files out of the Dropbox,
and set `quiet_fallback`:

```yaml
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:

```yaml
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

```yaml
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](https://github.com/martinkirch/drop2beets/tree/master/examples) folder, 
feel free to post them in
[Issues](https://github.com/martinkirch/drop2beets/issues) or
[Pull Requests](https://github.com/martinkirch/drop2beets/pulls).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/martinkirch/drop2beets",
    "name": "drop2beets",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.7",
    "maintainer_email": null,
    "keywords": "watch, beets, music, import",
    "author": "Martin Kirchgessner",
    "author_email": "martin.kirch@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c7/62/e6ca2c0cf3a7466f3c7bc30681150b1438672c7f9907a5df4d1a0c3128e8/drop2beets-2.0.1.tar.gz",
    "platform": null,
    "description": "# drop2beets\n\nA [Beets](http://beets.io/) plug-in that imports singles as soon as they are dropped in a folder.\n\nYou can provide a function to set meta-data\nor custom attributes depending on the sub-folder in which the file has been dropped.\nThe [examples](https://github.com/martinkirch/drop2beets/tree/master/examples)\nfolder contains some examples of `on_item` functions you may\nadapt to your needs.\n\nWe use Beets' auto-tagger in quiet mode,\nand [inotify](https://pypi.org/project/inotify/) to detect dropped files.\n\n## Get started\n\nYou'll need Python3 and an existing Beets library.\nRun:\n\n```bash\npip install drop2beets\n```\n\nEnable and configure the plug-in by running `beet config -e` and set at least\nthe path to the \"dropbox\" folder.\n\n```yaml\nplugins: drop2beets\ndrop2beets:\n    dropbox_path: ~/beets-dropbox\n```\n\nWe advise you configure Beets to always move files out of the Dropbox,\nand set `quiet_fallback`:\n\n```yaml\nimport:\n    move: yes\n    copy: no\n    quiet_fallback: asis\n```\n\n`quiet_fallback` tells Beets what to do when the auto-tagger is not sure about\nthe song's identifiaction.\nSet it to `skip` to abort the importation in case of ambiguity,\nor `asis` to import using tags as they are in the incoming file.\nThis will avoid surprises in case of ambiguous matches,\nbecause this script invokes Beet's auto-tagger in quiet mode (as `beet import -q`)\nafter your custom function.\n\nThis function is `on_item`. It is written in Python,\nand lets you set some tags depending of which sub-folder the file is dropped in.\nIf you want one, define it in the configuration from this template:\n\n```yaml\ndrop2beets:\n    on_item: |\n        def on_item(item, path):\n            \"\"\"\n            Parameters:\n                item: the beets Item that we're about to import\n                path: its sub-folders path in our dropbox ; if the items has been dropped at the root, then it's empty.\n            Returns:\n                A dict of custom attributes (according to path, maybe) ; return None if you don't want to import the file right now.\n            \"\"\"\n            return {}\n```\n\nNow you're ready to test by calling `beet dropbox` on the command line and\ndropping a few files in the folder.\nHit Ctrl+C to close the script.\n\nFor a longer-term installation, configure a log file path\n\n```yaml\ndrop2beets:\n    log_path: ~/drop2beets/log.log\n```\n\nLinux users can install this as a user-lever systemd service by running `beet install_dropbox`\n(in a shell where the virtual environment is activated).\nNote that you'll have to restart the service when you update the `on_item` function.\n\n\n## Examples wanted !\n\nI'd be happy to include your own variations of this script or the `on_item` function\nin the [examples](https://github.com/martinkirch/drop2beets/tree/master/examples) folder, \nfeel free to post them in\n[Issues](https://github.com/martinkirch/drop2beets/issues) or\n[Pull Requests](https://github.com/martinkirch/drop2beets/pulls).\n",
    "bugtrack_url": null,
    "license": "WTFPL",
    "summary": "Import singles to Beets as soon as they are dropped in a folder",
    "version": "2.0.1",
    "project_urls": {
        "Homepage": "https://github.com/martinkirch/drop2beets",
        "Repository": "https://github.com/martinkirch/drop2beets.git"
    },
    "split_keywords": [
        "watch",
        " beets",
        " music",
        " import"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7bf0a2a0bee3068fde3d503109330499fd2d6fd9baa7db05a112419b1dc91cfe",
                "md5": "26813e624d6cbba4150e49ff63560245",
                "sha256": "aab02ea7afe9ffd7b9354f91aefe4b0f9e90b96c9e2b63cd7e0b7f3c49c8dc92"
            },
            "downloads": -1,
            "filename": "drop2beets-2.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "26813e624d6cbba4150e49ff63560245",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.7",
            "size": 8109,
            "upload_time": "2024-04-21T16:41:20",
            "upload_time_iso_8601": "2024-04-21T16:41:20.065449Z",
            "url": "https://files.pythonhosted.org/packages/7b/f0/a2a0bee3068fde3d503109330499fd2d6fd9baa7db05a112419b1dc91cfe/drop2beets-2.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c762e6ca2c0cf3a7466f3c7bc30681150b1438672c7f9907a5df4d1a0c3128e8",
                "md5": "e318264508012d70fa78c016e864cb73",
                "sha256": "cd8fdd336f77ed0ed79e2051f7282d9ddb5caa2507f3b2e850afce18c2bca216"
            },
            "downloads": -1,
            "filename": "drop2beets-2.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e318264508012d70fa78c016e864cb73",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.7",
            "size": 6136,
            "upload_time": "2024-04-21T16:41:22",
            "upload_time_iso_8601": "2024-04-21T16:41:22.004621Z",
            "url": "https://files.pythonhosted.org/packages/c7/62/e6ca2c0cf3a7466f3c7bc30681150b1438672c7f9907a5df4d1a0c3128e8/drop2beets-2.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-21 16:41:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "martinkirch",
    "github_project": "drop2beets",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "drop2beets"
}
        
Elapsed time: 4.18645s