fixed thumbnails
This commit is contained in:
parent
31b09b1ca3
commit
5ef903010c
|
|
@ -1,2 +1,4 @@
|
|||
# UnusualVideos
|
||||
https://www.youtube.com/channel/UCpnkp_D4FLPCiXOmDhoAeYA
|
||||
# UUM Archive
|
||||
https://www.youtube.com/@unusualvideos_archive
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@
|
|||
# Archive Settings
|
||||
--download-archive yt-dlp-archive.txt
|
||||
-a yt-dlp-channels.txt
|
||||
-f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best'
|
||||
--write-description
|
||||
#-f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best'
|
||||
--write-thumbnail
|
||||
--skip-download
|
||||
--restrict-filenames
|
||||
|
||||
# Debug
|
||||
-v
|
||||
|
|
|
|||
18
import.py
18
import.py
|
|
@ -4,6 +4,7 @@ import sys
|
|||
import fnmatch
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
sys.path.append('./')
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'ragnarok.settings'
|
||||
import django
|
||||
|
|
@ -35,9 +36,9 @@ def find_image_file(name_pattern, folder):
|
|||
return os.path.join(root, filename)
|
||||
return None
|
||||
|
||||
|
||||
for filename in os.listdir(folder_path):
|
||||
if filename.endswith('.mp4'):
|
||||
files = os.listdir(folder_path)
|
||||
for filename in files:
|
||||
if filename.endswith('.mp4'):
|
||||
# Create a new Video object
|
||||
video = Video()
|
||||
id = extract_version(filename)
|
||||
|
|
@ -53,11 +54,12 @@ for filename in os.listdir(folder_path):
|
|||
# Open the file and save it to the Video object
|
||||
with open(os.path.join(folder_path, filename), 'rb') as f:
|
||||
video.file.save(filename, f)
|
||||
|
||||
#filepath = find_image_file("V"+str(id), folder_path)
|
||||
with open(filepath, 'rb') as f:
|
||||
video.thumbnail.save(filename, f)
|
||||
|
||||
index = [idx for idx, s in enumerate(files) if bool(re.search('V'+str(video.id)+'( |_)', s)) and '.webp' in s]
|
||||
if not index:
|
||||
continue
|
||||
index = index[0]
|
||||
with open(os.path.join(folder_path, files[index]), 'rb') as f:
|
||||
video.thumbnail.save(files[index], f)
|
||||
# Save the Video object to the database
|
||||
video.save()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user