diff options
author | Leonard Kugis <leonard@kug.is> | 2023-03-21 20:21:44 +0100 |
---|---|---|
committer | Leonard Kugis <leonard@kug.is> | 2023-03-21 20:21:44 +0100 |
commit | f4ab7d7816d7b8871a48e5b2db68f89965550a73 (patch) | |
tree | 8e667866b19259bbcca3520aa7e6be31797da683 /file-tagger.py | |
parent | ab237445e95f164403ef693063fe5ffc89926343 (diff) |
Using relative paths for TMSU
Diffstat (limited to 'file-tagger.py')
-rw-r--r-- | file-tagger.py | 6 |
1 files changed, 3 insertions, 3 deletions
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)) |