mirror of
https://github.com/k4yt3x/video2x.git
synced 2025-01-30 23:58:11 +00:00
fixed thread name error
This commit is contained in:
parent
fb18d561e2
commit
4f269ad938
14
video2x.py
14
video2x.py
@ -151,7 +151,7 @@ def upscale_frames(w2):
|
|||||||
# Create a folder for each thread and append folder
|
# Create a folder for each thread and append folder
|
||||||
# name into a list
|
# name into a list
|
||||||
|
|
||||||
thread_folders = []
|
thread_pool = []
|
||||||
for thread_id in range(args.threads):
|
for thread_id in range(args.threads):
|
||||||
thread_folder = '{}\\{}'.format(FRAMES, str(thread_id))
|
thread_folder = '{}\\{}'.format(FRAMES, str(thread_id))
|
||||||
|
|
||||||
@ -161,21 +161,21 @@ def upscale_frames(w2):
|
|||||||
os.mkdir(thread_folder)
|
os.mkdir(thread_folder)
|
||||||
|
|
||||||
# Append folder path into list
|
# Append folder path into list
|
||||||
thread_folders.append(thread_folder)
|
thread_pool.append((thread_folder, thread_id))
|
||||||
|
|
||||||
# Evenly distribute images into each folder
|
# Evenly distribute images into each folder
|
||||||
# until there is none left in the folder
|
# until there is none left in the folder
|
||||||
for image in frames:
|
for image in frames:
|
||||||
# Move image
|
# Move image
|
||||||
shutil.move(image, thread_folders[0])
|
shutil.move(image, thread_pool[0][0])
|
||||||
# Rotate list
|
# Rotate list
|
||||||
thread_folders = thread_folders[-1:] + thread_folders[:-1]
|
thread_pool = thread_pool[-1:] + thread_pool[:-1]
|
||||||
|
|
||||||
# Create threads and start them
|
# Create threads and start them
|
||||||
for thread_folder in thread_folders:
|
for thread_info in thread_pool:
|
||||||
# Create thread
|
# Create thread
|
||||||
thread = threading.Thread(target=w2.upscale, args=(thread_folder, UPSCALED, args.width, args.height))
|
thread = threading.Thread(target=w2.upscale, args=(thread_info[0], UPSCALED, args.width, args.height))
|
||||||
thread.name = str(thread_id)
|
thread.name = thread_info[1]
|
||||||
|
|
||||||
# Add threads into the pool
|
# Add threads into the pool
|
||||||
upscaler_threads.append(thread)
|
upscaler_threads.append(thread)
|
||||||
|
Loading…
Reference in New Issue
Block a user