Skip to content

Commit 2ca16d1

Browse files
authored
Merge pull request #70 from jodal/modernize
Update to mopidy-ext-template 2.0 and Mopidy 4.0
2 parents 4538f0e + d7e3d19 commit 2ca16d1

File tree

18 files changed

+367
-300
lines changed

18 files changed

+367
-300
lines changed

.copier-answers.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
_commit: v2.0.0
2+
_src_path: gh:mopidy/mopidy-ext-template
3+
author_email: [email protected]
4+
author_full_name: Stein Magnus Jodal
5+
dist_name: mopidy-mpd
6+
ext_name: mpd
7+
github_username: mopidy
8+
short_description: Mopidy extension for controlling Mopidy from MPD clients

.github/workflows/ci.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,40 @@ on:
77
- main
88

99
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-24.04
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: hynek/build-and-inspect-python-package@v2
16+
1017
main:
1118
strategy:
1219
fail-fast: false
1320
matrix:
1421
include:
15-
- name: "Test: Python 3.11"
22+
- name: "pytest (3.11)"
1623
python: "3.11"
1724
tox: "3.11"
18-
- name: "Test: Python 3.12"
25+
- name: "pytest (3.12)"
1926
python: "3.12"
2027
tox: "3.12"
21-
- name: "Test: Python 3.13"
28+
- name: "pytest (3.13)"
2229
python: "3.13"
2330
tox: "3.13"
2431
coverage: true
25-
- name: "Lint: pyright"
32+
- name: "pyright"
2633
python: "3.13"
2734
tox: "pyright"
28-
- name: "Lint: ruff lint"
35+
- name: "ruff check"
2936
python: "3.13"
30-
tox: "ruff-lint"
31-
- name: "Lint: ruff format"
37+
tox: "ruff-check"
38+
- name: "ruff format"
3239
python: "3.13"
3340
tox: "ruff-format"
3441

3542
name: ${{ matrix.name }}
36-
runs-on: ubuntu-22.04
43+
runs-on: ubuntu-24.04
3744
container: ghcr.io/mopidy/ci:latest
3845

3946
steps:
@@ -44,12 +51,13 @@ jobs:
4451
with:
4552
python-version: ${{ matrix.python }}
4653
cache: pip
54+
allow-prereleases: true
4755
- run: python -m pip install tox
4856
- run: python -m tox -e ${{ matrix.tox }}
4957
if: ${{ ! matrix.coverage }}
5058
- run: python -m tox -e ${{ matrix.tox }} -- --cov-report=xml
5159
if: ${{ matrix.coverage }}
52-
- uses: codecov/codecov-action@v4
60+
- uses: codecov/codecov-action@v5
5361
if: ${{ matrix.coverage }}
5462
with:
5563
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/release.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ on:
66

77
jobs:
88
release:
9-
runs-on: ubuntu-20.04
10-
9+
runs-on: ubuntu-24.04
10+
environment:
11+
name: pypi
12+
url: https://pypi.org/project/mopidy-mpd/
13+
permissions:
14+
id-token: write
1115
steps:
1216
- uses: actions/checkout@v4
13-
- uses: actions/setup-python@v5
17+
- uses: hynek/build-and-inspect-python-package@v2
18+
id: build
19+
- uses: actions/download-artifact@v4
1420
with:
15-
python-version: "3.12"
16-
- name: "Install dependencies"
17-
run: python3 -m pip install build
18-
- name: "Build package"
19-
run: python3 -m build
21+
name: ${{ steps.build.outputs.artifact-name }}
22+
path: dist
2023
- uses: pypa/gh-action-pypi-publish@release/v1
21-
with:
22-
password: ${{ secrets.PYPI_TOKEN }}

