home · contact · privacy
Get rid of unnecessary "./" prefixes to VideoFile.rel_path.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 29 Nov 2024 01:06:21 +0000 (02:06 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 29 Nov 2024 01:06:21 +0000 (02:06 +0100)
src/ytplom/misc.py

index 0cd4c92c5f9d34dcc3402213e160859ae3b56ea0..e325af8c6ce104be8215ddfefefe57df53866df5 100644 (file)
@@ -3,8 +3,8 @@
 # included libs
 from typing import Any, NewType, Optional, Self, TypeAlias
 from os import chdir, environ, getcwd, makedirs, scandir, remove as os_remove
-from os.path import (dirname, isdir, isfile, exists as path_exists,
-                     join as path_join, normpath, splitext, basename)
+from os.path import (basename, dirname, isdir, isfile, exists as path_exists,
+                     join as path_join, splitext)
 from base64 import urlsafe_b64encode, urlsafe_b64decode
 from random import shuffle
 from time import time, sleep
@@ -390,7 +390,7 @@ class VideoFile(DbData):
     @property
     def full_path(self) -> PathStr:
         """Return self.rel_path suffixed under PATH_DOWNLOADS."""
-        return PathStr(normpath(path_join(PATH_DOWNLOADS, self.rel_path)))
+        return PathStr(path_join(PATH_DOWNLOADS, self.rel_path))
 
     @property
     def basename(self) -> PathStr:
@@ -650,7 +650,8 @@ class DownloadsManager:
         old_cwd = getcwd()
         chdir(PATH_DOWNLOADS)
         paths = [file.rel_path for file in files_via_db]
-        for path in [PathStr(e.path) for e in scandir() if isfile(e.path)]:
+        for path in [PathStr(basename(e.path)) for e in scandir()
+                     if isfile(e.path)]:
             if path not in paths:
                 yt_id = self._id_from_filename(path)
                 file = VideoFile(path, yt_id)