Commit graph

8633 commits

Author SHA1 Message Date
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
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
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
Carl Suster
de6718abdf bpd: separate tests by command category 2019-04-01 14:49:27 +11:00
Adrian Sampson
422189ca3d Changelog for #3202 2019-03-31 22:06:01 -04:00
Adrian Sampson
b318f6fe58 Merge pull request #3202 from jackwilsdon/fix-3.8
Support Python 3.8 (fixes #3201)
2019-03-31 22:05:17 -04:00
Adrian Sampson
6c9c881989 Changelog for #3089 2019-03-31 21:52:30 -04:00
Adrian Sampson
a588784dc7 Merge pull request #3089 from pprkut/delayed_type_casting
Performance improvement: Type cast properties on demand
2019-03-31 21:51:34 -04:00
Adrian Sampson
1382f02caa
Merge pull request #3198 from arcresu/test-ui-pytest
Fix test_ui:test_version under pytest
2019-03-31 21:48:52 -04: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
a1f965a3e5 Changelog for #3197 2019-03-31 21:45:08 -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
0d31b33948 Changelog for #3196 2019-03-31 21:42:16 -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
Adrian Sampson
3701d145b0 Changelog for #3195 2019-03-31 21:39:55 -04:00
Adrian Sampson
fa3a569a45 Merge pull request #3195 from arcresu/patch-1
the: log a debug only when text is changed
2019-03-31 21:39:13 -04:00
Jack Wilsdon
8df213e9b6
Support Python 3.8 (fixes #3201) 2019-03-31 18:26:22 +01:00
Carl Suster
b4c4f3ca19 bpd: use plugin logger instead of global logger 2019-03-31 22:06:43 +11:00
Thomas McWork
1916fe0ad5
Provide an example for the languages list
It's hard to impossible to figure out the correct syntax for non python users.
2019-03-31 13:06:27 +02:00
Heinz Wiesinger
f9f2bddba0 Add class wrapper for lazily converting attributes 2019-03-31 11:58:16 +02:00
Carl Suster
bed89df69a Fix test_ui:test_version under pytest
The test `CommonOptionsParserCliTest.test_version` was passing with nose
but failing with pytest (see output below). The reason for the failure
seemed to be that the `test` plugin was loaded when it wasn't expected
to be loaded, changing the output of the `version` command. I'm not sur
exactly why that was happening, but since that test already inherited
from `TestHelper`, just invoking the plugin load/unload helper was
enough to fix it. I also removed the line setting the `self.lib`
variable since that's already done in the helper.

---

self = <test.test_ui.CommonOptionsParserCliTest testMethod=test_version>

    def test_version(self):
        l = self.run_with_output(u'version')
        self.assertIn(u'Python version', l)
>       self.assertIn(u'no plugins loaded', l)
E       AssertionError: 'no plugins loaded' not found in 'beets version 1.4.8\nPython version 3.7.3rc1\nplugins: test\n'

test/test_ui.py:1292: AssertionError
2019-03-31 20:22:44 +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
3997141250 Fix deprecated imports from collections for Py3
Since Python 3.3 the abstract base classes from `collections` are moved
to the `collections.abc` module. From Python 3.8 they will be
unavailable from their original location.

https://docs.python.org/3/library/collections.abc.html
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