From: Christian Heller Date: Fri, 29 Nov 2024 01:06:21 +0000 (+0100) Subject: Get rid of unnecessary "./" prefixes to VideoFile.rel_path. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/balance?a=commitdiff_plain;h=9c0a831570606d5821f2b6d465dd9661c4027d62;p=ytplom Get rid of unnecessary "./" prefixes to VideoFile.rel_path. --- diff --git a/src/ytplom/misc.py b/src/ytplom/misc.py index 0cd4c92..e325af8 100644 --- a/src/ytplom/misc.py +++ b/src/ytplom/misc.py @@ -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)