remove format strings :(

feature-unify_handlers
Tomáš Mládek 2018-09-02 20:04:16 +02:00 committed by Tomáš Mládek
parent 7cd8a640b3
commit 1403711bb0
1 changed files with 5 additions and 5 deletions

View File

@ -50,7 +50,7 @@ def download_ydl(urls, subdir, date, extract=False, filename=None):
ydl_opts = {
'noplaylist': True,
'restrictfilenames': True,
'outtmpl': f'{TMP_DIR}/' + datestr(date) + '__%(title)s__%(id)s.%(ext)s'
'outtmpl': TMP_DIR + '/' + datestr(date) + '__%(title)s__%(id)s.%(ext)s'
}
if extract:
ydl_opts['format'] = 'bestaudio'
@ -60,7 +60,7 @@ def download_ydl(urls, subdir, date, extract=False, filename=None):
# }]
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download(urls)
out_dir = f'{OUT_DIR}/{subdir}/'
out_dir = OUT_DIR + '/' + subdir + '/'
for filename in map(ydl.prepare_filename, map(ydl.extract_info, urls)):
globbeds = glob(os.path.splitext(filename)[0] + '.*')
for globbed in globbeds:
@ -70,7 +70,7 @@ def download_ydl(urls, subdir, date, extract=False, filename=None):
def download_raw(urls, subdir, date, extract=False, filename=None):
for url in urls:
local_filename = f"{OUT_DIR}/{subdir}/" + "%s__%s" % (datestr(date), filename or url.split('/')[-1])
local_filename = OUT_DIR + '/' + subdir + '/' + "%s__%s" % (datestr(date), filename or url.split('/')[-1])
r = requests.get(url, stream=True)
with open(local_filename, 'wb') as f:
for chunk in r.iter_content(chunk_size=1024):
@ -128,8 +128,8 @@ def handle(urls, message, download, filename=None):
reply = 'Downloading'
if hashtag:
mkdir_p(f'{OUT_DIR}/{hashtag}')
reply += f' to "{hashtag}"'
mkdir_p(OUT_DIR + '/' + hashtag)
reply += ' to "' + hashtag + '"'
reply += '...'
if hashtag == 'AUDIO' and download != download_raw: