diff --git a/beetsplug/playlist.py b/beetsplug/playlist.py index 624791ee4..654e3e1d0 100644 --- a/beetsplug/playlist.py +++ b/beetsplug/playlist.py @@ -19,7 +19,7 @@ import beets class PlaylistQuery(beets.dbcore.FieldQuery): """Matches files listed by a playlist file. """ - def __init__(self, field, pattern, fast=False): + def __init__(self, field, pattern, fast=True): super(PlaylistQuery, self).__init__(field, pattern, fast) config = beets.config['playlist'] @@ -51,6 +51,14 @@ class PlaylistQuery(beets.dbcore.FieldQuery): os.path.join(relative_to, line.rstrip()) )) + def col_clause(self): + if not self.paths: + # Playlist is empty + return '0', () + clause = 'BYTELOWER(path) IN ({0})'.format( + ', '.join('BYTELOWER(?)' for path in self.paths)) + return clause, (beets.library.BLOB_TYPE(p) for p in self.paths) + def match(self, item): return item.path in self.paths