Commit graph

2338 commits

Author SHA1 Message Date
Carl Suster
063e4f259b
Merge pull request #3222 from arcresu/bpd-decoders
bpd: support decoders command
2019-04-21 09:20:42 +10:00
Louis Sautier
4d98088cc1
Replace more instances of unsafe calls to yaml.load 2019-04-20 01:14:15 +02: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
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
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
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
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
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
4158bdb95e mpdstats: update tests for currentsong 2019-04-06 15:31:03 +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
4be2e1b5e6 Remove beets.util.inspect wrapper 2019-04-02 10:22:47 +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
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
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
999cf14401 BPD tests: change expectedFailure -> skip for nose 2019-03-31 10:50:42 +11:00
Carl Suster
2e35c27dce BPD tests: improve helpers 2019-03-31 10:46:14 +11:00
Carl Suster
eb5c7513a1 BPD tests: fix GstPlayer mock 2019-03-31 10:46:14 +11:00
Carl Suster
2a2d9b5c98 BPD tests: explicitly close client socket 2019-03-31 10:46:14 +11:00
Carl Suster
a6c976b880 BPD tests: small code reformatting 2019-03-31 10:46:14 +11:00
Carl Suster
3eaf0f7a19 BPD tests: use canonical capitalisation of tags 2019-03-31 10:46:14 +11:00
Carl Suster
4c627cbacb [skip travis] BPD tests: add items by path 2019-03-31 10:46:14 +11:00
Carl Suster
dfc5da70cd BPD tests: avoid os.fsdecode new in Py3.2 2019-03-31 10:46:14 +11:00
Carl Suster
14d0cc3b85 BPD tests: be more careful with paths 2019-03-31 10:46:14 +11:00
Carl Suster
7c8bbd3011 BPD tests: avoid Py3.7-only mp.Process.kill 2019-03-31 10:46:14 +11:00
Carl Suster
35bf041ad0 BPD tests: fork and launch beets 2019-03-31 10:46:14 +11:00
Carl Suster
c42c0c06bc BPD tests: fix CI failures 2019-03-31 10:46:14 +11:00
Carl Suster
2286c0ce7b BPD tests: run bpd in a subprocess 2019-03-31 10:46:14 +11:00
Carl Suster
767441d5d5 BPD tests: improve test helpers
Decode the bytes to strings: the MPD protocol specifies that the
communications are all in UTF-8.

Also parse the body into a dict since this is typically more convenient
than having to do it manually in each test.
2019-03-31 10:46:14 +11:00
Carl Suster
d9537f27dc BPD tests: fix CI failures 2019-03-31 10:46:14 +11:00
Carl Suster
76221428f8 Add a DummyIn::close no-op implementation
The BOD tests are currently forking a process with a server running, and
this attempts to close stdin. Tests were failing due to DummyIn not
implementing the close() method. Adding this simple no-op does the trick
to allow forking and seems like a harmless addition.
2019-03-31 10:46:14 +11:00
Carl Suster
5d2b883b72 BPD tests: test several simple commands 2019-03-31 10:46:14 +11:00
Carl Suster
7302cd6ab5 BPD tests: test helper for BPD batch commands
The MPD protocol allows batching commands. There are two choices for the
first message that announced a batch is starting, and we just go for the
one that causes the server to respond with a marker message between each
individual response, since that's easier. This might need to be tweaked
in order to test the behaviour with the other batch indicator.
2019-03-31 10:46:14 +11:00
Carl Suster
9a5be1f971 BPD tests: test supported tag types
MPD now supports more fields ("tags") than what BPD advertises. Fixing
this should be a simple task of extending the mapping of fields to tags
in BPD's implementation.
2019-03-31 10:46:14 +11:00
Carl Suster
acd66ce560 BPD tests: run BPD Server with a fake gstplayer 2019-03-31 10:46:14 +11:00
Carl Suster
acc3f3efb0 BPD tests: check all specified commands known
The current MPD spec is several versions ahead of BPD. These tests just
compare the full specified list of commands against what BPD claims to
support (without actually testing their implementations). It's handy as
a measure of progress against the specification, but can perhaps be
dropped later once all of the individual protocol methods have tests.
2019-03-31 10:46:14 +11:00
Carl Suster
59e66aaa7f BPD tests: password command 2019-03-31 10:46:14 +11:00
Carl Suster
078c583434 BPD tests: add basic test framework
A simple TCP client wraps the low level protocol to allow testing of the
BPD server as a black box.
2019-03-31 10:46:14 +11:00
jroitgrund@gmail.com
ea307f62d1 Don't move album art twice 2019-03-27 01:41:42 +00:00
Jack Wilsdon
25549a656f
Add test for interpolating byte strings in hook plugin 2019-02-25 14:42:20 +00: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
76a3e44aad test: Make music dir of playlist tests Windows-compatible 2019-02-17 21:27:37 +01:00
Jan Holthuis
7ec55a5f3b test: Use unicode literals for library queries in playlist tests 2019-02-17 21:27:09 +01:00
Jan Holthuis
a9dd5a7cdc test: Add testcase for playlist plugin's update functionality 2019-02-17 20:31:15 +01:00
Adrian Sampson
7edba6e9ea Fix test harness for named queries 2019-02-17 14:11:40 -05:00
Jan Holthuis
1af82cc450 test: Split up playlist test helper class 2019-02-17 19:41:37 +01:00
Adrian Sampson
d8e167637e Prototype support for named (pseudo-field) queries
As discussed here:
https://github.com/beetbox/beets/pull/3145#pullrequestreview-204523870

