Commit graph

2710 commits

Author SHA1 Message Date
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
Carl Suster
0f53ae9a87 bpd: error instead of crashing on extra argument
If an MPC client is expecting a command to take an argument that bpd
isn't expecting (e.g. because of a difference in protocol versions) then
bpd currently crashes completely. Instead, do what the real MPD does and
return an error message over the protocol.
2019-04-01 14:49:27 +11:00
Carl Suster
d94a5393b2 bpd: fix crossfade command
Although crossfade is not implemented in bpd, we can store the setting
and repeat is back to clients. Also log a warning that the operation is
not implemented.

The real MPD doesn't show the crossfade in status if it's zero since
that means no crossfade, so now we don't either.
2019-04-01 14:49:27 +11:00
Adrian Sampson
c74a7059b4 Merge pull request #3192 from translit/yaml-safe-load
Fix PyYAML yaml.load(input) Deprecation
2019-03-31 21:46:29 -04:00
Adrian Sampson
0208ec69ef Merge pull request #3197 from arcresu/deprecation
Fix several deprecation warnings
2019-03-31 21:44:37 -04:00
Adrian Sampson
0042f3205e Merge pull request #3196 from arcresu/bpd-log
bpd: use plugin logger instead of global logger
2019-03-31 21:41:22 -04:00
Carl Suster
b4c4f3ca19 bpd: use plugin logger instead of global logger 2019-03-31 22:06:43 +11:00
Carl Suster
a6305c36e1 Fix deprecated plistlib function
https://docs.python.org/3.7/library/plistlib.html#plistlib.readPlist
2019-03-31 19:53:17 +11:00
Carl Suster
e4c03fd63f Fix deprecated placement of inline regex flags
https://bugs.python.org/issue22493
2019-03-31 19:44:49 +11:00
Carl Suster
ca60555ffa Fix deprecated call log.warn -> log.warning
https://bugs.python.org/issue13235
2019-03-31 19:44:40 +11:00
Carl Suster
7557bb06d6 bpd: use log instead of stdout 2019-03-31 18:43:18 +11:00
Carl Suster
0b4293de6e
the: log a debug only when text is changed
Previously the `the` plugin would log a debug message when the text _didn't_ get changed by the plugin, whereas I think what was intended was the opposite. With this change the logged messages show the actual transformations made by the plugin.
2019-03-31 18:19:09 +11:00
Alexei Datskevich
be12a89372 Fix PyYAML yaml.load(input) Deprecation 2019-03-30 08:34:13 +01:00
Adrian Sampson
6ee824fb0f Fix #3184: AttributeError in error handler 2019-03-14 09:53:32 -04:00
Jack Wilsdon
9bb6c29d22
Always use custom formatter for formatting hook commands 2019-02-25 14:41:59 +00:00
Adrian Sampson
80f4f0a0f2 badfiles: Fix decoding for command output
Probably fixes #3165. There were several things going wrong here:

1. For some reason, this was using the *filesystem* encoding, which is
   what you use to decode filenames. But this was general command
   output, not filenames.
2. Errors in decoding threw exceptions, even though all we do with this
   output is show it to the user.
3. The prints were using `displayable_path`, even though the lines are
   *already* Unicode strings.

