remove format strings :(
This commit is contained in:
parent
7cd8a640b3
commit
1403711bb0
1 changed files with 5 additions and 5 deletions
10
delojza.py
10
delojza.py
|
@ -50,7 +50,7 @@ def download_ydl(urls, subdir, date, extract=False, filename=None):
|
||||||
ydl_opts = {
|
ydl_opts = {
|
||||||
'noplaylist': True,
|
'noplaylist': True,
|
||||||
'restrictfilenames': 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:
|
if extract:
|
||||||
ydl_opts['format'] = 'bestaudio'
|
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:
|
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
||||||
ydl.download(urls)
|
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)):
|
for filename in map(ydl.prepare_filename, map(ydl.extract_info, urls)):
|
||||||
globbeds = glob(os.path.splitext(filename)[0] + '.*')
|
globbeds = glob(os.path.splitext(filename)[0] + '.*')
|
||||||
for globbed in globbeds:
|
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):
|
def download_raw(urls, subdir, date, extract=False, filename=None):
|
||||||
for url in urls:
|
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)
|
r = requests.get(url, stream=True)
|
||||||
with open(local_filename, 'wb') as f:
|
with open(local_filename, 'wb') as f:
|
||||||
for chunk in r.iter_content(chunk_size=1024):
|
for chunk in r.iter_content(chunk_size=1024):
|
||||||
|
@ -128,8 +128,8 @@ def handle(urls, message, download, filename=None):
|
||||||
|
|
||||||
reply = 'Downloading'
|
reply = 'Downloading'
|
||||||
if hashtag:
|
if hashtag:
|
||||||
mkdir_p(f'{OUT_DIR}/{hashtag}')
|
mkdir_p(OUT_DIR + '/' + hashtag)
|
||||||
reply += f' to "{hashtag}"'
|
reply += ' to "' + hashtag + '"'
|
||||||
reply += '...'
|
reply += '...'
|
||||||
|
|
||||||
if hashtag == 'AUDIO' and download != download_raw:
|
if hashtag == 'AUDIO' and download != download_raw:
|
||||||
|
|
Loading…
Reference in a new issue