Skip to content

Commit

Permalink
Merge pull request #51 from DrkYoda:DrkYoda/issue50
Browse files Browse the repository at this point in the history
Add ability to parse integer amounts
  • Loading branch information
DrkYoda committed Sep 29, 2023
2 parents 8c8da59 + 2faec15 commit 930654e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
- Fixed issue #43
v 1.2.4
- Fixed issue #45
v 1.2.5
- Fixed issue #50
****************************************************************************************************
"""
# MODULES
Expand All @@ -73,7 +75,6 @@
import logging
from pathlib import Path
import re
from shutil import move
from time import perf_counter, process_time
from typing import List
from rich.console import Console
Expand Down Expand Up @@ -444,7 +445,7 @@ def switch_key_and_values(name_map: dict[str, dict[str, list[str]]], key_txt: st
game_number_regex = re.compile(r"(?P<game_number>\d{13})")
hand_time_regex = re.compile(r"(?P<start_date_utc>.+:\d+)")
seats_regex = re.compile(
r" #(?P<seat>\d+) \"(?P<player>.+?) @ (?P<device_id>[-\w]+)\" \((?P<amount>\d+\.\d{2})\)"
r" #(?P<seat>\d+) \"(?P<player>.+?) @ (?P<device_id>[-\w]+)\" \((?P<amount>\d+\.\d{2}|\d+)\)"
)
post_regex = re.compile(
r"\"(?P<player>.+?) @ (?P<device_id>[-\w]+)\" (?P<type>posts a .+) "
Expand All @@ -453,26 +454,26 @@ def switch_key_and_values(name_map: dict[str, dict[str, list[str]]], key_txt: st
round_regex = re.compile(r"(?P<street>^\w.+):.+")
cards_regex = re.compile(r"\[(?P<cards>.+)\]")
addon_regex = re.compile(
r"(?P<player>.+?) @ (?P<device_id>[-\w]+)\" adding (?P<amount>\d+\.\d{2})"
r"(?P<player>.+?) @ (?P<device_id>[-\w]+)\" adding (?P<amount>\d+\.\d{2}|\d+)"
)
hero_hand_regex = re.compile(r"Your hand is (?P<cards>.+)")
non_bet_action_regex = re.compile(
r"\"(?P<player>.+?) @ (?P<device_id>[-\w]+)\" (?P<player_action>\w+(?![ a-z]+\d+\.\d{2}))"
r"\"(?P<player>.+?) @ (?P<device_id>[-\w]+)\" (?P<player_action>\w+(?![ a-z]+(?:\d+\.\d{2}|\d+)))"
)
bet_action_regex = re.compile(
r"\"(?P<player>.+?) @ (?P<device_id>[-\w]+)\" (?!collected)(?!shows)(?P<player_action>\w+) "
r"[a-z]*\s*(?P<amount>\d+\.\d{2})\s*(?P<all_in>[a-z ]+)*"
r"[a-z]*\s*(?P<amount>\d+\.\d{2}|\d+)\s*(?P<all_in>[a-z ]+)*"
)
uncalled_regex = re.compile(
r"Uncalled bet of (?P<amount>\d+\.\d{2}) .+ \"(?P<player>.+?) @ (?P<device_id>[-\w]+)\""
r"Uncalled bet of (?P<amount>\d+\.\d{2}|\d+) .+ \"(?P<player>.+?) @ (?P<device_id>[-\w]+)\""
)
show_regex = re.compile(
r"\"(?P<player>.+?) @ (?P<device_id>[-\w]+)\" "
r"(?P<player_action>\w+) a (?P<cards>[\dAKQJTshcd, ]+)\."
)
winner_regex = re.compile(
r"\"(?P<player>.+?) @ (?P<device_id>[-\w]+)\" (?P<player_action>collected) "
r"(?P<amount>\d+\.\d{2}).+"
r"(?P<amount>\d+\.\d{2}|\d+).+"
)
log_dir = Path("./Logs")
log_dir.mkdir(exist_ok=True)
Expand Down

0 comments on commit 930654e

Please sign in to comment.