Add a sorted_playlist macro
This commit is contained in:
parent
ca8d753cd0
commit
55205ec0ac
2 changed files with 16 additions and 3 deletions
|
|
@ -87,7 +87,7 @@ smartplaylist:
|
||||||
- name: "precision.m3u"
|
- name: "precision.m3u"
|
||||||
query: ['plprecision:1']
|
query: ['plprecision:1']
|
||||||
- name: "exercise.m3u"
|
- name: "exercise.m3u"
|
||||||
query: ['label:exercise-'] # ['^plexercise::^$ plexercise-']
|
query: ['sorted_playlist:exercise'] # ['^plexercise::^$ plexercise-']
|
||||||
- name: "chiptune.m3u"
|
- name: "chiptune.m3u"
|
||||||
query: ['genre:chiptune', 'genre:8-bit', 'plchiptune:1']
|
query: ['genre:chiptune', 'genre:8-bit', 'plchiptune:1']
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,23 @@ def parse_sorted_query_override(
|
||||||
"""Given a list of strings, create the `Query` and `Sort` that they
|
"""Given a list of strings, create the `Query` and `Sort` that they
|
||||||
represent.
|
represent.
|
||||||
"""
|
"""
|
||||||
# First, expand any playlist: macros
|
# First, expand any playlist: and sorted_playlist: macros
|
||||||
expanded_parts = []
|
expanded_parts = []
|
||||||
|
|
||||||
for part in parts:
|
for part in parts:
|
||||||
if part.startswith('playlist:') and not re.match(r"[+-]$", part):
|
if part.startswith('sorted_playlist:'):
|
||||||
|
# Extract playlist name
|
||||||
|
playlist_name = part[len("sorted_playlist:"):]
|
||||||
|
|
||||||
|
if valid_playlist(playlist_name):
|
||||||
|
# Expand to the query
|
||||||
|
expanded_parts.extend(expand_playlist_query(playlist_name))
|
||||||
|
# Inject the sort
|
||||||
|
expanded_parts.append(f"playlist:{playlist_name}-")
|
||||||
|
else:
|
||||||
|
# Unknown playlist, just let it go through
|
||||||
|
expanded_parts.append(part)
|
||||||
|
elif part.startswith('playlist:') and not re.match(r"[+-]$", part):
|
||||||
playlist_name = part[len("playlist:"):]
|
playlist_name = part[len("playlist:"):]
|
||||||
|
|
||||||
if valid_playlist(playlist_name):
|
if valid_playlist(playlist_name):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue