Commit graph

16 commits

Author SHA1 Message Date
Adrian Sampson
d9974081a7 add extension for proxied images
`urllib.urlretrieve` was using the correct extension in most cases -- I think
when the URL ended with .jpg -- but not in every case. This was leading to files
named just "cover" and not "cover.jpg" or something else sensible. In
particular, proxied URLs don't have .jpg extensions. This generates the filename
manually so the source image always has an extension.
2012-11-01 12:39:02 -07:00
Adrian Sampson
45650a4b64 artresizer: fix argument lists to helper functions
Also added some useful debug logs.
2012-11-01 12:15:51 -07:00
Adrian Sampson
07d3f3e066 lazily initialize ArtResizer singleton (#64)
Searching for `convert` or PIL has non-negligible performance overhead, so it's
preferable to only do it when really necessary. This way, the search is only
performed when ArtResizer.shared is accessed for the first time.
2012-11-01 11:40:53 -07:00
Adrian Sampson
f7677a4b56 fetchart: fix command & use maxwidth (#64)
An earlier commit broke the call to art_for_album here (too few arguments).
I've also now propagated the maxwidth setting for the command to match the
import hook.
2012-11-01 00:19:15 -07:00
Adrian Sampson
e3fe9712d5 fetchart fixes for image resizing (#64)
Fixed a number of issues with the changes to fetchart:
- Remove redundant fetches. This was making the Amazon source download every
  image twice even when art resizing was not enabled!
- Restore local_only switch in plugin hook, which got lost in the shuffle at
  some point.
- Don't replace the original image file in-place; use a temporary file instead.
  This would clobber the original source image on the filesystem with the
  downscaled version!
2012-11-01 00:09:35 -07:00
Adrian Sampson
3873c29448 artresizer (#64): helper functions, not classes
The previous method was to change self.__class__ dynamically to make __init__
instantiate different classes. This new way, which uses bare functions instead
of separate functor-like classes, instead just forwards the resize() call to
a module-global implementation based on self.method.

Additionally, the semantics of ArtResizer have changed. Clients now *always*
call resize() and proxy_url(), regardless of method. The method makes *one* of
these a no-op. This way, clients need not manually inspect which method is
being used.
2012-10-31 23:33:59 -07:00
Fabrice Laporte
447454a62c fix few errors revealed by test_art.py 2012-10-28 23:02:45 +01:00
Fabrice Laporte
d271735dd2 fetchart: fix urlopen call 2012-10-28 17:09:39 +01:00
Fabrice Laporte
7f2aa44ac6 Add 'maxwidth' option to embedart and fetchart plugins.
artresizer.py instances an ArtResizer object that uses internally the PIL; ImageMagick
or a web proxy service to perform the resizing operations.
Because embedart works on input images located on filesystem it requires PIL or ImageMagick, whereas
fetchart is able to do the job with the fallback webproxy resizer.
2012-10-28 15:36:42 +01:00
Adrian Sampson
57e66d7b1a fetchart: sort image filenames (GC-452) 2012-10-25 18:02:22 -07:00
Adrian Sampson
701d8cf204 fetchart: fix extension-less files from CAA 2012-08-02 09:46:57 -07:00
Adrian Sampson
6503e85a57 fetchart: autofetch option
This necessitated a slight refactoring in the plugin event handling mechanism.
Rather than loading all handlers up front and storing them in a module-scope
structure, we now scan for event handlers at every send(). This is probably
very slightly less efficient but allows for more flexible logic.
2012-06-24 19:01:19 -07:00
Adrian Sampson
fbb5823541 fetchart: command to manually download art 2012-06-24 18:27:00 -07:00
Adrian Sampson
77cbb19564 fetchart: get local art for as-is imports (GC-339) 2012-06-24 17:41:37 -07:00
Adrian Sampson
d807b3fbf1 Cover Art Archive support (GC-71) 2012-06-24 16:57:04 -07:00
Adrian Sampson
11d4fb1abb move album art fetching to a plugin (fetchart) 2012-06-24 00:34:50 -07:00
Renamed from beets/autotag/art.py (Browse further)