diff options
author | nathansmithsmith <thenathansmithsmith@gmail.com> | 2024-01-14 22:32:48 +0000 |
---|---|---|
committer | nathansmithsmith <thenathansmithsmith@gmail.com> | 2024-01-14 22:32:48 +0000 |
commit | 563499ce3d39be5e906a62260e3098c14994f698 (patch) | |
tree | 09765dedc33499a6df09c787bf5e2f33a21cba14 /src/model/youload_playlist.py | |
parent | 06b4e71ce3d0f0b82a9e7ed9608a04285091c26d (diff) | |
download | youload-563499ce3d39be5e906a62260e3098c14994f698.tar.gz youload-563499ce3d39be5e906a62260e3098c14994f698.tar.bz2 youload-563499ce3d39be5e906a62260e3098c14994f698.zip |
Numbers addedrelease1.1
Diffstat (limited to 'src/model/youload_playlist.py')
-rw-r--r-- | src/model/youload_playlist.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/model/youload_playlist.py b/src/model/youload_playlist.py index f23533f..a021b83 100644 --- a/src/model/youload_playlist.py +++ b/src/model/youload_playlist.py @@ -31,20 +31,26 @@ class YouLoadPlayList: """Gets the playlist ready for download. Creates the output folder and that stuff.""" os.mkdir(self.folder_name) - def download_video(self, video_num: int) -> str: + def download_video(self, video_num: int, use_prefix: bool) -> str: """Download video at 'video_num'""" video = self.yt_playlist.videos[video_num] video_size = video.streams.get_highest_resolution().filesize + # Create prefix. + filename_prefix = "" + + if use_prefix: + filename_prefix = str(video_num + 1) + " " + # Download this fucker. if self.download_type == "highest": - video.streams.get_highest_resolution().download(output_path=self.folder_name) + video.streams.get_highest_resolution().download(output_path=self.folder_name, filename_prefix=filename_prefix) elif self.download_type == "lowest": - video.streams.get_lowest_resolution().download(output_path=self.folder_name) + video.streams.get_lowest_resolution().download(output_path=self.folder_name, filename_prefix=filename_prefix) elif self.download_type == "audio": - video.streams.get_audio_only().download(output_path=self.folder_name) + video.streams.get_audio_only().download(output_path=self.folder_name, filename_prefix=filename_prefix) else: - video.streams.get_by_resolution(self.download_type).download(output_path=self.folder_name) + video.streams.get_by_resolution(self.download_type).download(output_path=self.folder_name, filename_prefix=filename_prefix) return f"Title: {video.title}, Size: {video_size // (1024 ** 2)} MB" |