Commit graph

2752 commits

Author SHA1 Message Date
Adrian Sampson
5f9b28124d Merge pull request #3220 from rain0r/3219
Update __init__.py
2019-04-21 20:39:46 -04:00
Rainer Hihn
b7d3ef6274 - Improved doc and changelog
- Cleaner implementation of mutual excursion of the command line
arguments.
2019-04-21 18:32:41 +02:00
Jack Wilsdon
f5f9aed641
Add loadext plugin 2019-04-21 15:10:28 +01:00
Carl Suster
063e4f259b
Merge pull request #3222 from arcresu/bpd-decoders
bpd: support decoders command
2019-04-21 09:20:42 +10:00
Adrian Sampson
1edd21fab1
Merge pull request #3223 from arcresu/mpd-port
mpdupdate, mpdstats: use MPD_PORT env variable
2019-04-20 14:21:20 -04:00
Louis Sautier
4d98088cc1
Replace more instances of unsafe calls to yaml.load 2019-04-20 01:14:15 +02:00
Rainer Hihn
ddd7b4b3b4 Removed empty line 2019-04-19 21:17:15 +02:00
Rainer Hihn
5c643a8f16 Removed ipdb import 2019-04-19 21:08:26 +02:00
Rainer Hihn
e4b2e7b476 Made -a and -A mutually exclusive. 2019-04-19 20:58:13 +02:00
Carl Suster
21cba304bd mpdupdate: use MPD_PORT env variable 2019-04-19 17:35:42 +10:00
Carl Suster
dc5f110844 mpdstats: use MPD_PORT env variable 2019-04-19 17:35:42 +10:00
Carl Suster
3da23167ca bpd: support decoders command
This uses GStreamer APIs to extract a list of audio decoders and the
relevant MIME types and file extensions. Some clients like ncmpcpp use
this command to fetch a list of supported file extensions.
2019-04-19 16:08:05 +10:00
Rainer Hihn
0b2334f8e8 Added command line options to query explicit for albums and / or tracks. 2019-04-18 22:31:49 +02:00
rain0r
fc95fb86a1
Update __init__.py
Also fetch genres for single tracks via query.
2019-04-17 20:57:58 +02: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
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
6fbf3853f2 bpd: bump protocol version to 0.14.0 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
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
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
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
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
f35944f49c random: move implementation to beets.util.random 2019-04-06 11:06:19 +11:00
Carl Suster
95dd513b25 bpd: add flake8 exception for test command 2019-04-02 14:25:56 +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
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
Carl Suster
0c3a63ef9f bpd: fix repeat mode behaviour
The repeat flag indicates that the entire playlist should be repeated.
If both the repeat and single flags are set then this triggers the old
behaviour of looping over a single track.
2019-04-01 17:39:35 +11:00
Carl Suster
b245c0e755 bpd: test fields returned by status command 2019-04-01 16:42:39 +11:00
Carl Suster
bae9c40600 bpd: support the single command
This command instructs bpd to stop playing when the current song
finishes. In the MPD 0.20 protocol this flag gains a value 'oneshot' but
for now we just support its older version with a boolean value.
2019-04-01 16:30:02 +11:00
Carl Suster
71e7621642 bpd: no-op support for persistent playlists
The real MPD offers persistent playlist manipulation, storing the
playlists in a directory set in the config file. If that directory is
not available then the feature is disabled and the relevant commands all
respond with errors. Based on this, the initial support in bpd just
returns errors matching the MPD server in the disabled mode.

For playlistadd, extend the _bpd_add helper to work with playlists other
than the queue in order to support testing the real implementations of
these commands in the future.
2019-04-01 16:30:02 +11:00
Carl Suster
859e16d1e3 bpd: support consume command 2019-04-01 16:30:02 +11:00
Carl Suster
e5851866d7 bpd: add replay_gain_* commands
There's a special status command for checking the replay gain mode,
which can be set to one of a short list of possible values. For now at
least we can ignore this feature, but track the setting anyway.
2019-04-01 14:49:27 +11:00
Carl Suster
67a0b38d20 bpd: add dummy command for volume
MPD supports a deprecated command 'volume' which was used to change the
volume by a relative amount unlike its replacement 'setvol' which uses
an absolute amount. As far as I can tell 'volume' always responds with a system
error message "No mixer".
2019-04-01 14:49:27 +11:00
Carl Suster
1511e313f7 bpd: add mixramp commands
These are a more sophisticated version of crossfade so we're free to
ignore them, at least for now. We now track the values of the two
settings, and show them in the status output. Like MPD, we suppress the
mixrampdb value if it's set to nan, which is how it signals that the
feature should be turned off.
2019-04-01 14:49:27 +11:00