diff --git a/get_youtube_videos/get_youtube_videos.py b/get_youtube_videos/get_youtube_videos.py index 3629172..5ef3413 100644 --- a/get_youtube_videos/get_youtube_videos.py +++ b/get_youtube_videos/get_youtube_videos.py @@ -147,12 +147,19 @@ class GetYoutubeVideos: self.channel_count+1, self.config['channel_limit'] ) + if self.config['channel_folder'] and 'channel' in video_info: + download_dir = os.path.join( + self.config['download_dir'], + video_info['channel'] + ) + else: + download_dir = self.config['download_dir'] ydl_opts = { 'logger': self._log, 'progress_hooks': [self._yt_progress_hook], 'paths': { 'temp': '/tmp', - 'home': self.config['download_dir'] + 'home': download_dir }, 'writesubtitles': True, 'writeautomaticsub': True, @@ -327,6 +334,12 @@ class GetYoutubeVideos: exclude it from the requested languages, e.g. ['all', '-live_chat']. And you can use wildcards like en.*''' ) +@click.option( + '--channels-folder', '-c', + is_flag=True, + default=False, + help='Create folders per channel and save videos inside their channel folder' +) @click_config_file.configuration_option() def __main__(**kwargs): return GetYoutubeVideos(**kwargs)