GameSentenceMiner 2.16.6__py3-none-any.whl → 2.16.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -978,21 +978,24 @@ def register_database_api_routes(app):
978
978
  imported_lines = []
979
979
  games_set = set()
980
980
  errors = []
981
- seen_uuids = set() # Track UUIDs within this import batch
982
-
981
+ seen_uuids = set() # Track UUIDs + Line within import batch
982
+
983
+ def get_line_hash(uuid: str, line_text: str) -> str:
984
+ return uuid + '|' + line_text.strip()
985
+
983
986
  for row_num, row in enumerate(csv_reader):
984
987
  try:
985
988
  # Extract and validate required fields
986
- uuid = row.get('uuid', '').strip()
987
- name = row.get('name', '').strip()
989
+ game_uuid = row.get('uuid', '').strip()
990
+ game_name = row.get('name', '').strip()
988
991
  line = row.get('line', '').strip()
989
992
  time_str = row.get('time', '').strip()
990
993
 
991
994
  # Validate required fields
992
- if not uuid:
995
+ if not game_uuid:
993
996
  errors.append(f"Row {row_num}: Missing UUID")
994
997
  continue
995
- if not name:
998
+ if not game_name:
996
999
  errors.append(f"Row {row_num}: Missing name")
997
1000
  continue
998
1001
  if not line:
@@ -1002,12 +1005,12 @@ def register_database_api_routes(app):
1002
1005
  errors.append(f"Row {row_num}: Missing time")
1003
1006
  continue
1004
1007
 
1005
- # Check for duplicates within this import batch
1006
- if uuid in seen_uuids:
1007
- logger.info(f"Skipping duplicate UUID within import batch: {uuid}")
1008
+ line_hash = get_line_hash(game_uuid, line)
1009
+ if line_hash in seen_uuids:
1010
+ logger.info(f"Skipping duplicate line from game UUID {game_uuid} in import batch")
1008
1011
  continue
1009
- seen_uuids.add(uuid)
1010
-
1012
+ seen_uuids.add(line_hash)
1013
+
1011
1014
  # Convert time to timestamp
1012
1015
  try:
1013
1016
  timestamp = float(time_str)
@@ -1018,22 +1021,22 @@ def register_database_api_routes(app):
1018
1021
  # Clean up line text (remove extra whitespace and newlines)
1019
1022
  line_text = line.strip()
1020
1023
 
1021
- # Check if this UUID already exists in database
1022
- existing_line = GameLinesTable.get(uuid)
1024
+ # Check if this line already exists in database
1025
+ existing_line = GameLinesTable.get(line_hash)
1023
1026
  if existing_line:
1024
- logger.info(f"Skipping duplicate UUID already in database: {uuid}")
1027
+ logger.info(f"Skipping duplicate UUID already in database: {line_hash}")
1025
1028
  continue
1026
1029
 
1027
1030
  # Create GameLinesTable entry
1028
1031
  game_line = GameLinesTable(
1029
- id=uuid,
1030
- game_name=name,
1032
+ id=line_hash,
1033
+ game_name=game_name,
1031
1034
  line_text=line_text,
1032
1035
  timestamp=timestamp
1033
1036
  )
1034
1037
 
1035
1038
  imported_lines.append(game_line)
1036
- games_set.add(name)
1039
+ games_set.add(game_name)
1037
1040
 
1038
1041
  except Exception as e:
1039
1042
  errors.append(f"Row {row_num}: Error processing row - {str(e)}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.16.6
3
+ Version: 2.16.7
4
4
  Summary: A tool for mining sentences from games. Update: Overlay?
5
5
  Author-email: Beangate <bpwhelan95@gmail.com>
6
6
  License: MIT License
@@ -56,7 +56,7 @@ GameSentenceMiner/util/downloader/oneocr_dl.py,sha256=l3s9Z-x1b57GX048o5h-MVv0UT
56
56
  GameSentenceMiner/util/win10toast/__init__.py,sha256=6TL2w6rzNmpJEp6_v2cAJP_7ExA3UsKzwdM08pNcVfE,5341
57
57
  GameSentenceMiner/util/win10toast/__main__.py,sha256=5MYnBcFj8y_6Dyc1kiPd0_FsUuh4yl1cv5wsleU6V4w,668
58
58
  GameSentenceMiner/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
- GameSentenceMiner/web/database_api.py,sha256=Fk51pNWsSXL0tq4YqVF-evAcu9NZ1XX51fb9SLR3CEQ,50782
59
+ GameSentenceMiner/web/database_api.py,sha256=yz06Y3DZGGsfeMQzCOUalTqj-expK_hMr6oZhplOUeM,50937
60
60
  GameSentenceMiner/web/events.py,sha256=6Vyz5c9MdpMIa7Zqljqhap2XFQnAVYJ0CdQV64TSZsA,5119
61
61
  GameSentenceMiner/web/gsm_websocket.py,sha256=IwwQo6VtgPqeOuc-datgfJyLpX3LwB2MISDqA6EkiSA,4131
62
62
  GameSentenceMiner/web/service.py,sha256=YZchmScTn7AX_GkwV1ULEK6qjdOnJcpc3qfMwDf7cUE,5363
@@ -90,9 +90,9 @@ GameSentenceMiner/web/templates/utility.html,sha256=KtqnZUMAYs5XsEdC9Tlsd40NKAVi
90
90
  GameSentenceMiner/web/templates/components/navigation.html,sha256=6y9PvM3nh8LY6JWrZb6zVOm0vqkBLDc6d3gB9X5lT_w,1055
91
91
  GameSentenceMiner/web/templates/components/theme-styles.html,sha256=hiq3zdJljpRjQO1iUA7gfFKwXebltG-IWW-gnKS4GHA,3439
92
92
  GameSentenceMiner/wip/__init___.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
93
- gamesentenceminer-2.16.6.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
94
- gamesentenceminer-2.16.6.dist-info/METADATA,sha256=teMRqganfBhqm1zn_U6Fd5ZbFl6zRt1dFbYq9VxZDWY,7348
95
- gamesentenceminer-2.16.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
96
- gamesentenceminer-2.16.6.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
97
- gamesentenceminer-2.16.6.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
98
- gamesentenceminer-2.16.6.dist-info/RECORD,,
93
+ gamesentenceminer-2.16.7.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
94
+ gamesentenceminer-2.16.7.dist-info/METADATA,sha256=YVoiDIvmBYF-EZikzbgl-84q2Q2hD-GZeCvBMvb4iWs,7348
95
+ gamesentenceminer-2.16.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
96
+ gamesentenceminer-2.16.7.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
97
+ gamesentenceminer-2.16.7.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
98
+ gamesentenceminer-2.16.7.dist-info/RECORD,,