Commit graph

127 commits

Author SHA1 Message Date
Lachlan Charlick
03a41e82da fetchart: minor google backend refactor 2015-12-29 00:02:41 +10:30
Lachlan Charlick
99fb656f52 fetchart: Remove some debug logging from google backend 2015-12-28 23:57:38 +10:30
Lachlan Charlick
deadc4d049 fetchart: Automatically disable google backend if no API key is set 2015-12-28 23:57:03 +10:30
Lachlan Charlick
b73cfb9f8d fetchart: Fix typo in google API config key 2015-12-28 23:53:56 +10:30
Lachlan Charlick
ff15f4af9b fetchart: Use config singleton rather than passing object to each backend 2015-12-28 23:42:11 +10:30
Lachlan Charlick
c14abe56a5 fetchart: Add new google backend using google custom search
Requires an API key from google similar to lyrics plugin.
Limited to 100 queries/day.
2015-12-28 23:16:12 +10:30
Adrian Sampson
5597313ea0 fetchart: Remove Google backend (fix #1760) 2015-12-12 16:47:00 -08:00
Adrian Sampson
3314db2f77 fetchart: Better logging for iTunes (#1760) 2015-12-12 16:44:55 -08:00
Adrian Sampson
c90ca1096c fetchart: Log reasons for rejecting art 2015-11-23 17:30:09 -08:00
Adrian Sampson
1d0984a294 Slight log rewording 2015-11-21 12:54:50 -08:00
Peter Kessen
3eb8008b11 added encoding as comment in files
added line like
# -*- coding: utf-8 -*-
to all files with correct license in header
2015-11-19 18:41:01 +01:00
reiv
81a72f74c9 Merge branch 'master' into 314-reimport-art 2015-11-04 18:37:06 +01:00
reiv
0ebc4c799d fetchart: in auto, ignore albums with art
When re-importing an album, we don't want fetchart to interfere
with any existing album art.
2015-11-04 15:08:42 +01:00
reiv
1625dfc17e Merge branch 'master' into 1264-unnecessary-resize 2015-11-03 02:46:33 +01:00
reiv
19dcc25a93 fetchart: Improve validation of image dimensions
This avoids images being resized unnecessarily if the dimensions
are correct.
2015-11-03 02:19:47 +01:00
reiv
db08896d8c fetchart: add docstring to helper function
_is_valid_image_candidate() now has three different return values.
These are documented here.
2015-11-02 03:04:45 +01:00
reiv
9182fd8f04 PEP8 amendments 2015-11-01 16:20:48 -08:00
reiv
3250fa80ae fetchart: Only resize when necessary
Fixes #1264: When a re-import triggers fetchart, the existing album art is no
longer resized if it already has the correct dimensions. This avoids creating
new album art files with unique filenames ("cover.n.jpg").
2015-11-01 16:20:18 -08:00
reiv
269d0e5403 fetchart: Check if album art file actually exists
Fixes #1126.
2015-11-01 16:14:51 -08:00
Adrian Sampson
854a4539cb Fix #1588: fetchart gets PNGs, not GIFs 2015-09-02 12:45:35 -07:00
Adrian Sampson
e32744a66a Fix extra parameter introduced for #1581 2015-08-30 11:55:06 -07:00
Adrian Sampson
9ce49b7ef0 fetchart: Do not emable Wikipedia by default
Because DBpedia seems to be down (it's responding very slowly with errors),
this seems like a good defensive action. It narrows the default sources to
those that resolve quickly, with only a couple of HTTP requests. We can
re-enable this again in the future if things seem to stabilize over at
DBpedia.
2015-08-29 12:52:57 -07:00
Adrian Sampson
e249fcb06f fetchart: Fix #1581, splitting in Wikipedia source 2015-08-29 12:45:10 -07:00
Adrian Sampson
b5cb4e4cc4 Slightly more efficient image streaming 2015-08-29 12:41:54 -07:00
Adrian Sampson
3d20f25f06 fetchart: Fix bungled Requests API 2015-08-29 12:27:37 -07:00
Adrian Sampson
75e810409b fetchart: Use a mixin for even more logging 2015-08-29 12:13:28 -07:00
Adrian Sampson
608e4ffbef fetchart: Lots more logging 2015-08-29 11:59:46 -07:00
Adrian Sampson
2b1d7fc3aa fetchart: Logging, naming, remove unused option 2015-08-29 11:31:59 -07:00
Adrian Sampson
96c5121f65 Documentation for #1555/#1556 2015-08-01 15:00:13 -07:00
Ben Ockmore
4818264a36 Added TypeError to the list of caught exceptions in fetachart._fetch_image
requests/urllib3 is throwing an exception due to an internal problem triggered
by some sort of timeout. This change catches the TypeError so that beets
reports "error fetching art" instead of crashing when this happens.
2015-08-01 16:50:59 +01:00
Kylie McClain
c7cdadfd49 fetchart: Use text_highlight_minor for color rather than text_success 2015-06-22 02:15:49 -04:00
Kylie McClain
b8d6c37fec fetchart: Use success coloring if album art is found 2015-06-19 20:36:50 -04:00
Tom Jaspers
a7eace81d4 fetchart: improve Wikipedia art source
Artists with non-typical casing (e.g., alt-J, dEUS) would not get matched on
DBPedia, as the RDFS:label uses arbitrary casing, and SPARQL provides only exact
matches. The FOAF:name attribute is always title-cased (e.g., Alt-J, Deus).

Due to a bug in DBPedia, the cover filename is truncated when it contains
parentheses, (e.g., 'Foo bar (band).jpg' gets truncated to 'Foo bar .jpg').
To work around this, an additional Wikipedia call gets made for all its
images, in which we try to match our truncated image.

The Wikipedia art source now catches the correct exceptions, instead of
a broad catch-all.

Wikipedia album images can be gifs, so these are now added to the list of
accepted content types.
2015-05-19 09:57:54 +02:00
Tom Jaspers
a82dee35cb fetchart complains if no imaging backend available
The `enforce_ratio` and `minwidth` options depend on PIL or ImageMagick.
Previously it silently fails. Now it will log a warning, and accept the
image.

Tests concerning these options are skipped when no imaging backend is available.

Fix #1460
2015-05-18 19:44:40 +02:00
Frederik “Freso” S. Olesen
0d21e816d4 Fetchart: Remove hard 500px size limit for CAA cover art.
Using -500 URLs for coverartarchive.org will only ever return images
where the biggest dimension is (width or height) is 500 pixels,
regardless of what fetchart settings are otherwise set.

This commit removes the -500 from the URL entirely rather than using it
conditionally, since a maxwidth of 500 will allow for a 600 high and 500
wide image, but CAA.org/...-500 would return a 500x417 image instead, so
not enforcing a size is the only way to ensure the user's {max,min}width
settings are properly respected.
2015-04-07 15:24:01 +02:00
Tom Jaspers
b5ec26c949 Fetchart: minwidth & enforce_ratio options
- Minimum image width can be specified via minwidth (default `0`)
- The image ratio can be enforced to 1:1 using `enforce_ratio` (default `no`)

See #1058
2015-04-04 20:52:08 +02:00
Tom Jaspers
6572e1bf5a Fetchart: add empty album check to iTunes art
Was causing some tests to fail in test_art.py:CombinedTest
2015-02-09 14:59:56 +01:00
Tom Jaspers
927a53d59b Merge pull request #1281 from tomjaspers/configurable-colors
Colors are now user configurable.

Conflicts:
	beets/ui/__init__.py
	beets/ui/commands.py
2015-01-30 13:48:19 +01:00
Tom Jaspers
f483012183 Colorize is now to be called with the abstract color_name instead of the color.
E.g., `colorize('text_success', 'hello world')`

To ensure compatibility with 3rd party plugins, a valid color ('red') can still be passed,
but it will be logged.
2015-01-29 14:33:57 +01:00
Adrian Sampson
b8dab9cf9f Merge pull request #1247 from brunal/future
Use all __future__ imports in beets core

Conflicts:
	beetsplug/web/__init__.py
	test/test_embedart.py
2015-01-26 17:02:07 -08:00
Tom Jaspers
d3fce35481 Colors are user configurable
- Colors are mapped on to a dictionary using abstract names (e.g., text_success)
- Add `colors` option under `ui` to allow users to choose their own color scheme
- Move configuration option `color` from top-level to `ui`
- Show deprecation warning if top-level `color` configuration is used (but respect it)

Fix #1238
2015-01-26 17:24:32 +01:00
Bruno Cauet
060c275fd3 Merge branch 'master' into libmodels-formatting
Conflicts:
	beetsplug/embedart.py
2015-01-26 10:17:15 +01:00
Bruno Cauet
8165dec985 Delete manual formattings of album & item 2015-01-25 21:32:22 +01:00
Bruno Cauet
a5026100a3 All plugins use unicode_literals
Given that part of them has no test I may have broke them
2015-01-20 16:22:27 +01:00
Bruno Cauet
90b388b775 Use __future__ imports but unicode_literals everywhere
Include import of __future__ features division, absolute_imports and
print_function everywhere. Don't add unicode_literals yet for it is
harder to convert.

Goal is smoothing the transition to python 3.
2015-01-19 12:25:16 +01:00
Tom Jaspers
133c21a9c5 Fetchart: add fetching artwork from Wikipedia following the new class-based structure of the plugin 2015-01-18 15:09:36 +01:00
Bruno Cauet
4babc40fd8 Delete useless "config['mypluginname']" mentions
Replace with self.config where this is painless.
More plugins would benefit from this update but that requires turning
functions into methods.
2015-01-12 10:55:59 +01:00
Adrian Sampson
24317fd4c7 Rename BeetsPlugin._import_stages to import_stages
For #1208. Restores backwards-compatibility and matches the development docs.
2015-01-11 14:27:59 -08:00
Bruno Cauet
b27c5304d1 Merge branch 'master' into logging
Conflicts:
	beetsplug/fetchart.py
	beetsplug/mpdstats.py
2015-01-09 15:15:27 +01:00
Adrian Sampson
1654fc82ce Merge pull request #1211 from brunal/fetchart-check-isfile
Fetchart: check that the art found is a file
2015-01-08 13:40:21 -08:00