sanitize playlist names

Make e. g.
- name: $albumartist/$year-$album.m3u'
work when album data includes non fs-friendly characters
This commit is contained in:
michaelbub 2016-11-10 13:05:18 +01:00
parent c5edd34841
commit 3e53d4caff

View file

@ -20,7 +20,7 @@ from __future__ import division, absolute_import, print_function
from beets.plugins import BeetsPlugin
from beets import ui
from beets.util import mkdirall, normpath, syspath, bytestring_path
from beets.util import mkdirall, normpath, sanitize_path, syspath, bytestring_path
from beets.library import Item, Album, parse_query_string
from beets.dbcore import OrQuery
from beets.dbcore.query import MultipleSort, ParsingError
@ -186,7 +186,7 @@ class SmartPlaylistPlugin(BeetsPlugin):
# As we allow tags in the m3u names, we'll need to iterate through
# the items and generate the correct m3u file names.
for item in items:
m3u_name = item.evaluate_template(name, True)
m3u_name = sanitize_path(item.evaluate_template(name, True), lib.replacements)
if m3u_name not in m3us:
m3us[m3u_name] = []
item_path = item.path