.gitignore

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
*.egg-info
2-
*.pyc
3-
.coverage
4-
.mypy_cache/
5-
.pytest_cache/
6-
.tox/
7-
build/
8-
dist/
1+
*.egg-info/
2+
/*.lock
3+
/.*_cache/
4+
/.coverage
5+
/.tox/
6+
/.venv/
7+
/build/
8+
/dist/
9+
__pycache__/

README.md

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
# mopidy-mpd
2+
3+
![PyPI - Version](https://img.shields.io/pypi/v/mopidy-mpd?link=https://pypi.org/p/mopidy-mpd)
4+
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/mopidy/mopidy-mpd/ci.yml?link=https://github.com/mopidy/mopidy-mpd/actions/workflows/ci.yml)
5+
![Codecov](https://img.shields.io/codecov/c/gh/mopidy/mopidy-mpd?link=https://codecov.io/gh/mopidy/mopidy-mpd)
6+
7+
[Mopidy](https://mopidy.com/) extension for controlling Mopidy from MPD
8+
clients.
9+
10+
MPD stands for Music Player Daemon, which is also the name of the
11+
[original MPD server project](https://www.musicpd.org/). Mopidy does not
12+
depend on the original MPD server, but implements the MPD protocol
13+
itself, and is thus compatible with most clients built for the original
14+
MPD server.
15+
16+
## Maintainer wanted
17+
18+
Mopidy-MPD is currently kept on life support by the Mopidy core
19+
developers. It is in need of a more dedicated maintainer.
20+
21+
If you want to be the maintainer of Mopidy-MPD, please:
22+
23+
1. Make 2-3 good pull requests improving any part of the project.
24+
25+
2. Read and get familiar with all of the project's open issues.
26+
27+
3. Send a pull request removing this section and adding yourself as the
28+
"Current maintainer" in the "Credits" section below. In the pull
29+
request description, please refer to the previous pull requests and
30+
state that you've familiarized yourself with the open issues.
31+
32+
As a maintainer, you'll be given push access to the repo and the
33+
authority to make releases to PyPI when you see fit.
34+
35+
## Installation
36+
37+
Install by running:
38+
39+
```sh
40+
python3 -m pip install mopidy-mpd
41+
```
42+
43+
See https://mopidy.com/ext/mpd/ for alternative installation methods.
44+
45+
## Configuration
46+
47+
Before starting Mopidy, you must add configuration for
48+
mopidy-mpd to your Mopidy configuration file:
49+
50+
```ini
51+
[mpd]
52+
hostname = ::
53+
```
54+
55+
> [!WARNING]
56+
> As a simple security measure, the MPD server is by default only available from
57+
> localhost. To make it available from other computers, change the
58+
> `mpd/hostname` config value.
59+
>
60+
> Before you do so, note that the MPD server does not support any form of
61+
> encryption and only a single clear text password (see `mpd/password`) for weak
62+
> authentication. Anyone able to access the MPD server can control music
63+
> playback on your computer. Thus, you probably only want to make the MPD server
64+
> available from your local network. You have been warned.
65+
66+
The following configuration values are available:
67+
68+
- `mpd/enabled`: If the MPD extension should be enabled or not.
69+
- `mpd/hostname`: Which address the MPD server should bind to. This
70+
can be a network address or the path toa Unix socket:
71+
- `127.0.0.1`: Listens only on the IPv4 loopback interface
72+
(default).
73+
- `::1`: Listens only on the IPv6 loopback interface.
74+
- `0.0.0.0`: Listens on all IPv4 interfaces.
75+
- `::`: Listens on all interfaces, both IPv4 and IPv6.
76+
- `unix:/path/to/unix/socket.sock`: Listen on the Unix socket at
77+
the specified path. Must be prefixed with `unix:`.
78+
- `mpd/port`: Which TCP port the MPD server should listen to. Default: 6600.
79+
- `mpd/password`: The password required for connecting to the MPD
80+
server. If blank, no password is required. Default: blank.
81+
- `mpd/max_connections`: The maximum number of concurrent connections
82+
the MPD server will accept. Default: 20.
83+
- `mpd/connection_timeout`: Number of seconds an MPD client can stay
84+
inactive before the connection is closed by the server. Default: 60.
85+
- `mpd/zeroconf`: Name of the MPD service when published through
86+
Zeroconf. The variables `$hostname` and `$port` can be used in the
87+
name. Set to an empty string to disable Zeroconf for MPD. Default:
88+
`Mopidy MPD server on $hostname`
89+
- `mpd/command_blacklist`: List of MPD commands which are disabled by
90+
the server. By default this blacklists `listall` and `listallinfo`.
91+
These commands don't fit well with many of Mopidy's backends and
92+
are better left disabled unless you know what you are doing.
93+
- `mpd/default_playlist_scheme`: The URI scheme used if the server
94+
cannot find a backend appropriate for creating a playlist from the
95+
given tracks. Default: `m3u`
96+
97+
## Limitations
98+
99+
This is a non-exhaustive list of MPD features that Mopidy doesn't
100+
support.
101+
102+
- Only a single password is supported. It gives all-or-nothing access.
103+
- Toggling of audio outputs is not supported.
104+
- Channels for client-to-client communication are not supported.
105+
- Stickers are not supported.
106+
- Crossfade is not supported.
107+
- Replay gain is not supported.
108+
- `stats` does not provide any statistics.
109+
- `decoders` does not provide information about available decoders.
110+
- Live update of the music database is not supported.
111+
112+
## Clients
113+
114+
Over the years, a huge number of MPD clients have been built for every
115+
thinkable platform. As always, the quality and state of maintenance
116+
varies between clients, so you might have to try a couple before you
117+
find one you like for your purpose. In general, they should all work
118+
with Mopidy-MPD.
119+
120+
The [Wikipedia article on
121+
MPD](https://en.wikipedia.org/wiki/Music_Player_Daemon#Clients) has a
122+
short list of well-known clients. In the MPD wiki there is a [more
123+
complete list](https://mpd.fandom.com/wiki/Clients) of the available MPD
124+
clients. Both lists are grouped by user interface, e.g. terminal,
125+
graphical, or web-based
126+
127+
## Project resources
128+
129+
- [Source code](https://github.com/mopidy/mopidy-mpd)
130+
- [Issues](https://github.com/mopidy/mopidy-mpd/issues)
131+
- [Releases](https://github.com/mopidy/mopidy-mpd/releases)
132+
133+
## Development
134+
135+
### Set up development environment
136+
137+
Clone the repo using, e.g. using [gh](https://cli.github.com/):
138+
139+
```sh
140+
gh repo clone mopidy/mopidy-mpd
141+
```
142+
143+
Enter the directory, and install dependencies using [uv](https://docs.astral.sh/uv/):
144+
145+
```sh
146+
cd mopidy-mpd/
147+
uv sync
148+
```
149+
150+
### Running tests
151+
152+
To run all tests and linters in isolated environments, use
153+
[tox](https://tox.wiki/):
154+
155+
```sh
156+
tox
157+
```
158+
159+
To only run tests, use [pytest](https://pytest.org/):
160+
161+
```sh
162+
pytest
163+
```
164+
165+
To format the code, use [ruff](https://docs.astral.sh/ruff/):
166+
167+
```sh
168+
ruff format .
169+
```
170+
171+
To check for lints with ruff, run:
172+
173+
```sh
174+
ruff check .
175+
```
176+
177+
To check for type errors, use [pyright](https://microsoft.github.io/pyright/):
178+
179+
```sh
180+
pyright .
181+
```
182+
183+
### Making a release
184+
185+
To make a release to PyPI, go to the project's [GitHub releases
186+
page](https://github.com/mopidy/mopidy-mpd/releases)
187+
and click the "Draft a new release" button.
188+
189+
In the "choose a tag" dropdown, select the tag you want to release or create a
190+
new tag, e.g. `v0.1.0`. Add a title, e.g. `v0.1.0`, and a description of the changes.
191+
192+
Decide if the release is a pre-release (alpha, beta, or release candidate) or
193+
should be marked as the latest release, and click "Publish release".
194+
195+
Once the releease is created, the `release.yml` GitHub Action will automatically
196+
build and publish the release to
197+
[PyPI](https://pypi.org/project/mopidy-mpd/).
198+
199+
## Credits
200+
201+
- Original author: [Stein Magnus Jodal](https://github.com/jodal) and
202+
[Thomas Adamcik](https://github.com/adamcik) for the Mopidy-MPD
203+
extension in Mopidy core.
204+
- Current maintainer: None. Maintainer wanted, see section above.
205+
- [Contributors](https://github.com/mopidy/mopidy-mpd/graphs/contributors)

0 commit comments

Comments
 (0)