summaryrefslogtreecommitdiff
path: root/tidal_dl_ng/helper/path.py
diff options
context:
space:
mode:
authorexislow <exislow@users.noreply.github.com>2024-11-13 12:36:35 +0100
committerGitHub <noreply@github.com>2024-11-13 12:36:35 +0100
commitc75edc9b6ba3821f295e057ffd3972bcd5142b55 (patch)
treed549a9f69c2349421a7f17155ee8638946fabbe7 /tidal_dl_ng/helper/path.py
parentbeea8f1fe75b56ec743b17076d65756bc4e9ec30 (diff)
parentf5ed1c6554dbe5e7dda8ce662ac7ee49919cece3 (diff)
downloadtidal-dl-ng-c75edc9b6ba3821f295e057ffd3972bcd5142b55.tar.gz
Merge pull request #229 from exislow/196-feature-do-not-add-the-2-5-second-pause-until-the-next-file-if-the-current-file-is-skipped
196 feature do not add the 2 5 second pause until the next file if the current file is skipped
Diffstat (limited to 'tidal_dl_ng/helper/path.py')
-rw-r--r--tidal_dl_ng/helper/path.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tidal_dl_ng/helper/path.py b/tidal_dl_ng/helper/path.py
index e6f5b14..627f7c1 100644
--- a/tidal_dl_ng/helper/path.py
+++ b/tidal_dl_ng/helper/path.py
@@ -1,9 +1,9 @@
import math
import os
+import pathlib
import posixpath
import re
import sys
-from pathlib import Path, PosixPath
from urllib.parse import unquote, urlsplit
from pathvalidate import sanitize_filename, sanitize_filepath
@@ -197,7 +197,7 @@ def get_format_template(
def path_file_sanitize(path_file: str, adapt: bool = False, uniquify: bool = False) -> (bool, str):
# Split into path and filename
pathname, filename = os.path.split(path_file)
- file_extension: str = Path(path_file).suffix
+ file_extension: str = pathlib.Path(path_file).suffix
# Sanitize path
try:
@@ -207,7 +207,7 @@ def path_file_sanitize(path_file: str, adapt: bool = False, uniquify: bool = Fal
except ValidationError:
# If adaption of path is allowed in case of an error set path to HOME.
if adapt:
- pathname_sanitized: str = Path.home()
+ pathname_sanitized: str = str(pathlib.Path.home())
else:
raise
@@ -274,10 +274,10 @@ def file_unique_suffix(path_file: str, seperator: str = "_") -> str:
return unique_suffix
-def check_file_exists(path_file: str, extension_ignore: bool = False) -> bool:
+def check_file_exists(path_file: pathlib.Path, extension_ignore: bool = False) -> bool:
if extension_ignore:
- path_file_stem: str = Path(path_file).stem
- path_parent: PosixPath = Path(path_file).parent
+ path_file_stem: str = pathlib.Path(path_file).stem
+ path_parent: pathlib.Path = pathlib.Path(path_file).parent
path_files: [str] = []
for extension in AudioExtensions: