From 0587a7240f48bcde430073ec61966e65760d1cf8 Mon Sep 17 00:00:00 2001 From: J0J0 T Date: Fri, 2 Sep 2022 07:17:00 +0200 Subject: [PATCH] Fix error when output filename is an url - Fixes #16 - mb_trackid contains an URL populated by some metadata source plugins (eg. bandcamp) - use the md5 filename generation lines (that were already there for cases where mb_trackid is not present at all) in case mb_trackid contains a slash (/) character - could be advanced later if other unwanted characters populated by source plugins are found in mb_trackid but should be a good enough for now fix. --- beetsplug/xtractor/command.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beetsplug/xtractor/command.py b/beetsplug/xtractor/command.py index 3a39f4c..e7ec70e 100755 --- a/beetsplug/xtractor/command.py +++ b/beetsplug/xtractor/command.py @@ -262,7 +262,7 @@ def _execute_on_each_items(self, items, func): def _get_output_path_for_item(self, item: Item): identifier = item.get("mb_trackid") - if not identifier: + if not identifier or '/' in identifier: input_path = self._get_input_path_for_item(item) identifier = hashlib.md5(input_path.encode('utf-8')).hexdigest()