From eb6a3fd194c9cfdd676b231608e4d33d0c3e4cd9 Mon Sep 17 00:00:00 2001
From: emkael <emkael@tlen.pl>
Date: Wed, 14 Feb 2024 10:55:56 +0100
Subject: Compatibility with new, longer TC result link hashes

---
 jfr_playoff/data/match/tcjson.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/jfr_playoff/data/match/tcjson.py b/jfr_playoff/data/match/tcjson.py
index 590f27d..2bd6a2c 100644
--- a/jfr_playoff/data/match/tcjson.py
+++ b/jfr_playoff/data/match/tcjson.py
@@ -22,7 +22,11 @@ class TCJsonMatchInfo(MatchInfoClient):
 
     def _get_round_from_link(self, link):
         fragment = urlparse.urlparse(link).fragment
-        return max(1, int(fragment[11:14])), max(1, int(fragment[14:17]))
+        if len(fragment) < 28:
+            # old, shorter TC hashes
+            return int(fragment[11:14]), int(fragment[14:17])
+        # new, longer TC hashes
+        return int(fragment[20:26]), int(fragment[26:32])
 
     def get_match_link(self):
         PlayoffLogger.get('match.tcjson').info(
-- 
cgit v1.2.3