smartplaylist: split query w/ shlex (fixes #256)

This commit is contained in:
Adrian Sampson 2013-04-21 20:55:07 -07:00
parent aaafba4d28
commit bf904187e2
3 changed files with 12 additions and 7 deletions

View file

@ -17,7 +17,7 @@
from __future__ import print_function
from beets.plugins import BeetsPlugin
from beets import config, ui
from beets import config, ui, library
from beets.util import normpath, syspath
from beets.util.functemplate import Template
import os
@ -36,7 +36,7 @@ def update_playlists(lib):
relative_to = normpath(relative_to)
for playlist in playlists:
items = lib.items(playlist['query'])
items = lib.items(library.AndQuery.from_string(playlist['query']))
m3us = {}
basename = playlist['name'].encode('utf8')
# As we allow tags in the m3u names, we'll need to iterate through

View file

@ -23,15 +23,18 @@ Changelog
* When listing the items in an album, the items are now always in track-number
order. This should lead to more predictable listings from the
:doc:`/plugins/importfeeds`.
* :doc:`/plugins/smartplaylist`: Queries are now split using shell-like syntax
instead of just whitespace, so you can now construct terms that contain
spaces.
* :doc:`/plugins/lastgenre`: The ``force`` config option now defaults to true
and controls the behavior of the import hook. (Previously, new genres were
always forced during import.)
* :doc:`/plugins/web`: Fix an error when specifying the hostname on the
command line.
* :doc:`/plugins/web`: The underlying API was expanded slightly to support
`Tomahawk`_ collections. And file transfers now have a "Content-Length"
header. Thanks to Uwe L. Korn.
* :doc:`/plugins/lastgenre`: Fix an error when using genre canonicalization.
* :doc:`/plugins/lastgenre`: The ``force`` config option now defaults to true
and controls the behavior of the import hook. (Previously, new genres were
always forced during import.)
.. _Tomahawk: http://www.tomahawk-player.org/

View file

@ -30,8 +30,10 @@ If you intend to use this plugin to generate playlists for MPD, you should set
You can generate as many playlists as you want by adding them to the
``playlists`` section, using beets query syntax (see
:doc:`/reference/query`) for ``query`` and the file name to be generated for
``name``. If you have existing files with the same names, you should
back them up---they will be overwritten when the plugin runs.
``name``. The query will be split using shell-like syntax, so if you need to
use spaces in the query, be sure to quote them (e.g., ``artist:"The Beatles"``).
If you have existing files with the same names, you should back them up---they
will be overwritten when the plugin runs.
For more advanced usage, you can use template syntax (see
:doc:`/reference/pathformat/`) in the ``name`` field. For example::