Commit graph

52 commits

Author SHA1 Message Date
Šarūnas Nejus
c490ac5810
Fix formatting 2025-05-07 10:41:01 +01:00
Šarūnas Nejus
179ed13e09
Say bye to util._fsencoding 2025-04-21 12:41:57 +01:00
Skia
225c21b90f plugins/thumbnails: fix FFI with GIO on s390x
Using the correct function signature for g_file_new_for_path fixes the
tests on s390x.
I do not have the full story on why this failed consistently only on
s390x, but I guess the big endian might have something to play with
this.

Here is how the tests were failing:
```
169s ___________________________ ThumbnailsTest.test_uri ____________________________
169s
169s self = <test.plugins.test_thumbnails.ThumbnailsTest testMethod=test_uri>
169s
169s     def test_uri(self):
169s         gio = GioURI()
169s         if not gio.available:
169s             self.skipTest("GIO library not found")
169s
169s >       assert gio.uri("/foo") == "file:///"  # silent fail
169s E       AssertionError: assert '' == 'file:///'
169s E
169s E         - file:///
169s
169s test/plugins/test_thumbnails.py:268: AssertionError
```
You can see a full log here [1] and a history of consistent failure
here [2]. Both links are bound to expire at some point, sorry future
archeologist 🤷.

[1]: https://autopkgtest.ubuntu.com/results/autopkgtest-plucky/plucky/s390x/b/beets/20250403_162414_5d1da@/log.gz#S5
[2]: https://autopkgtest.ubuntu.com/packages/beets/plucky/s390x
2025-04-14 02:19:10 +01:00
Šarūnas Nejus
85a17ee503
Reformat the codebase 2024-09-21 11:57:48 +01:00
Šarūnas Nejus
f388ff6ec1
Replace py3_path with builtin os.fsdecode
`os.fsdecode` has only been available since Python 3.2.
2024-06-16 00:52:37 +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
luzpaz
8419149c7a
Fix various typos 2023-08-09 21:26:15 -04:00
wisp3rwind
29c21860a9 add missing syspath conversions (2/3, beetsplug) 2023-07-16 10:17:40 +02: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
8a969e3041 artresizer: backend classes part 1: stub classes, version checks 2022-03-12 19:48:45 +01: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
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
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
wordofglass
bb5629ea1d Remove untyped except statements 2017-04-29 00:05:20 +02:00
Adrian Sampson
d356356111 Fix #2466: GIO returns bytes, so decode them 2017-03-03 11:59:50 -06:00
Johnny Robeson
e8afcbe7ec replace unicode with six.text_type 2016-06-24 05:53:49 -04:00
Johnny Robeson
b602faabb8 more bytestringification in thumbnails plugin 2016-06-16 23:11:16 -04:00
Johnny Robeson
15c07613bf decode the filename written to .desktop file 2016-06-16 23:04:52 -04:00
Johnny Robeson
52f2ab2547 encode uri passed to hashlib in thumbnails plugin 2016-06-16 23:00:45 -04:00
Johnny Robeson
3112a18463 treat ctypes .value as bytes in thumbnails plugin 2016-06-14 00:51:12 -04:00
Jack Wilsdon
79d602b2a0 Use correct methods for ImageMagick and PIL info 2016-04-27 20:41:09 +01:00
Jack Wilsdon
8317a20bcd Use correct methods from art resizer 2016-04-27 20:34:28 +01:00
Adrian Sampson
e54c7eec3d Standardize __future__ imports without parentheses
Since the list is short enough now, we don't need parentheses for the line
wrap. This is a little less ugly.
2016-02-28 15:03:51 -08:00
Peter Kessen
7155999d00 Removed import of unicode_literals from plugins
* thumbnails
* types
2016-02-20 14:34:49 +01:00
Jack Wilsdon
12cd5306b7 Update copyright dates to 2016 2015-12-30 15:42:06 +00:00
Adrian Sampson
6c0f43cf1c Thumbnails: Fix string memory management
Should fix #1433. The problem now was that we were freeing the string memory
that Python expected to be managing in a string object held by the `uri`
variable. Now, we do a silly dance to copy the memory out of the buffer
returned by the library and return that instead.
2015-11-20 11:26:35 -08:00
Adrian Sampson
530b42156b Thumbnails: Declare more interface types
Seems to address a segfault indicated in #1433, but there are still crashes
lurking.
2015-11-20 10:55:25 -08:00
Adrian Sampson
a18506f471 Fix #1686: thumbnails using unicode paths 2015-11-02 11:03:43 -08:00
David
36bf49aa8d typo: thumnails -> thumbnails 2015-05-11 14:26:49 -04:00
Tom Jaspers
c95b89ebc1 Thumbnails: add None check on lib_name
`find_library` could return None, which would not cause an OSError
from `loadLibrary`, making the plugin (falsely) think the library is available

