From 3e53d4caff31d4f9229572b60c9f4b87086565fe Mon Sep 17 00:00:00 2001 From: michaelbub Date: Thu, 10 Nov 2016 13:05:18 +0100 Subject: [PATCH] sanitize playlist names Make e. g. - name: $albumartist/$year-$album.m3u' work when album data includes non fs-friendly characters --- beetsplug/smartplaylist.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beetsplug/smartplaylist.py b/beetsplug/smartplaylist.py index 416dc37f5..73c3f59eb 100644 --- a/beetsplug/smartplaylist.py +++ b/beetsplug/smartplaylist.py @@ -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