From a949c82bce0e74c9305e21d9d35e6a59610fb89f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Wed, 31 Jan 2018 14:23:01 +0100 Subject: [PATCH] hotfix this ytdl merging bullshit --- robot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/robot.py b/robot.py index 2f0171c..5e33ac1 100755 --- a/robot.py +++ b/robot.py @@ -3,6 +3,7 @@ import logging import os import shutil import sys +from glob import glob import requests import youtube_dl @@ -35,14 +36,17 @@ def datestr(date): def download_ydl(urls, date): ydl_opts = { 'noplaylist': True, + 'restrictfilenames': True, 'download_archive': DIR + '/downloaded.lst', 'outtmpl': TMP_DIR + '/' + datestr(date) + '__%(title)s__%(id)s.%(ext)s' } with youtube_dl.YoutubeDL(ydl_opts) as ydl: ydl.download(urls) for filename in map(ydl.prepare_filename, map(ydl.extract_info, urls)): - logger.info("Moving %s to %s..." % (filename, OUT_DIR)) - shutil.move(filename, OUT_DIR) + globbeds = glob(os.path.splitext(filename)[0] + '.*') + for globbed in globbeds: + logger.info("Moving %s to %s..." % (globbed, OUT_DIR)) + shutil.move(globbed, OUT_DIR) def download_raw(url, date):