From 7efc67eb0361ff731f5c756e43c99107c49058f9 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 17 Feb 2019 13:52:00 -0500 Subject: [PATCH] playlist: Use new "named query" functionality --- beetsplug/playlist.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/beetsplug/playlist.py b/beetsplug/playlist.py index e5c80f129..8b58b03be 100644 --- a/beetsplug/playlist.py +++ b/beetsplug/playlist.py @@ -17,11 +17,11 @@ import fnmatch import beets -class PlaylistQuery(beets.dbcore.FieldQuery): +class PlaylistQuery(beets.dbcore.Query): """Matches files listed by a playlist file. """ - def __init__(self, field, pattern, fast=True): - super(PlaylistQuery, self).__init__(field, pattern, fast) + def __init__(self, pattern): + self.pattern = pattern config = beets.config['playlist'] # Get the full path to the playlist @@ -74,14 +74,8 @@ class PlaylistQuery(beets.dbcore.FieldQuery): return item.path in self.paths -class PlaylistType(beets.dbcore.types.String): - """Custom type for playlist query. - """ - query = PlaylistQuery - - class PlaylistPlugin(beets.plugins.BeetsPlugin): - item_types = {'playlist': PlaylistType()} + item_queries = {'playlist': PlaylistQuery} def __init__(self): super(PlaylistPlugin, self).__init__()