mpd: Ensure quotes are matched
This commit is contained in:
parent
e6cff216a3
commit
064a005ce3
@ -180,8 +180,7 @@ def playlist(context):
|
||||
return playlistinfo(context)
|
||||
|
||||
|
||||
@handle_request(r'playlistfind\ (?P<tag>[^"]+)\ "(?P<needle>[^"]+)"$')
|
||||
@handle_request(r'playlistfind\ "(?P<tag>[^"]+)"\ "(?P<needle>[^"]+)"$')
|
||||
@handle_request(r'playlistfind\ ("?)(?P<tag>[^"]+)\1\ "(?P<needle>[^"]+)"$')
|
||||
def playlistfind(context, tag, needle):
|
||||
"""
|
||||
*musicpd.org, current playlist section:*
|
||||
@ -263,8 +262,7 @@ def playlistinfo(context, songpos=None, start=None, end=None):
|
||||
return translator.tracks_to_mpd_format(tl_tracks, start, end)
|
||||
|
||||
|
||||
@handle_request(r'playlistsearch\ "(?P<tag>[^"]+)"\ "(?P<needle>[^"]+)"$')
|
||||
@handle_request(r'playlistsearch\ (?P<tag>\w+)\ "(?P<needle>[^"]+)"$')
|
||||
@handle_request(r'playlistsearch\ ("?)(?P<tag>\w+)\1\ "(?P<needle>[^"]+)"$')
|
||||
def playlistsearch(context, tag, needle):
|
||||
"""
|
||||
*musicpd.org, current playlist section:*
|
||||
@ -282,8 +280,7 @@ def playlistsearch(context, tag, needle):
|
||||
raise MpdNotImplemented # TODO
|
||||
|
||||
|
||||
@handle_request(r'plchanges\ (?P<version>-?\d+)$')
|
||||
@handle_request(r'plchanges\ "(?P<version>-?\d+)"$')
|
||||
@handle_request(r'plchanges\ ("?)(?P<version>-?\d+)\1$')
|
||||
def plchanges(context, version):
|
||||
"""
|
||||
*musicpd.org, current playlist section:*
|
||||
|
||||
@ -11,7 +11,7 @@ from mopidy.frontends.mpd.protocol import handle_request, stored_playlists
|
||||
|
||||
|
||||
LIST_QUERY = r"""
|
||||
"? # Optional quote around the field type
|
||||
("?) # Optional quote around the field type
|
||||
(?P<field>( # Field to list in the response
|
||||
[Aa]rtist
|
||||
| [Aa]lbumartist
|
||||
@ -21,7 +21,7 @@ LIST_QUERY = r"""
|
||||
| [Gg]enre
|
||||
| [Pp]erformer
|
||||
))
|
||||
"? # End of optional quote around the field type
|
||||
\1 # End of optional quote around the field type
|
||||
(?: # Non-capturing group for optional search query
|
||||
\ # A single space
|
||||
(?P<mpd_query>.*)
|
||||
@ -47,10 +47,10 @@ SEARCH_FIELDS = r"""
|
||||
|
||||
SEARCH_QUERY = r"""
|
||||
(?P<mpd_query>
|
||||
(
|
||||
(?: # Non-capturing group for repeating query pairs
|
||||
"? # Optional quote around the field type
|
||||
(?:
|
||||
""" + SEARCH_FIELDS + """
|
||||
""" + SEARCH_FIELDS + r"""
|
||||
)
|
||||
"? # End of optional quote around the field type
|
||||
\ # A single space
|
||||
@ -454,7 +454,8 @@ def lsinfo(context, uri=None):
|
||||
raise MpdNotImplemented # TODO
|
||||
|
||||
|
||||
@handle_request(r'rescan(\ "(?P<uri>[^"]+)")*$')
|
||||
@handle_request(r'rescan$')
|
||||
@handle_request(r'rescan\ "(?P<uri>[^"]+)"$')
|
||||
def rescan(context, uri=None):
|
||||
"""
|
||||
*musicpd.org, music database section:*
|
||||
@ -555,7 +556,8 @@ def searchaddpl(context, playlist_name, mpd_query):
|
||||
context.core.playlists.save(playlist)
|
||||
|
||||
|
||||
@handle_request(r'update(\ "(?P<uri>[^"]+)")*$')
|
||||
@handle_request(r'update$')
|
||||
@handle_request(r'update\ "(?P<uri>[^"]+)"$')
|
||||
def update(context, uri=None, rescan_unmodified_files=False):
|
||||
"""
|
||||
*musicpd.org, music database section:*
|
||||
|
||||
@ -6,8 +6,7 @@ from mopidy.frontends.mpd.exceptions import (
|
||||
MpdArgError, MpdNoExistError, MpdNotImplemented)
|
||||
|
||||
|
||||
@handle_request(r'consume\ (?P<state>[01])$')
|
||||
@handle_request(r'consume\ "(?P<state>[01])"$')
|
||||
@handle_request(r'consume\ ("?)(?P<state>[01])\1$')
|
||||
def consume(context, state):
|
||||
"""
|
||||
*musicpd.org, playback section:*
|
||||
@ -129,8 +128,7 @@ def play(context):
|
||||
return context.core.playback.play().get()
|
||||
|
||||
|
||||
@handle_request(r'playid\ (?P<tlid>-?\d+)$')
|
||||
@handle_request(r'playid\ "(?P<tlid>-?\d+)"$')
|
||||
@handle_request(r'playid\ ("?)(?P<tlid>-?\d+)\1$')
|
||||
def playid(context, tlid):
|
||||
"""
|
||||
*musicpd.org, playback section:*
|
||||
@ -157,8 +155,7 @@ def playid(context, tlid):
|
||||
return context.core.playback.play(tl_tracks[0]).get()
|
||||
|
||||
|
||||
@handle_request(r'play\ (?P<songpos>-?\d+)$')
|
||||
@handle_request(r'play\ "(?P<songpos>-?\d+)"$')
|
||||
@handle_request(r'play\ ("?)(?P<songpos>-?\d+)\1$')
|
||||
def playpos(context, songpos):
|
||||
"""
|
||||
*musicpd.org, playback section:*
|
||||
@ -252,8 +249,7 @@ def previous(context):
|
||||
return context.core.playback.previous().get()
|
||||
|
||||
|
||||
@handle_request(r'random\ (?P<state>[01])$')
|
||||
@handle_request(r'random\ "(?P<state>[01])"$')
|
||||
@handle_request(r'random\ ("?)(?P<state>[01])\1$')
|
||||
def random(context, state):
|
||||
"""
|
||||
*musicpd.org, playback section:*
|
||||
@ -268,8 +264,7 @@ def random(context, state):
|
||||
context.core.tracklist.random = False
|
||||
|
||||
|
||||
@handle_request(r'repeat\ (?P<state>[01])$')
|
||||
@handle_request(r'repeat\ "(?P<state>[01])"$')
|
||||
@handle_request(r'repeat\ ("?)(?P<state>[01])\1$')
|
||||
def repeat(context, state):
|
||||
"""
|
||||
*musicpd.org, playback section:*
|
||||
@ -314,8 +309,7 @@ def replay_gain_status(context):
|
||||
return 'off' # TODO
|
||||
|
||||
|
||||
@handle_request(r'seek\ (?P<songpos>\d+)\ (?P<seconds>\d+)$')
|
||||
@handle_request(r'seek\ "(?P<songpos>\d+)"\ "(?P<seconds>\d+)"$')
|
||||
@handle_request(r'seek\ ("?)(?P<songpos>\d+)\1\ ("?)(?P<seconds>\d+)\3$')
|
||||
def seek(context, songpos, seconds):
|
||||
"""
|
||||
*musicpd.org, playback section:*
|
||||
@ -370,8 +364,7 @@ def seekcur(context, position=None, diff=None):
|
||||
context.core.playback.seek(position).get()
|
||||
|
||||
|
||||
@handle_request(r'setvol\ (?P<volume>[-+]*\d+)$')
|
||||
@handle_request(r'setvol\ "(?P<volume>[-+]*\d+)"$')
|
||||
@handle_request(r'setvol\ ("?)(?P<volume>[-+]*\d+)\1$')
|
||||
def setvol(context, volume):
|
||||
"""
|
||||
*musicpd.org, playback section:*
|
||||
@ -392,8 +385,7 @@ def setvol(context, volume):
|
||||
context.core.playback.volume = volume
|
||||
|
||||
|
||||
@handle_request(r'single\ (?P<state>[01])$')
|
||||
@handle_request(r'single\ "(?P<state>[01])"$')
|
||||
@handle_request(r'single\ ("?)(?P<state>[01])\1$')
|
||||
def single(context, state):
|
||||
"""
|
||||
*musicpd.org, playback section:*
|
||||
|
||||
@ -7,8 +7,7 @@ from mopidy.frontends.mpd.protocol import handle_request
|
||||
from mopidy.frontends.mpd.translator import playlist_to_mpd_format
|
||||
|
||||
|
||||
@handle_request(r'listplaylist\ (?P<name>\w+)$')
|
||||
@handle_request(r'listplaylist\ "(?P<name>[^"]+)"$')
|
||||
@handle_request(r'listplaylist\ ("?)(?P<name>[^"]+)\1$')
|
||||
def listplaylist(context, name):
|
||||
"""
|
||||
*musicpd.org, stored playlists section:*
|
||||
@ -29,8 +28,7 @@ def listplaylist(context, name):
|
||||
return ['file: %s' % t.uri for t in playlist.tracks]
|
||||
|
||||
|
||||
@handle_request(r'listplaylistinfo\ (?P<name>\w+)$')
|
||||
@handle_request(r'listplaylistinfo\ "(?P<name>[^"]+)"$')
|
||||
@handle_request(r'listplaylistinfo\ ("?)(?P<name>[^"]+)\1$')
|
||||
def listplaylistinfo(context, name):
|
||||
"""
|
||||
*musicpd.org, stored playlists section:*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user