Log search queries

This commit is contained in:
Stein Magnus Jodal 2010-08-09 13:17:09 +02:00
parent 8997c08595
commit e2ed3b2d61
3 changed files with 6 additions and 3 deletions

View File

@ -68,11 +68,12 @@ class DespotifyLibraryController(BaseLibraryController):
for value in values:
if field == u'track':
field = u'title'
if field is u'any':
if field == u'any':
spotify_query.append(value)
else:
spotify_query.append(u'%s:"%s"' % (field, value))
spotify_query = u' '.join(query)
logger.debug(u'Spotify search query: %s', spotify_query)
result = self.backend.spotify.search(spotify_query.encode(ENCODING))
if (result is None or result.playlist.tracks[0].get_uri() ==
'spotify:track:0000000000000000000000'):

View File

@ -77,11 +77,12 @@ class LibspotifyLibraryController(BaseLibraryController):
for value in values:
if field == u'track':
field = u'title'
if field is u'any':
if field == u'any':
spotify_query.append(value)
else:
spotify_query.append(u'%s:"%s"' % (field, value))
spotify_query = u' '.join(spotify_query)
logger.debug(u'Spotify search query: %s', spotify_query)
logger.debug(u'In search method, search for: %s' % spotify_query)
my_end, other_end = multiprocessing.Pipe()
self.backend.spotify.search(spotify_query.encode(ENCODING), other_end)

View File

@ -117,7 +117,7 @@ class MpdFrontend(object):
r'"?(?:[Aa]lbum|[Aa]rtist|[Ff]ilename|[Tt]itle|[Aa]ny)"? "[^"]+"')
query_parts = re.findall(query_pattern, mpd_query)
query_part_pattern = (
r'"?(?P<field>([Aa]lbum|[Aa]rtist|[Ff]ilename|[Tt]itle|[Aa]ny))"?\s'
r'"?(?P<field>([Aa]lbum|[Aa]rtist|[Ff]ilename|[Tt]itle|[Aa]ny))"? '
r'"(?P<what>[^"]+)"')
query = {}
for query_part in query_parts:
@ -131,6 +131,7 @@ class MpdFrontend(object):
query[field].append(what)
else:
query[field] = [what]
logger.debug(u'Search query: %s', query)
return query
@handle_pattern(r'^disableoutput "(?P<outputid>\d+)"$')