Update download.py

This commit is contained in:
TylerCG 2025-05-12 10:40:14 -04:00
parent 04e93cad07
commit ec46022fd8

View File

@ -6,8 +6,18 @@ logger = logging.getLogger(__name__)
# Define the hook function
def my_hook(d):
if d['status'] == 'finished':
logging.info(f"Download completed: {d['filename']}")
status = d.get('status')
if status == 'downloading':
logger.info(f"Downloading: {d.get('_percent_str')} at {d.get('_speed_str')} for {d.get('filename')}")
elif status == 'finished':
logger.info(f"Download completed: {d.get('filename')}")
elif status == 'error':
logger.error(f"Error occurred: {d.get('error')}")
elif status == 'postprocessing':
logger.info(f"Post-processing: {d.get('filename')}")
elif status == 'processing':
logger.info(f"Processing: {d.get('filename')}")
def ebook(url, author):
destination = f"/ebooks/{author}"