eliminated unnecessary variable upscale_begin_time

This commit is contained in:
K4YT3X 2020-09-12 17:40:17 -04:00
parent 64eb03ac08
commit 6dbdf93ca4

View File

@ -4,7 +4,7 @@
Creator: Video2X GUI Creator: Video2X GUI
Author: K4YT3X Author: K4YT3X
Date Created: May 5, 2020 Date Created: May 5, 2020
Last Modified: September 9, 2020 Last Modified: September 12, 2020
""" """
# local imports # local imports
@ -1065,13 +1065,12 @@ It\'s also highly recommended for you to attach the [log file]({}) under the pro
def progress_monitor(self, progress_callback: pyqtSignal): def progress_monitor(self, progress_callback: pyqtSignal):
# initialize progress bar values # initialize progress bar values
upscale_begin_time = time.time() progress_callback.emit((self.begin_time, 0, 0, 0, 0, 0, [], pathlib.Path(), pathlib.Path()))
progress_callback.emit((upscale_begin_time, 0, 0, 0, 0, 0, [], pathlib.Path(), pathlib.Path()))
# keep querying upscaling process and feed information to callback signal # keep querying upscaling process and feed information to callback signal
while self.upscaler.running: while self.upscaler.running:
progress_callback.emit((upscale_begin_time, progress_callback.emit((self.begin_time,
self.upscaler.total_frames_upscaled, self.upscaler.total_frames_upscaled,
self.upscaler.total_frames, self.upscaler.total_frames,
self.upscaler.total_processed, self.upscaler.total_processed,
@ -1084,10 +1083,10 @@ It\'s also highly recommended for you to attach the [log file]({}) under the pro
# upscale process will stop at 99% # upscale process will stop at 99%
# so it's set to 100 manually when all is done # so it's set to 100 manually when all is done
# progress_callback.emit((upscale_begin_time, 0, 0, 0, 0, pathlib.Path(), pathlib.Path())) # progress_callback.emit((self.begin_time, 0, 0, 0, 0, pathlib.Path(), pathlib.Path()))
def set_progress(self, progress_information: tuple): def set_progress(self, progress_information: tuple):
upscale_begin_time = progress_information[0] self.begin_time = progress_information[0]
total_frames_upscaled = progress_information[1] total_frames_upscaled = progress_information[1]
total_frames = progress_information[2] total_frames = progress_information[2]
total_processed = progress_information[3] total_processed = progress_information[3]
@ -1098,9 +1097,9 @@ It\'s also highly recommended for you to attach the [log file]({}) under the pro
last_frame_upscaled = progress_information[8] last_frame_upscaled = progress_information[8]
# calculate fields based on frames and time elapsed # calculate fields based on frames and time elapsed
time_elapsed = time.time() - upscale_begin_time time_elapsed = time.time() - self.begin_time
try: try:
rate = total_frames_upscaled / (time.time() - upscale_begin_time) rate = total_frames_upscaled / (time.time() - self.begin_time)
time_remaining = (total_frames - total_frames_upscaled) / rate time_remaining = (total_frames - total_frames_upscaled) / rate
except Exception: except Exception:
rate = 0.0 rate = 0.0