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