import ctypes
import glob
import os
import shutil
os.system('cls' if os.name == 'nt' else 'clear')
print("")
print("")
ctypes.windll.kernel32.SetConsoleTitleW("TIMELINE CHECKER")
input_path = 'D:/Path/To/Folder/With/Scenes'
output_path = 'D:/Path/Where/Timeline/Scene/Will/Be/Moved'
timeline_length = 30.0
if not os.path.exists(output_path):
os.makedirs(output_path)
print(f"\nSearching .png files...\n")
files = glob.glob(input_path + '/**/*.png', recursive=True)
total_files = len(files)
print(f"\n({total_files}) .png files founded.\n")
count = 0
tl_count = 0
check_list = ['cameraOPos"', 'cameraORot"', 'cameraOZoom"', 'cameraFOV"', 'cameraPos"', 'cameraRot"', 'timeScale"']
for current_file in files:
has_time_greater_than_value = False
if os.path.isfile(current_file):
with open(current_file, 'rt', encoding="ansi") as fp:
for index, line in enumerate(fp):
if line.count("Timeline") >= 2:
if 'timeline' in line:
elements = line.strip().split()
for element in elements:
if 'time="' in element:
try:
time_value = float(element.split('time="')[1].replace('"', ''))
if time_value > timeline_length:
has_time_greater_than_value = True
except ValueError:
continue
if has_time_greater_than_value and 'id="' in element and not any(
check_string in element for check_string in check_list):
tl_count += 1
file_name = os.path.split(current_file)
print('\nTimeline scene found: ' + file_name[1] + '\n')
fp.close()
shutil.move(current_file, output_path + '\\' + file_name[1])
break
else:
continue
break
else:
fp.close()
count += 1
print(f"\n({count}/{total_files}) Timeline scene count: [{tl_count}]\n")
print("\n╭⋟────────────────────────────────────────────────────────────────╮")
print(f'\n Total timeline scenes found: [{tl_count}/{total_files}]\n')
print("╰────────────────────────────────────────────────────────────────⋞╯\n\n")