1 from .ttNpy.tinyterraNodes import TTN_VERSIONS 2 from .ttNpy import ttNserver # Do Not Remove 3 import configparser 4 import folder_paths 5 import subprocess 6 import shutil 7 import os 8
111 112 # Autoupdate if True 113 if config_value_validator("ttNodes", "auto_update", 'false') == 'true': 114 try: 115 with subprocess.Popen(["git", "pull"], cwd=cwd_path, stdout=subprocess.PIPE) as p: 116 p.wait() 117 result = p.communicate()[0].decode() 118 if result != "Already up to date.\n":
111 112 # Autoupdate if True 113 if config_value_validator("ttNodes", "auto_update", 'false') == 'true': 114 try: 115 with subprocess.Popen(["git", "pull"], cwd=cwd_path, stdout=subprocess.PIPE) as p: 116 p.wait() 117 result = p.communicate()[0].decode() 118 if result != "Already up to date.\n":
116 p.wait() 117 result = p.communicate()[0].decode() 118 if result != "Already up to date.\n": 119 print("\033[92m[t ttNodes Updated t]\033[0m") 120 except: 121 pass 122 123 # --------- WEB ---------- # 124 # Remove old web JS folder
74 # Fetch the NSP Pantry 75 if pantry_path is None: 76 pantry_path = os.path.join(ttNpaths.tinyterraNodes, 'nsp_pantry.json') 77 if not os.path.exists(pantry_path): 78 response = urlopen('https://raw.githubusercontent.com/WASasquatch/noodle-soup-prompts/main/nsp_pantry.json') 79 tmp_pantry = json.loads(response.read()) 80 # Dump JSON locally 81 pantry_serialized = json.dumps(tmp_pantry, indent=4)
103 104 # Apply random results for each noodle counted 105 for _ in range(tcount): 106 new_text = new_text.replace( 107 tkey, random.choice(nspterminology[term]), 1) 108 seed += 1 109 random.seed(seed) 110
544 font = None 545 if os.path.exists(ttNpaths.font_path): 546 try: 547 font = ImageFont.truetype(str(Path(ttNpaths.font_path)), font_size) 548 except: 549 pass 550 551 if font is None: 552 font = ImageFont.load_default(font_size)
36 # Fetch the NSP Pantry 37 if pantry_path is None: 38 pantry_path = os.path.join(ttNpaths.tinyterraNodes, 'nsp_pantry.json') 39 if not os.path.exists(pantry_path): 40 response = urlopen('https://raw.githubusercontent.com/WASasquatch/noodle-soup-prompts/main/nsp_pantry.json') 41 tmp_pantry = json.loads(response.read()) 42 # Dump JSON locally 43 pantry_serialized = json.dumps(tmp_pantry, indent=4)
65 66 # Apply random results for each noodle counted 67 for _ in range(tcount): 68 new_text = new_text.replace( 69 tkey, random.choice(nspterminology[term]), 1) 70 seed += 1 71 random.seed(seed) 72
728 plot_image_vars["seed"] = seed - index 729 value_label = f"{plot_image_vars['seed']}" 730 731 elif value == 'randomize': 732 plot_image_vars["seed"] = random.randint(0, 0xffffffffffffffff) 733 value_label = f"{plot_image_vars['seed']}" 734 else: 735 plot_image_vars[value_type] = value
11 @routes.get("/ttN/reboot") 12 def restart(self): 13 try: 14 sys.stdout.close_log() 15 except Exception as e: 16 pass 17 18 print(f"\nRestarting...\n\n") 19 if sys.platform.startswith('win32'):
16 pass 17 18 print(f"\nRestarting...\n\n") 19 if sys.platform.startswith('win32'): 20 return os.execv(sys.executable, ['"' + sys.executable + '"', '"' + sys.argv[0] + '"'] + sys.argv[1:]) 21 else: 22 return os.execv(sys.executable, [sys.executable] + sys.argv) 23
18 print(f"\nRestarting...\n\n") 19 if sys.platform.startswith('win32'): 20 return os.execv(sys.executable, ['"' + sys.executable + '"', '"' + sys.argv[0] + '"'] + sys.argv[1:]) 21 else: 22 return os.execv(sys.executable, [sys.executable] + sys.argv) 23 24 @routes.get("/ttN/models") 25 def get_models(self):