Hopefully this cleans up that mess.
2019-02-24 16:06:36 -05:00
Jan Holthuis
3e10d5d39f badfiles: Fix #3158 by calling superclass __init__ method 2019-02-21 12:40:54 +01:00
Adrian Sampson
be118b922a
Merge pull request #3155 from Holzhaus/fetchart-error-handling
fetchart: Add some error handling to prevent crashes
2019-02-20 08:45:22 -05:00
Bernardo Meurer
9374983e9d
Fixed import order 2019-02-19 18:49:29 -08:00
Bernardo Meurer
e209fe5886
Parallelized beet bad 2019-02-19 18:47:47 -08:00
Jan Holthuis
c07903ed66 fetchart: Add some error handling to prevent crashes
Today I had some network problems regarding dbpedia.org, which made
beets crash because a requests.exceptions.ConnectionError was raised
("[Errno 113] No route to host"). This commits adds some error handling
around network requests to prevent further crashes in the future.
2019-02-19 16:16:56 +01:00
Bernardo Meurer
1dad5ded03
Move absubmit plugin parallelization to util.par_map 2019-02-18 22:42:20 -08:00
Adrian Sampson
81c5ae3fdf
Merge pull request #3151 from Holzhaus/playlist-plugin-additions
playlist: Add auto-update functionality and more tests
2019-02-18 08:40:55 -05:00
Jan Holthuis
4ba5dfaa43 playlist: Remove leftover print call and fix 'auto' option access style 2019-02-18 09:13:39 +01:00
Jan Holthuis
7bca5cf549 playlist: Don't use syspath() when checking if path is absolute 2019-02-17 22:28:39 +01:00
Jan Holthuis
ee2cce4280 playlist: Work around Windows' Mandatory File Locking on playlist updates 2019-02-17 22:12:13 +01:00
Jan Holthuis
d991e2a7d8 playlist: Normalize path before lookup in changes dict 2019-02-17 21:51:09 +01:00
Adrian Sampson
9320db21eb
Merge pull request #3150 from beetbox/named-query
Add support for "named queries" and use them in the playlist plugin
2019-02-17 15:08:31 -05:00
Adrian Sampson
55ef2ffd39 Add future imports to playlist plugin 2019-02-17 14:02:26 -05:00
Adrian Sampson
7efc67eb03 playlist: Use new "named query" functionality 2019-02-17 13:52:00 -05:00
Jan Holthuis
6d42028057 playlist: Add playlist auto-update functionality 2019-02-17 19:38:21 +01:00
Adrian Sampson
00667bda0f Merge pull request #3145 from Holzhaus/playlist-plugin
Playlist plugin
2019-02-17 13:16:26 -05:00
Jan Holthuis
4f1a468aa9 playlist: Restore case sensitivity in col_clause method 2019-02-17 17:34:36 +01:00
Jan Holthuis
055f2d3702 playlist: Also catch IOErrors to restore Python 2.7 compatiblity 2019-02-17 16:00:04 +01:00
Jan Holthuis
f9f2fa0e26 playlist: Restructure playlist reading code and add error handling 2019-02-17 15:17:10 +01:00
Jan Holthuis
19b92e1199 playlist: Improve speed in PlaylistQuery class
Implement the col_clause method for faster, sqlite-based querying. This
will only make a difference if the "fast" kwarg is set to True.
2019-02-17 14:38:36 +01:00
Jan Holthuis
a80a07f093 playlist: Add playlist plugin
Adds M3U playlist support as a query to beets and thus partially
resolves issue #123. The implementation is heavily based on #2380 by
Robin McCorkell.

It supports referencing playlists by absolute path:

    $ beet ls playlist:/path/to/someplaylist.m3u

It also supports referencing playlists by name. The playlist is then
seached in the playlist_dir and the ".m3u" extension is appended to the
name:

    $ beet ls playlist:anotherplaylist

The configuration for the plugin looks like this:

    playlist:
        relative_to: library
        playlist_dir: /path/to/playlists

The relative_to option specifies how relative paths in playlists are
handled. By default, paths are relative to the "library" directory. It
also possible to make them relative to the "playlist" or set the option
or set it to a fixed path.
2019-02-17 14:38:36 +01:00
Adrian Sampson
69fbba1eed
Merge pull request #3144 from Holzhaus/add-id3v23-to-convert
Add id3v23 option to convert plugin
2019-02-15 09:51:46 -07:00
Jan Holthuis
7afeb9b2ac convert: Add id3v23 config option to convert plugin 2019-02-14 23:42:36 +01:00
Adrian Sampson
f54042f194 Make a comment into a full sentence 2019-02-08 18:18:30 -08:00
jan
5ace667757 add forgotten request_finished 2019-02-08 01:09:07 +01:00
jan
9bc3898951 add request_finished function, rename wait_for_rate_limiter to request_start, add doc and changelog 2019-02-08 01:02:33 +01:00