Skip to content

Commit

Permalink
Updated Log Messages
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWicklowWolf authored Aug 19, 2024
1 parent adcbb48 commit 02d05ff
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ChannelTube.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,20 @@ def download_items(self, item_list, channel_folder_path, channel):

def progress_callback(self, progress_data):
status = progress_data.get("status", "unknown")
is_live_video = progress_data.get("info_dict", {}).get("is_live", False)
fragment_index = progress_data.get("fragment_index", 1)
show_log_message = fragment_index % 10 == 0

if status == "finished":
self.general_logger.warning("Download complete")
self.general_logger.warning("Processing File...")
self.general_logger.warning("Processing file...")

elif status == "downloading" and is_live_video and show_log_message:
downloaded_bytes_str = progress_data.get("_downloaded_bytes_str", "0")
elapsed = progress_data.get("elapsed", 1)
minutes, seconds = divmod(elapsed, 60)
elapsed_str = f"{int(minutes)} minutes and {int(seconds)} seconds"
self.general_logger.warning(f"Live Video - Downloaded: {downloaded_bytes_str} (Fragment Index: {fragment_index}, Elapsed: {elapsed_str})")

elif status == "downloading" and show_log_message:
percent_str = progress_data.get("_percent_str", "unknown")
Expand Down

0 comments on commit 02d05ff

Please sign in to comment.