Commit graph

10772 commits

Author SHA1 Message Date
wisp3rwind
9ead9cdbb8 replaygain: pass the write flag explicitly
The variable was previously captured by the closure. This is in
preparation for moving these nested functions elsewhere.
2022-01-22 14:00:32 +01:00
wisp3rwind
ad75cbf4a5 replaygain: Flatten data structures
Now that we have the *Task objects, the AlbumGain tuple can be removed.
2022-01-22 14:00:32 +01:00
wisp3rwind
67d85d18ad replaygain: introduce Task objects to bundle the state related to computations
Renames *GainHandler -> *Task and instead of having a singleton
instance, creates a *Task object for each album/item to process. The
advantage is that now, related data can be bundled in the instance,
instead of passing multiple arguments around.
2022-01-22 14:00:32 +01:00
wisp3rwind
ae3e95f9d3 replaygain: Convert the ad-hoc tag_specific_values to classes
The plugin has loads of indirection and nested functions which make it
really hard to reason about. The larger picture here is that I'd like to make
the code more manageable before reworking the parallelism issues.

In particular, instead of manually implementing an interface using a
function that returns a tuple of function pointers, this commit creates proper
classes. Again, no functionality is changed, this only moves code
around.
2022-01-22 14:00:32 +01:00
wisp3rwind
edf2bda1ce replaygain: store backend name as class attribute
Doesn't change any functionality, but appears a little cleaner to me.
2022-01-22 14:00:32 +01:00
wisp3rwind
96025c6de6 replaygain: avoid determining the method again and again 2022-01-22 14:00:32 +01:00
wisp3rwind
3eb49fca2e replaygain: clarify docs for overwrite/force and actually respect it correctly
The code used to always check the 'overwrite' config value, while that
should only apply during imports. The manual 'replaygain' command has it's
own '-f' flag.

The logic for this flag was changed quite a few times recently, see

https://github.com/beetbox/beets/pull/3816
https://github.com/beetbox/beets/issues/3872
https://github.com/beetbox/beets/pull/3890

but apparently we (me and @ybnd) never really got it right...
If it is some comfort, the logic was never correct in the first place.
2022-01-22 14:00:32 +01:00
wisp3rwind
6689502854 replaygain: rewrite long conditionals in a more imperative manner (2/2)
This is significantly easier to parse (for me, at least).
Also, void building some lists inside of any(...) in the process.
2022-01-22 14:00:32 +01:00
wisp3rwind
356a775c5e replaygain: rewrite long conditionals in a more imperative manner (1/2)
This is significantly easier to parse (for me, at least).
Also, void building some lists inside of any(...) in the process.
2022-01-22 14:00:32 +01:00
Benedikt
2744e593f6
Merge pull request #4244 from wisp3rwind/pr_fix_reraise
Fix exception handling in tests
2022-01-20 23:41:33 +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
Adrian Sampson
4905e0f5f5
Merge pull request #4240 from wisp3rwind/pr_contrib_py3
CONTRIBUTING.rst: minor Python 3 adaptation
2022-01-20 15:12:52 -05:00
Adrian Sampson
8e3e9c3d85
Merge pull request #4243 from beetbox/ci-sphinx-pin
Pin Sphinx <4.4.0 in CI to work around new warning
2022-01-20 14:47:31 -05:00
Adrian Sampson
1bcec4e5f0
Move Sphinx pin to tox.ini
Turns out the Sphinx installed "outside" of the tox virtualenv is not
the one that actually builds the docs...
2022-01-20 14:39:04 -05:00
Adrian Sampson
cf69cad56f
Pin Sphinx <4.4.0 in CI
A recent change in Sphinx introduced a new warning about missed extlink
opportunities:
https://github.com/sphinx-doc/sphinx/issues/10112

