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: