mopidy-beets 5.0.0a1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. mopidy_beets-5.0.0a1/.copier-answers.yml +9 -0
  2. mopidy_beets-5.0.0a1/.github/workflows/ci.yml +61 -0
  3. mopidy_beets-5.0.0a1/.github/workflows/release.yml +23 -0
  4. mopidy_beets-5.0.0a1/.gitignore +9 -0
  5. mopidy_beets-5.0.0a1/.mailmap +2 -0
  6. mopidy_beets-5.0.0a1/LICENSE +7 -0
  7. mopidy_beets-5.0.0a1/PKG-INFO +186 -0
  8. mopidy_beets-5.0.0a1/README.md +166 -0
  9. mopidy_beets-5.0.0a1/pyproject.toml +159 -0
  10. mopidy_beets-5.0.0a1/setup.cfg +4 -0
  11. mopidy_beets-5.0.0a1/src/mopidy_beets/__init__.py +26 -0
  12. mopidy_beets-5.0.0a1/src/mopidy_beets/actor.py +36 -0
  13. mopidy_beets-5.0.0a1/src/mopidy_beets/browsers/__init__.py +21 -0
  14. mopidy_beets-5.0.0a1/src/mopidy_beets/browsers/albums.py +68 -0
  15. mopidy_beets-5.0.0a1/src/mopidy_beets/client.py +282 -0
  16. mopidy_beets-5.0.0a1/src/mopidy_beets/ext.conf +4 -0
  17. mopidy_beets-5.0.0a1/src/mopidy_beets/library.py +188 -0
  18. mopidy_beets-5.0.0a1/src/mopidy_beets/translator.py +171 -0
  19. mopidy_beets-5.0.0a1/src/mopidy_beets.egg-info/PKG-INFO +186 -0
  20. mopidy_beets-5.0.0a1/src/mopidy_beets.egg-info/SOURCES.txt +29 -0
  21. mopidy_beets-5.0.0a1/src/mopidy_beets.egg-info/dependency_links.txt +1 -0
  22. mopidy_beets-5.0.0a1/src/mopidy_beets.egg-info/entry_points.txt +2 -0
  23. mopidy_beets-5.0.0a1/src/mopidy_beets.egg-info/requires.txt +3 -0
  24. mopidy_beets-5.0.0a1/src/mopidy_beets.egg-info/top_level.txt +1 -0
  25. mopidy_beets-5.0.0a1/tests/__init__.py +23 -0
  26. mopidy_beets-5.0.0a1/tests/data/beets-rsrc/README.md +9 -0
  27. mopidy_beets-5.0.0a1/tests/data/beets-rsrc/min.mp3 +0 -0
  28. mopidy_beets-5.0.0a1/tests/helper_beets.py +130 -0
  29. mopidy_beets-5.0.0a1/tests/test_beets_api.py +59 -0
  30. mopidy_beets-5.0.0a1/tests/test_extension.py +39 -0
  31. mopidy_beets-5.0.0a1/tests/test_library.py +7 -0
