From 7868cf301d7b034050abdfb25973cf3b6db2d8d0 Mon Sep 17 00:00:00 2001 From: Kumi Date: Sat, 21 Oct 2023 09:10:12 +0200 Subject: [PATCH] Add numeric image indices for krpanosteal --- handler.py | 1 + krpanosteal/__init__.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/handler.py b/handler.py index cbd08c7..70029cd 100755 --- a/handler.py +++ b/handler.py @@ -18,6 +18,7 @@ regs = { "c\d_l\d_\d_\d.jpg": "pindorasteal", "/[frblud]/l\d/\d/l\d_[frblud]_\d_\d.jpg": "eyerevolutionsteal", "(pos|neg)[xyz]\.jpg": "xvrsteal", + r"\d.jpg": "krpanosteal", } diff --git a/krpanosteal/__init__.py b/krpanosteal/__init__.py index bf5f74b..395a759 100644 --- a/krpanosteal/__init__.py +++ b/krpanosteal/__init__.py @@ -95,7 +95,7 @@ def krpano_export(schema): return output -def krpano_export_simple(url): +def krpano_export_simple(url, tiles="frblud"): ''' Exports krpano panoramas which only consist of six complete tiles. Takes the URL of one of these images and returns a list of PIL.Image objects @@ -106,7 +106,7 @@ def krpano_export_simple(url): output = [] - for i in "frblud": + for i in tiles: cur = url[:-5] + i + url[-4:] res = urllib.request.urlopen(cur) assert res.getcode() == 200 @@ -130,6 +130,8 @@ def krpano_make_tiles(url): try: if re.search(r"\_[frblud].jpg", parts[-1]): return krpano_export_simple(url) + elif re.search(r"\d.jpg", parts[-1]): + return krpano_export_simple(url, "012345") else: schema = krpano_normalize(url) images = krpano_export(schema)