From 6da72beeb092e05a8f1bcecc35c216e71e499797 Mon Sep 17 00:00:00 2001 From: J0J0 Todos Date: Sun, 7 Sep 2025 18:58:42 +0200 Subject: [PATCH] lastgenre: Add expanduser to whitelist/tree load --- beetsplug/lastgenre/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beetsplug/lastgenre/__init__.py b/beetsplug/lastgenre/__init__.py index bf4081261..343c50888 100644 --- a/beetsplug/lastgenre/__init__.py +++ b/beetsplug/lastgenre/__init__.py @@ -120,7 +120,7 @@ class LastGenrePlugin(plugins.BeetsPlugin): if wl_filename in (True, ""): # Indicates the default whitelist. wl_filename = WHITELIST if wl_filename: - text = Path(wl_filename).read_text(encoding="utf-8") + text = Path(wl_filename).expanduser().read_text(encoding="utf-8") for line in text.splitlines(): if (line := line.strip().lower()) and not line.startswith("#"): whitelist.add(line) @@ -140,7 +140,7 @@ class LastGenrePlugin(plugins.BeetsPlugin): # Read the tree if c14n_filename: self._log.debug("Loading canonicalization tree {}", c14n_filename) - with Path(c14n_filename).open(encoding="utf-8") as f: + with Path(c14n_filename).expanduser().open(encoding="utf-8") as f: genres_tree = yaml.safe_load(f) flatten_tree(genres_tree, [], c14n_branches) return c14n_branches, canonicalize