mirror of
https://github.com/beetbox/beets.git
synced 2026-01-03 06:22:48 +01:00
changelog and light style fixes for #64
This commit is contained in:
parent
447454a62c
commit
29c6f9c342
4 changed files with 38 additions and 22 deletions
|
|
@ -12,6 +12,9 @@
|
|||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
"""Abstraction layer to resize images using PIL, ImageMagick, or a
|
||||
public resizing proxy if neither is available.
|
||||
"""
|
||||
import urllib
|
||||
import subprocess
|
||||
import os
|
||||
|
|
@ -20,8 +23,6 @@ import shutil
|
|||
from tempfile import NamedTemporaryFile
|
||||
import logging
|
||||
|
||||
"""Abstraction layer to resize an image without requiring additional dependency
|
||||
"""
|
||||
# Resizing methods
|
||||
PIL = 1
|
||||
IMAGEMAGICK = 2
|
||||
|
|
@ -29,10 +30,12 @@ WEBPROXY = 3
|
|||
|
||||
log = logging.getLogger('beets')
|
||||
|
||||
|
||||
class ArtResizerError(Exception):
|
||||
"""Raised when an error occurs during image resizing
|
||||
"""Raised when an error occurs during image resizing.
|
||||
"""
|
||||
|
||||
|
||||
def call(args):
|
||||
"""Execute the command indicated by `args` (a list of strings) and
|
||||
return the command's output. The stderr stream is ignored. If the
|
||||
|
|
@ -106,7 +109,8 @@ class ImageMagickResizer(object):
|
|||
|
||||
|
||||
class ArtResizer(object):
|
||||
|
||||
"""A singleton class that performs image resizes.
|
||||
"""
|
||||
convert_path = None
|
||||
|
||||
def __init__(self, detect=True):
|
||||
|
|
@ -122,7 +126,6 @@ class ArtResizer(object):
|
|||
self.__class__ = ImageMagickResizer
|
||||
log.debug("ArtResizer method is %s" % self.__class__)
|
||||
|
||||
|
||||
def set_method(self):
|
||||
"""Set the most appropriate resize method. Use PIL if present, else
|
||||
check if ImageMagick is installed.
|
||||
|
|
@ -148,7 +151,6 @@ class ArtResizer(object):
|
|||
|
||||
return WEBPROXY
|
||||
|
||||
|
||||
def resize(self, maxwidth, url, path_out=None):
|
||||
"""Resize using web proxy. Return the output path of resized image.
|
||||
"""
|
||||
|
|
@ -165,8 +167,6 @@ class ArtResizer(object):
|
|||
shutil.copy(fn, path_out)
|
||||
return path_out
|
||||
|
||||
# module-as-singleton instanciation
|
||||
|
||||
# Singleton instantiation.
|
||||
inst = ArtResizer()
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ Changelog
|
|||
* :doc:`/plugins/replaygain`: This plugin has been completely overhauled to use
|
||||
the `mp3gain`_ or `aacgain`_ command-line tools instead of the failure-prone
|
||||
Gstreamer ReplayGain implementation. Thanks to Fabrice Laporte.
|
||||
* :doc:`/plugins/fetchart` and :doc:`/plugins/embedart`: Both plugins can now
|
||||
resize album art to avoid excessively large images. Thanks to
|
||||
Fabrice Laporte.
|
||||
* :doc:`/plugins/scrub`: Scrubbing now removes *all* types of tags from a file
|
||||
rather than just one. For example, if your FLAC file has both ordinary FLAC
|
||||
tags and ID3 tags, the ID3 tags are now also removed.
|
||||
|
|
|
|||
|
|
@ -46,8 +46,11 @@ To do so, add this to your ``~/.beetsconfig``::
|
|||
[embedart]
|
||||
autoembed: no
|
||||
|
||||
A maximum image width can be defined to downscale images before embedding them
|
||||
(source image on filesystem is not altered). The resize operation reduces image width to
|
||||
``maxwidth`` pixels and height is recomputed so that aspect ratio is preserved.
|
||||
The [PIL](http://www.pythonware.com/products/pil/) or [ImageMagick](www.imagemagick.org/) is required
|
||||
to use the ``maxwidth`` config option.
|
||||
A maximum image width can be configured as ``maxwidth`` to downscale images
|
||||
before embedding them (the original image file is not altered). The resize
|
||||
operation reduces image width to ``maxwidth`` pixels. The height is recomputed
|
||||
so that the aspect ratio is preserved. `PIL`_ or `ImageMagick`_ is required to
|
||||
use the ``maxwidth`` config option.
|
||||
|
||||
.. _PIL: http://www.pythonware.com/products/pil/
|
||||
.. _ImageMagick: http://www.imagemagick.org/
|
||||
|
|
|
|||
|
|
@ -16,12 +16,6 @@ By default, beets stores album art image files alongside the music files for an
|
|||
album in a file called ``cover.jpg``. To customize the name of this file, use
|
||||
the :ref:`art-filename` config option.
|
||||
|
||||
A maximum image width can be defined to downscale fetched images if they are too
|
||||
big. The resize operation reduces image width to ``maxwidth`` pixels and
|
||||
height is recomputed so that aspect ratio is preserved.
|
||||
When using ``maxwidth`` config option, please consider installing
|
||||
[ImageMagick](www.imagemagick.org/) first for optimal performance.
|
||||
|
||||
To disable automatic art downloading, just put this in your configuration
|
||||
file::
|
||||
|
||||
|
|
@ -41,6 +35,22 @@ already have it; the ``-f`` or ``--force`` switch makes it search for art
|
|||
regardless. If you specify a query, only matching albums will be processed;
|
||||
otherwise, the command processes every album in your library.
|
||||
|
||||
Image Resizing
|
||||
--------------
|
||||
|
||||
A maximum image width can be configured as ``maxwidth`` to downscale fetched
|
||||
images if they are too big. The resize operation reduces image width to
|
||||
``maxwidth`` pixels. The height is recomputed so that the aspect ratio is
|
||||
preserved.
|
||||
|
||||
Beets can resize images using `PIL`_, `ImageMagick`_, or a server-side resizing
|
||||
proxy. If either PIL or ImageMagick is installed, beets will use those;
|
||||
otherwise, it falls back to the resizing proxy. Since server-side resizing can
|
||||
be slow, consider installing one of the two backends for better performance.
|
||||
|
||||
.. _PIL: http://www.pythonware.com/products/pil/
|
||||
.. _ImageMagick: http://www.imagemagick.org/
|
||||
|
||||
Album Art Sources
|
||||
-----------------
|
||||
|
||||
|
|
@ -61,4 +71,4 @@ Embedding Album Art
|
|||
|
||||
This plugin fetches album art but does not embed images into files' tags. To do
|
||||
that, use the :doc:`/plugins/embedart`. (You'll want to have both plugins
|
||||
enabled.)
|
||||
enabled.)
|
||||
|
|
|
|||
Loading…
Reference in a new issue