These warnings are causing spurious CI failures. Some of these
suggestions are good but many of them are not, and there is not
currently a way to disable the warning (globally or locally). So the
only workable solution currently seems to be to pin an old version of
Sphinx in CI for now. Hopefully there will be an option to disable this
in 4.4.1, at which point we can unpin.
2022-01-20 14:24:08 -05:00
Benedikt
c3a0bb1d81
Merge pull request #4241 from wisp3rwind/pr_really_remove_six
Really remove six
2022-01-20 18:50:29 +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
wisp3rwind
c1df4fc8c2 CONTRIBUTING.rst: minor Python 3 adaptation 2022-01-19 22:53:08 +01:00
Benedikt
ee77b6fbe2
Merge pull request #4232 from jmizv/master
Correct headers in limit plugin documentation
2022-01-14 23:37:46 +01:00
Alex
a09829f47f
Update changelog.rst 2022-01-14 23:22:27 +01:00
Alex
919e8be4e3
use correct headings 2022-01-14 23:13:29 +01:00
Adrian Sampson
a0587e01e3
Merge pull request #4209 from beetbox/atomic-move-fix
Improved fix for Unicode mistakes in atomic move
2022-01-11 08:17:34 -08:00
Adrian Sampson
1962223c91
Merge branch 'master' into atomic-move-fix 2022-01-11 08:11:00 -08:00
Adrian Sampson
28ceda112d
Merge pull request #4227 from JOJ0/discogs_skip_untagged
discogs: Skip Discogs query on insufficiently tagged files
2022-01-10 18:53:20 -08:00
Adrian Sampson
b5762bd381
Merge branch 'master' into discogs_skip_untagged 2022-01-10 18:53:12 -08:00
Adrian Sampson
b3100415fc
Merge pull request #4229 from ybnd/pr_fix-tekstowo-scraper
Minor fixes to lyrics scrapers
2022-01-10 16:08:47 -08:00
ybnd
414760282b Remove footer text from Genius lyrics 2022-01-10 22:09:03 +01:00
ybnd
3a8520e30a Add changelog entry 2022-01-10 19:07:59 +01:00
ybnd
3f896ab281 Make Tekstowo scraper more specific 2022-01-10 19:03:36 +01:00
J0J0 T
2a53b890be Add to discogs plugin docs regarding PR #4227
- Clarify basic search behaviour in intro chapter of discogs plugin,
- and state change introduced in PR#4227 (discogs: Discogs query on
  insufficiently tagged files)
2022-01-10 09:10:21 +01:00
J0J0 T
4401de94f7 Add changelog entry for PR #4227 (discogs: Skip
Discogs query on insufficiently tagged files).
2022-01-10 08:32:32 +01:00
J0J0 T
e35c767e2c Skip Discogs query on insufficiently tagged files
- When files are missing both, album and artist tags, the Discogs metadata
  plugin sends empty information to the Discogs API which returns arbitrary
  query results.
- This patch catches this case and states it in beets import verbose output.
2022-01-10 08:27:18 +01:00
Adrian Sampson
2fea53c34d
Merge pull request #4226 from mousecloak/convert-logging-respect-quiet 2022-01-07 22:47:22 -08:00
mousecloak
438262844a
Fixed style violation 2022-01-07 21:39:19 -08:00
Adrian Sampson
c38f10e16e
Merge branch 'master' into convert-logging-respect-quiet 2022-01-07 21:34:19 -08: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
Adrian Sampson
493a503397
Merge pull request #4182 from sumpfralle/patch-1
beetsplug/web: fix translation of query path
2022-01-06 14:37:19 -08:00
Lars Kruse
a09c80447a beetsplug/web: fix translation of query path
The routing map translator `QueryConverter` was misconfigured:
* decoding (parsing a path): splitting with "/" as tokenizer
* encoding (translating back to a path): joining items with "," as separator

This caused queries containing more than one condition (separated by a
slash) to return an empty result.  Queries with only a single condition
were not affected.

Instead the encoding should have used the same delimiter (the slash) for the
backward conversion.

How to reproduce:
* query: `/album/query/albumartist::%5Efoo%24/original_year%2B/year%2B/album%2B`
* resulting content in parsed argument `queries` in the `album_query` function:
    * previous (wrong): `['albumartist::^foo$,original_year+,year+,album+']`
    * new (correct): `['albumartist::^foo$', 'original_year+', 'year+', 'album+']`
2022-01-06 22:00:26 +01:00
Adrian Sampson
686838856a
Two more syspath calls 2022-01-05 16:15:39 -08:00
Adrian Sampson
bb13f37e59
Provide consistent types to NamedTemporaryFile 2022-01-03 10:16:39 -08:00
Adrian Sampson
5d0442f094
Merge pull request #4190 from patrick-nicholson/limit-plugin
Limit plugin
2021-12-27 17:01:09 -08:00
Adrian Sampson
de3eedc033
Use bytes for destination base name
This is mostly "defensive programming": clients *should* only call this
on bytestring paths, but just in case this gets called on a Unicode
string path, we should now not crash.
2021-12-27 13:51:42 -08:00
patrick-nicholson
5b34797056 sigh 2021-12-27 14:51:04 -05:00
patrick-nicholson
27c2b79f01 Finally learning to read GitHub. 2021-12-27 13:39:35 -05:00
patrick-nicholson
c3829c52c8 Lint ignore. 2021-12-27 13:38:20 -05: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
6c64ab6df1 Noticed GitHub linter wanted a docstring. 2021-12-27 12:11:18 -05:00
patrick-nicholson
086fec0096 Fixed truediv typo (switched to intdiv).
Fixed linter objections.
2021-12-26 21:58:45 -05:00