Classify by channel

This commit is contained in:
Antonio J. Delgado 2024-11-18 14:37:01 +02:00
parent 62bb7d96ba
commit f8db4deca7

View file

@ -147,12 +147,19 @@ class GetYoutubeVideos:
self.channel_count+1, self.channel_count+1,
self.config['channel_limit'] 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 = { ydl_opts = {
'logger': self._log, 'logger': self._log,
'progress_hooks': [self._yt_progress_hook], 'progress_hooks': [self._yt_progress_hook],
'paths': { 'paths': {
'temp': '/tmp', 'temp': '/tmp',
'home': self.config['download_dir'] 'home': download_dir
}, },
'writesubtitles': True, 'writesubtitles': True,
'writeautomaticsub': True, 'writeautomaticsub': True,
@ -327,6 +334,12 @@ class GetYoutubeVideos:
exclude it from the requested languages, e.g. ['all', '-live_chat']. exclude it from the requested languages, e.g. ['all', '-live_chat'].
And you can use wildcards like en.*''' 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() @click_config_file.configuration_option()
def __main__(**kwargs): def __main__(**kwargs):
return GetYoutubeVideos(**kwargs) return GetYoutubeVideos(**kwargs)