Commit graph

2795 commits

Author SHA1 Message Date
J0J0 Todos
c6746ed399 Add a test for Beatport ID extraction 2023-03-08 18:29:04 +01:00
J0J0 Todos
af600497ee Add a test for Deezer ID extraction 2023-03-08 18:28:41 +01:00
J0J0 Todos
c1299f64a1 Add a test for Spotify metadata ID extraction 2023-03-08 18:22:54 +01:00
J0J0 Todos
0175a9aed8 Introduce new module beets.util.id_extractors
- We introduce a new submodule of beets.util named id_extractors.
- Parts of the ID extraction utilites required by metadata source plugins
  should live there.
- Also this enables future usage of those utilities from the "outside" of
  metadata source plugins.
- Move Discogs ID extractor to the new module and change test_discogs to use
  the new location.
- Add spotify_id_regex variable to the new module.
2023-03-08 18:12:31 +01:00
J0J0 Todos
4908e1ae09 Fix flake8 issues in test_ui.py
that were introduced in 27218a94.
2023-02-28 09:24:30 +01:00
J0J0 Todos
93fa19f493 Fix albumtypes plugin and its tests
The new database type DelimitedString does list to string and vice versa
conversions itself.
2023-02-27 13:43:03 +01:00
Jonathan Matthews
27218a9490 Mark albumtype/s expected test failure as fixed 2023-02-27 13:43:03 +01:00
Benedikt
22ca6eff82
Merge pull request #4374 from wisp3rwind/pr_drop_old_python
Drop Python 3.6, some Python 2 + Python <= 3.6 cleanup
2023-02-19 10:19:36 +01:00
wisp3rwind
e6fd038b0e tests: robustify path query / case_sensitive tests
- samefile exists on all platforms for recent python
- don't rely on monkey-patching os/os.path and on specifics on the
  implementation: as a result of doing so, the tests start failing in
  obscure ways as soon as the implementation (and its usage of
  os.path.exists and os.path.samefile) is changed
2023-02-12 16:16:43 +01:00
wisp3rwind
12173d30a8 permissions: Move syspath conversion to the actual API boundary 2023-02-12 14:04:24 +01:00
Katelyn Dickey
f0359007a5
Code style fixes 2023-01-31 11:26:22 -05:00
Katelyn Dickey
2c43adf463
Fix album store method to cascade flex field deletions to items 2023-01-31 01:31:53 -05:00
wisp3rwind
a6d74686d8 test: separate case_sensitive unit tests from PathQueryTest
- move tests for case_sensitive to test_util.py, since this is not
  really the concern of PathQueryTest
- removes part of the tests, since the tests that patch os.path.samefile
  and os.path.exists are super brittle since they test the
  implementation rather than the functionality of case_sensitive().
  This is a prepartory step for actually changing the implementation,
  which would otherwise break the tests in a confusing way...
2022-12-24 13:36:53 +01:00
wisp3rwind
d24cf69269 remove old Python: remove util.text_string
This was a helper for situations when Python 2 and 3 APIs returned bytes
and unicode, respectively. In these situation, we should nowadays know
which of the two we receive, so there's no need to wrap & hide the
`bytes.decode()` anymore (when it is still required).

Detailed justification:

beets/ui/__init__.py:
- command line options are always parsed to str

beets/ui/commands.py:
- confuse's config.dump always returns str
- open(...) defaults to text mode, read()ing str

beetsplug/keyfinder.py:
- ...

beetsplug/web/__init__.py:
- internally, paths are always bytestrings
- additionally, I took the liberty to slighlty re-arrange the code: it
  makes sense to split off the basename first, since we're only
  interested in the unicode conversion of that part.

test/helper.py:
- capture_stdout() gives a StringIO, which yields str

test/test_ui.py:
- self.io, from _common.TestCase, ultimately contains a
  _common.DummyOut, which appears to be dealing with str (cf.
  DummyOut.get)
2022-12-24 13:09:26 +01:00
wisp3rwind
1c7889b0ba tests: add a (failing) test for issue #4528 2022-12-18 09:10:02 +01:00
wisp3rwind
d5f998b312 tests: fix assertions for empty MediaFile.images
used to work due to inconsistent mediafile implementation, but with
https://github.com/beetbox/mediafile/pull/64 (in mediafile >= 0.11.0)
list fields are None if non-existent, not the empty list
2022-12-18 08:41:42 +01:00
Adrian Sampson
7cfb55b746
Merge pull request #4546 from luharder/master
Force Tekstowo to check result for match, added Tekstowo test suite
2022-11-26 19:17:19 -08:00
Luke Harder
f155d3ba75 bug 4406 fix v5 (tests pass again) 2022-11-22 20:40:13 -05:00
Bootjewolf
2a282116bd Reorder parameters of _make_track function and fix linting errors 2022-11-19 12:39:16 +01:00
Bootjewolf
4918ee6457 Added test for the parsing of the remixer field 2022-11-15 17:42:34 +01:00
Luke Harder
43f1a8412a bug 4406 fix v3 2022-11-10 14:53:50 -05:00
Luke Harder
252121f537 bug 4406 fix 2022-11-10 12:54:45 -05:00
Aidan Epstein
c906e55ba9 Fix recent bug that would not transcode when format was wrong
Bug introduced in c6d623241b, should_transcode would return False even when the format was different.

Also fix up tests and documentation.
2022-10-19 08:55:51 -07:00
Adrian Sampson
1ebcbf6944
Merge branch 'master' into fix_max_bitrate_default 2022-10-03 11:02:07 -07:00
Jordi Ortolá Ankum
95e0161876
Merge branch 'master' into fix_max_bitrate_default 2022-10-03 10:49:51 +02:00
Adrian Sampson
8baf3e302d
Skip an unhelpful test on Windows
On Windows, converting command-line arguments (hopefully!!!) only needs
to deal with valid strings from the OS. So it is not really relevant to
test with non-UTF-8, non-surrogate bytes.
2022-10-01 17:13:57 -07:00
Adrian Sampson
5ae1e0f3c8
Adapt tests to latest Unidecode version
Unidecode 1.3.5 (a yanked PyPI version) changed the behavior of
Unidecode for some specific characters:

> Remove trailing space in replacements for vulgar fractions.

As luck would have it, our tests used the 1/2 character specifically to
test the behavior when these characters decoded to contain slashes. We
now pin a sufficiently recent version of Unidecode and adapt the tests
to match the new behavior.
2022-10-01 10:33:26 -07:00
Jordi
c6d623241b Fix beets#4472 - set 'max_bitrate' default param to none 2022-10-01 01:20:30 +02:00
Adrian Sampson
e584b043be
Merge pull request #4199 from jcassette/duplicate
Allow to configure which fields are used to find duplicates
2022-08-21 10:44:31 -07:00
Adrian Sampson
1054b729d3
Merge branch 'master' into duplicate 2022-08-21 10:34:15 -07:00
Adrian Sampson
3c945cba0c
Change config key from "single" to "item"
For consistency with the rest of the terminology in the docs/config.
Also, correct the documentation (which previously only covered albums).
2022-08-21 10:31:45 -07:00
Adrian Sampson
8c84bae689
Remove match_querystring in responses
Quoth the responses documentation:

> querystring is matched by default

