Commit graph

92 commits

Author SHA1 Message Date
dettrittus
e1d2b5220c Add 'auto' option in acoustid(Fix #629) 2014-07-25 23:40:23 -04: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
Thomas Scholtes
c3ea1ded30 Add item.try_write() to log errors
Many commands and plugins use `item.write()` to update tags. Since the success
of the call is not critical to the functionality of most consumers we want to
catch any exceptions, log an error and continue with our task. The new method
encapsulates this logic.

This fixes #675.
2014-04-10 15:26:05 +02:00
Adrian Sampson
dcee7b6219 dbcore: terminology
Replace "library" and "lib" references in dbcore with "database" and "db" for
short.
2014-01-18 16:36:04 -08:00
Adrian Sampson
1ad1f7634c py26 compatible format strings (fix #490) 2014-01-09 11:22:49 -08:00
Adrian Sampson
c7fe017752 remove Library.{move,store} methods
These methods are now provided by LibModel, which makes dealing with items and
albums symmetric.
2013-08-21 15:34:45 -07: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
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
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
dde4bfab8c Update signature for item_candidates() in chroma plugin. 2013-05-22 08:10:20 +10:00
Tai Lee
3eb6f8e5eb Add discogs plugin, which extends the autotagger to include results from the discogs database.
This is a refactor of the plugin developed by `imenem`.

- Pass `artist`, `album` and `va_likely` to `candidates()` so that
  plugins don't have to work this out from `items` all over again.
- Pass `artist` and `title` to `item_candidates()`.
- Silence spurious `urllib3` info log lines.
- Use a proper "beets" user agent with `discogs_client`.
- Remove `abstract_search` plugin. It seems unnecessary. How many
  music databases are there? How many will beets support? How much
  common code might there be between them? We can add some abstraction
  if or when more databases are supported.
- Derive more AlbumInfo and TrackInfo properties from discogs Release
  objects, especially album ID so that beets doesn't just use the first
  release and think all subsequent releases are duplicates.
- Add basic documentation, doc strings and code comments.
- Sanitise search query. Remove non-word characters and medium info that
  might filter out good search results.
- Use artist `join` strings from discogs Release object when an album
  or track has multiple artists.
- Don't rely on discogs track position, which is unreliable. But tracks
  are in order, so we can recalculate medium and medium_index as long as
  we can extract a consistent medium across tracks from the position.
- Add "various" as a known signal to indicate various artists.
- Prevent `chroma` plugin from returning a a huge track distance for any
  track that is missing an ID (e.g. all discog tracks).
- `TrackInfo.index` should be the release index (calculated by beets),
  not the medium index (derived from discogs track position).
- Add `AlbumInfo.data_source`. It's "Unknown" by default which is shown
  in red when displaying a suggested or selected match. The built in
  auto tagger sets it to "MusicBrainz" which is shown in green. Anything
  else (e.g. "Discogs") is shown in yellow.
- Remove double spaces from album titles (bad data from Discogs).
2013-05-21 21:16:52 +10:00
Adrian Sampson
ae40b97528 chroma: catch acoustid exceptions during submit 2013-03-12 20:30:57 -07:00
Adrian Sampson
aff3fb106d chroma: fingerprint command's write from config
This turns on metadata-writing based on the import.write config option, so
those with this option turned off will be spared any surprises. (Affects #217
and #143.)
2013-03-11 19:19:48 -07:00
Lucas Duailibe
704259b459 fix typo 2013-03-11 19:26:33 -03:00
Lucas Duailibe
a6ae5c4a4f cleaning up 2013-03-11 19:22:03 -03:00
Lucas Duailibe
3390fd339a store fingerprints with the "fingerprint" command 2013-03-11 18:31:53 -03:00
Lucas Duailibe
8a64686ff3 store fingerprints 2013-03-11 17:56:13 -03:00
Adrian Sampson
7a410f636b happy new year
For future reference, this command did the trick:
ack -l 'Copyright 201' | xargs perl -pi -E 's/Copyright 201./Copyright 2013/'
2013-01-11 10:43:41 -08:00
Adrian Sampson
3ef9e006f4 finish confit-ifying all the plugins 2012-12-13 17:14:19 -08:00
Adrian Sampson
6c94358b13 begin Confit-ifying plugins in alphabetical order 2012-12-13 12:31:10 -08:00
Adrian Sampson
3e9135ee7c syspath-ify call to pyacoustid (GC-464) 2012-12-07 14:49:11 -08:00
Adrian Sampson
ca1581996d fix early call to imported_items in chroma 2012-07-24 14:56:14 -07:00
Adrian Sampson
ec849a3f88 chroma & lyrics: crash due to name change
I changed ImportTask.all_items to ImportTask.imported_items but forgot to change
the calls in the chroma and lyrics plugins.
2012-07-03 17:18:23 -07:00
Adrian Sampson
d83c1fad6b chroma: use multiple recording candidates 2012-06-06 12:35:25 -07:00
Adrian Sampson
face0ba323 chroma submission: fix crash; better errors 2012-05-17 14:54:58 -07:00
Adrian Sampson
760fff3ace use new "except ... as ...:" syntax
This replaces the older "except ..., ...:" syntax.
2012-05-13 21:18:50 -07:00
Adrian Sampson
f6b37d2c8c remove with_statement __future__ imports
This is the first of several commits that will modernize the beets codebase for
Python 2.6 conventions. (Compatibility with Python 2.5 is hereby abandoned.)
2012-05-13 20:39:07 -07:00
Adrian Sampson
b68e87b92c The Great Trailing Whitespace Purge of 2012
What can I say? I used to use TextMate!
2012-05-13 20:22:17 -07:00
Adrian Sampson
6ce08c4ce6 merge 2012-05-08 11:59:41 -07:00
Adrian Sampson
8b25a86ee3 use 2.6-compatible format strings 2012-05-08 11:46:08 -07:00
Adrian Sampson
5a9cc6a2d9 fix crash on 0 chroma matches for singleton 2012-05-06 21:19:13 -07:00
Adrian Sampson
2d20e3582b typo: >=, not > 2012-04-01 20:58:49 -07:00
Adrian Sampson
44bcc5b3bd chroma: "beet submit" command (#332) 2012-04-01 20:41:27 -07:00
Adrian Sampson
01dce53212 store Acoustid data in DB & file
This is accomplished via a new event, "import_task_apply", which is called
right after metadata is applied to newly-imported items.

This change makes chroma REQUIRE a new version (0.6) of pyacoustid. Users with
older versions installed will see complaints about a missing method
"fingerprint_file".
2012-04-01 19:38:46 -07:00
Adrian Sampson
82a4bafc3e chroma: fingerprint when task begins
The old "caching"-based approach to fingerprinting was kinda hacky to begin
with. Now, the chroma plugin has an explicit opportunity (in the form of a new
event) to perform its initial fingerprinting and lookup for all tracks. Then,
this information is used explicitly during the autotagging phase rather than
being used transparently through memoization of the lookup function.
2012-04-01 18:55:14 -07:00
Adrian Sampson
aeeb040fe4 chroma: more logging on match failure 2012-04-01 17:55:30 -07:00
Adrian Sampson
8fca659392 log errors when fingerprinting fails 2012-02-26 17:51:19 -08:00
Adrian Sampson
eb8b194508 handle acoustid response w/ no recording (#322) 2012-01-29 17:50:03 -08:00
Adrian Sampson
99bb4df94b check for releases in acoustid result (fixes #252) 2011-11-19 17:55:19 -08:00
Adrian Sampson
f2bb220f5a chroma plugin (for acoustid fingerprinting) (#152)
--HG--
rename : docs/plugins/lastid.rst => docs/plugins/chroma.rst
2011-11-12 15:33:00 -08:00