From f4ab7d7816d7b8871a48e5b2db68f89965550a73 Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Tue, 21 Mar 2023 20:21:44 +0100 Subject: Using relative paths for TMSU --- file-tagger.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'file-tagger.py') diff --git a/file-tagger.py b/file-tagger.py index 2b76947..c56e760 100644 --- a/file-tagger.py +++ b/file-tagger.py @@ -82,7 +82,7 @@ def tmsu_tags(base, file): logger = logging.getLogger(__name__) logger.debug("Getting existing tags for file {}".format(file)) tags = set() - proc = subprocess.Popen(["tmsu", "tags", file], cwd=base, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + proc = subprocess.Popen(["tmsu", "tags", os.path.relpath(file, base)], cwd=base, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc.wait() logger.debug("TMSU returncode: {}".format(proc.returncode)) if proc.returncode == 0: @@ -104,13 +104,13 @@ def tmsu_tag(base, file, tags, untag=True): logger = logging.getLogger(__name__) if untag: logger.debug("Untagging file") - proc = subprocess.Popen(["tmsu", "untag", "--all", file], cwd=base, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + proc = subprocess.Popen(["tmsu", "untag", "--all", os.path.relpath(file, base)], cwd=base, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc.wait() if proc.returncode != 0: logger.error("Could not untag file {}".format(file)) if tags: logger.debug("Writing tags {}".format(tags)) - proc = subprocess.Popen(["tmsu", "tag", file] + list(tags), cwd=base, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + proc = subprocess.Popen(["tmsu", "tag", os.path.relpath(file, base)] + list(tags), cwd=base, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc.wait() if proc.returncode != 0: logger.error("Could not write tags to file {}".format(file)) -- cgit v1.2.1