Commit graph

2025 commits

Author SHA1 Message Date
Adrian Sampson
9a6b6240d0 zero: fix nulling fields containing None 2013-06-01 17:28:59 -07:00
Adrian Sampson
4624f65ce3 fix interface to ID matching
As outlined in #299, we broke many places in the code that were expecting
_album_for_id and _track_for_id to return a single item rather than a list. I
took this opportunity to divide up the interface: there's now one function for
MBIDs (returning a single object or None) and one for generic IDs (returning a
list).
2013-06-01 17:22:39 -07:00
Adrian Sampson
18bbe9f645 Merge pull request #298 from jayme-github/python26-resub
Fix Python 2.6 compatibility
2013-05-30 09:48:50 -07:00
Tai Lee
ee0c00708b Quick fix for a couple other places that were expecting hooks._album_for_id()` to return a single result.
It's possible that these plugins might require a little more thought
into how they should work (or not work) with potentially multiple albums
matching an idea, and potentially those those albums being an incorrect
match (e.g. if two data source plugins share a simple numerical ID
format).
2013-05-31 00:05:24 +10:00
Tai Lee
0a448a2380 Display album disambiguation information in order of common importance. Media, year, country, label, albumdisambig. 2013-05-30 23:28:33 +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
46340af6b7 #291: changelog and docs 2013-05-29 15:39:10 -07:00
Adrian Sampson
a408f691b4 #291: plugin hook for track_for_id
For symmetry with album candidates, plugins can now provide item candidates by
ID.
2013-05-29 15:31:59 -07:00
Adrian Sampson
5e7964d2dd fix implicit ID search
This was broken because hooks._album_for_id now returns a list. This was
assuming it returned a single value (or None).
2013-05-29 15:24:05 -07:00
Adrian Sampson
bf1291a97d #291: restore shortcut for manual ID searches 2013-05-29 15:16:27 -07:00
Adrian Sampson
73a904f7e8 #291: simplify plugin interface for album_for_id 2013-05-29 15:02:42 -07:00
Adrian Sampson
611dc44c46 fix tests for ID parsing (#291)
The previous tests accessed the network. This refactoring lets us test the ID
parsing in isolation.
2013-05-29 14:51:16 -07: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
Adrian Sampson
e75718d196 use album template fields in item templates
This lets you use, for example, the example album bitrate field in path
formats.
2013-05-29 10:10:07 -07: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
Johannes Baiter
adb22c3511 Return a list of candidates in hooks._album_for_id 2013-05-29 10:53:55 +02:00
Adrian Sampson
d8815898b8 fix for undefined TRACK_LENGTH_GRACE
Thanks for catching this, @mrmachine.
2013-05-28 23:37:04 -07:00
Adrian Sampson
3b438b7778 inline: rename "pathfields" to "item_fields" 2013-05-28 23:20:19 -07:00
Adrian Sampson
0176e10ccf inline: allow album field definitions
Under the album_field heading.
2013-05-28 23:10:47 -07:00
Adrian Sampson
a0cb31956d distinguish Album and Item template fields
An earlier change (due to @pedros) added the ability for plugins to define
template fields that work with Albums as well as Items. This enables some
cool new use cases but required that every template field definition check the
type of its arguments. Instead, this iteration on the idea distinguishes
between fields meant for Items and those meant for Albums.

In addition to simplifying the implementation of these functions, this also
enables the creation of album fields with identical names to item fields.
(For example, a user contacted me recently about adding a $bitrate field for
albums, which would be the average bitrate of the items. They can do this now
using a plugin.)

I also changed the docs to stop using the decorator approach to registering
template fields. We're moving toward removing those.
2013-05-28 22:30:23 -07: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
6334f4d1a5 refinements to artpath modification patch
That's 371cc72f2d09 in hg. This makes the patch slightly more general by
reusing our type conversion infrastructure. It also uses "bytes" as a synonym
for "str" that I find a little bit clearer.
2013-05-28 21:41:03 -07:00
Adrian Sampson
4d44e11a32 back out source-sensitive sorting
This is now addressed by a distance penalty.
2013-05-28 21:28:46 -07:00
Adrian Sampson
b3646f2659 fix some docs syntax 2013-05-28 21:28:26 -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
Adrian Sampson
17ae1e90c5 avoid loading config at import time
By running .get() (or, rather, .as_number()) in the module scope, this was
forcing the configuration to be materialized when the module was imported.
This is a little bit messier but requires a less duplication and avoids that
early loading problem.

I know the as_number calls scattered throughout are rather ugly; I'm pondering
a solution to mitigate that.
2013-05-28 21:13:09 -07:00
Adrian Sampson
89e76b8e5a simplify current_metadata return value
We now just return the underlying dicts instead of an increasingly long tuple.
2013-05-28 20:51:30 -07:00
mrmachine
bf6f739ac1 Merge pull request #292 from mrmachine/improved-distance
Look at many more metadata fields when calculating distance.
2013-05-28 17:38:16 -07:00
Tai Lee
a5151bb32e Look at many more metadata fields when calculating distance.
Produce slightly more varied similarity score to prioritise extremely
similar releases.
2013-05-29 10:18:55 +10:00
Johannes Baiter
ad66b8796a Fix tests for albums from manual ID 2013-05-28 13:50:20 +02: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
Johannes Baiter
a82e3f9f52 Delegate album_for_id to plugins if no MusicBrainz match is found 2013-05-28 12:57:02 +02:00
Lucas Duailibe
87dedaafad Fixes a bug when trying to modify the artpath with special characters
Basically, it uses the helpers that handle conversion bytestring <-> unicode with the item's path, but weren't being used with artpath. For now, it just fixes the behavior for `modify`
2013-05-27 02:06:27 -03:00
Tai Lee
29546fda5f Add missing import. 2013-05-27 01:34:22 +10: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
Tai Lee
7700eaee79 Update examples in docs to reflect new UI enhancements. 2013-05-27 01:25:13 +10:00
Tai Lee
799c85f380 Check for both track length and number difference independently when downgrading recommendations. 2013-05-25 22:47:07 +10:00
Tai Lee
e66a865f17 Rename the discogs max rec setting to non_mb_source, so it can apply to all data source plugins. 2013-05-25 22:44:41 +10:00
Tai Lee
feb1d8631d Move match distance weights to an undocumented configuration setting. 2013-05-25 17:59:00 +10:00
Tai Lee
a6b1bb1bbc Move articles to the front of Discogs artist names. 2013-05-25 14:05:03 +10:00
Tai Lee
22d82b73b4 Given an identical similarity, prefer MusicBrainz matches. 2013-05-25 13:18:51 +10:00
Tai Lee
e3fa403ad2 Only execute pathfields expressions and functions if they are called with an Item argument. Otherwise, return an empty string. 2013-05-25 12:28:52 +10:00
Tai Lee
3f4e194c41 We only need to strip the disambiguation from artist names, not the join strings. 2013-05-25 12:19:48 +10:00
Adrian Sampson
72f0505744 discogs: extra space in ambiguous artists (#289) 2013-05-24 12:31:18 -07:00
Adrian Sampson
d877f5e3e8 Merge pull request #289 from Smyds/master
Remove discogs artist disambiguation number
2013-05-24 12:28:50 -07:00