Update download.py
This commit is contained in:
parent
4fb6aa7cf0
commit
b2c4173676
@ -106,31 +106,33 @@ class grab():
|
|||||||
else:
|
else:
|
||||||
print("Downloaded MP4 but no thumbnail found.")
|
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():
|
class dropout():
|
||||||
def archive(show, season):
|
def archive(show, season):
|
||||||
with open('/data/dropout.json', 'r') as json_file:
|
with open('/data/dropout.json', 'r') as json_file:
|
||||||
url_mapping = json.load(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)
|
url = next((item['URL'] for item in url_mapping if item['SHOW'] == show), None)
|
||||||
if url is None:
|
if url is None:
|
||||||
raise ValueError(f"Show '{show}' not found in the JSON data.")
|
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}'
|
playlist_url = f'{url}/season:{season}'
|
||||||
|
|
||||||
# Process the URL and add to the archive without downloading
|
dl_opts = {
|
||||||
with yt_dlp.YoutubeDL(dl_opts) as ydl:
|
'quiet': True,
|
||||||
ydl.download([playlist_url]) # Pass a list containing the URL
|
'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):
|
def show(show, season, episode_start=None):
|
||||||
directory = f'/tv/{show}/Season {season}/'
|
directory = f'/tv/{show}/Season {season}/'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user