mirror of
				https://github.com/asdlokj1qpi233/subconverter.git
				synced 2025-10-26 10:52:21 +00:00 
			
		
		
		
	Add lhie1 rules to auto update config
This commit is contained in:
		| @@ -21,3 +21,8 @@ match=Surge/Ruleset/** | |||||||
| url=https://github.com/NobyDa/Script | url=https://github.com/NobyDa/Script | ||||||
| branch=master | branch=master | ||||||
| match=Surge/*.list | match=Surge/*.list | ||||||
|  |  | ||||||
|  | [lhie1] | ||||||
|  | url=https://github.com/dler-io/Rules | ||||||
|  | branch=main | ||||||
|  | match=Surge/Surge 3/Provider/** | ||||||
|   | |||||||
| @@ -26,6 +26,9 @@ def update_rules(repo_path: str, save_path: str, matches: list[str], keep_tree: | |||||||
|     os.makedirs(save_path, exist_ok=True) |     os.makedirs(save_path, exist_ok=True) | ||||||
|     for pattern in matches: |     for pattern in matches: | ||||||
|         files = glob.glob(os.path.join(repo_path, pattern), recursive=True) |         files = glob.glob(os.path.join(repo_path, pattern), recursive=True) | ||||||
|  |         if len(files) == 0: | ||||||
|  |             logging.warn(f"no files found for pattern {pattern}") | ||||||
|  |             continue | ||||||
|         for file in files: |         for file in files: | ||||||
|             if os.path.isdir(file): |             if os.path.isdir(file): | ||||||
|                 continue |                 continue | ||||||
| @@ -68,6 +71,7 @@ def main(): | |||||||
|         else: |         else: | ||||||
|             logging.info(f"repo {repo_path} exists") |             logging.info(f"repo {repo_path} exists") | ||||||
|              |              | ||||||
|  |         try: | ||||||
|             if commit is not None: |             if commit is not None: | ||||||
|                 logging.info(f"checking out to commit {commit}") |                 logging.info(f"checking out to commit {commit}") | ||||||
|                 r.git.checkout(commit) |                 r.git.checkout(commit) | ||||||
| @@ -77,6 +81,9 @@ def main(): | |||||||
|             else: |             else: | ||||||
|                 logging.info(f"checking out to default branch") |                 logging.info(f"checking out to default branch") | ||||||
|                 r.active_branch.checkout() |                 r.active_branch.checkout() | ||||||
|  |         except Exception as e: | ||||||
|  |             logging.error(f"checkout failed {e}") | ||||||
|  |             continue | ||||||
|  |  | ||||||
|         update_rules(repo_path, save_path, matches, keep_tree) |         update_rules(repo_path, save_path, matches, keep_tree) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user