Prechádzať zdrojové kódy

store screenshots in network folder

Richard Köhl 1 rok pred
rodič
commit
0d169fc71d
2 zmenil súbory, kde vykonal 4 pridanie a 6 odobranie
  1. 0 0
      fights/.gitkeep
  2. 4 6
      screenshot.py

+ 0 - 0
fights/.gitkeep


+ 4 - 6
screenshot.py

@@ -98,8 +98,7 @@ def save_screenshot():
 
   timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
   image = Image.open(io.BytesIO(result))
-  # TODO: write screenshots to network folder /mnt/t/nextcloud/InstantUpload/Herowars/
-  jpeg_filename = f"fights/{timestamp}.jpg"
+  jpeg_filename = f"/mnt/t/nextcloud/InstantUpload/Herowars/{timestamp}.jpg"
 
   image = image.convert('RGB')  # Convert to RGB mode for JPEG
   with open(jpeg_filename, "wb") as fp:
@@ -132,7 +131,6 @@ def is_end_of_log(template):
   templates = find_templates(template)
   result = len(templates) > 0
   if result:
-    print(templates)
     print("reached end of guild war log!")
 
   return result
@@ -207,8 +205,8 @@ def process_war_log():
   swipe(find_max_y_pair(buttons), fight_scroll_top)
 
 # start
-while True:
+while not is_end_of_log(end_of_log):
   process_war_log();
 
-  if is_end_of_log(end_of_log):
-    break;
+# possible duplicates here, but necessary to be sure to get the last fights
+process_war_log();