Commit graph

8665 commits

Author SHA1 Message Date
Carl Suster
dc5f110844 mpdstats: use MPD_PORT env variable 2019-04-19 17:35:42 +10:00
Carl Suster
7b910c3fde
Merge pull request #3215 from arcresu/bpd-compat
bpd: support short form of list command for albums
2019-04-15 13:39:23 +10:00
Carl Suster
7ddde2a10c Changelog for #3215 2019-04-15 13:25:02 +10:00
Carl Suster
9182f18e6f bpd: support short form of list command for albums
Some clients list the albums belonging to an artist by issuing the
command `list album <ARTIST NAME>`. This change inserts the tag `artist`
before the artist name so that this succeeds. Fixes #3007
2019-04-15 13:25:02 +10:00
Adrian Sampson
818f5bd07b
Merge pull request #3205 from arcresu/bpd-idle
bpd: support idle command and with it MPD 0.14
2019-04-11 09:42:02 -04:00
Carl Suster
241e23eae8 bpd: document new control_port config 2019-04-10 15:54:41 +10:00
Carl Suster
826244777e bpd: minor control socket refactor 2019-04-10 15:52:47 +10:00
Carl Suster
d55f061f0b bpd: add control socket
A new `ControlConnection` is created each time a client connects over
a new control socket. This is used to forward events from the player,
and also for debugging utilities that are not part of the real MPD
protocol.