This would replace the need for #3149.
2019-02-17 13:41:05 -05:00
Jan Holthuis
5b68d88346 test: Add more playlist tests for the different relative_to settings 2019-02-17 19:36:26 +01:00
Jan Holthuis
9f3acce2ae test: Add non-existing item to playlist tests 2019-02-17 19:35:54 +01:00
Jan Holthuis
b00b38dab6 test: Add test for relative playlists 2019-02-17 19:35:43 +01:00
Jan Holthuis
14cad04d35 test: Further improve Windows compatibility in playlist plugin test 2019-02-17 19:33:54 +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
d6022e28d7 test: Ensure path quoting in playlist tests 2019-02-17 16:43:36 +01:00
Jan Holthuis
31c687c853 test: Fix playlist plugin path handling for Windows compatibility 2019-02-17 16:17:47 +01:00
Jan Holthuis
32b6df046e test: Don't use unix-only paths in playlist plugin testcase 2019-02-17 15:57:40 +01:00
Jan Holthuis
d4039be9c0 test: Get rid of TemporaryDirectory to restore Python 2.7 compatibility 2019-02-17 15:39:47 +01:00
Jan Holthuis
d52dcdd48f test: Add playlist testcases for nonexisting playlists 2019-02-17 15:17:10 +01:00
Jan Holthuis
0988a2a186 test: Add test suite for the playlist plugin 2019-02-17 15:17:10 +01:00
Rahul Ahuja
7b57b0b608 Appease Flake8 2019-01-22 10:53:18 -08:00
Rahul Ahuja
3a67eae46d Use track attrs directly, better naming/docstrings 2019-01-22 10:41:18 -08:00
Rahul Ahuja
77f9a930b7 Fix remaining test, use official doc wording 2019-01-21 23:15:08 -08:00
Rahul Ahuja
0527edbd48 Fix test index, add docstrings 2019-01-21 23:05:47 -08:00
Rahul Ahuja
2cda2b5b3a Remove hardcoded ordering of filters in tests 2019-01-21 22:53:23 -08:00
Rahul Ahuja
237792a4fb Fix other test_track_request case 2019-01-21 22:40:15 -08:00
Rahul Ahuja
f63beca39a Switch filter ordering in test 2019-01-21 22:35:12 -08:00
Rahul Ahuja
5472a49991 Add candidates and item_candidates, modularize Search API queries 2019-01-21 21:24:41 -08:00
Adrian Sampson
1087740580
Merge pull request #3100 from regagain/fetchart_unittests
Unit tests for fetchart plugin iTunes source
2019-01-21 18:19:08 -05:00
Reg
272bf5940b test_art/iTunesStore: log check fix. 2019-01-21 22:49:19 +01:00
Reg
1be3c954f3 test_art/iTunesStore: Python2 string fix. 2019-01-21 18:26:58 +01:00
Reg
ce35c36762 test_art/iTunesStore: Verify logs. 2019-01-20 23:09:18 +01:00
Rahul Ahuja
b95eaa8ffe fix test, document Spotify ID 2019-01-20 02:20:10 -08:00
Rahul Ahuja
9a30000b56 better naming, formatting 2019-01-20 02:04:46 -08:00
Rahul Ahuja
104f6185ab revert unnecessary double --> single quotes 2019-01-19 23:57:36 -08:00
Rahul Ahuja
337cf2a1c3 appease Flake8 2019-01-19 23:35:06 -08:00
Rahul Ahuja
dc77943da2 try oauth token mock 2019-01-19 23:21:02 -08:00
Reg
088b5b173d test_art/iTunesStore: Check match level is as expected 2019-01-19 14:58:41 +01:00
Reg
57c27039d6 test_art/iTunesStore: renamed test for clarity 2019-01-12 19:54:49 +01:00
Reg
fa32485755 test_art/iTunesStore: requestexception test improvements 2019-01-10 20:03:32 +01:00
Reg
ac09c480c9 test_art/iTunesStore: removed unnecessary statement and renamed test 2018-12-27 09:44:04 +01:00
Reg
5d1c97824c Unit tests for fetchart plugin iTunes source 2018-12-23 17:48:44 +01:00
Reg
f955f72e2c test_fetchart: Fix for hidden files on Windows 2018-12-21 11:27:09 +01:00
Reg
54a83fa941 Fetchart / ignore settings tests 2018-12-20 18:44:55 +01:00
Reg
0696f915e5 test_fetchart: Avoid duplicate code in future tests. 2018-12-20 18:44:55 +01:00
Adrian Sampson
ca359d7e0d
Merge pull request #3085 from jackwilsdon/modify-skip-remaining
Allow exiting object selection early
2018-12-02 14:57:16 -05:00
Guilherme Danno
fa1037ee28
Enhance %title (#3059)
Use string.capwords in %title to lower char after apostrophe
2018-11-29 11:30:48 -02:00
Jack Wilsdon
bed3abd97a
Allow exiting object selection early 2018-11-28 17:17:12 +00:00
Adrian Sampson
0a74e0fd3f Style fixes for latest pycodestyle changes 2018-10-24 17:05:38 -04:00
David Logie
27f0b57d2b Remove pointless print call. 2018-10-10 15:40:21 +01:00
Jack Wilsdon
5ad16983d4
Fix miscellaneous typos 2018-10-09 01:11:06 +01:00
David Logie
932609933f Allow "deleting" fixed attributes via beet modify.
Deleting a fixed field isn't possible so we just reset the
field back to it's "null" value.

Fixes #2497.
2018-09-27 11:22:17 +01:00
Adrian Sampson
62772ceece Merge branch 'master' into arogl-master 2018-09-16 20:56:17 -04:00
Adrian Sampson
dc45119a8d Avoid comparing patterns in a test
As pointed out here:
https://github.com/beetbox/beets/pull/3028#issuecomment-420257867
2018-09-16 20:52:31 -04:00
Andrew Rogl
919f3f9c34 mbsync no longer queries MusicBrainz when the either the mb_albumid or mb_trackid field is invalid 2018-09-09 15:20:26 +10:00
Adrian Sampson
3ddf3ef58a
Merge pull request #3022 from beetbox/default-ignore-data-tracks
Make `ignore_data_tracks` `yes` by default
2018-09-05 23:13:44 -04:00
Filipe Fortes
2b41775b8a Fix tests 2018-09-05 11:37:54 -04:00
David Logie
57b268923f Split release and release-group disambiguation into separate fields. 2018-09-05 12:45:19 +01:00
Filipe Fortes
692060cc0a Re-order tests 2018-09-04 11:33:07 -04:00
Filipe Fortes
1701aefe5c Make ignore_data_tracks yes by default 2018-09-04 10:04:17 -04:00
Filipe Fortes
210b9d316f Allow ignoring of audio data tracks on import 2018-09-02 10:09:10 -04:00
Adrian Sampson
142aeb6822
Merge branch 'master' into 2972-from-scratch-keep-immutable 2018-07-02 15:18:38 -04:00
Zsin Skri
77242d6b2b add test: from_scratch only removes writeable
Tests for commit ba8fcdfd from_scratch import: only remove writable fields.
2018-07-01 20:23:41 +02:00
Zsin Skri
154e6cfca8 improve tests prefer_specific without canonical
This improves the tests for the changes introduced in
commit cef9a331 LastGenre: allow prefer_specific without canonical.
2018-07-01 09:19:36 +02:00
Zsin Skri
96120d5c6d LastGenre test: prefer_specific without canonical
This tests commit cef9a331.
2018-06-30 22:38:56 +02:00
Zsin Skri
0f847aefcb LastGenre tests: setup_config: add prefer_specific
Allow to specify prefer_specific in lastgenre tests configuration setup.
2018-06-30 22:37:28 +02:00
Iliana Weller
d1d745a58e
Test {album,track}info_received sends in mbsync 2018-05-09 21:46:57 -07:00
Jérémie Detrey
b12b4a1998 mbsync: Add unit test for recording MBID change. 2018-05-08 17:17:23 +02:00
Jérémie Detrey
81e1fc1a7e test.helper: Allow extra track values in generate_album_info. 2018-05-08 17:02:38 +02:00
Jérémie Detrey
f01799207a Add mb_releasetrackid tag to full.* media files. 2018-05-01 08:37:34 +02:00
Jérémie Detrey
9f4c5c8096 Do not rely on positional arguments for TrackInfo. 2018-04-30 18:37:27 +02:00
Jérémie Detrey
f74899ab9a Fix errors due to missing track['id'] in unit tests. 2018-04-30 18:26:06 +02:00
Jérémie Detrey
3e3a51dbb1 Merge branch 'feature/406' of github.com:Rawrmonkeys/beets into feature/406 2018-04-30 11:26:10 +02:00
Jérémie Detrey
c1d1388729 Unit test for import with video data tracks. 2018-04-29 20:19:11 +02:00
Jérémie Detrey
e88a7cea90 Unit test for import with audio data tracks. 2018-04-29 20:06:44 +02:00
Adrian Sampson
4288e11fc0
Merge pull request #2891 from dbogdanov/discogs_fixes
Some fixes and updates for the Discogs plugin
2018-04-28 14:32:27 -04:00
Adrian Sampson
8eb50fee33 Avoid weird mutation in web tests
This was strange and unnecessary---setting a field on the response
object instead of just using a local variable---and also broke on Flask
1.0.
2018-04-27 17:34:18 -04:00
Dmitry Bogdanov
676536efa7 Fix incorrect indexing of two-sided mediums
Fix incorrect split of a tracklist by medium for the case of
two-sided mediums (#2887).

Following the discussion in #2887, the 'medium_total' value should
contain the number of tracks on the medium to which each particular
track belongs, not the total number of different mediums present on
a release.

Fix unit tests accordingly.
2018-04-27 19:28:35 +02:00
Denis Defreyne
0202d762bf
Add artist_credit config option 2018-04-08 08:29:06 +02:00
Rawrmonkeys
0f6f0391fd add tag, database entry, data population for musicbrainz release track id 2018-03-25 18:58:04 -07:00
Adrian Sampson
492ff7359a Set up date tests for #2652 2018-02-20 22:57:58 -05:00
Adrian Sampson
9577a511cb Update tests for new Unidecode behavior: fix #2799
The library has started putting spaces around the expanded versions of
vulgar fraction characters.
2018-01-30 20:50:43 -05:00
Nicolas Guillaumin
816de1c3da Rename setting to ignored_media for consistency 2018-01-02 15:04:00 -08:00
Nicolas Guillaumin
22c4f9cb97 Added a setting to control which formats are ignored
This is related to #2688 where a list of hard-coded non-audio formats to
ignore has been added. Some users may want to rip the audio portion of
video tracks (e.g. DVD-Video) so it would be beneficial to let them
control exactly which formats to ignore.

I added a `ignored_formats` setting for that purpose and moved the
hard-coded list into the config. Test and documentation have been
updated accordingly.

Aside: I also clarified the changelog a bit regarding this change and
the related one for #1210.
2018-01-02 11:03:02 -08:00
Nicolas Guillaumin
d325bceb1d Added a setting to control if video tracks are ignored
Users may want to keep tracking video tracks, for example if they rip
the audio part of the video tracks. Added a setting to allow this.
2017-12-31 10:46:48 -08:00
Nicolas Guillaumin
71b4d5c702 Fixes #1210: Skip non-audio tracks from MusicBrainz
This ignores non-audio tracks during import:
- Data tracks, based on their title `[data track]` (which seems to be
the MusicBrainz convention, as there's no specific flag to indicate
that a track is a data one),
- Video tracks, based on the `video=true` attribute.

It's similar to the Picard changes mentioned in #1210, except it doesn't
deal with `[silence]` tracks: These ones will probably require a setting
to let the user control if they should be imported or not.
2017-12-30 19:20:43 -08:00
Nicolas Guillaumin
3b491ce9b4 Fixes #2688: Skip non-audio media from MusicBrainz
Some releases have non-audio media, such as CD+DVD or CD+DVD-Video. Skip
these media when fetching album info as they will never match audio
tracks and will always report missing tracks.

I took the naive approach of cherry-picking a list of media suspected to
not contain audio from the MusicBrainz formats list:

https://musicbrainz.org/doc/Release/Format
2017-12-30 13:29:37 -08:00
tummychow
e848adab04 Implement from_scratch option
Fixes #934, and also helps with #1173.
2017-12-07 14:46:40 -05:00
Sebastian Reuße
c40ea4f22a mediafile._safe_cast: be safer when converting to int
The regex «[\+-]?[0-9]*» possibly matches a single minus/plus, which would then
be passed on to int(), raising a ValueError from within _safe_cast. The test
suite covered this for float, but not for int.

We now make sure we actually have a number after the sign by using a Kleene
plus.
2017-11-19 09:21:07 +01:00
Meet Udeshi
70f0bc5b6c Implement album merging for duplicates
Fixes #112
2017-11-01 02:00:48 +05:30
konman2
578143ae12 updated to pass pep8 checks 2017-10-07 21:28:33 -07:00
konman2
fdeef05cc9 clearart asks for permission before deleting embedded albumart 2017-10-07 20:42:01 -07:00
zigarrre
b376139663 Refactored move functions for clarity according to #2682
The move functions in library.py and manipule_files in importer.py where
changed to use a single parameter for the file operation instead of
multiple boolean flags.

A typo in the documentation of the Album.move and Item.move functions
confusing True and False when describing the store parameter was fixed
as well.
2017-09-11 17:03:44 +02:00
euri10
25fb2453b4 Modified the name of the fetchart plugin switch from missing to quiet 2017-09-05 18:27:47 +02:00
euri10
b2fd274e2c Added a missing switch to the fetchart command so that only missing albums
are displayed
2017-09-05 16:34:26 +02:00
wordofglass
8833fef249 Merge pull request #2668 from wordofglass/edit_logic
Edit plugin logic: Regression from previous PR; incorrect diffs
2017-08-25 15:52:40 +02:00
wordofglass
5f21bd3ccd test_edit: Add a test for retagging. 2017-08-24 15:03:18 +02:00
wordofglass
b903b44a0c test_edit: Fix test that intended to change one item but affected two.
This didn't manifest as a testing failure since the plugin (mostly
silently) drops id changes.
2017-08-22 23:34:35 +02:00
wordofglass
c811102eb2 test_edit: Expect mtime to change, unbreaks the multiple-item tests. 2017-08-22 23:34:06 +02:00
wordofglass
18c82cab5f test_edit: Add a comment explaining why I didn't change the writing behaviour
I was midway through writing a test when realizing that it's best
the way it is...
2017-08-22 23:24:33 +02:00
wordofglass
7d4627bb8f Ensure mtime is non-zero for Items in test fixtures.
mtime == 0 is the "this Item contains newer metadata than the file's
tags" marker. Setting this to something else than 0 emulates the state
of Items freshly read from the database.

Breaks 4 of the edit plugin tests.
2017-08-22 23:24:33 +02:00
Antoine Beaupré
914dba4152
add tests for slug function, failing 2017-07-18 16:32:47 -04:00
Adrian Sampson
8085d1318b Fix ipfs test to sort items in order 2017-06-20 16:19:31 -04:00
Adrian Sampson
2a9be17cf6 Fix some brittle query tests
These were written to incidentally depend on Nones; the behavior they're
actually testing doesn't really have anything to say about None-ness.
2017-06-20 15:56:33 -04:00
euri10
6664b656f4 Merge branch 'relativedate'
Solved conflicts with upstream of new parse classmethod of DateQuery

# Conflicts:
#	beets/dbcore/query.py
2017-06-15 08:59:43 +02:00
Adrian Sampson
ace5656e36 Complete set of __future__ imports 2017-06-14 19:08:27 -04:00
A.L. Kleijngeld
2eb4e3d515 Merge branch 'master' into master 2017-06-13 14:43:10 +02:00
Bart Kleijngeld
762f9ca054 revised to fix flake8 warnings 2017-06-13 14:33:08 +02:00
Adrian Sampson
dfde9ce916 Merge pull request #2510 from SpirosChadoulos/master
New export command (issue #435)
2017-06-11 12:21:06 -04:00
Adrian Sampson
389aed8d5d Merge pull request #2528 from discopatrick/query-datetime-parser
Query datetime parser
2017-06-10 20:57:29 -04:00
Adrian Sampson
15a7dfccff Merge pull request #2583 from yacoob/master
Fix a lastgenre crash
2017-06-10 20:47:19 -04:00
Adrian Sampson
0e47095bb0 Merge pull request #2560 from autrimpo/r128
RFC: replaygain: R128 support
2017-06-10 20:32:42 -04:00
Adrian Sampson
ca4f96e33c Consolidate export tests into MoveTest
Just one new flag.
2017-06-10 20:26:41 -04:00
Adrian Sampson
730c84e5e5 Correct tests for export mode
The old tests were wrong but the incorrectness was hidden by the incorrect
parameter passing fixed in the previous commit. Now we actually test that the
item's path did not change.
2017-06-10 20:25:48 -04:00
Adrian Sampson
714560aace Fix parameter order and binding
The calls didn't match up with the parameter order.
2017-06-10 20:19:27 -04:00
Adrian Sampson
b25eb87f60 Remove unnecessary output capture 2017-06-10 20:05:17 -04:00
Adrian Sampson
29d6c27d02 Fix some spurious whitespace changes 2017-06-10 20:03:01 -04:00
discopatrick
291b287f56 Add a test for a non-range date query 2017-06-05 16:31:37 +01:00
Jakub Turski
f6830b4bc3 Here, flake8, be happy. 2017-06-02 16:27:49 +01:00
Jakub Turski
0e7a0a62d4 Fix excessive line length. 2017-06-02 16:04:05 +01:00
Jakub Turski
a43f5fdace Remove unnecessary test setup parameter. 2017-06-02 15:50:58 +01:00
Jakub Turski
ee46a5150f Don't crash if non-canonical genre and prefer_specific: yes.
Also, add a test for this.
2017-06-02 15:48:05 +01:00
discopatrick
e1101d4e95 Update assertion with correct error name 2017-06-01 12:33:23 +01:00
Bart Kleijngeld
c64878179e finished tests for set_fields on importer 2017-06-01 11:57:24 +02:00
discopatrick
fbb868e5ed Merge branch 'master' into query-datetime-parser 2017-06-01 04:37:45 +01:00
Michal Koutenský
ddfe44266b r128 gain tags in mediafile test 2017-05-17 21:41:12 +02:00
Adrian Sampson
9840964f51 Fix #2562: avoid crash with newlines in templates
Turns out! The $ character in Python regexes also matches before the last
newline at the end of a string, not just at the end of a string. The \Z entity
does what we really want: the *real* end of the string.
2017-05-16 14:00:10 -04:00
Adrian Sampson
9ccaad27d3 Undo some noisy whitespace changes 2017-05-12 10:42:50 -04:00
Adrian Sampson
0cb643f35e Merge pull request #2529 from dosoe/master
Add composer_sort as a tag
2017-05-12 10:34:46 -04:00
SpirosChadoulos
8f62e8bc68 Requested changes done 2017-05-12 14:49:03 +03:00
SpirosChadoulos
c4ef23d9f7 Minor Flake fixes 2017-05-11 12:45:03 +03:00
SpirosChadoulos
51835e762f Minor fixes to move tests 2017-05-11 12:30:21 +03:00
SpirosChadoulos
0dc948d9d3 Made sure that the destination directory will exist 2017-05-11 12:11:21 +03:00
SpirosChadoulos
f5b23fffd4 Replaced all AssertNotExists with AssertExists 2017-05-06 15:03:42 +03:00
Fabrice Laporte
409f070970 Remove lyrics.com source 2017-05-03 22:54:09 +02:00
Fabrice Laporte
fc6b65d592 Merge pull request #2538 from Kraymer/lyrics-test
Tests to track whether lyrics websites are correctly fetched
2017-05-03 20:02:03 +02:00
Fabrice Laporte
8f32bfed82 Reactivate test of LyricsCom and MusiXmatch sources 2017-05-03 07:42:50 +02:00
Fabrice Laporte
f53ab801b8 Add indent 2017-05-03 00:11:26 +02:00
Fabrice Laporte
b3fbdbae5a Fix flake8 2017-05-03 00:02:09 +02:00
Fabrice Laporte
3e38a33c4a Fix PEP8 2017-05-02 23:37:20 +02:00
Fabrice Laporte
11eb90c758 Fix PEP8 2017-05-02 07:46:51 +02:00
Fabrice Laporte
3e3ad6974c Fix PEP8 2017-05-02 07:30:40 +02:00
Fabrice Laporte
fa9262d61b Disable tests that do real requests to lyrics sites by default.
Set BEETS_TEST_LYRICS_SOURCES environment variable to '1' to not skip the
tests.
2017-05-02 01:05:18 +02:00
Fabrice Laporte
d88cabc846 Divide LyricsGooglePluginTest into two classes.
Move existing tests into LyricsGooglePluginMachineryTest.
Create LyricsPluginSourcesTest class to check fetching of each source.
Some code was supposed to do that until now but was never executed as we
exited early at the "if not check_lyrics_fetched():" check.
2017-05-02 01:03:26 +02:00
Fabrice Laporte
a85dcd88c4 Store whole expected lyrics, not just keywords, but randomized 2017-05-02 00:56:56 +02:00
Fabrice Laporte
4e0527f07d Docstrings style 2017-05-02 00:54:58 +02:00
Fabrice Laporte
f8862ac0ea Sort imports 2017-05-02 00:52:07 +02:00
Adrian Sampson
84febb13c1 Merge pull request #2523 from discopatrick/rename-error
Rename error
2017-05-01 15:29:21 -04:00
SpirosChadoulos
a88192240e ExportTest correction 2017-04-30 15:14:17 +03:00
SpirosChadoulos
bab99f546f Added a test for the new export feature 2017-04-30 15:02:50 +03:00
dosoe
813b078d02 added composer_sort on test_mediafile.py since there is artist_sort 2017-04-29 18:47:03 +02:00
Jack Wilsdon
f622e42a88 Replace blind excepts with generic Exception excepts in tests 2017-04-29 00:12:14 +02:00
dosoe
23f172d03d if there is no artist_sort, there should not be a composer_sort. 2017-04-28 13:49:50 +02:00
dosoe
4a17da8e10 requested changes: where there is no artist_sort, there is no need for composer_sort; cleaning up whitespaces. 2017-04-28 13:41:54 +02:00
dosoe
d4ff82e46f adding image stuff for composer_sort 2017-04-28 12:45:31 +02:00
dosoe
e3c37981bb little indentation stuff 2017-04-28 12:13:27 +02:00
dosoe
c51ecd46e3 add composer_sort tag# 2017-04-28 12:10:02 +02:00
discopatrick
50a2e37a4d Keep function names lowercase to pass flake8 tests 2017-04-27 15:58:08 +01:00
discopatrick
6e6dd76513 Remove space separator tests from test_x_precision_intervals tests
This is not the correct place for space separator tests. Each test
should test one thing only. Space separator tests are now in a separate
test case.
2017-04-27 11:36:03 +01:00
discopatrick
5a3b74f681 Test an invalid datetime separator raises error 2017-04-27 11:29:45 +01:00
discopatrick
1ab913b200 Test each valid datetime separator 2017-04-27 11:28:10 +01:00
discopatrick
24890c77f1 Add a date query precision of ‘second’ 2017-04-27 00:24:17 +01:00
discopatrick
02bd19fb32 Allow minute precision queries to use space separator 2017-04-27 00:06:36 +01:00
discopatrick
c3771f722c Allow hour precision queries to use space separator 2017-04-27 00:04:46 +01:00
discopatrick
b8e1c5675e Fix tests 2017-04-25 02:25:50 +01:00
discopatrick
ba324df0d1 Add a date query precision of ‘minute’ 2017-04-25 01:38:31 +01:00
discopatrick
5f2c47ec18 Test further hour precision intervals 2017-04-25 01:38:31 +01:00
discopatrick
61b832990f Add a date query precision of ‘hour’ 2017-04-25 01:38:24 +01:00
discopatrick
58417526cb Rename InvalidQueryArgumentTypeError to InvalidQueryArgumentValueError
The way we use `InvalidQueryArgumentTypeError` is more akin to a `ValueError` than a `TypeError`. For example, we try to parse a string as an int, float, or date, but the parsing fails - there was nothing wrong with the type of the variable (string), but its contents were not parseable into the type we wanted - there was a problem with the value of the string.
2017-04-22 18:07:30 +01:00
Adrian Sampson
78f19db511 Merge pull request #2521 from tweitzel/master
add --yes argument to play command
2017-04-19 18:59:50 -04:00
xarph
02aa6191c1 rename --force to --yes in play plugin
fix some pep8 goo
2017-04-19 10:51:44 -07:00
Adrian Sampson
31c7330de4 Merge pull request #2517 from discopatrick/date-value-field-validation
Date value field validation
2017-04-19 11:36:18 -04:00
xarph
ffcaf33845 add -f argument to play command 2017-04-18 15:30:24 -07:00
Adrian Sampson
0cbb40869a Merge pull request #2403 from antlarr/master
Run python2 or python3 depending on what's being used
2017-04-15 11:28:45 -04:00
Adrian Sampson
fb7296711c Fix Windows encoding in convert stub (#2516) 2017-04-15 11:27:19 -04:00
discopatrick
d466f8802c passes flake8 2017-04-14 14:45:51 +01:00
discopatrick
ff4c0abcf1 tests ‘added’ instead of ‘mtime’ , and uses a correct date format 2017-04-14 13:05:13 +01:00
discopatrick
ed0ea1dee5 tests more invalid date queries 2017-04-14 01:49:58 +01:00
discopatrick
8e6909bf4b raises error when date string has too many components 2017-04-14 01:32:18 +01:00
discopatrick
a3251ef7c6 skips tests for now 2017-04-14 01:13:02 +01:00
discopatrick
1744ca6e88 raises error when dates passed to query as long numbers 2017-04-14 00:40:06 +01:00
Antonio Larrosa
85e0c0dcee Fixed E501 and E305 PEP8 errors 2017-04-04 09:08:30 +02:00
Antonio Larrosa
fa468ce9d1 Properly quote executable and command line parameter
Use shlex.quote (on python3) or pipes.quote (on python2) to properly
quote the python executable and parameter instead of using single quotes
2017-04-04 09:08:30 +02:00
Antonio Larrosa
44ddd2e8f5 Shell-escape sys.executable
sys.executable needs to be shell-escaped on windows.
2017-04-04 09:08:30 +02:00
Antonio Larrosa
42b4e54391 Use sys.executable instead of composing the executable name
Better use sys.executable than using sys.version_info.major and compose
the name of the python executable.
2017-04-04 09:08:30 +02:00
Antonio Larrosa
1e4378d636 Run python2 or python3 depending on what's used
On a system with dependencies installed for python3 but not for python2,
we have to make sure python3 is used everywhere since 'python' might be running
the python2 interpreter.

This helps with some problems in #2400, but doesn't fix the issue completely.
2017-04-04 09:08:30 +02:00
Aaron
64d69f0817 embedart: Added test case for inputting “no” option interactively. 2017-03-10 23:30:49 -08:00
Aaron
f6df3befac Added interactive test method for embedart plugin. 2017-03-08 19:06:09 -08:00
Adrian Sampson
5a71ce722a Simplify embedart test changes for #2422
Whenever possible, it's nice to avoid using DummyIO---it can make debugging
difficult.
2017-03-06 23:55:14 -05:00
Adrian Sampson
74df2788c0 Merge branch 'master' into Stunner-master 2017-03-06 23:51:10 -05:00
Adrian Sampson
17ad3e83db Test updates for #2466 fix 2017-03-03 12:10:26 -06:00
Aaron Jubbal
864aa11ec5 Merge branch 'master' into master 2017-02-21 04:43:45 -08:00
Jacob Gillespie
1fd22604fb Fix linter issues 2017-02-19 17:33:26 -06:00
Jacob Gillespie
902b955696 Fix test_hardlink_arrives 2017-02-19 17:22:01 -06:00
Jacob Gillespie
ccd0f5d129 Remove not-found hardlink test (the OS prevents this from happening) 2017-02-19 17:19:42 -06:00
Jacob Gillespie
b4efecb709 Add option to hardlink when importing 2017-02-19 15:56:13 -06:00
Aaron
d1ac893915 Style changes to pass PEP8 tests. 2017-02-13 01:58:31 -08:00
Aaron
9c97f95073 Updated embedart test cases to accomodate confirmation prompt. 2017-02-13 01:58:31 -08:00
euri10
d2cd4c0f21 Change relative date's format to further simplify it
A relative date doesn't need to be prefixed by @ anymore.
The relative date pattern now displays named groups.
Digits have been change to [0-9] to avoid other digit characters.
Removed the @ character in tests.
Updated subsequent documentation.
2017-01-31 16:56:03 +01:00
wordofglass
c252b9256b Merge pull request #2415 from beetbox/fetchart_cleanup
fetchart: Clean-up data structures
2017-01-30 10:18:33 +01:00
wordofglass
7c79d8ce89 fetchart: minor restructuring of tests. 2017-01-30 10:01:19 +01:00
euri10
e4a7d37a6d implementing changes asked
corrected rst
fixed flake8 in test
2017-01-29 11:49:22 +01:00
euri10
d48d1f8e3c fixed E226 flake8 2017-01-29 03:54:10 +01:00
euri10
af679de8ec using a pattern may avoid copy-paste error when used 3 times after
fixed an error with the weeks that didn't use the sign correctly
added more tests, this is where py.test fixtures would shine
2017-01-29 03:51:24 +01:00
euri10
3e76c219fb without dateutil 2017-01-28 22:39:37 +01:00
euri10
2b89b90ab6 tests flake8 fixed I think finally 2017-01-28 21:47:01 +01:00
euri10
8d054f3656 tests flake8 issues
added some doc
2017-01-28 21:40:26 +01:00
euri10
868746bb51 tests 2017-01-28 21:23:03 +01:00
wordofglass
bc582701ff fetchart: Internally pass settings in a cleaner way.
Dump the 'extra' dictionary which only duplicated attributes of the
plugin onject in favor of passing a reference to the plugin directly.
2017-01-25 00:01:05 +01:00
Adrian Sampson
3a6967eb7a Remove dependencies from convert_stub.py
See: https://github.com/beetbox/beets/pull/2403#issuecomment-274358494
2017-01-22 12:59:04 -08:00
diomekes
04f7915d41 change no-bracket argument from white space to empty 2017-01-20 22:47:47 -05:00
diomekes
eaa2161a90 fix empty disambig string test 2017-01-20 19:40:09 -05:00
diomekes
d10df34c65 add test for aunique without brackets 2017-01-20 09:06:38 -05:00
diomekes
3a967df396 simplify check for empty disam_val, update changelog and docs, add change bracket test 2017-01-19 20:41:44 -05:00
diomekes
377a2a6964 add bracket argument to aunique 2017-01-19 20:39:12 -05:00
Steve Johnson
e3707e45f3 Maybe fix code and tests for Windows 2017-01-15 11:21:59 -08:00
Steve Johnson
6b7a6baaf2 Add test for /item/path/ endpoint 2017-01-15 11:21:59 -08:00
Steve Johnson
05bc4996a8 Rename and invert new config option 2017-01-15 11:21:33 -08:00
Steve Johnson
cedd93b778 Add tests for exclude_paths_from_items 2017-01-15 11:21:33 -08:00
Adrian Sampson
0f1a93c666 Add missing unittest suite declaration (#2389) 2017-01-14 17:33:36 -08:00
Adrian Sampson
703f47ae97 Use flexible attribute for track_alt
No need for a built-in field for a simple string-type optional field like
this.
2017-01-10 21:01:36 -05:00
Mike Cameron
bba5a7c712 Fixed (?) failing test where
umber was 	rack_alt was missing during import.
2017-01-10 19:08:18 -05:00
Mike Cameron
3cd4f1c091 Fixed failing test where track number was missing from mocked data. 2017-01-10 18:57:42 -05:00
Mike Cameron
3f67a27989 Fixed failing test because mocked data was missing property
umber.
2017-01-10 18:21:28 -05:00
Adrian Sampson
f7ebf5524f flake8 fix for #2379 2017-01-10 13:25:24 -05:00
Adrian Sampson
f137f87878 More test docs about the image.* mixin 2017-01-10 12:41:34 -05:00
Adrian Sampson
5863859a5d Remove image tests for DSF (#2379)
There isn't currently an `image.dsf`, so those tests fail.
2017-01-10 12:38:44 -05:00
Adrian Sampson
5e20cfd26e flake8 fixes for 2379 2017-01-10 12:33:23 -05:00
Adrian Sampson
96350ab7db Merge pull request #2379 from docbobo/feature/dsf-support
Support for DSF files
2017-01-10 12:28:29 -05:00
Boris Pruessmann
e0a4dc67a8 Test improvements for DSF.
- Fixed unparseable.dsf
- Added DSF feature detection to test_mediafile.py
2017-01-10 11:21:40 +01:00
Adrian Sampson
a2d37dd588 Document how to add tests for a new format (#2379) 2017-01-09 13:02:28 -05:00
Boris Pruessmann
1e10e62d82 Added DSF to test_mediafile 2017-01-09 18:54:30 +01:00
Adrian Sampson
e5e710033c Remove old test for misspelled config option
See 6b9d766, which removed the option.
2017-01-07 17:19:02 -05:00
Adrian Sampson
fbc0f322f6 Merge branch 'tigranl-https_fix' 2017-01-02 20:54:17 -05:00
Adrian Sampson
33a8e81f08 Simplify test changes
We don't need quite so many checks now that SSL isn't conditional most of the
time.
2017-01-02 20:49:12 -05:00
Diego M. Rodriguez
37cb1c295f
Merge remote-tracking branch 'upstream/master' into discogs-relax-assumptions
Conflicts:
	docs/changelog.rst
	test/test_discogs.py
2016-12-30 10:42:50 +01:00
Diego M. Rodriguez
0a9cb1fd3d
discogs: revise subtrack merging based on subindex
Modify the coalescing of subtracks by taking into account the subindices
of the subtracks for deciding if they represent "logical" tracks
(merging them into one single track, as previously) or if they represent
physical tracks (treating them as individual tracks).
Add unit tests for nested logical/physical subtracks, and disc titles.
2016-12-29 18:03:54 +01:00
Diego M. Rodriguez
4364757fcc
Merge remote-tracking branch 'upstream/master' into discogs-relax-assumptions
Conflicts:
	docs/changelog.rst
2016-12-29 13:27:06 +01:00
Diego M. Rodriguez
30f238151e
discogs: additional sanity checks parsing release
Add extra checks for the presence of specific field (artists, title,
id, tracklist) when parsing a Release from discogs, failing gracefully
if the fields could not be found.
Add a test for releases without required fields.
2016-12-29 13:19:01 +01:00
Diego M. Rodriguez
02666424d4
discogs: improve robustness when parsing an album
Improve the robustness of `get_album_info()` by preferring the use of
`get()` over accesing the dictionary keys directly for several fields,
plus adding extra checks for fields that depend on nested containers on
the Release data.
Add a test for parsing a release that contains a minimal amount of
fields.
2016-12-28 21:07:18 +01:00
Adrian Sampson
8763be5423 Revert "Fix tests for new prompt order"
This reverts commit a357cc4e1a.

We no longer need the tests to change---I was able to fix the order by
bringing the "abort" action into the standard list of options.
2016-12-28 14:33:11 -05:00
Adrian Sampson
a357cc4e1a Fix tests for new prompt order 2016-12-28 14:23:22 -05:00
Adrian Sampson
7c6eafa285 Refactor manual search options to use Proposal
This is the first step to making them behave like plugin actions.
2016-12-28 13:50:53 -05:00
Adrian Sampson
8408264142 Update test file for new set of tags
The new MediaFile tags in #2333 mean that the `test_unicode_path` test will
write new tags to this test fixture file.
2016-12-26 17:41:44 -05:00
Josh Brown
7833469261 add confirmation for empty query 2016-12-26 14:13:01 -06:00
Josh Brown
2903925e2f Rewrite zero plugin manual mode 2016-12-26 13:34:34 -06:00