@@ -0,0 +1,9 @@
1
+ _commit: v2.2.0
2
+ _src_path: gh:mopidy/mopidy-ext-template
3
+ author_email: devel@sumpfralle.de
4
+ author_full_name: Lars Kruse
5
+ dist_name: mopidy-beets
6
+ ext_name: beets
7
+ github_username: mopidy
8
+ short_description: Mopidy extension for playing music from a music collection managed
9
+ via Beets
@@ -0,0 +1,61 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ build:
12
+ name: Build
13
+ runs-on: ubuntu-24.04
14
+ steps:
15
+ - uses: actions/checkout@v6
16
+ - uses: hynek/build-and-inspect-python-package@v2
17
+
18
+ main:
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ include:
23
+ - name: "pytest (3.13)"
24
+ python: "3.13"
25
+ tox: "3.13"
26
+ - name: "pytest (3.14)"
27
+ python: "3.14"
28
+ tox: "3.14"
29
+ coverage: true
30
+ # - name: "pyright"
31
+ # python: "3.14"
32
+ # tox: "pyright"
33
+ - name: "ruff check"
34
+ python: "3.14"
35
+ tox: "ruff-check"
36
+ - name: "ruff format"
37
+ python: "3.14"
38
+ tox: "ruff-format"
39
+
40
+ name: ${{ matrix.name }}
41
+ runs-on: ubuntu-24.04
42
+ container: ghcr.io/mopidy/ci:latest
43
+
44
+ steps:
45
+ - uses: actions/checkout@v6
46
+ - name: Fix home dir permissions to enable pip caching
47
+ run: chown -R root /github/home
48
+ - uses: actions/setup-python@v6
49
+ with:
50
+ python-version: ${{ matrix.python }}
51
+ cache: pip
52
+ allow-prereleases: true
53
+ - run: python -m pip install tox
54
+ - run: python -m tox -e ${{ matrix.tox }}
55
+ if: ${{ ! matrix.coverage }}
56
+ - run: python -m tox -e ${{ matrix.tox }} -- --cov-report=xml
57
+ if: ${{ matrix.coverage }}
58
+ - uses: codecov/codecov-action@v5
59
+ if: ${{ matrix.coverage }}
60
+ with:
61
+ token: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,23 @@
1
+ name: Release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ release:
9
+ runs-on: ubuntu-24.04
10
+ environment:
11
+ name: pypi
12
+ url: https://pypi.org/project/mopidy-beets/
13
+ permissions:
14
+ id-token: write
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+ - uses: hynek/build-and-inspect-python-package@v2
18
+ id: build
19
+ - uses: actions/download-artifact@v4
20
+ with:
21
+ name: ${{ steps.build.outputs.artifact-name }}
22
+ path: dist
23
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,9 @@
1
+ *.egg-info/
2
+ /*.lock
3
+ /.*_cache/
4
+ /.coverage
5
+ /.tox/
6
+ /.venv/
7
+ /build/
8
+ /dist/
9
+ __pycache__/
@@ -0,0 +1,2 @@
1
+ Janez Troha <janez.troha@gmail.com>
2
+ Janez Troha <janez.troha@gmail.com> <dz0ny@users.noreply.github.com>
@@ -0,0 +1,7 @@
1
+ Copyright (C) 2013 <dz0ny at shortmail dot com>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,186 @@
1
+ Metadata-Version: 2.4
2
+ Name: mopidy-beets
3
+ Version: 5.0.0a1
4
+ Summary: Mopidy extension for playing music from a music collection managed via Beets
5
+ Author-email: Lars Kruse <devel@sumpfralle.de>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/mopidy/mopidy-beets
8
+ Classifier: Environment :: No Input/Output (Daemon)
9
+ Classifier: Intended Audience :: End Users/Desktop
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Players
13
+ Requires-Python: >=3.13
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: mopidy>=4.0.0a7
17
+ Requires-Dist: pykka>=4.1
18
+ Requires-Dist: requests>=2.32
19
+ Dynamic: license-file
20
+
21
+ # mopidy-beets
22
+
23
+ [![Latest PyPI version](https://img.shields.io/pypi/v/mopidy-beets)](https://pypi.org/p/mopidy-beets)
24
+ [![CI build status](https://img.shields.io/github/actions/workflow/status/mopidy/mopidy-beets/ci.yml)](https://github.com/mopidy/mopidy-beets/actions/workflows/ci.yml)
25
+ [![Test coverage](https://img.shields.io/codecov/c/gh/mopidy/mopidy-beets)](https://codecov.io/gh/mopidy/mopidy-beets)
26
+
27
+ [Mopidy](https://mopidy.com/) extension for playing music from a music collection managed via [Beets](https://beets.io/).
28
+ This extension uses the
29
+ [Beets plugin "web"](https://beets.readthedocs.io/en/latest/plugins/web.html).
30
+
31
+
32
+ ## Installation
33
+
34
+ Install by running:
35
+
36
+ ```sh
37
+ python3 -m pip install mopidy-beets
38
+ ```
39
+
40
+ See https://mopidy.com/ext/beets/ for alternative installation methods.
41
+
42
+
43
+ ## Configuration
44
+
45
+ 1. Setup the [Beets plugin
46
+ "web"](https://beets.readthedocs.io/en/latest/plugins/web.html).
47
+
48
+ 2. Tell Mopidy where to find the Beets web interface by adding the following to
49
+ your `mopidy.conf`:
50
+
51
+ ```ini
52
+ [beets]
53
+ hostname = 127.0.0.1
54
+ port = 8337
55
+ ```
56
+
57
+ 3. Restart Mopidy.
58
+
59
+ The Beets library is now accessible in the "browser" section of your Mopidy
60
+ client. Additional searches in Mopidy return results from your Beets library.
61
+
62
+
63
+ ### Proxy configuration for OGG files (optional)
64
+
65
+ In case you use a Beets version older than 1.6.1, you may need to configure
66
+ an HTTP reverse-proxy server in front of the Beets web plugin (not Mopidy)
67
+ because `it does not handle HTTP "Range" requests properly
68
+ <https://github.com/beetbox/beets/pull/5057>`_.
69
+
70
+ If you don't apply this workaround, Mopidy may not be able to stream/play
71
+ large audio files and/or does not allow you to seek.
72
+ The is the case for OGG files in particular.
73
+
74
+ The following Nginx configuration snippet is sufficient:
75
+
76
+ ```
77
+ server {
78
+ listen 127.0.0.1:8338;
79
+ root /usr/share/beets/beetsplug/web;
80
+ server_name beets.local;
81
+ location / {
82
+ proxy_pass http://localhost:8337;
83
+ # this statement forces Nginx to emulate "Range" responses
84
+ proxy_force_ranges on;
85
+ # Hide Range header from beets/flask, preventing range handling
86
+ proxy_set_header "Range" "";
87
+ }
88
+ }
89
+ ```
90
+
91
+ Now you should change the Mopidy configuration accordingly to point to the
92
+ Nginx port above instead of the Beets port. Afterwards Mopidy will be able to
93
+ play file formats that require seeking.
94
+
95
+
96
+ ## Usage
97
+
98
+ 1. Run `beet web` to start the Beets web interface.
99
+
100
+ 2. Start Mopidy and access your Beets library via any Mopidy client:
101
+
102
+ - Browse your collection by album
103
+ - Search for tracks or albums
104
+ - Let the music play!
105
+
106
+
107
+ ## Project resources
108
+
109
+ - [Source code](https://github.com/mopidy/mopidy-beets)
110
+ - [Issues](https://github.com/mopidy/mopidy-beets/issues)
111
+ - [Releases](https://github.com/mopidy/mopidy-beets/releases)
112
+
113
+
114
+ ## Development
115
+
116
+ ### Set up development environment
117
+
118
+ Clone the repo using, e.g. using [gh](https://cli.github.com/):
119
+
120
+ ```sh
121
+ gh repo clone mopidy/mopidy-beets
122
+ ```
123
+
124
+ Enter the directory, and install dependencies using [uv](https://docs.astral.sh/uv/):
125
+
126
+ ```sh
127
+ cd mopidy-beets/
128
+ uv sync
129
+ ```
130
+
131
+ ### Running tests
132
+
133
+ To run all tests and linters in isolated environments, use
134
+ [tox](https://tox.wiki/):
135
+
136
+ ```sh
137
+ tox
138
+ ```
139
+
140
+ To only run tests, use [pytest](https://pytest.org/):
141
+
142
+ ```sh
143
+ pytest
144
+ ```
145
+
146
+ To format the code, use [ruff](https://docs.astral.sh/ruff/):
147
+
148
+ ```sh
149
+ ruff format .
150
+ ```
151
+
152
+ To check for lints with ruff, run:
153
+
154
+ ```sh
155
+ ruff check .
156
+ ```
157
+
158
+ To check for type errors, use [pyright](https://microsoft.github.io/pyright/):
159
+
160
+ ```sh
161
+ pyright .
162
+ ```
163
+
164
+
165
+ ### Making a release
166
+
167
+ To make a release to PyPI, go to the project's [GitHub releases
168
+ page](https://github.com/mopidy/mopidy-beets/releases)
169
+ and click the "Draft a new release" button.
170
+
171
+ In the "choose a tag" dropdown, select the tag you want to release or create a
172
+ new tag, e.g. `v0.1.0`. Add a title, e.g. `v0.1.0`, and a description of the changes.
173
+
174
+ Decide if the release is a pre-release (alpha, beta, or release candidate) or
175
+ should be marked as the latest release, and click "Publish release".
176
+
177
+ Once the release is created, the `release.yml` GitHub Action will automatically
178
+ build and publish the release to
179
+ [PyPI](https://pypi.org/project/mopidy-beets/).
180
+
181
+
182
+ ## Credits
183
+
184
+ - Original author: [Janez Troha](https://github.com/dz0ny)
185
+ - Current maintainer: [Lars Kruse](https://github.com/sumpfralle)
186
+ - [Contributors](https://github.com/mopidy/mopidy-beets/graphs/contributors)
@@ -0,0 +1,166 @@
1
+ # mopidy-beets
2
+
3
+ [![Latest PyPI version](https://img.shields.io/pypi/v/mopidy-beets)](https://pypi.org/p/mopidy-beets)
4
+ [![CI build status](https://img.shields.io/github/actions/workflow/status/mopidy/mopidy-beets/ci.yml)](https://github.com/mopidy/mopidy-beets/actions/workflows/ci.yml)
5
+ [![Test coverage](https://img.shields.io/codecov/c/gh/mopidy/mopidy-beets)](https://codecov.io/gh/mopidy/mopidy-beets)
6
+
7
+ [Mopidy](https://mopidy.com/) extension for playing music from a music collection managed via [Beets](https://beets.io/).
8
+ This extension uses the
9
+ [Beets plugin "web"](https://beets.readthedocs.io/en/latest/plugins/web.html).
10
+
11
+
12
+ ## Installation
13
+
14
+ Install by running:
15
+
16
+ ```sh
17
+ python3 -m pip install mopidy-beets
18
+ ```
19
+
20
+ See https://mopidy.com/ext/beets/ for alternative installation methods.
21
+
22
+
23
+ ## Configuration
24
+
25
+ 1. Setup the [Beets plugin
26
+ "web"](https://beets.readthedocs.io/en/latest/plugins/web.html).
27
+
28
+ 2. Tell Mopidy where to find the Beets web interface by adding the following to
29
+ your `mopidy.conf`:
30
+
31
+ ```ini
32
+ [beets]
33
+ hostname = 127.0.0.1
34
+ port = 8337
35
+ ```
36
+
37
+ 3. Restart Mopidy.
38
+
39
+ The Beets library is now accessible in the "browser" section of your Mopidy
40
+ client. Additional searches in Mopidy return results from your Beets library.
41
+
42
+
43
+ ### Proxy configuration for OGG files (optional)
44
+
45
+ In case you use a Beets version older than 1.6.1, you may need to configure
46
+ an HTTP reverse-proxy server in front of the Beets web plugin (not Mopidy)
47
+ because `it does not handle HTTP "Range" requests properly
48
+ <https://github.com/beetbox/beets/pull/5057>`_.
49
+
50
+ If you don't apply this workaround, Mopidy may not be able to stream/play
51
+ large audio files and/or does not allow you to seek.
52
+ The is the case for OGG files in particular.
53
+
54
+ The following Nginx configuration snippet is sufficient:
55
+
56
+ ```
57
+ server {
58
+ listen 127.0.0.1:8338;
59
+ root /usr/share/beets/beetsplug/web;
60
+ server_name beets.local;
61
+ location / {
62
+ proxy_pass http://localhost:8337;
63
+ # this statement forces Nginx to emulate "Range" responses
64
+ proxy_force_ranges on;
65
+ # Hide Range header from beets/flask, preventing range handling
66
+ proxy_set_header "Range" "";
67
+ }
68
+ }
69
+ ```
70
+
71
+ Now you should change the Mopidy configuration accordingly to point to the
72
+ Nginx port above instead of the Beets port. Afterwards Mopidy will be able to
73
+ play file formats that require seeking.
74
+
75
+
76
+ ## Usage
77
+
78
+ 1. Run `beet web` to start the Beets web interface.
79
+
80
+ 2. Start Mopidy and access your Beets library via any Mopidy client:
81
+
82
+ - Browse your collection by album
83
+ - Search for tracks or albums
84
+ - Let the music play!
85
+
86
+
87
+ ## Project resources
88
+
89
+ - [Source code](https://github.com/mopidy/mopidy-beets)
90
+ - [Issues](https://github.com/mopidy/mopidy-beets/issues)
91
+ - [Releases](https://github.com/mopidy/mopidy-beets/releases)
92
+
93
+
94
+ ## Development
95
+
96
+ ### Set up development environment
97
+
98
+ Clone the repo using, e.g. using [gh](https://cli.github.com/):
99
+
100
+ ```sh
101
+ gh repo clone mopidy/mopidy-beets
102
+ ```
103
+
104
+ Enter the directory, and install dependencies using [uv](https://docs.astral.sh/uv/):
105
+
106
+ ```sh
107
+ cd mopidy-beets/
108
+ uv sync
109
+ ```
110
+
111
+ ### Running tests
112
+
113
+ To run all tests and linters in isolated environments, use
114
+ [tox](https://tox.wiki/):
115
+
116
+ ```sh
117
+ tox
118
+ ```
119
+
120
+ To only run tests, use [pytest](https://pytest.org/):
121
+
122
+ ```sh
123
+ pytest
124
+ ```
125
+
126
+ To format the code, use [ruff](https://docs.astral.sh/ruff/):
127
+
128
+ ```sh
129
+ ruff format .
130
+ ```
131
+
132
+ To check for lints with ruff, run:
133
+
134
+ ```sh
135
+ ruff check .
136
+ ```
137
+
138
+ To check for type errors, use [pyright](https://microsoft.github.io/pyright/):
139
+
140
+ ```sh
141
+ pyright .
142
+ ```
143
+
144
+
145
+ ### Making a release
146
+
147
+ To make a release to PyPI, go to the project's [GitHub releases
148
+ page](https://github.com/mopidy/mopidy-beets/releases)
149
+ and click the "Draft a new release" button.
150
+
151
+ In the "choose a tag" dropdown, select the tag you want to release or create a
152
+ new tag, e.g. `v0.1.0`. Add a title, e.g. `v0.1.0`, and a description of the changes.
153
+
154
+ Decide if the release is a pre-release (alpha, beta, or release candidate) or
155
+ should be marked as the latest release, and click "Publish release".
156
+
157
+ Once the release is created, the `release.yml` GitHub Action will automatically
158
+ build and publish the release to
159
+ [PyPI](https://pypi.org/project/mopidy-beets/).
160
+
161
+
162
+ ## Credits
163
+
164
+ - Original author: [Janez Troha](https://github.com/dz0ny)
165
+ - Current maintainer: [Lars Kruse](https://github.com/sumpfralle)
166
+ - [Contributors](https://github.com/mopidy/mopidy-beets/graphs/contributors)
@@ -0,0 +1,159 @@
1
+ [project]
2
+ name = "mopidy-beets"
3
+ description = "Mopidy extension for playing music from a music collection managed via Beets"
4
+ readme = "README.md"
5
+ requires-python = ">= 3.13"
6
+ license = { text = "MIT" }
7
+ authors = [{ name = "Lars Kruse", email = "devel@sumpfralle.de" }]
8
+ classifiers = [
9
+ "Environment :: No Input/Output (Daemon)",
10
+ "Intended Audience :: End Users/Desktop",
11
+ "License :: OSI Approved :: Apache Software License",
12
+ "Operating System :: OS Independent",
13
+ "Topic :: Multimedia :: Sound/Audio :: Players",
14
+ ]
15
+ dynamic = ["version"]
16
+ dependencies = [
17
+ "mopidy >= 4.0.0a7",
18
+ "pykka >= 4.1",
19
+ "requests >= 2.32",
20
+ ]
21
+
22
+ [project.urls]
23
+ Homepage = "https://github.com/mopidy/mopidy-beets"
24
+
25
+ [project.entry-points."mopidy.ext"]
26
+ beets = "mopidy_beets:Extension"
27
+
28
+
29
+ [build-system]
30
+ requires = ["setuptools >= 78", "setuptools-scm >= 8.2"]
31
+ build-backend = "setuptools.build_meta"
32
+
33
+
34
+ [dependency-groups]
35
+ dev = [
36
+ "tox",
37
+ { include-group = "ruff" },
38
+ { include-group = "tests" },
39
+ { include-group = "typing" },
40
+ ]
41
+ ruff = ["ruff"]
42
+ tests = [
43
+ # We need the `beets.test` module, which is not part of a release, yet (2024-01)
44
+ "beets@git+https://github.com/beetbox/beets.git@master",
45
+ "flask",
46
+ "pytest",
47
+ "pytest-cov",
48
+ "responses",
49
+ "werkzeug",
50
+ ]
51
+ typing = ["pyright"]
52
+
53
+
54
+ [tool.coverage.paths]
55
+ source = ["src/", "*/site-packages/"]
56
+
57
+ [tool.coverage.run]
58
+ source_pkgs = ["mopidy_beets"]
59
+
60
+ [tool.coverage.report]
61
+ show_missing = true
62
+
63
+
64
+ [tool.pyright]
65
+ pythonVersion = "3.13"
66
+ typeCheckingMode = "standard"
67
+ # Not all dependencies have type hints:
68
+ reportMissingTypeStubs = false
69
+ # Already covered by ruff's flake8-self checks:
70
+ reportPrivateImportUsage = false
71
+
72
+
73
+ [tool.pytest.ini_options]
74
+ filterwarnings = [
75
+ # By default, fail tests on warnings from our own code
76
+ "error:::mopidy_beets",
77
+ #
78
+ # Add any warnings you want to ignore here
79
+ ]
80
+
81
+
82
+ [tool.ruff]
83
+ target-version = "py313"
84
+
85
+ [tool.ruff.lint]
86
+ select = ["ALL"]
87
+ ignore = [
88
+ # Add rules you want to ignore here
89
+ "ANN001", # missing-type-function-argument # TODO
90
+ "ANN002", # missing-type-args # TODO
91
+ "ANN003", # missing-type-kwargs # TODO
92
+ "ANN201", # missing-return-type-undocumented-public-function # TODO
93
+ "ANN202", # missing-return-type-private-function # TODO
94
+ "ANN204", # missing-return-type-special-method # TODO
95
+ "ANN205", # missing-return-type-static-method # TODO
96
+ "D", # pydocstyle
97
+ "D203", # one-blank-line-before-class
98
+ "D213", # multi-line-summary-second-line
99
+ "FIX002", # line-contains-todo # TODO
100
+ "G004", # logging-f-string
101
+ "TD002", # missing-todo-author
102
+ "TD003", # missing-todo-link
103
+ #
104
+ # Conflicting with `ruff format`
105
+ "COM812", # missing-trailing-comma
106
+ "ISC001", # single-line-implicit-string-concatenation
107
+ ]
108
+
109
+ [tool.ruff.lint.per-file-ignores]
110
+ "tests/*" = [
111
+ "ARG", # flake8-unused-arguments
112
+ "D", # pydocstyle
113
+ "S101", # assert
114
+ ]
115
+
116
+
117
+ [tool.setuptools.package-data]
118
+ "*" = ["*.conf"]
119
+
120
+
121
+ [tool.setuptools_scm]
122
+ # This section, even if empty, must be present for setuptools_scm to work
123
+
124
+
125
+ [tool.tox]
126
+ env_list = [
127
+ "3.13",
128
+ "3.14",
129
+ "pyright",
130
+ "ruff-check",
131
+ "ruff-format",
132
+ ]
133
+
134
+ [tool.tox.env_run_base]
135
+ package = "wheel"
136
+ wheel_build_env = ".pkg"
137
+ dependency_groups = ["tests"]
138
+ commands = [
139
+ [
140
+ "pytest",
141
+ "--cov",
142
+ "--basetemp={envtmpdir}",
143
+ { replace = "posargs", extend = true },
144
+ ],
145
+ ]
146
+
147
+ [tool.tox.env.pyright]
148
+ dependency_groups = ["typing"]
149
+ commands = [["pyright", "{posargs:src}"]]
150
+
151
+ [tool.tox.env.ruff-check]
152
+ skip_install = true
153
+ dependency_groups = ["ruff"]
154
+ commands = [["ruff", "check", "{posargs:.}"]]
155
+
156
+ [tool.tox.env.ruff-format]
157
+ skip_install = true
158
+ dependency_groups = ["ruff"]
159
+ commands = [["ruff", "format", "--check", "--diff", "{posargs:.}"]]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,26 @@
1
+ import pathlib
2
+ from importlib.metadata import version
3
+
4
+ from mopidy import config, ext
5
+
6
+ __version__ = version("mopidy-beets")
7
+
8
+
9
+ class Extension(ext.Extension):
10
+ dist_name = "mopidy-beets"
11
+ ext_name = "beets"
12
+ version = __version__
13
+
14
+ def get_default_config(self):
15
+ return config.read(pathlib.Path(__file__).parent / "ext.conf")
16
+
17
+ def get_config_schema(self):
18
+ schema = super().get_config_schema()
19
+ schema["hostname"] = config.Hostname()
20
+ schema["port"] = config.Port()
21
+ return schema
22
+
23
+ def setup(self, registry):
24
+ from mopidy_beets.actor import BeetsBackend # noqa: PLC0415
25
+
26
+ registry.add("backend", BeetsBackend)
@@ -0,0 +1,36 @@
1
+ import logging
2
+ from typing import ClassVar
3
+
4
+ import pykka
5
+ from mopidy import backend
6
+ from mopidy.types import UriScheme
7
+
8
+ from .client import BeetsRemoteClient
9
+ from .library import BeetsLibraryProvider
10
+
11
+ logger = logging.getLogger(__name__)
12
+
13
+
14
+ class BeetsBackend(pykka.ThreadingActor, backend.Backend):
15
+ uri_schemes: ClassVar[list[UriScheme]] = [UriScheme("beets")]
16
+
17
+ def __init__(self, config, audio):
18
+ super().__init__()
19
+
20
+ beets_endpoint = (
21
+ f"http://{config['beets']['hostname']}:{config['beets']['port']}"
22
+ )
23
+
24
+ self.beets_api = BeetsRemoteClient(beets_endpoint, config["proxy"])
25
+ self.library = BeetsLibraryProvider(backend=self)
26
+ self.playback = BeetsPlaybackProvider(audio=audio, backend=self)
27
+ self.playlists = None
28
+
29
+
30
+ class BeetsPlaybackProvider(backend.PlaybackProvider):
31
+ backend: BeetsBackend
32
+
33
+ def translate_uri(self, uri):
34
+ track_id = uri.split(";")[1]
35
+ logger.debug(f"Getting info for track {uri} with id {track_id}")
36
+ return self.backend.beets_api.get_track_stream_url(track_id)