sane-tag-music: fix sandboxing to support renaming

This commit is contained in:
2024-07-11 19:12:55 +00:00
parent 00d644ef07
commit a56795ff79
2 changed files with 5 additions and 0 deletions

View File

@@ -230,6 +230,7 @@ in
"sane-scripts.tag-music".sandbox = {
method = "bwrap";
autodetectCliPaths = "existing";
whitelistPwd = true; # for music renaming
};
"sane-scripts.vpn".fs = lib.foldl'

View File

@@ -95,6 +95,8 @@ logger = logging.getLogger(__name__)
kks = pykakasi.kakasi()
IMAGE_EXTENSIONS = [
# "bmp", # Writing of BMP files is not yet supported
"gif",
"jpg",
"jpeg",
"png",
@@ -109,6 +111,7 @@ def maybe_romanize(a: str) -> str|None:
if a == "お握り": return "onigiri"
if a == "存流": return "ARU"
if a.lower() == "жужжалка": return "zhuzhzhalka" # Russian
if a == "♞": return "knight"
if a == "+": return "."
if a == "&": return "and"
@@ -370,6 +373,7 @@ class Tags:
return os.path.join(artist, filename)
if not (artist and album and title):
logger.warning(f"missing artist/album/title after cleaning path: {self} ({artist!r}, {album!r}, {title!r}")
return None
if self.producer: