From fbd90b050733a2445d3c10ac182e8704b342616c Mon Sep 17 00:00:00 2001 From: J0J0 Todos <2733783+JOJ0@users.noreply.github.com> Date: Sun, 7 Sep 2025 17:45:41 +0200 Subject: [PATCH] lastgenre: Use pathlib for opening tree file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit instead of syspath(normpath()) Co-authored-by: Šarūnas Nejus --- beetsplug/lastgenre/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/beetsplug/lastgenre/__init__.py b/beetsplug/lastgenre/__init__.py index c314a69ab..3e9186106 100644 --- a/beetsplug/lastgenre/__init__.py +++ b/beetsplug/lastgenre/__init__.py @@ -24,6 +24,7 @@ https://gist.github.com/1241307 import os import traceback +from pathlib import Path from typing import Union import pylast @@ -140,9 +141,7 @@ class LastGenrePlugin(plugins.BeetsPlugin): # Read the tree if c14n_filename: self._log.debug("Loading canonicalization tree {}", c14n_filename) - with open( - syspath(normpath(c14n_filename)), "r", encoding="utf-8" - ) as f: + with Path(c14n_filename).open(encoding="utf-8") as f: genres_tree = yaml.safe_load(f) flatten_tree(genres_tree, [], c14n_branches) return c14n_branches, canonicalize