Skip to content
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.

Commit

Permalink
Make minor simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
realshouzy committed Jun 30, 2024
1 parent 79f69e1 commit 50dd573
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions YTDownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ class DownloadOptions(NamedTuple):
# defining helper functions
def _increment_playlist_dir_name(root: Path | str, sub: Path | str) -> Path:
"""Increment the directory if the user downloads a playlist more than once."""
original_path: Path = Path(f"{root}/{sub}")
if not original_path.exists():
if not (original_path := Path(f"{root}/{sub}")).exists():
return original_path

i: int = 1
Expand All @@ -83,8 +82,7 @@ def _increment_playlist_dir_name(root: Path | str, sub: Path | str) -> Path:

def _increment_video_file_name(root: Path | str, file_name: str) -> str:
"""Increment the file if the user downloads a video more than once."""
file_path: Path = Path(f"{root}/{file_name}.mp4")
if not file_path.exists():
if not Path(f"{root}/{file_name}.mp4").exists():
return file_name

i: int = 1
Expand Down

0 comments on commit 50dd573

Please sign in to comment.