Not sure how recent this is, unfortunately---but probably 0.17.0, since
that's the version where `match_querystring` was deprecated.
2022-08-21 08:18:49 -07:00
Adrian Sampson
63b7595bd4
Remove use of imp
The replacements in `importlib.util` have been available since Python
3.5.
2022-08-21 08:13:07 -07:00
Adrian Sampson
7af40db050
Merge branch 'master' into formatted-modify 2022-08-20 16:37:52 -07:00
Adrian Sampson
32ce44f589
One more test fix 2022-08-17 16:25:17 -07:00
Adrian Sampson
495c8accc0
Update exact query prefix tests 2022-08-17 16:11:16 -07:00
Jaime Marquínez Ferrándiz
8d957f35f9 Add path template "sunique" to disambiguate between singleton tracks 2022-08-12 14:19:52 +02:00
vicholp
6803ef3b83 add test to get item file of web plugin 2022-08-03 01:22:45 -04:00
Adrian Sampson
c5e68f5643
Adapt to pycodestyle changes 2022-07-30 19:54:24 -04:00
Jan Holthuis
3e37d0163e test(import): Add test for _paths_from_logfile method 2022-06-28 00:17:34 +02:00
Šarūnas Nejus
72c5302004
Fix lints 2022-05-31 22:45:05 +01:00
Šarūnas Nejus
ba777dda50
Skip implicit paths tests for win32 2022-05-31 22:34:40 +01:00
Šarūnas Nejus
d68ed1adca
Make implicit path queries explicit and simplify their handling 2022-05-31 21:51:47 +01:00
Benedikt
424c47696b
Merge pull request #4345 from qcasey/qcasey-patch-2
Change "first" and "second" in test_lyrics output to "expected" and "result"
2022-05-06 20:43:33 +02:00
Quinn Casey
1320944898
Update test_lyrics.py 2022-05-05 15:33:32 -07:00
Quinn Casey
a09f5e7dfe
Update lyricstext.yaml 2022-05-05 14:04:54 -07:00
olgarrahan
c0bb2ff2a1 Genius lyrics header bug fixed and updated test case for lyrics plugin 2022-04-15 16:37:05 -04:00
alicezou
2886296c86 fix code review comments 2022-03-29 21:24:13 -04:00
alicezou
67e778fec6 switch to control_stdin 2022-03-29 20:04:56 -04:00
alicezou
a0b0028874 working db 2022-03-29 19:58:15 -04:00
alicezou
c0d05f8545 add test cases 2022-03-27 17:09:30 -04:00
wisp3rwind
b76a3fcaa4 artresizer: move ImageMagick/PIL code from thumbnails plugin to ArtResizer
Makes the dispatch to the chosen backend simpler in the thumbnails
plugin. Given that ArtResizer is not only about resizing art anymore,
these methods fit there quite nicely.
2022-03-12 23:34:46 +01:00
wisp3rwind
e44a08eeb6 artresizer: style fixes 2022-03-12 23:34:46 +01:00
wisp3rwind
1b92dea995 artresizer: move deinterlace functions to backend classes 2022-03-12 20:37:20 +01:00
wisp3rwind
c45d2e28a6 artresizer: move resize functions to backend classes 2022-03-12 20:23:37 +01:00
wisp3rwind
8a969e3041 artresizer: backend classes part 1: stub classes, version checks 2022-03-12 19:48:45 +01:00
J0J0 T
b2f4834b76 discogs: Add URI to test_parse_minimal_release data 2022-03-04 08:17:49 +01:00
Joseph Heyburn
55e4917df3 discogs: allow style to be appended to genre
- Adds a configuration that, when enabled, will append the style to genre
- Rationale is to have more verbose genres in genre tag of players that only support genre
2022-03-02 22:04:36 +00:00
wisp3rwind
1815d08392 artresizer: fix image comparison test
Since the ImageMagick based comparison is now abstracted via ArtResizer,
it becomes a little more involved to mock it for testing.
2022-02-14 22:52:00 +01:00
wisp3rwind
0125b1cd42 artresizer: in backends, always use the appropriate ArtResizer instance
This didn't cause any issues since we only use the shared instance
anyway, but logically it doesn't make a lot of sense for the backends
always using ArtResizer.shared (which they should be oblivious of).
2022-02-12 22:45:22 +01:00
wisp3rwind
a17a5f2fa6 art: move the backend-specific code to util.artresizer
all the other backend-specific code is already there.
2022-02-12 22:45:19 +01:00
Adrian Sampson
debbe4efa5
Merge pull request #4263 from wisp3rwind/pr_better_deprecation_warning
confit: Improve deprecation warning
2022-02-02 10:38:46 -05:00
wisp3rwind
ef59465869 test_replaygain: fix exception handling again
This is the same as d26b0bc1, which I reintroduced again in a new test
due to a botched rebase...
2022-02-01 21:39:42 +01:00
wisp3rwind
cc8c3529fb confit: Improve deprecation warning
Show the actual origin of the import statement, cf. #4024
2022-02-01 19:10:24 +01:00
wisp3rwind
c86d5d0264 lyrics: Rework lyrics assertions for more useful output on failure
Uses a custom assertion to have more detailed output (which should help
with getting an idea what the difference between expected and actual
lyrics is), and use `subTest` to clearly associate test failure to a
backend.

In addition, this strip parenthesis from the lyrics' words. That helps
with the currently failing Tekstowo test, but doesn't entirely fix it.

Requires Python 3.4 for subTest.
2022-01-31 21:07:28 +01:00
Julien Cassette
bf9bf4887c Merge branch 'master' into duplicate
# Conflicts:
#	docs/changelog.rst
2022-01-30 16:47:44 +01:00
Adrian Sampson
2b51b2443b
Remove a relevant test 2022-01-29 18:35:36 -05:00
Adrian Sampson
19e4f41a72
Merge pull request #4251 from rcrowell/query_prefixes
Add query prefixes :~ and :=
2022-01-26 07:51:23 -05:00
Rob Crowell
2cab2d670a Fix bug in StringQuery.string_match 2022-01-25 16:24:04 -08:00
Rob Crowell
6457532274 Add query prefixes :~ and := 2022-01-24 19:19:48 -08:00
Julien Cassette
7633465734 Add duplicate_keys feature for singletons 2022-01-22 22:36:47 +01:00
Julien Cassette
f50d250c4a Review duplicate_keys feature 2022-01-22 16:49:45 +01:00
Julien Cassette
6ce29a6b1b Allow to use flexible attributes in duplicate_keys 2022-01-22 15:00:18 +01:00
wisp3rwind
fd7919e627 replaygain test: add basic importer test 2022-01-22 14:00:32 +01:00
wisp3rwind
676c8fe45e replaygain test: add r128 targetlevel test 2022-01-22 14:00:32 +01:00
wisp3rwind
e8960501f2 replaygain test: extend tests for skipping items
Test more combinations of tags that might initially be present and
expected tags. The R128 codepath and the case of having the wrong type
of tags wasn't really tested before.
2022-01-22 14:00:32 +01:00
wisp3rwind
1442594e5b replaygain test: reorganize backend handling
in an attempt to make it simpler to add new test classes
2022-01-22 14:00:32 +01:00
wisp3rwind
80f7c58e5a replaygain test: add basic per_disc testcase
The per_disc codepath is currently not exercised at all by the tests.
This test is not very meaningful, but better than nothing.
2022-01-22 14:00:32 +01:00
wisp3rwind
81396412ef replaygain test: add album fixtures in individual tests instead of setUp
preparation for adding more tests that want different fixtures
2022-01-22 14:00:32 +01:00
wisp3rwind
ad4c68112f test helper: add support for multi-disc album fixtures 2022-01-22 14:00:32 +01:00
wisp3rwind
c0af86c04a replaygain tests: remove duplicated function
Not sure how this got here, the git blame doesn't make a lot of sense..
maybe an incorrect merge commit?
2022-01-22 14:00:32 +01:00
wisp3rwind
ea0d905b22 replaygain tests: remmove duplicate store()
probably leftover from debugging database issue
2022-01-22 14:00:32 +01:00
wisp3rwind
c272696d9f test_logging: fix incorrect exception handling
Another incorrect py2 -> py3 translation. Since python 3 attached the
traceback to the exception, this should preserve the traceback without
needing to resort to sys.exc_info
2022-01-20 21:16:17 +01:00
wisp3rwind
d26b0bc19b test_replaygain: fix complicated and incorrect exception handling
This is an incorrect translation of a python 2 reraise to python 3.
With python 3, however, we can just rely on exception chaining to get
the traceback, so get rid of the complicated re-raising entirely, with
the additional benefit that the exception from the tear-down is also
shown.
2022-01-20 21:12:59 +01:00
wisp3rwind
807f124ef8 really remove all six imports
apparently, pyupgrade didn't know how to handle these...
2022-01-20 00:26:01 +01:00
mousecloak
0132067a29
Fix @unittest.skipIf annotations to ignore only win32 2022-01-07 21:29:44 -08:00
mousecloak
ec06694097
Makes the import converter respect the quiet and pretend flags.
When the delete_originals was set, beets would print the following, regardless
of the presence of the quiet parameter:

convert: Removing original file /path/to/file.ext

This commit ensures that the log is only printed when quiet is not present.
2022-01-07 21:29:43 -08:00
patrick-nicholson
a3754f7592 Test failing due to unidentified argument processing issue; replacing with API calls gives expected results.
Fixed some linting issues.
2021-12-27 13:26:38 -05:00
patrick-nicholson
086fec0096 Fixed truediv typo (switched to intdiv).
Fixed linter objections.
2021-12-26 21:58:45 -05:00
Duncan Overbruck
0456c8f790
test multiple items in test_modify_formatted 2021-12-15 14:32:11 +01:00
Patrick Nicholson
0ac38c110e Tests for limit plugin 2021-12-07 21:27:57 -05:00
Kirill A. Korinsky
c459ff26fb
Prevent fails of tests when path contains dots
Unit test may fails when path to temprorary library contains `.`; to
garantue that bug wasn't here, it forces to use one more `.` inside path.

Fixes: https://github.com/beetbox/beets/issues/4151
2021-11-19 16:54:28 +01:00
Paldin Bet Eivaz
a1fe106dc5 fixed linting error 2021-11-18 09:37:15 -08:00
Paldin Bet Eivaz
7a30bd6d61 created Spotify track and album info rsrcs 2021-11-17 16:25:26 -08:00
Paldin Bet Eivaz
d7055fac1d added test for track_for_id method 2021-11-17 16:24:10 -08:00
Julien Cassette
b67c25a55d Use slow queries for flexible attributes in aunique (fix #2678, close #3553) 2021-11-11 19:32:55 +01:00
Piotrek Kochański
1a130059e8 deinterlace option to affect when no other processing
remove interlacing by default when resizing/down-scaling, the
`deinterlace` option is to remove interlace when otherwise no processing
would have happened.
2021-11-01 13:51:57 +01:00
Piotrek Kochański
417ef0d453 Merge branch 'master' of github.com:beetbox/beets into deinterlace 2021-10-31 13:27:00 +01:00
Christopher Larson
86465e6437 Allow custom replacements in Item.destination
This allows for the use of differing replacements for destinations other than
the library, which is useful for beets-alternatives in the case where
filesystem requirements differ between the two paths.

Signed-off-by: Christopher Larson <kergoth@gmail.com>
2021-10-27 12:30:16 -07:00
Duncan Overbruck
819ba735bd
allow templates/formatting of set_fields on import 2021-10-27 00:28:23 +02:00
Duncan Overbruck
636e36ef7a
allow templates/formatting when setting fields with modify 2021-10-27 00:10:25 +02:00
Andrew Rogl
b880e2db8a Final clean up 2021-10-05 13:00:38 +10:00
Andrew Rogl
109f4fa430 Add tests for range of discogs id extraction 2021-10-04 17:40:07 +10:00
Andrew Rogl
237bd07508 Address feedback from @sampsyo 2021-09-28 18:05:44 +10:00
Andrew Rogl
ac6cc2ffa4 Fix up invalid master merges 2021-09-26 17:33:15 +10:00
Andrew Rogl
ed07bb5b7e
Merge branch 'master' into pyupgrade 2021-09-26 17:22:15 +10:00
Andrew Rogl
d9be9a0d9b MIssed another new file 2021-09-26 17:08:57 +10:00
Andrew Rogl
5859d31405 Commit #4036 2021-09-26 16:41:13 +10:00
Andrew Rogl
8205b901db Commits #4048 & #4050 2021-09-26 16:03:00 +10:00
Andrew Rogl
f04059bfee Commit #4038 2021-09-26 15:54:13 +10:00
Duncan Overbruck
f5e336747a
Add permissions test case for set_art event 2021-09-12 16:40:58 +02:00
Edgars Supe
d40f0c8860 Fill default config for albumtypes plugin 2021-09-10 14:48:28 +03:00
Edgars Supe
6fdc505798 Add tests for albumtypes plugin 2021-09-09 23:07:11 +03:00
Piotrek Kochański
073136ba17 Merge branch 'master' of github.com:beetbox/beets into deinterlace 2021-09-02 01:34:23 +02:00
Jack Wilsdon
0ed2fbc7b0 Tidy up plugins in ui config tests
Some of these tests load plugins using beets' normal plugin loader, but
didn't call unload_plugins to tidy up afterwards. This led to any future
plugin loads being ignored until the next unload_plugins call.

This commit changes the config tests so that we always call load_plugins
on setup (to store the default beets state) and unload_plugins on
teardown (to restore the previously stored state).
2021-08-31 21:28:03 +01:00
Andrew Rogl
9106b41a50 Remove as many as possible sys.version tests 2021-08-27 10:24:27 +10:00
Piotrek Kochański
54522e6908 Remove extraneous empty line that failed lint. 2021-08-26 13:18:15 +02:00
Andrew Rogl
ee4268dabb Remove unused imports
Fix imports
Fix formatting
2021-08-26 20:59:48 +10:00
Andrew Rogl
0f48ccde78 Final pyupgrade 2021-08-26 20:14:08 +10:00
Andrew Rogl
1ec87a3bdd pyupgrade beetsplug and tests
All tests working
More tidy up to be done
2021-08-26 19:12:51 +10:00
Piotrek Kochański
c6e05e8ab7 Add tests to check deinterlace functionality. 2021-08-25 22:55:54 +02:00
Adrian Sampson
ea3a6e5fd7
Skip some more tests on Windows
We should actually fix these, I suppose!
2021-08-21 13:35:28 -04:00
Adrian Sampson
f545cd3830
Remove unused import 2021-08-19 17:02:28 -04:00
Adrian Sampson
af1eaf5062
Merge remote-tracking branch 'origin/windows-ci' into drop-py2 2021-08-19 16:48:46 -04:00
Adrian Sampson
75c41c0546
Remove most six.PY2 checks 2021-08-19 16:45:11 -04:00
Andrew Sultana
86e11fb582 template: fix ifdef bug #3852 involving non-string fields with missing values 2021-06-16 16:49:16 +01:00
Jack Wilsdon
6a98e5d8db
Add missing test data for tekstowo 2021-05-24 18:20:33 +01:00
Benedikt
eef26d1886
Merge pull request #3927 from bertbesser/set-fields-persist-to-tracks
persist set_fields to media files
2021-05-14 10:51:34 +02:00
Bert Besser
8dc960b1f6 fix: formatting 2021-05-14 10:19:59 +02:00
Bert Besser
e98f78e29b fix: transactions and stricter tests 2021-05-13 15:09:55 +02:00
sandersantema
51b22a41f0 Add tests for new itunes_dateadded function of metasync plugin 2021-05-13 12:42:59 +02:00
bertbesser
a25a2a6cbb
Merge branch 'master' into set-fields-persist-to-tracks 2021-05-13 07:38:26 +02:00
Andrew Rogl
533559136e Add 7z file support #3906 2021-05-07 22:04:46 +10:00
Bert Besser
9cbbc35a95 persist set_fields to media files 2021-05-06 19:55:12 +02:00
Sam Thursfield
2fa3717731 Optimise FormattedMapping when querying a specific set of fields
This changes greatly improves the speed of `beet export` and `beet info`
when the `--include-keys` option is used. It also removes the globbing
feature of `--include-keys` that was added in #1295. (See #3762 for
discussion).

Listing all fields for an item requires querying the database to find
any flex attributes. This is slow when done for every item being
exported. We already have a way for the user to specify a fixed set
of keys, but we previously queried everything and filtered it afterwards.
The new approach is more efficient.

Code that iterates through all fields now have to handle invalid field
names. The export and info plugins output invalid fields as None.

