mirror of
https://github.com/beetbox/beets.git
synced 2025-12-28 11:32:30 +01:00
playlist: Use new "named query" functionality
This commit is contained in:
parent
22c8289269
commit
7efc67eb03
1 changed files with 4 additions and 10 deletions
|
|
@ -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__()
|
||||
|
|
|
|||
Loading…
Reference in a new issue