mirror of
				https://github.com/Wan-Video/Wan2.1.git
				synced 2025-11-04 06:15:17 +00:00 
			
		
		
		
	updated mmgp version check
This commit is contained in:
		
							parent
							
								
									132aee82d8
								
							
						
					
					
						commit
						5b6b3f2832
					
				
							
								
								
									
										50
									
								
								wgp.py
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								wgp.py
									
									
									
									
									
								
							@ -40,7 +40,7 @@ global_queue_ref = []
 | 
				
			|||||||
AUTOSAVE_FILENAME = "queue.zip"
 | 
					AUTOSAVE_FILENAME = "queue.zip"
 | 
				
			||||||
PROMPT_VARS_MAX = 10
 | 
					PROMPT_VARS_MAX = 10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target_mmgp_version = "3.3.4"
 | 
					target_mmgp_version = "3.4.0"
 | 
				
			||||||
from importlib.metadata import version
 | 
					from importlib.metadata import version
 | 
				
			||||||
mmgp_version = version("mmgp")
 | 
					mmgp_version = version("mmgp")
 | 
				
			||||||
if mmgp_version != target_mmgp_version:
 | 
					if mmgp_version != target_mmgp_version:
 | 
				
			||||||
@ -52,29 +52,29 @@ task_id = 0
 | 
				
			|||||||
# progress_tracker = {}
 | 
					# progress_tracker = {}
 | 
				
			||||||
# tracker_lock = threading.Lock()
 | 
					# tracker_lock = threading.Lock()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def download_ffmpeg():
 | 
					# def download_ffmpeg():
 | 
				
			||||||
    if os.name != 'nt': return
 | 
					#     if os.name != 'nt': return
 | 
				
			||||||
    exes = ['ffmpeg.exe', 'ffprobe.exe', 'ffplay.exe']
 | 
					#     exes = ['ffmpeg.exe', 'ffprobe.exe', 'ffplay.exe']
 | 
				
			||||||
    if all(os.path.exists(e) for e in exes): return
 | 
					#     if all(os.path.exists(e) for e in exes): return
 | 
				
			||||||
    api_url = 'https://api.github.com/repos/GyanD/codexffmpeg/releases/latest'
 | 
					#     api_url = 'https://api.github.com/repos/GyanD/codexffmpeg/releases/latest'
 | 
				
			||||||
    r = requests.get(api_url, headers={'Accept': 'application/vnd.github+json'})
 | 
					#     r = requests.get(api_url, headers={'Accept': 'application/vnd.github+json'})
 | 
				
			||||||
    assets = r.json().get('assets', [])
 | 
					#     assets = r.json().get('assets', [])
 | 
				
			||||||
    zip_asset = next((a for a in assets if 'essentials_build.zip' in a['name']), None)
 | 
					#     zip_asset = next((a for a in assets if 'essentials_build.zip' in a['name']), None)
 | 
				
			||||||
    if not zip_asset: return
 | 
					#     if not zip_asset: return
 | 
				
			||||||
    zip_url = zip_asset['browser_download_url']
 | 
					#     zip_url = zip_asset['browser_download_url']
 | 
				
			||||||
    zip_name = zip_asset['name']
 | 
					#     zip_name = zip_asset['name']
 | 
				
			||||||
    with requests.get(zip_url, stream=True) as resp:
 | 
					#     with requests.get(zip_url, stream=True) as resp:
 | 
				
			||||||
        total = int(resp.headers.get('Content-Length', 0))
 | 
					#         total = int(resp.headers.get('Content-Length', 0))
 | 
				
			||||||
        with open(zip_name, 'wb') as f, tqdm(total=total, unit='B', unit_scale=True) as pbar:
 | 
					#         with open(zip_name, 'wb') as f, tqdm(total=total, unit='B', unit_scale=True) as pbar:
 | 
				
			||||||
            for chunk in resp.iter_content(chunk_size=8192):
 | 
					#             for chunk in resp.iter_content(chunk_size=8192):
 | 
				
			||||||
                f.write(chunk)
 | 
					#                 f.write(chunk)
 | 
				
			||||||
                pbar.update(len(chunk))
 | 
					#                 pbar.update(len(chunk))
 | 
				
			||||||
    with zipfile.ZipFile(zip_name) as z:
 | 
					#     with zipfile.ZipFile(zip_name) as z:
 | 
				
			||||||
        for f in z.namelist():
 | 
					#         for f in z.namelist():
 | 
				
			||||||
            if f.endswith(tuple(exes)) and '/bin/' in f:
 | 
					#             if f.endswith(tuple(exes)) and '/bin/' in f:
 | 
				
			||||||
                z.extract(f)
 | 
					#                 z.extract(f)
 | 
				
			||||||
                os.rename(f, os.path.basename(f))
 | 
					#                 os.rename(f, os.path.basename(f))
 | 
				
			||||||
    os.remove(zip_name)
 | 
					#     os.remove(zip_name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def format_time(seconds):
 | 
					def format_time(seconds):
 | 
				
			||||||
    if seconds < 60:
 | 
					    if seconds < 60:
 | 
				
			||||||
@ -4676,7 +4676,7 @@ def create_demo():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if __name__ == "__main__":
 | 
					if __name__ == "__main__":
 | 
				
			||||||
    atexit.register(autosave_queue)
 | 
					    atexit.register(autosave_queue)
 | 
				
			||||||
    download_ffmpeg()
 | 
					    # download_ffmpeg()
 | 
				
			||||||
    # threading.Thread(target=runner, daemon=True).start()
 | 
					    # threading.Thread(target=runner, daemon=True).start()
 | 
				
			||||||
    os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"
 | 
					    os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"
 | 
				
			||||||
    server_port = int(args.server_port)
 | 
					    server_port = int(args.server_port)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user