Compare commits
No commits in common. "43f12decea6eb9eea99d32757137e21292d8d597" and "e7583336b259b63add4706ea30e9821ec4ebea63" have entirely different histories.
43f12decea
...
e7583336b2
22
mirror-yt.py
22
mirror-yt.py
|
|
@ -13,14 +13,8 @@ import click
|
|||
help='Base directory where the channel directories get created')
|
||||
@click.option('--max-video-height', type=int,
|
||||
help='Maximum height of the video e.g. 720 or 1080 to filter video formats by')
|
||||
@click.option('--sleep-interval', type=int, default=30, show_default=True,
|
||||
help="Minimum sleep interval between downloads")
|
||||
@click.option('--max-sleep-interval', type=int, default=300, show_default=True,
|
||||
help="Maximum sleep interval between downloads (see also --sleep-interval")
|
||||
@click.option('--with-playlist-index', is_flag=True, help="Prepend the playlist index to the output file name")
|
||||
@click.argument('CHANNEL_FILE', required=True)
|
||||
def download(allow_unknown, base_dir, max_video_height, sleep_interval, max_sleep_interval, with_playlist_index,
|
||||
channel_file):
|
||||
def download(allow_unknown, base_dir, max_video_height, channel_file):
|
||||
"""Mirror channels from YouTube
|
||||
|
||||
The list of channels needs to be provided via CHANNEL_FILE. The format of the file should be one channel per line.
|
||||
|
|
@ -58,19 +52,11 @@ def download(allow_unknown, base_dir, max_video_height, sleep_interval, max_slee
|
|||
if not target_dir.exists():
|
||||
target_dir.mkdir()
|
||||
|
||||
# NOTE: Using %(formats.:.height)s doesn't work, because the
|
||||
# thumbnail doesn't take it's own output template even when
|
||||
# provided with -o 'thumbnail:…'
|
||||
name_fmt = '%(upload_date)s - %(title)s - %(id)s{}.%(ext)s'.format(
|
||||
f" - {max_video_height}" if max_video_height else '')
|
||||
if with_playlist_index:
|
||||
name_fmt = f"%(playlist_index)s - {name_fmt}"
|
||||
|
||||
cmd = [
|
||||
'yt-dlp',
|
||||
'-o', name_fmt,
|
||||
'--sleep-interval', str(sleep_interval),
|
||||
'--max-sleep-interval', str(max_sleep_interval),
|
||||
'-o', '%(upload_date)s - %(title)s - %(id)s.%(ext)s',
|
||||
'--sleep-interval', '30',
|
||||
'--max-sleep-interval', '300',
|
||||
'--download-archive', target_dir / '.archive',
|
||||
'--break-on-existing',
|
||||
'--write-thumbnail',
|
||||
|
|
|
|||
Loading…
Reference in New Issue