cache by default
This commit is contained in:
		
							
								
								
									
										11
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								main.py
									
									
									
									
									
								
							| @@ -238,7 +238,7 @@ class Replay: | ||||
|     password: t.Optional[str] | ||||
|  | ||||
|  | ||||
| def fetch(replay: str, cache: bool = False) -> Replay: | ||||
| def fetch(replay: str, cache: bool = True) -> Replay: | ||||
|     replay = replay.replace("https://replay.pokemonshowdown.com/", "") | ||||
|     replay_file = Path.cwd() / "cache" / f"{replay}.json" | ||||
|  | ||||
| @@ -264,7 +264,12 @@ def main(): | ||||
|         prog=APP, description="extracts stats from a Showdown replay" | ||||
|     ) | ||||
|     parser.add_argument("-v", "--verbose", action="count", help="add debugging info") | ||||
|     parser.add_argument("-c", "--cache", action="store_true", help="cache replays") | ||||
|     parser.add_argument( | ||||
|         "-C", | ||||
|         "--no-cache", | ||||
|         action="store_true", | ||||
|         help="fetch replays instead of using cache", | ||||
|     ) | ||||
|     parser.add_argument("replay", nargs="+", help="replay ID or URL") | ||||
|  | ||||
|     args = parser.parse_args(sys.argv[1:]) | ||||
| @@ -279,7 +284,7 @@ def main(): | ||||
|  | ||||
|         for r in args.replay: | ||||
|             try: | ||||
|                 replay = fetch(r, cache=args.cache) | ||||
|                 replay = fetch(r, cache=not args.no_cache) | ||||
|             except Exception as e: | ||||
|                 LOG.error(f"bad replay {r}") | ||||
|                 continue | ||||
|   | ||||
		Reference in New Issue
	
	Block a user