From 1403711bb0d72cfae2c74abc9cd96f8fc73b1af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Sun, 2 Sep 2018 20:04:16 +0200 Subject: [PATCH] remove format strings :( --- delojza.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/delojza.py b/delojza.py index 127555d..9a0ca0a 100755 --- a/delojza.py +++ b/delojza.py @@ -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: