Add Gemini OCR and fix VRC log world handling

This commit is contained in:
every_holiday
2026-06-09 02:37:06 +09:00
parent fad1a20089
commit 0521af2933
4 changed files with 148 additions and 35 deletions

View File

@@ -352,6 +352,9 @@ def parseVrchatEvents(text, config):
output_lines = []
self_state = None
if not guest_names:
debug("guest_names is empty; guest comparison is disabled")
for raw_line in text.splitlines():
line_time = parseLineTime(raw_line)
if not line_time or line_time < start_time:
@@ -362,24 +365,35 @@ def parseVrchatEvents(text, config):
room_match = ENTERING_ROOM_PATTERN.search(raw_line)
world_name_match = WORLD_NAME_PATTERN.search(raw_line)
world_match = WORLD_PATTERN.search(raw_line)
should_update_world = bool(room_match or world_name_match)
location = ""
world_id = ""
instance_id = ""
if should_update_world and world_match:
if world_name_match:
world_id = world_name_match.group(1).strip()
location = world_id
elif room_match and world_match:
location = world_match.group(1).strip()
world_id, instance_id = splitWorldLocation(location)
elif world_match:
location = world_match.group(1).strip()
world_id, instance_id = splitWorldLocation(location)
if location != state["location"]:
state["location"] = location
state["world_id"] = world_id
state["instance_id"] = instance_id
state["guest_present_set"].clear()
state["staff_present_set"].clear()
state["member_present_set"].clear()
state["last_notice_key"] = None
output_lines = []
if world_id and world_id != state["world_id"]:
state["location"] = location or world_id
state["world_id"] = world_id
state["instance_id"] = instance_id
state["guest_present_set"].clear()
state["staff_present_set"].clear()
state["member_present_set"].clear()
state["last_notice_key"] = None
output_lines = []
world_label = formatWorldLabel(world_id, world_name_map)
if world_label != "不明":
output_lines.append(f"ワールド入室: {world_label}")
join_match = JOIN_PATTERN.search(raw_line)
if join_match and state["world_id"] and line_matches:
if join_match and line_matches:
name = join_match.group(1).strip()
join_leave_line = None
if isSelf(name, self_name):
@@ -408,7 +422,7 @@ def parseVrchatEvents(text, config):
continue
left_match = LEFT_PATTERN.search(raw_line)
if left_match and state["world_id"] and line_matches:
if left_match and line_matches:
name = left_match.group(1).strip()
join_leave_line = None
if isSelf(name, self_name):
@@ -469,9 +483,9 @@ def collectVrchatLog(pattern=None, notify_changed=True):
text = readTextSafe(latest_log)
lines, self_state = parseVrchatEvents(text, config)
output_text = "\n".join(lines) if lines else ""
output_path = None
if lines:
output_text = "\n".join(lines)
output_path = appendRuntimeLog("VRC LOG", output_text)
join_leave_lines = [line for line in lines if "[join]" in line or "[leave]" in line]
if join_leave_lines: