rename some helper scripts
This commit is contained in:
parent
90eedca0d7
commit
7c7a9b881b
5 changed files with 28 additions and 13 deletions
|
@ -1,13 +1,23 @@
|
|||
import bot
|
||||
import os
|
||||
import ycdl_easy
|
||||
import traceback
|
||||
import ycdl
|
||||
import ytapi
|
||||
|
||||
from voussoirkit import downloady
|
||||
|
||||
youtube_core = ytapi.Youtube(bot.YOUTUBE_KEY)
|
||||
youtube = ycdl.YCDL(youtube_core)
|
||||
|
||||
DIRECTORY = 'C:\\users\\owner\\youtube thumbnails'
|
||||
|
||||
videos = ycdl_easy.youtube.get_videos()
|
||||
videos = ycdl_repl.youtube.get_videos()
|
||||
for video in videos:
|
||||
try:
|
||||
thumbnail_path = os.path.join(DIRECTORY, video['id']) + '.jpg'
|
||||
if os.path.exists(thumbnail_path):
|
||||
continue
|
||||
result = downloady.download_file(video['thumbnail'], thumbnail_path)
|
||||
print(result)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
|
|
5
refresh_channels.py
Normal file
5
refresh_channels.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
'''
|
||||
Just a shortcut script to refresh all channels.
|
||||
'''
|
||||
import ycdl_repl
|
||||
ycdl_repl.youtube.refresh_all_channels()
|
8
ycdl.py
8
ycdl.py
|
@ -177,13 +177,15 @@ class YCDL:
|
|||
print('That video does not need to be downloaded.')
|
||||
return
|
||||
|
||||
download_directory = self.channel_directory(channel_id)
|
||||
download_directory = download_directory or os.getcwd()
|
||||
|
||||
current_directory = os.getcwd()
|
||||
download_directory = self.channel_directory(channel_id)
|
||||
download_directory = download_directory or current_directory
|
||||
|
||||
os.makedirs(download_directory, exist_ok=True)
|
||||
os.chdir(download_directory)
|
||||
|
||||
self.youtube_dl_function(video_id)
|
||||
|
||||
os.chdir(current_directory)
|
||||
|
||||
self.cur.execute('UPDATE videos SET download = "downloaded" WHERE id == ?', [video_id])
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
import ycdl_easy
|
||||
ycdl_easy.youtube.refresh_all_channels()
|
|
@ -1,5 +1,5 @@
|
|||
'''
|
||||
Run `python -i ycdl_easy.py to get an interpreter
|
||||
Run `python -i ycdl_repl.py to get an interpreter
|
||||
session with these variables preloaded.
|
||||
'''
|
||||
|
Loading…
Reference in a new issue