Update download.py
This commit is contained in:
parent
4fb6aa7cf0
commit
b2c4173676
@ -106,31 +106,33 @@ class grab():
|
||||
else:
|
||||
print("Downloaded MP4 but no thumbnail found.")
|
||||
|
||||
class ArchiveOnlyYDL(yt_dlp.YoutubeDL):
|
||||
def process_info(self, info_dict):
|
||||
# """Pretend the video was downloaded successfully, so archive is updated."""
|
||||
self.record_download_archive(info_dict)
|
||||
self.to_screen(f"Archived: {info_dict.get('title')}")
|
||||
return info_dict
|
||||
|
||||
class dropout():
|
||||
def archive(show, season):
|
||||
with open('/data/dropout.json', 'r') as json_file:
|
||||
url_mapping = json.load(json_file)
|
||||
|
||||
# Find the URL associated with the given show
|
||||
url = next((item['URL'] for item in url_mapping if item['SHOW'] == show), None)
|
||||
if url is None:
|
||||
raise ValueError(f"Show '{show}' not found in the JSON data.")
|
||||
|
||||
# Set download options to skip the download and only write to the archive
|
||||
dl_opts = {
|
||||
'quiet': True,
|
||||
'skip_download': True,
|
||||
'cookiefile': '/data/dropout.cookies.txt',
|
||||
'download_archive': '/data/logs/dropout.archive.log',
|
||||
'force_write_archive': True
|
||||
}
|
||||
|
||||
# Assuming you are constructing a playlist URL for the season
|
||||
playlist_url = f'{url}/season:{season}'
|
||||
|
||||
# Process the URL and add to the archive without downloading
|
||||
with yt_dlp.YoutubeDL(dl_opts) as ydl:
|
||||
ydl.download([playlist_url]) # Pass a list containing the URL
|
||||
dl_opts = {
|
||||
'quiet': True,
|
||||
'cookiefile': '/data/dropout.cookies.txt',
|
||||
'download_archive': '/data/logs/dropout.archive.log',
|
||||
'skip_download': True, # Prevent actual downloads
|
||||
}
|
||||
|
||||
with ArchiveOnlyYDL(dl_opts) as ydl:
|
||||
ydl.download([playlist_url])
|
||||
|
||||
def show(show, season, episode_start=None):
|
||||
directory = f'/tv/{show}/Season {season}/'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user