This new feature reuses as much infrastructure from the normal protocol
handling as possible (e.g. `Command` for parsing messages). While the
normal connection delegates to server `cmd_*` methods which are string
generators, the control connections delegate to `ctrl_*` methods defined
on the connection itself that are full coroutines.
2019-04-09 12:19:15 +10:00
Carl Suster
fa3813844c bpd: reimplement idle without polling 2019-04-08 16:33:34 +10:00
Carl Suster
e70b2134e4 bpd: update documentation 2019-04-08 11:40:24 +10:00
Carl Suster
275301750a Changelog for #3205 2019-04-08 11:40:24 +10:00
Carl Suster
6fbf3853f2 bpd: bump protocol version to 0.14.0 2019-04-08 11:40:24 +10:00
Carl Suster
d05ca2c2b0 bpd: add tests for idle command 2019-04-08 11:40:24 +10:00
Carl Suster
699de94f4f bpd: send all relevant idle events 2019-04-08 11:40:24 +10:00
Carl Suster
7105c800aa bpd: implement the idle command
Getting this command puts the connection into a special mode where it
awaits MPD events (like the player changing state or the playlist
changing due to other clients interacting with the server.

The MPD specification states that events should queue while a client is
connected, and when it issues the `idle` command any matching events
should be sent immediately if there are any, or as soon as they happen
otherwise.
2019-04-08 11:40:24 +10:00
Carl Suster
ee0c31ba6a bpd: track and log client session details
Keep track of a list of currently-connected clients.

Use `socket.getpeername()` to get an identifier for each connection and
include this in each log message. This function is documented as not
being available on all systems, but it's unclear which systems this
involves.

Also log a message on client connect and disconnect events. If the
disconnection reason is because the client sent a blank line, match MPD
by returning a protocol error then hanging up. Escape curly braces.
2019-04-08 11:28:56 +10:00
Carl Suster
5b0a02eb31 bpd: don't send volume if zero in status 2019-04-08 10:52:15 +10:00
Carl Suster
f8a2c22e8d bpd: fix typo in comment 2019-04-08 10:52:15 +10:00
Carl Suster
bb1613694b
Merge pull request #3209 from arcresu/prune_dirs-except
Catch OSError in prune_dirs helper
2019-04-08 09:47:38 +10:00
Adrian Sampson
362722c87c
Merge pull request #3206 from arcresu/random-util
random: move functionality into beets.random
2019-04-07 11:59:39 -04:00
Carl Suster
9147fabb97 random: beets.util.random -> beets.random 2019-04-07 18:46:11 +10:00
Carl Suster
df5579d4a8
Merge pull request #3210 from gdtwst/mpdstats_quickfix
mpdstats: Re-add fixes from #2707
2019-04-07 18:00:18 +10:00
Carl Suster
27599410e8 Changelog for #3209 2019-04-07 16:39:28 +10:00
Jack Wilson
dc897c0bb9 Catch OSError in prune_dirs
Since `fnmatch_all` can raise `OSError`s, and we were already silently
giving up in `prune_dirs` on some of these exception, just do more of
the same.
2019-04-07 16:31:21 +10:00
gdtwst
c41197cc5c Re-add fixes from #2707 2019-04-07 10:07:38 +07:00
Adrian Sampson
ebed21f319 Merge pull request #3207 from arcresu/mpd-currentsong
mpdstats: use currentsong instead of playlist
2019-04-06 13:51:18 -04:00
Adrian Sampson
2748527407 Changelog for #3054 2019-04-06 13:49:50 -04:00
Adrian Sampson
63b7ede4f7 Merge pull request #3054 from discopatrick/2704-lastgenre-force
WIP: Remove `default` arg for `lastgenre --force` flag
2019-04-06 13:49:07 -04:00
Adrian Sampson
d17ac8699f
Merge pull request #3199 from thomas-mc-work/patch-1
Provide an example for the languages list
2019-04-06 12:41:35 -04:00
Thomas McWork
0e93b0f58d
follow comment explanation 2019-04-06 09:29:15 +02:00
Carl Suster
f35eda717b Changelog for #3207 2019-04-06 15:36:52 +11:00
Carl Suster
4158bdb95e mpdstats: update tests for currentsong 2019-04-06 15:31:03 +11:00
Rainer Unseld
ce5981b885 mpdstats: use currentsong instead of playlist
Improved the method to get the path of the current song. Before, the complete playlist was fetched from the server. Now, the command "currentsong" is used for this purpose. This improves performance when a huge playlist is active.
2019-04-06 15:23:34 +11:00
Carl Suster
9056467fdc random: allow custom random generator 2019-04-06 12:12:52 +11:00
Carl Suster
438009ba94 random: add test for equal_chance_permutation 2019-04-06 12:10:27 +11:00
Carl Suster
f35944f49c random: move implementation to beets.util.random 2019-04-06 11:06:19 +11:00
Adrian Sampson
a1e26bd8d8
Merge pull request #3200 from arcresu/bpd2
bpd: extend coverage of MPD protocol
2019-04-02 10:09:51 -04:00
Carl Suster
95dd513b25 bpd: add flake8 exception for test command 2019-04-02 14:25:56 +11:00
Carl Suster
140d25df52 Changelog for #3200 2019-04-02 13:50:16 +11:00
Carl Suster
20e2f8beec bpd: output an info-level message when ready 2019-04-02 13:38:43 +11:00
Carl Suster
d074dac771 bpd: add comments to the error handling code 2019-04-02 13:37:40 +11:00
Carl Suster
28db7d3d33 bpd: provide precision time in status 2019-04-02 11:15:00 +11:00
Carl Suster
4be2e1b5e6 Remove beets.util.inspect wrapper 2019-04-02 10:22:47 +11:00
Carl Suster
36c85a8aeb Fix beets.util.inspect for Python 3
Under the original compatibility shim we weren't correctly inclusing
`self` in the argument list for bound methods.
2019-04-02 10:11:43 +11:00
Carl Suster
9622e7433b bpd: return real audio data 2019-04-02 09:44:34 +11:00
Carl Suster
e839e4ea19 bpd: improve exception handling
Check function signature instead of using TypeError to crudely guess
that the wrong number of arguments were provided.

Prevent bpd from crashing when trying to log a traceback. The
`traceback.format_exc` function takes an optional argument which is
supposed to be an integer restricting the length of the backtrace to
show. Instead we were passing the exception object to this function and
causing a new exception to be raised.
2019-04-02 09:39:07 +11:00
Thomas McWork
4cbe116e42
use most simple syntax 2019-04-01 09:13:36 +02:00
Carl Suster
146c5f5e13 bpd: fix repeat, consume and single in reverse
These flags are all relevant to the 'previous' command as well as the
'next' command.
2019-04-01 18:05:10 +11:00
Carl Suster
12e49b3c88 bpd: skipping backwards through zero keeps playing
Previously issuing the 'previous' command when at position 0 on the
playlist would cause bpd to stop playing. MPD instead just restarts the
currently playing song instead, so we now match this behaviour.
2019-04-01 17:51:21 +11:00
Carl Suster
a4fe6875a1 bpd: fix bug in bounds check of current song index
The songs are indexed starting from zero for the play command, however
the bound check was off by one. An index matching the length of the
playlist would crash the server instead of responding with an error
message over the protocol.
2019-04-01 17:41:25 +11:00