mirror of
https://github.com/beetbox/beets.git
synced 2026-02-20 14:21:34 +01:00
fix track query syntax
It turns out the documentation for MB was wrong here: http://wiki.musicbrainz.org/XMLWebService#Searching_Tracks At the time that I read it, at least, that said the field for track title was named "title". It's actually named "track".
This commit is contained in:
parent
f567c505d8
commit
6ba433e3b1
2 changed files with 7 additions and 2 deletions
|
|
@ -23,6 +23,7 @@ principal interface is the function `match_album`.
|
|||
from __future__ import with_statement # for Python 2.5
|
||||
import re
|
||||
import time
|
||||
import logging
|
||||
import musicbrainz2.webservice as mbws
|
||||
from musicbrainz2.model import Release
|
||||
from threading import Lock
|
||||
|
|
@ -33,6 +34,8 @@ VARIOUS_ARTISTS_ID = VARIOUS_ARTISTS_ID.rsplit('/', 1)[1]
|
|||
|
||||
class ServerBusyError(Exception): pass
|
||||
|
||||
log = logging.getLogger('beets')
|
||||
|
||||
# We hard-code IDs for artists that can't easily be searched for.
|
||||
SPECIAL_CASE_ARTISTS = {
|
||||
'!!!': 'f26c72d3-e52c-467b-b651-679c73d8e1a7',
|
||||
|
|
@ -164,6 +167,7 @@ def find_releases(criteria, limit=SEARCH_LIMIT):
|
|||
|
||||
# Build the filter and send the query.
|
||||
query = _lucene_query(criteria)
|
||||
log.debug('album query: %s' % query)
|
||||
return get_releases(limit=limit, query=query)
|
||||
|
||||
def find_tracks(criteria, limit=SEARCH_LIMIT):
|
||||
|
|
@ -172,6 +176,7 @@ def find_tracks(criteria, limit=SEARCH_LIMIT):
|
|||
`find_releases`.
|
||||
"""
|
||||
query = _lucene_query(criteria)
|
||||
log.debug('track query: %s' % query)
|
||||
filt = mbws.TrackFilter(limit=limit, query=query)
|
||||
results = _query_wrap(mbws.Query().getTracks, filter=filt)
|
||||
for result in results:
|
||||
|
|
@ -263,7 +268,7 @@ def match_track(artist, title):
|
|||
"""
|
||||
return find_tracks({
|
||||
'artist': artist,
|
||||
'title': title,
|
||||
'track': title,
|
||||
})
|
||||
|
||||
def album_for_id(albumid):
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ class LastIdPlugin(BeetsPlugin):
|
|||
# Do a full search.
|
||||
criteria = {
|
||||
'artist': last_data['artist'],
|
||||
'title': last_data['title'],
|
||||
'track': last_data['title'],
|
||||
}
|
||||
if last_data['artist_mbid']:
|
||||
criteria['artistid'] = last_data['artist_mbid']
|
||||
|
|
|
|||
Loading…
Reference in a new issue