Commit graph

60 commits

Author SHA1 Message Date
Adrian Sampson
bcc591bf97 Generalize exception handler for #1347 2015-03-06 12:01:09 -08:00
Bruno Cauet
d1f6bbaf01 Discogs plugin: catch client lib ValueErrors
When search fails, log the query which caused it and return an empty
result.

Kind of fixes #1347.
2015-03-06 11:16:20 +01:00
Bruno Cauet
457afdc55d Auto re-auth for discogs plugin upon error 401
This goes in the direction of #1299 and #1305.
2015-02-18 15:11:52 +01:00
Bruno Cauet
5a1f499c64 Discogs plugin: fix event listener params
Also delete related deprecated comment.
2015-02-11 09:11:20 +01:00
Adrian Sampson
0247785440 discogs: Catch JSON decode errors
Fix #1305 *again*.
2015-02-03 23:42:47 -08:00
Adrian Sampson
cc01d87209 discogs: Catch *another* exception (fix #1305)
Everything but requests is a travesty.
2015-02-03 23:04:14 -08:00
Adrian Sampson
77833f6c05 Oops 😳 #1299 2015-02-02 22:34:22 -08:00
Adrian Sampson
8151a40f1f discogs: Catch socket errors (#1299)
See also:

https://github.com/discogs/discogs_client/issues/44
2015-02-02 22:27:14 -08: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
438044c6ae Fix bytes/str with unicode-nazi
Further cleaning will require setting unicode_literals on plugins
2015-01-20 15:25:12 +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
Bruno Cauet
7c2d5f0948 Import beets.ui in discogs plugin
The discogs plugin uses beets.ui but did not explicitely import it,
which might cause it to crash when used in standalone.
2015-01-16 17:59:35 +01:00
Bruno Cauet
b27c5304d1 Merge branch 'master' into logging
Conflicts:
	beetsplug/fetchart.py
	beetsplug/mpdstats.py
2015-01-09 15:15:27 +01:00
Frederik “Freso” S. Olesen
4b1f0cbf48 Happy 2015. ;)
See 7a410f636b

Command used:

    git grep -l 'Copyright 201'|xargs sed -i -E 's/Copyright 201./Copyright 2015/'`
2015-01-08 21:37:09 +01:00
Bruno Cauet
e14a54df05 Convert multiple plugins' logger usage (easy ones)
Those plugins only called methods and no function, which eases the
conversion.
2015-01-06 21:34:13 +01:00
Bruno Cauet
b8211a3c4c Every plugin uses its own logger
logging.getLogger(__name__) everywhere!
Several loggers prefixed every log message with [logername], which we
delete here.
2015-01-06 10:35:44 +01:00
Bruno Cauet
30f158a95e Move "from beets import logging" statements
Move the import next to other beets-related imports
2015-01-05 10:05:21 +01:00
Bruno Cauet
7df8bef8b7 Update logging imports: logging → beets.logging 2015-01-04 17:02:27 +01:00
Bruno Cauet
8cac47af2a Convert beets plugins to lazy logging 2015-01-04 17:02:27 +01:00
Adrian Sampson
fe655e4610 discogs: Only authenticate on import (#1123)
No need to authenticate for other commands.
2014-11-30 11:18:32 -08:00
Adrian Sampson
a9981c1dc7 Comment about workaround in #1073 2014-11-07 19:51:38 -08:00
David
5480ceeaf8 Encode to ascii,not utf8.Replace missing chars 2014-11-07 20:46:35 -05:00
Adrian Sampson
50c7cf0f56 discogs: Fix #1049: intermittent trailing comma 2014-10-30 09:36:39 -07:00
Adrian Sampson
eb35d7084a Save Discogs token (#1040) 2014-10-26 15:45:34 -07:00
Adrian Sampson
a8a5191cf5 discogs #1040: Standard API key, handle failure 2014-10-26 15:24:17 -07:00
David
d9c9e06674 Add authentication to discogs plugin 2014-10-26 16:26:59 -04:00
Dustin Rodriguez
020c96d99f Added handler for requests.exceptions.ConnectionError to discogs plugin. 2014-10-11 20:50:31 -04:00
e5e4eaeacd39c5cfba4d7c852c48277ae50331e6
66aee8094f Clean up of logging messages as described here
All logging now prefers the ' (single quote) over the " (double quote)

https://github.com/sampsyo/beets/wiki/Hacking
2014-09-09 11:28:43 +10:00
Andrii Kohut
4279ac0b67 New api requires client and dict as parameters for Release initialization 2014-08-25 20:22:47 +03:00
Andrii Kohut
34584eadd1 Works faster then checking each result item with isinstance 2014-08-25 19:14:41 +03:00
Andrii Kohut
f8af931caa Seems like something broken in new version of discogs_client 2014-08-24 17:34:31 +03:00
Andrii Kohut
9a80179059 this should fix UnicodeEncodeError with non-ascii queries 2014-08-24 16:37:24 +03:00
Andrii Kohut
d0115f1110 set user agent as Client parameter, remove imports 2014-08-23 13:12:28 +03:00
Andrii Kohut
a663e52bad Fix problems with new discogs_client version 2014-08-23 13:00:25 +03:00
Adrian Sampson
e5a9db1cac fix up some indentation warnings in plugins 2014-04-13 17:55:49 -07:00
Fabrice Laporte
3ead936fe5 flake8 cleaning beetsplug/*
Remaining warnings are related to visual indentation.
2014-04-13 23:24:57 +02:00
Adrian Sampson
f6faf72328 move Distance class to hooks module 2013-06-10 15:21:32 -07:00
Tai Lee
e6ac8e1646 Use a Distance object instead of floats for distance calculations.
The new Distance object knows how to perform various types of distance
calculations (expression, equality, number, priority, string).

It will keep track of each individual penalty that has been applied so
that we can utilise that information in the UI and when making decisions
about the recommendation level.

We now display the top 3 penalties (sorted by weight) on the release
list (and "..." if there are more than 3), and we display all penalties
on the album info line and track change line.

The implementation of the `max_rec` setting has been simplified by
removing duplicate validation and instead looking at the penalties that
have been applied to a distance. As a result, we can now configure a
maximum recommendation for any penalty that might be applied.

We have a few new checks when calculating album distance:

`match: preferred: countries` and `match: preferred: media` can each be
set to a list of countries and media in order of your preference. These
are empty by default. A value that matches the first item will have no
penalty, and a value that doesn't match any item will have an unweighted
penalty of 1.0.

If `match: preferred: original_year` is set to "yes", beets will apply
an unweighted penalty of 1.0 for each year of difference between the
release year and the original year.

We now configure individual weights for `mediums` (disctotal), `label`,
`catalognum`, `country` and `albumdisambig` instead of a single generic
`minor` weight. This gives more control, but more importantly separates
and names the applied penalties so that the UI can convey exactly which
fields have contributed to the overall distance penalty.

Likewise, `missing tracks` and `unmatched tracks` are penalised and
displayed in the UI separately, instead of a combined `partial` penalty.

Display non-MusicBrainz source in the disambiguation string, and
"source" in the list of penalties if a release is penalised for being
a non-MusicBrainz.
2013-06-02 18:25:10 +10:00
Jayme
5bb0881cdd Replace two more flag arguments 2013-05-30 10:09:39 +02:00
Jayme
32e1c13510 Fix Python 2.6 compatibility 2013-05-30 09:30:00 +02:00
Adrian Sampson
303cd9ba00 Merge pull request #291 from jbaiter/discogs_albumid
Support for manually entered IDs in plugins
2013-05-29 14:43:59 -07:00
Johannes Baiter
3df635eca2 Make regex for Discogs ID more specific 2013-05-29 20:31:58 +02:00
Johannes Baiter
2d4ea4e49b Fix bug in discogs.album_for_id for ID-Strings that end in a bracket 2013-05-29 10:59:04 +02:00
Johannes Baiter
40a6e03ba6 Improve regular expression for Discogs IDs 2013-05-29 10:54:15 +02:00
Adrian Sampson
9f927438ca fix some dumb mistakes from most recent flurry 2013-05-28 22:04:20 -07:00
Adrian Sampson
72449caccf discogs: move config default into constructor
Such is the new convention for plugin configuratino defaults.
2013-05-28 21:45:31 -07:00
Adrian Sampson
480fa80e47 discogs: penalty only for matches from discogs
Otherwise, this was penalizing all album matches.

This also applies the same treatment as the previous commit: only load the
config at run time (at the expense of code clutter).
2013-05-28 21:25:28 -07:00
Johannes Baiter
f17e8550ca Determine IDs from MusicBrainz and Discogs URLs 2013-05-28 13:49:34 +02:00
Johannes Baiter
e3418be75d Add support for manually entered release ID in Discogs 2013-05-28 12:58:05 +02:00
Tai Lee
35e926a51b Add Discogs and general source weight penalty (configurable, undocumented).
Discogs (and other individual plugins) should return a penalty between
0.0 and 0.1, which will be multiplied by the general source weight. This
allows individual plugins to be weighted against relative to each other,
and amplified together against other penalty categories (track, title,
etc.)
2013-05-27 01:28:40 +10:00