# 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
@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:
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)