Timings before:

    > /usr/bin/time beet export -i title,path,artist -l  Bob Dylan
    13.26user 20.22system 0:34.01elapsed 98%CPU (0avgtext+0avgdata 52544maxresident)k

    > /usr/bin/time beet export -l  Bob Dylan
    12.93user 20.15system 0:33.58elapsed 98%CPU (0avgtext+0avgdata 53632maxresident)k

Timings after:

    > /usr/bin/time beet export -l  Bob Dylan
    13.33user 20.17system 0:34.02elapsed 98%CPU (0avgtext+0avgdata 53500maxresident)k

    > /usr/bin/time beet export -i title,path,artist -l  Bob Dylan
    0.49user 0.07system 0:00.56elapsed 98%CPU (0avgtext+0avgdata 50496maxresident)k

Notice the dramatic speedup in the last example!
2021-05-01 23:41:09 +02:00
Xavier Hocquet
8c6530369d
Merge branch 'master' into tekstowo-lyrics 2021-03-28 12:05:42 -06:00
wisp3rwind
9a6b65351b Merge pull request #3560 from davidswarbrick/master
Album Art Resize to filesize
2021-03-23 12:15:51 +01:00
David Swarbrick
07b5e69f40 fetchart/artresizer: add max_filesize support (#3560)
Squashed from the PR, relevant commit messages follow below:

Added file size option to artresizer

 - In line with comments on PR, adjusted the ArtResizer API to add
   functionality to "resize to X bytes" through `max_filesize` arg

 - Adjustment to changelog.rst to include max_filesize change to ArtResizer
   and addition of new plugin.

Added explicit tests for PIL & Imagemagick Methods

 - Checks new resizing functions do reduce the filesize of images

Expose max_filesize logic to fetchart plugin

- Add syspath escaping for OS cross compatibility
- Return smaller PIL image even if max filesize not reached.
- Test resize logic against known smaller filesize (//2)
- Pass integer (not float) quality argument to PIL
- Remove Pillow from dependencies
- Implement "max_filesize" fetchart option, including
  logic to resize and rescale if maxwidth is also set.

Added tests & documentation for fetchart additions.

Tests now check that a target filesize is reached with a
higher initial quality (a difficult check to pass).

With a starting quality of 95% PIL takes 4 iterations to succeed
in lowering the example cover image to 90% its original size.
To cover all bases, the PIL loop has been changed to 5 iterations
in the worst case, and the documentation altered to reflect the
50% loss in quality this implies. This seems reasonable as users
concerned about performance would most likely be persuaded to
install ImageMagick, or remove the maximum filesize constraint.
The previous 30% figure was arbitrary.
2021-03-23 12:00:14 +01:00
Graham R. Cobb
c3485b5b04 Remove unnecessary call to format.
Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-16 22:36:42 +00:00
Graham R. Cobb
d1ec7b4b70 Add `bareasc` command to display entries with the unidecode transformation
applied.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-16 11:57:52 +00:00
Graham R. Cobb
fab7a27e9f Add a couple more tests and make lint happy.
Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-15 12:43:58 +00:00
Graham R. Cobb
dcbe622b76 Oops, use in for matching! (It was late last night!)
Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-15 10:25:19 +00:00
Graham R. Cobb
80048e7153 Specify unicode, for python2
Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-15 09:11:17 +00:00
Graham R. Cobb
0c612f408b Create plugin for "bare-ASCII" matching query
Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-15 00:55:14 +00:00
Graham R. Cobb
4ffe9a2c45 Fixed bug where readonly value was not being read from config file.
Also simplified the setup of the `readonly` value in the tests which
fixes a test ordering issue found using --random-order.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-12 17:58:35 +00:00
Graham R. Cobb
23c8d61104 Add tests for patch operations
Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-11 22:55:42 +00:00
Graham R. Cobb
51d22b765e Add tests for delete operations
Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-11 18:02:38 +00:00
Adrian Sampson
84f6d374c4
Merge pull request #3869 from GrahamCobb/web-regex-fix
Web regex fix
2021-03-10 20:36:03 -05:00
Graham R. Cobb
45cf9d00c7 Improve handling of paths for Windows tests
Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-09 18:58:05 +00:00
Graham R. Cobb
ab2e858bce Aaargh! Forgot to run lint again
Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-09 12:10:40 +00:00
Graham R. Cobb
f19faae1dc Attempt to make path-related tests portable to Windows
Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-09 11:19:54 +00:00
Graham R. Cobb
4d5c5c02ae Lint fixes
Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-08 17:26:04 +00:00
Graham R. Cobb
38fb1b5f08 Add tests for several web queries, including the regex queries fixed in
bugfix #3867.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-08 17:00:41 +00:00
Adrian Sampson
09a6ec4f74
Merge branch 'master' into pr/item-album-fallback 2021-03-07 09:20:50 -05:00
Graham R. Cobb
9986b9892c Fix bug where album artpath not returned when INCLUDE_PATHS is set
Track item paths and album artpaths should be removed from results unless
INCLUDE_PATHS is set. This works for items but for albums the artpath is always
removed.

This patch makes the artpath removal conditional on INCLUDE_PATHS not being set
and includes a regression test. Note: the default value for INCLUDE_PATHS is
False so no changes will be seen by users unless they already have
INCLUDE_PATHS set.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-06 15:25:48 +00:00
Graham R. Cobb
7d3fb0d7ec Fix lint errors
Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-05 16:52:21 +00:00
Graham R. Cobb
de58334ecb Test web API /stats
Added a test (test_get_stats) for the /stats web API.
This involved adding another item so that we can check both items and albums
are being counted correctly, which required a few small changes to some item
tests.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-05 16:29:26 +00:00
Graham R. Cobb
15be534e7c Test ?expand using documented syntax
Documentation says that ?expand does not need a value (i.e. ?expand=1 is wrong),
so the test is changed to reflect that syntax.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-05 16:17:14 +00:00
Graham R. Cobb
79b41f6f38 Add test for getting album track listing using ?expand=1
Added test_get_album_details to test fetching /album/2?expand=1.
Also changed second album name to make tests more robust.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-05 15:56:46 +00:00
Graham R. Cobb
dc55480f51 Document "id" handling in test setup and add test to confirm
self.lib.add ignores the "id" field from the entry being added and overwrites
it with the next free number. So remove the misleading id fields.
Add a test to confirm that the album query response contains the expected
album id number.

Signed-off-by: Graham R. Cobb <g+beets@cobb.uk.net>
2021-03-05 15:27:00 +00:00
Adam Tygart
1b1209a6c3 Add trackdisambig from musicbrainz.
fixes beetbox/beets#1904
2021-02-27 15:07:32 -06:00
Samuel Cook
ff4cec2e69
Removes support for bs1770gain.
References in the documentation to this plugin were removed in
beetbox/beets#3127 (beetbox/beets#3130) but no actual code
changes were made.

This PR removes support for this dependency entirely.
2021-01-27 17:42:18 -08:00
Vincent Ducamps
03a665861d reformating subsonicupdate.py
Co-authored-by: Jef LeCompte <jeffreylec@gmail.com>
2021-01-12 18:31:43 +01:00
vincent
811089af72 update test 2021-01-11 18:58:49 +01:00
FichteFoll
5ace2b626b
Merge remote-tracking branch 'upstream/master' into pr/item-album-fallback 2021-01-08 18:47:18 +01:00
Adrian Sampson
53dcb24d10
Merge pull request #3671 from dosoe/beets_test_parentwork
first try at mocking get_work_by_id
2020-12-22 12:01:17 -05:00
soergeld
03cc76375d style 2020-12-22 16:02:48 +01:00
soergeld
7803ce271e mock confined to test 2020-12-22 15:59:45 +01:00
soergeld
53474678e9 mock confined to test 2020-12-22 15:41:49 +01:00
soergeld
a8d1cc9ce4 mock confined to test 2020-12-22 15:40:50 +01:00
soergeld
a8b81ca193 style 2020-12-22 12:19:26 +01:00
soergeld
18bfefece7 revert changes to working version with external mock 2020-12-22 11:51:24 +01:00
wisp3rwind
30baf22e77 replaygain: Use on-disk database
there can only be a single connection to an in-memory database, but the
parallel replaygain code accesses the db from different threads
2020-12-21 11:13:45 +01:00
ybnd
e3205aacbd Merge remote-tracking branch 'origin/master' into parallel-replaygain 2020-12-14 22:19:28 +01:00
ybnd
363f71af2e Move OperationalError handler to test_replaygain.py 2020-12-14 22:10:54 +01:00
Adam Miller
e11687f80a keyfinder: Catch output from keyfinder-cli with no key 2020-12-07 22:04:05 -05:00
Adrian Sampson
9657919968
Merge pull request #3088 from rubdos/reflink
Add reflink option
2020-11-27 13:29:10 -05:00
FichteFoll
701cd6c42b
Merge remote-tracking branch 'upstream/master' into pr/item-album-fallback 2020-11-02 00:10:46 +01:00
Adrian Sampson
e99becb41e Use Unicode in lyrics tests 2020-10-18 07:32:44 -04:00
Adrian Sampson
ce80459110
Merge pull request #3767 from jackwilsdon/skip-azlyrics
Skip AZLyrics on GitHub actions
2020-10-05 20:48:49 -04:00
Jack Wilsdon
7138408491
Skip AZLyrics on GitHub actions 2020-10-06 00:05:48 +01:00
Jack Wilsdon
d115f3679b
Remove LyricWiki source
LyricWiki was shut down on 2020/09/21 and no longer serves lyrics.
2020-10-05 22:15:40 +01:00
Sam Thursfield
d9582f4bea export: Add --format=jsonlines option
This adds support for the JSON Lines format as documented at
https://jsonlines.org/.

In this mode the data is output incrementally, whereas the other
modes load every item into memory and don't produce output until
the end.
2020-10-02 12:41:29 +02:00
Adrian Sampson
b659ad6b0c Merge pull request #3670 from wisp3rwind/pr_remove_select
Add possibility to select individual items to the remove CLI command
2020-09-13 20:55:53 -04:00
djl
33b10d60fb
fetchart: Improve Cover Art Archive source. (#3748)
* fetchart: Improve Cover Art Archive source.

Instead of blindly selecting the first image, we now treat all "front"
images as candidates.

This is useful where some digital releases have both an animated cover
and a still image and the animated image is the first image returned
from the API.
2020-09-13 20:27:12 +01:00
wisp3rwind
1978484504 don't assume items are queried in any specific order in interactive delete test
The previous test worked (on my machine, and on Github CI and AppVeyor),
but it is not obvious whether the order is really guaranteed (given that
the full beets database stack and sqlite are involved). Thus, to prevent
this from exploding at some point, only verify the number of deletions
for now.
2020-09-13 15:55:09 +02:00
wisp3rwind
822bc1ce88 add possibility to select individual items to the remove CLI command 2020-09-13 14:26:00 +02:00
Jef LeCompte
3c8419dbe0
fix(plugin): subsonicupdate rest call
Signed-off-by: Jef LeCompte <jeffreylec@gmail.com>
2020-09-04 00:51:03 -04:00
Aidan Epstein
fce27e6fa9 mpdstats: Don't record a skip when stopping MPD.
MPD keeps the current track in the queue when stopping, so it's not
really like a skip, and I use it so that I can stop the music, and later
start at the beginning of a track.

I do this by keeping track of the current song id, and then comparing
them when we receive a stop signal.
2020-08-10 07:07:17 -07:00
soergeld
29a8eef281 problems importing patch 2020-08-10 11:02:14 +02:00
soergeld
4f0a483948 change function to method 2020-08-10 10:59:30 +02:00
soergeld
d727149dd4 first try at using patch 2020-08-10 10:55:30 +02:00
soergeld
76ca0549a9 move mocking to setUp 2020-08-09 15:45:58 +02:00
Samuel Cook
b89a2650cc
Delete after convert (#3700)
* If import move is true, files will be deleted after converting.
Fixes #2947

* Removed trailing whitespace to comply with W293, fixing build

* Add period to the end of the comment

Co-Authored-By: Adrian Sampson <adrian@radbox.org>

* Added changelog entry for this fix.

* Added delete_originals option to remove source files after transcode

* Added unit test, removed redundant syspath call

Co-authored-by: Logan Arens <logan-arens@users.noreply.github.com>
Co-authored-by: Logan Arens <heresmygithub@protonmail.com>
Co-authored-by: Adrian Sampson <adrian@radbox.org>
Co-authored-by: Logan Arens <logan.arens@protonmail.com>
2020-08-03 20:20:20 -05:00
Jacob Pavlock
96b9e7caa5 skip broken windows tests 2020-08-03 13:42:59 -07:00
Jack Wilsdon
92f425628d
Skip Genius integration test on GitHub actions 2020-08-02 17:56:22 +01:00
Gunther Schmidl
48d39ea11e fix regex, add test and changelog entry 2020-07-30 22:42:31 +02:00
FichteFoll
eda9930c59
Merge remote-tracking branch 'upstream/master' into pr/item-album-fallback 2020-07-27 19:32:44 +02:00
Gunther Schmidl
1eda0d39e6 better regex for drive letter; hopefully fixed tests for 2.7; added test to show only drive-letter like colons are affected 2020-07-25 22:11:07 +02:00
Gunther Schmidl
0a9a801b05 add unit tests 2020-07-25 21:50:33 +02:00
Ruben De Smet
5e2856ef87 Add reflink routine 2020-07-22 18:00:25 +02:00
Ruben De Smet
2926b49628 Add HAVE_REFLINK flag for tests 2020-07-22 18:00:25 +02:00
José Albornoz
dc7e433768
Fix thumbnail plugin pathlib bug (#3360)
PathlibURI.uri() would fail if given a path as bytes instead of as string.

Co-authored-by: Jacob Pavlock <jtpavlock@gmail.com>
2020-07-15 21:00:50 -05:00
soergeld
72e91d84f2 names 2020-07-14 00:01:22 +02:00
soergeld
ef08fbee0c correct test for parentwork 2020-07-13 23:01:18 +02:00
soergeld
08c1344639 correct test for parentwork 2020-07-13 22:57:05 +02:00
soergeld
8167870a7f correct test for parentwork_id_current 2020-07-13 22:52:31 +02:00
soergeld
e3fb243782 parentwork force test doesn't work 2020-07-13 22:44:49 +02:00
soergeld
66bb2adf19 try something 2020-07-13 22:40:34 +02:00
soergeld
ccd44bc57c complete mocked parentworks 2020-07-13 22:31:51 +02:00
soergeld
ab2d653d82 typo 2020-07-13 22:26:57 +02:00
soergeld
f87f271484 correct mock results of get_work_by_id 2020-07-13 22:22:16 +02:00
soergeld
55995a32cb correct force check, correct arguments for get_work_by_id 2020-07-13 22:17:24 +02:00
soergeld
df91813609 pep-8 2020-07-13 22:13:49 +02:00
soergeld
a4a9f0daa9 different way of mocking 2020-07-13 22:12:13 +02:00
soergeld
82411c67cf minor fixes 2020-07-13 21:51:45 +02:00
soergeld
1cb23e5c5c no hybrid mocking, two classes 2020-07-13 21:48:06 +02:00
soergeld
dba2e2320d hybrid mocking 2020-07-13 21:41:10 +02:00
soergeld
d71ee6bc31 exchanged tests with and without MB 2020-07-13 21:38:02 +02:00
soergeld
58b11d9d3c make tests both with MB and without 2020-07-13 21:34:24 +02:00
soergeld
94dd7cee70 unused library 2020-07-13 21:20:18 +02:00
soergeld
2d756df5b7 second try 2020-07-13 21:16:51 +02:00
soergeld
e943486da9 first try at mocking get_work_by_id 2020-07-13 21:11:30 +02:00
Jacob Pavlock
f2e7b3fdd7 remove references to nose 2020-07-07 15:28:38 -07:00
Jacob Pavlock
25c6843c28 classify integration tests in test_parentwork.py 2020-07-07 15:05:21 -07:00
jtpavlock
aedd77317f
Merge pull request #3658 from jtpavlock/integration_tests
Add weekly integration test github action
2020-07-06 11:37:46 -05:00
jtpavlock
45abc9ed7a
Clean up code and tests for Genius Lyrics plugin backend (#3641)
* clean-up code & add tests for genius lyrics backend

* add genius fetch tests

* organize imports: standard lib -> pip -> local

* check in sample genius lyrics page

* fix mock import

* force utf-8 encoding for opened files

* use io.open to force utf-8 encoding w/ python2.7
2020-07-06 08:41:27 -05:00
Jacob Pavlock
06553cc37c adjust test_lyrics.py to work with integration tests 2020-07-05 21:41:31 -07:00
Jacob Pavlock
17d9477106 tests for applicable genius artist slugging 2020-06-26 19:33:08 -07:00
Mark Trolley
6d41f31309 Rename use_secure to secure and add to changelog 2020-06-08 20:19:19 -04:00
Mark Trolley
22d74a3b8a feat: support secure Plex connections 2020-06-08 18:05:43 -04:00
Jef LeCompte
9f8bd4cd3f
style: flake8 linting 2020-05-25 20:06:43 -04:00
Jef LeCompte
0c3201930c
feat: added github actions
only working with linux for now. exact replica of travis basically.
should probably try to implement the rest of tox or deprecate some
functionality.
2020-05-25 19:35:15 -04:00
Jef LeCompte
10f589d80a
feat: added subsonicupdate tests 2020-05-22 21:23:26 -04:00
stlutz
5d306d6fd9 Remove debugging statement and conform to line length. 2020-05-16 17:48:56 +02:00
stlutz
46143d9762 Remove unnecessary intermediate web request to genius.com when fetching lyrics.
The search results already include the correct song page url, making it superfluous to do another request via the /song api just to get it.
2020-05-16 16:28:17 +02:00
Adrian Sampson
1dcfa03b5b Merge branch 'master' of github.com:beetbox/beets 2020-05-13 08:21:09 -04:00
Adrian Sampson
5db2b4ccaa Fix new flake8 warnings 2020-05-13 08:20:50 -04:00
soergeld
7c71bb87a2 cleaning up, renaming dup_XXInfo() to copy() 2020-05-08 16:32:12 +02:00
soergeld
d7ed84646e create method for deepcopy 2020-04-28 14:18:27 +02:00
soergeld
ba2b22cac5 try to correct deepcopy 2020-04-28 12:59:52 +02:00
soergeld
b39ef0b8f9 better deepcopy, docstring, minor improvements 2020-04-28 12:16:19 +02:00
soergeld
eec7994dbe corrected on deepcopy replacement 2020-04-27 16:16:37 +02:00
soergeld
2bc0027adf remove some prints, unused libraries, __setitem__ method 2020-04-27 16:08:47 +02:00
soergeld
048b5c2151 remove need for deepcopy, simplify __init__ 2020-04-27 15:55:12 +02:00
soergeld
14e1b33839 lines too long 2020-04-27 11:44:51 +02:00
soergeld
805f4e801f typo in tests 2020-04-27 11:31:39 +02:00
soergeld
f507f04639 reintroduce default arguments, adapt all occurences of TrackInfo and AlbumInfo to the absence of positional arguments 2020-04-27 11:21:13 +02:00
Ashhar Hasan
625e9253c0
Add tests for artist_sort as lyrics search fallback
Adjust doc comment to highlight that artist_sort is used as a fallback
2020-04-19 19:19:07 +05:30
lijacky
9ec0d725e5 Changes given feedback on https://github.com/beetbox/beets/pull/3554 and trimmed sample html 2020-04-17 17:14:21 -04:00
lijacky
b7ecf32f28 style changes 2020-04-16 19:06:17 -04:00
lijacky
525202e529 adding genius sample html 2020-04-16 19:06:17 -04:00
lijacky
29d7b80847 Added unit test for null check 2020-04-16 19:06:17 -04:00
x1ppy
19d6dfc8f3 Support extra tags for MusicBrainz queries 2020-03-20 14:13:40 -04:00
Xavier Hocquet
1266a04998 Docs, lint, and cleanup beautifulsoup source check 2020-03-19 21:10:52 -06:00
Adam Jakab
611659d03c removed value_match and repr tests 2020-03-16 10:16:29 +01:00
Adam Jakab
ac1a3851fa typo fix 2020-03-15 19:36:38 +01:00
Adam Jakab
ceb901fcca struggling with old python 2020-03-15 19:30:24 +01:00
Adam Jakab
935768d983 fixing repr tests 2020-03-15 19:19:09 +01:00
Adam Jakab
8e68b5ff2e cleaning up 2020-03-15 15:54:01 +01:00
Adam Jakab
532c6d7c82 better repr testing #2 2020-03-15 15:41:32 +01:00
Adam Jakab
3f2f125b09 better repr testing 2020-03-15 15:24:17 +01:00
Adam Jakab
d6538e5f0c removed value_match method - not reachable? 2020-03-15 14:57:02 +01:00
Adam Jakab
d5a52cbd26 removed unused imports 2020-03-14 21:51:46 +01:00
Adam Jakab
fbd1266bc5 simplified condition in test and added changelog entry 2020-03-14 21:30:22 +01:00
Adam Jakab
832c7326af corrected test to account for year and disctotal field now being treated as types.INTEGER 2020-03-02 13:03:18 +01:00
Adam Jakab
5fc4d7c35e - added field_two as type STRING in ModelFixture1
- renamed test test_format_fixed_field to test_format_fixed_field_string
- test_format_fixed_field_string not tests `field_two` with string values
- added new test_format_fixed_field_integer to test field `field_one` as INTEGER
- added new test_format_fixed_field_integer_normalized to test rounding float values
2020-03-02 13:00:15 +01:00
ybnd
63ea17365a Modify patched stdout in test_malformed_output 2020-02-05 09:04:24 +01:00
ybnd
c3817a4c06 Implement review comments
* safer version comparison

* regex bytes directly

* handle b'\x08 ...' case

* test_replaygain.py: injected command output should match the type of the actual output
2020-01-30 19:21:53 +01:00
ybnd
c1cb78c908 Small fixes in replaygain.Bs1770gainBackend and test_replaygain.py
* Fix unspecified `gain_adjustment` when method defined in config

* Fix difference between dB and LUFS values in case of mismatched `target_level`/`method`:

  ```
  db_to_lufs( target_level <dB> ) - lufs_to_dB( -23 <LUFS> )
  ```

* Ignore single assertion in case of bs1770gain

(cherry picked from commit 2395bf224032c44f1ea5d28e0c63af96a92b96df)
2020-01-30 17:59:57 +01:00
ybnd
c78afb1a97 Don't call bs1770gain outside of try statement 2020-01-30 17:02:28 +01:00
ybnd
53820c0a98 Handle bs1770gain v0.6.0 XML output
* Remove `0%\x08\x08` from output (backspace code doesn't resolve; progress percentages get spliced in)

* Handle changed attributes/fields:
  * `sample-peak` attribute `factor` is called `amplitude` instead
  * Album summary is not included in a `summary` tag now, but in two separate `integrated` and `sample-peak` tags

* Handle `lu` attribute

* Get bs1770gain version
  * If v0.6.0 or later, add `--unit=ebu` flag to convert `db` attributes to LUFS
  * May be useful later on

### Output examples

Track:
```
<!-- analyzing ... -->
<bs1770gain norm="-18.00">
  <track total="1" number="1" file="02 tïtle 0.mp3">
    <integrated lufs="-70.00" lu="52.00"/>
    <sample-peak spfs="-72.28" amplitude="0.00"/>
  </track>
  <integrated lufs="-70.00" lu="52.00"/>
  <sample-peak spfs="-72.28" amplitude="0.00"/>
</bs1770gain>
<!-- done. -->
```

Album:
```
<!-- analyzing ... -->
<bs1770gain norm="-18.00">
  <track total="2" number="1" file="02 tïtle 0.mp3">
    <integrated dbfs="-70.00" db="52.00"/>
    <sample-peak dbfs="-72.28" amplitude="0.00"/>
  </track>
  <track total="2" number="2" file="02 tïtle 1.mp3">
    <integrated dbfs="-70.00" db="52.00"/>
    <sample-peak dbfs="-72.28" amplitude="0.00"/>
  </track>
  <integrated dbfs="-70.00" db="52.00"/>
  <sample-peak dbfs="-72.28" amplitude="0.00"/>
</bs1770gain>
<!-- done. -->
```
2020-01-30 16:13:29 +01:00
Régis Behmo
b489f94b0d Replace the clinical "obsessive-compulsive" term
This is a follow-up on that conversation on gitter:
https://gitter.im/beetbox/beets?at=5d75ac34b3e2fc579379fe25
2019-11-02 23:26:14 +01:00
Adrian Sampson
a7671e16a6 Merge pull request #3409 from jackwilsdon/hook-check-call
hook: switch to using check_call
2019-10-17 11:12:06 -04:00
Jack Wilsdon
cf7a04ea36
Add tests for hook errors 2019-10-17 11:08:18 +01:00
Austin Marino
c1b646ff27
Merge branch 'master' into Extended_Export_Plugin_Support 2019-10-15 15:35:42 -07:00
Austin Marino
623f553c92 Updated Test structure 2019-10-15 11:51:45 -07:00
Austin Marino
21d809180e Updated Test structure 2019-10-15 11:45:38 -07:00
Austin Marino
07138f86dc Fixed styling and test to pass cli 2019-10-14 18:41:06 -07:00
Austin Marino
a9440ada2b Updated test structure for export 2019-10-14 18:17:12 -07:00
Austin Marino
0d818eced5 Ran test to ensure it works 2019-10-14 17:02:39 -07:00
Austin Marino
db5d21620b Updated tests 2019-10-14 13:57:32 -07:00
Austin Marino
fa2c9ba259 Aligned export related code with flake8 standards 2019-10-13 11:36:33 -07:00
Austin Marino
8ff875bded Addec Unit test for export plugin 2019-10-10 19:34:57 -07:00
Rahul Ahuja
f14137fcc2 Add BPSyncPlugin 2019-10-03 18:04:12 -07:00
temrix
486cfa1df1
Add tests for empty responses. 2019-09-21 16:54:47 +02:00
temrix
2691781d4e
Remove forgotten print statement. 2019-09-21 16:41:57 +02:00
temrix
dde905f9a8
Correct typo in docstring. 2019-09-21 16:41:16 +02:00
temrix
6c8535088a
Add test file. 2019-09-19 00:32:52 +02:00
Zsin Skri
e3645dfd59
Merge branch 'master' into r128-targetlevel-config 2019-07-25 23:22:32 +02:00
Adrian Sampson
84032e56e2 Merge pull request #3334 from MartyLake/martylake_add_forward_slash_option
Add option to force forward slashes in paths
2019-07-24 22:11:59 -04:00
MartyLake
fb96660171 Review: simpler implementation and test
Because **all** the path are bytestrings
2019-07-24 18:09:54 +02:00
Paul Malcolm
5f9a394ca9 Issue #2860 Fetch more acousticbrainz fields 2019-07-23 20:25:26 -04:00
MartyLake
076a82daa6 Review: Rename method 2019-07-24 00:09:52 +02:00
MartyLake
68ccfe0e6c Review: Add missing blank line 2019-07-23 23:54:54 +02:00
MartyLake
d1ba309f36 Add a new method that copied pathlib.path.as_posix 2019-07-23 17:17:40 +02:00
Zsin Skri
88ab5474c5 replaygain: add R128_* tag test
Assert that the replaygain plugin does not write REPLAYGAIN_* tags but R128_*
tags, when instructed to do so.

This test is skipped for the `command` backend as it does not support OPUS.
2019-07-22 13:42:26 +02:00
Zsin Skri
5a8bdb67f7 replaygain: add target_level test
Assert that analysing the same track with different target levels yields
different gain adjustments.
2019-07-22 13:42:26 +02:00
Zsin Skri
b9063a0240 fix bs1770gain test
This test caused other tests to fail due to missing cleanup.
2019-07-22 12:49:50 +02:00
Adrian Sampson
bd6a5cfd8e
Merge pull request #3056 from zsinskri/replaygain-backend-ffmpeg
Replaygain backend ffmpeg
2019-07-20 21:40:43 -04:00
Adrian Sampson
8b4d03095f parentwork tests: Remove unnecessary mocking
This mocking doesn't do anything because `command_output` is never
invoked by the code under test. See also #3332.
2019-07-20 16:23:03 -04:00
Zsin Skri
c3af5b3763 replaygain: add ffmpeg backend
Add replaygain backend using ffmpeg's ebur128 filter.

The album gain is calculated as the mean of all BS.1770 gating block powers.
Besides differences in gating block offset, this should be equivalent to a
BS.1770 analysis of a proper concatenation of all tracks.

Just calculating the mean of all track gains (as implemented by the bs1770gain
backend) yields incorrect results as that would:
- completely ignore track lengths
  - just using length in seconds won't work either (e.g. BS.1770 ignores
    passages below a threshold)
- take the mean of track loudness, not power

When using the ffmpeg replaygain backend to create R128_*_GAIN tags, the
targetlevel will be set to -23 LUFS. GitHub PullRequest #3065 will make this
configurable.
It will also skip peak calculation, as there is no R128_*_PEAK tag.

It is checked if the libavfilter library supports replaygain calculation. Before
version 6.67.100 that did require the `--enable-libebur128` compile-time-option,
after that the ebur128 library is included in libavfilter itself. Thus we
require either a recent enough libavfilter version or the `--enable-libebur128`
option.
2019-07-19 21:54:47 +02:00
Zsin Skri
088af4d171 bpd tests: skip control_port in queue
When setting up bpd tests, two servers are startet: first a control server, then
bpd. Both send their assigned ports down a queue. The recipient only needs bpd's
port and thus skips the first queue entry.
2019-07-17 19:05:51 +02:00
Zsin Skri
8ba79117d9 bpd tests: use mp.Queue to communicate assigned port
Use a `multiprocessing.Queue` instead of a `multiprocessing.Value` to avoid the
manual polling/timeout handling.

TODO: Strangely Listener seems to be constructed twice. Only the second one is
used. Fix that and then remove the code working around it.
2019-07-17 16:19:17 +02:00
Zsin Skri
871f79c8f2 bpd tests: close only existing sockets
Close sockets in `finally`-clauses only after they have actually been created.
2019-07-17 13:38:57 +02:00
Zsin Skri
fb07a5112a bpd tests: terminate server upon connection failure 2019-07-17 13:21:25 +02:00
Zsin Skri
bbda292145 bpd test: make start_server a freestanding function
Under some circumstances (maybe under MS Windows?) local objects can't be
pickled. When `start_server` is a local this causes a crash:
https://ci.appveyor.com/project/beetbox/beets/builds/25996163/job/rbp3frnkwsvbuwx6#L541

Make `start_server` a freestanding function to mitigate this.
2019-07-15 22:25:48 +02:00
Zsin Skri
0ebab5edaa fix "Sporadic test failures in BPD tests #3309"
The bpd test bind a socket in order to test the protocol implementation. When
running concurrently this often resulted in an attempt to bind an already
occupied port.

By using the port number `0` we instead let the OS choose a free port. We then
have to extract it from the socket (which is handled by `bluelet`) via
`mock.patch`ing.
2019-07-15 21:25:39 +02:00
Zsin Skri
30395911e2 util.command_output: return stderr, too
Return a namedtuple CommandOutput(stdout, stderr) instead of just stdout from
util.command_ouput, allowing separate access to stdout and stderr.

This change is required by the ffmpeg replaygain backend (GitHub
PullRequest #3056) as ffmpeg's ebur128 filter outputs only to stderr.
2019-07-14 18:32:59 +02:00
Adrian Sampson
e39341b282 Merge pull request #3322 from thedevilisinthedetails/master
465 discogs: Fetch a few more metadata fields
2019-07-01 17:22:50 -04:00
Peter
0cd46dab77 fixing per review comments 2019-07-01 21:04:35 +02:00
Peter
8bf9d75f66 fixing test 2019-06-30 12:50:36 +02:00
Peter
0e2e2dfec3 adding additional discogs attrributes 2019-06-30 12:22:22 +02:00
Peter
e9dd226b93 fixing test 2019-06-30 12:06:38 +02:00
Adrian Sampson
ed30a7aed2 Merge pull request #3251 from thedevilisinthedetails/master
#2579 Adding styles to discogs plugin
2019-06-10 13:26:09 -04:00
Peter
f0c91b8f45 fixing per review comments 2019-06-09 20:01:55 +02:00
Peter
5fc21a1e21 fixing per review comments 2019-06-09 15:39:49 +02:00
Peter
77dcd63254 adding line 2019-06-09 12:59:32 +02:00
Peter
9789c465aa removing blank line 2019-06-09 12:49:04 +02:00
Peter
371d978e13 removing blank line and making line shorter 2019-06-09 12:39:21 +02:00
Peter
6cdd1ab6c1 fixing test 2019-06-09 12:08:07 +02:00
Peter
851c413976 adding config option for seperator and addressing review comments 2019-06-09 10:37:33 +02:00
Adrian Sampson
c2fdf04539 Merge pull request #3279 from dosoe/beets_parentwork_3
add parentwork plugin
2019-06-08 21:35:05 -04:00
FichteFoll
c144141e9a
Update a few more http URLs to https that I missed
Should really be all now (pending the next commit).
2019-06-05 23:07:11 +02:00
Dorian Soergel
8363dedaeb logging and minor comments 2019-06-05 11:10:11 +02:00
FichteFoll
aa31fea037
Update a lot of URLs to use HTTPS
*All* URLs were checked manually, but only once per domain!

I mostly concerned myself with URLs in documentation rather than source
code because the latter may or may not have impactful changes, while the
former should be straight forward.

Changes in addition to simply adding an s:

- changed pip and pypi references as their location has changed
- MPoD (iOS app) url redirects to Regelian, so I replaced those
- updated homebrew references

Notable observations:

- beets.io does have HTTPS set up properly (via gh-pages)
- beatport.py uses the old HTTP url for beatport
- as does lyrics.py for lyrics.wikia.com
- https://tomahawk-player.org/ expired long ago, but the http page
  redirects to https regardless
- none of the sourceforge subdomains have https (in 2019!)
2019-06-05 03:11:49 +02:00
FichteFoll
dfc23e8efe
Implement database and model revision checking
Prevents reloading a model from the database when it hasn't changed.

Now we're back to almost the same speed as before the addition of album
field fallbacks.
2019-06-05 02:58:42 +02:00
FichteFoll
72515448ad
Add fallback for item access to album's attributes
Allows queries (especially for pathspecs) based on an album's flexattrs
while operating on items.

Fixes #2797.
2019-06-05 02:38:46 +02:00
Dorian Soergel
a71c381bb5 rename functions in test 2019-06-03 20:33:49 +02:00
Dorian Soergel
b3b59f8452 rename functions in test 2019-06-03 20:14:43 +02:00
Carl Suster
be1daa9771
Merge pull request #3214 from arcresu/bpd-mpd16
bpd: support MPD 0.16 protocol and more clients
2019-06-03 10:39:35 +10:00
Adrian Sampson
5a3157d85d Try to make a test more reliable
As @arcresu pointed out on Gitter, this openSUSE patch adds a safeguard
to this test, which was apparently failing for them:
https://build.opensuse.org/package/view_file/openSUSE:Factory/beets/fix_test_command_line_option_relative_to_working_dir.diff?expand=1

Reading the configuration once here to make sure that we're in a clean
state seems harmless enough. The culprit is likely that a previous test
was modifying the configuration and not properly cleaning up. This
change defends against that kind of mistake.
2019-06-02 20:16:51 -04:00
Carl Suster
62aa358ce7 bpd: bump protocol version to 0.16 2019-06-02 23:37:07 +10:00
Carl Suster
d8be83bc0d bpd: support ranges in playlistid 2019-06-02 23:37:07 +10:00
Carl Suster
dc7e3b9b6a bpd: support nextsong in status 2019-06-02 23:37:07 +10:00
Carl Suster
fdd809fd36 bpd: support more tagtypes 2019-06-02 23:37:07 +10:00
Carl Suster
27c462d287 bpd: make noidle a no-op outside idle mode
The real MPD ignores `noidle` when the client is not idle. It doesn't
even send a successful response, just ignores the command. Although
I don't understand why a client would fail to keep track of its own
state, it seems that this is necessary to get ncmpcpp working.
2019-06-02 23:37:07 +10:00
Carl Suster
1a5263b68f bpd: support volume command for real 2019-06-02 23:37:07 +10:00
Carl Suster
5c37a58ad6 bpd: add more tests 2019-06-02 23:37:07 +10:00
Carl Suster
59c506990a bpd: fix bug in playlistid
The playlistid command is supposed to list the whole playlist if no
argument is provided, but we were accidentally trying to look up an
impossible negative id in that case causing an error to always be
returned.
2019-06-02 23:37:07 +10:00
Carl Suster
10d41a1cbb tests: avoid non-test classes named Test*
When using pytest's test collector, any class with a name starting with
Test is collected. If it notices that the class has an `__init__` member
then it skips it with a warning since it's probably a false positive.
This isn't a big deal, but we can avoid warnings like this:

    test/test_ui_importer.py:33
      beets/test/test_ui_importer.py:33: PytestCollectionWarning: cannot collect test class 'TestTerminalImportSession' because it has a __init__ constructor
        class TestTerminalImportSession(TerminalImportSession):

simply by renaming TestX to XFixture.
2019-06-02 16:35:37 +10:00
Carl Suster
d2f13bf65c confit: replace with confuse in tests 2019-06-01 10:13:13 +10:00
Dorian Soergel
acf447b4b0 adapt tests, correct docstrings 2019-05-31 17:52:39 +02:00
Dorian Soergel
080680c950 add parentwork plugin, first try 2019-05-31 14:35:51 +02:00
Adrian Sampson
4fc9e2686b
Merge pull request #3277 from beetbox/arcresu-patch-3
Setup path correctly in testall.py
2019-05-30 21:51:14 -04:00
Jack Wilsdon
bc95253566 Setup path correctly in testall.py
By comparing `sys.path` as setup by nose vs. testall.py it seems that we
weren't adding the top-level beets directory to the path. The script was
also previously changing the working directory before running the tests.
2019-05-31 11:28:55 +10:00
Adrian Sampson
a31294f302 Merge pull request #3272 from dosoe/beets_work_id_2
add work, work-disambig and work_id tags
2019-05-30 20:55:24 -04:00
Adrian Sampson
c82072aa80 Merge pull request #3237 from arcresu/mediafile
mediafile: replace with a re-export of beetbox/mediafile
2019-05-30 20:23:17 -04:00
Adrian Sampson
99778d9ece bpd tests: Randomize port number
This is a hacky but effective way to work around a problem when running
the tests in parallel where two different test executions want to use
the same port.
2019-05-30 12:02:47 -04:00
Carl Suster
66e6359812
Make test_random work with setup.py test
Without this change `python setup.py test` fails to run, since this test was missing a `suite`.
2019-05-30 12:59:16 +10:00
Carl Suster
546bf3af7e mediafile: import from standalone module 2019-05-29 09:35:14 +10:00
Carl Suster
8f6e5ede1a mediafile: remove tests 2019-05-29 09:35:14 +10:00
Dorian Soergel
f0d96dcadd replace work_id by mb_workid 2019-05-27 11:59:11 +02:00
Dorian Soergel
7ebcda0c3f revert changes to mediafile 2019-05-27 10:04:54 +02:00
Dorian Soergel
4c197e6f19 completed library and test files 2019-05-26 00:38:38 +02:00
Adrian Sampson
8bef21a4d5 More permissive log check for #3247 2019-05-02 09:38:11 -04:00
Jack Wilsdon
f09088df43
replaygain: Handle invalid XML output from bs1770gain 2019-05-02 01:24:19 +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
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