lastgenre: Use pathlib for opening tree file

instead of syspath(normpath())

Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
This commit is contained in:
J0J0 Todos 2025-09-07 17:45:41 +02:00 committed by J0J0 Todos
parent 0cdb1224b9
commit fbd90b0507

View file

@ -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