Commit graph

20 commits

Author SHA1 Message Date
Šarūnas Nejus
fcff5d72af
Remove def suite TestLoader definitions 2024-07-28 18:58:51 +01:00
Šarūnas Nejus
2d5fd907c3
Remove redundant setup_beets and teardown_beets instructions 2024-07-28 18:58:34 +01:00
Šarūnas Nejus
3e278159ed
Dedupe TestHelper and _common.TestCase setup 2024-07-28 18:58:33 +01:00
Šarūnas Nejus
1fda7b6111
fetchart, artresizer: Create art files in predictable directories
This allows to clean them up in art (1) fetching, (2) resizing and (3)
deinterlace tests.
2024-07-02 15:35:24 +01:00
freddiewanah
e0de6e1b89 refactor the test methods to avoid suboptimal asserts. 2024-04-08 21:39:25 +08:00
Lars Kruse
508d28f66b tests: move reusable test-related modules into the beets package
External Python packages interfacing beets may want to use an in-memory
beets library instance for testing beets-related code.
The `TestHelper` class is very helpful for this purpose.
Previously `TestHelper` was located in the `test/` directory.
Now it is part of `beets` itself (`beets.test.helper.TestHelper`) and
can be easily imported.
2024-01-15 19:40:57 +01:00
Serene-Arc
a6e5201ff3 Apply formatting tools to all files
This is 'the big one', which touches every file so that it all conforms
to the given standard.
2023-10-22 09:53:18 +10: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
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
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
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
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
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