Also fixed  wrong method call to skip test in that case

See #1277
2015-03-30 19:56:22 +02:00
Bruno Cauet
e707342bf9 Add call to g_type_init() for glib < 2.36 2015-03-27 16:33:51 +01:00
Bruno Cauet
2e5803cfad Thumbnails: unicode → bytes filename 2015-03-27 14:00:22 +01:00
Bruno Cauet
f41ec9bbf6 ctpyes: set argtypes & restype 2015-03-27 14:00:13 +01:00
Bruno Cauet
07ee934352 Thumbnails: improve log readability 2015-03-25 20:14:23 +01:00
Bruno Cauet
4b349771ff thumbnails plugin setup: log tools chosen 2015-03-25 20:14:19 +01:00
Bruno Cauet
11a4777219 URI: use gio/gio.h's g_file_get_uri if available 2015-03-25 20:14:16 +01:00
Bruno Cauet
a72ae5991f Add send_art event for embedart and thumbnails
Album.set_art() sends a 'art_sent' event, with the album as a
parameter. embedart and thumbnails listen to that event, instead of
listening to 'album imported'. Consequences:
- 'embedart' and 'thumbnails' don't have to be after 'fetchart' on the
  plugins config line.
- embedart and thumbnails work event when a "beets fetchart" command is
  issued.
- if another plugin ever set art then embedart and thumbnails will "just
  work" with it.
2015-01-31 21:06:01 +01:00
Bruno Cauet
d299f40a72 Fix PNG metadata type: string only
instead of int
2015-01-29 16:00:05 +01:00
Bruno Cauet
9bdeb01689 Improve thumbnails logging
No info message printed twice per cover art (once for the normal
thumbnail and once for the big one)
2015-01-29 13:11:14 +01:00
Bruno Cauet
a78cc65826 Merge freedesktop plugin into thumbnails
Add test for that new code, update docs, update the changelog.
2015-01-29 13:08:02 +01:00
Bruno Cauet
bea5ad3f97 thumbnails: fix --force option management 2015-01-29 12:19:19 +01:00
Bruno Cauet
946aa8e4b3 Fix detection of thumbails to generate 2015-01-29 12:19:19 +01:00
Bruno Cauet
a39ab5163f thumbnails: add "auto" config option
default: True
2015-01-29 11:24:15 +01:00
Bruno Cauet
e8370044c9 thumbnails: add --force (-f) to force regeneration
It compares thumb mtime vs cover mtime when it should compare
Thumb::mtime thumb metadata vs cover mtime.
2015-01-29 11:24:15 +01:00
Bruno Cauet
540cae0de4 thumbnails: fix detection of local resizing capabilities 2015-01-29 11:24:14 +01:00
Bruno Cauet
180a3ece3b Improve thumbnails docstrings 2015-01-29 11:24:02 +01:00
Bruno Cauet
143e749426 thumbnails plugin writes standard metadata to the thumbnail
Write Thumb::URI and Thumb::MTime as requred by the spec:
http://standards.freedesktop.org/thumbnail-spec/latest/x142.html
2015-01-29 11:23:00 +01:00
Bruno Cauet
17d6d6529e thumbails: improve logging, update dependencies 2015-01-28 11:12:55 +01:00
Bruno Cauet
5453cf96c8 thumbnails plugin handles 128² and 256² thumbnails
If the source is good enough both will be produced, otherwise the former
only will be created.

This is warranted by the spec: http://standards.freedesktop.org/thumbnail-spec/latest/x122.html
2015-01-27 17:16:26 +01:00