Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelseeger committed Jul 22, 2024
1 parent 223e8a8 commit c8b3e76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
13 changes: 7 additions & 6 deletions obs_client.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import obsws_python as obs
import click

from time import sleep

from obs_tools.sc2client import sc2client
from config import config
from obs_tools.types import UIInfo, Screen
import click
import obsws_python as obs
from rich import print

from config import config
from obs_tools.sc2client import sc2client
from obs_tools.types import Screen, UIInfo


@click.command()
def main():
"""Monitor SC2 UI through client API and let OBS know when loading screen is active"""
with obs.ReqClient(
host="localhost", port=4455, password=config.obs_ws_pw, timeout=3
) as cl:
Expand Down
6 changes: 3 additions & 3 deletions obs_tools/sc2client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from config import config

from .types import GameInfo, Result, ScanResult, UIInfo, Screen
from .types import GameInfo, Result, ScanResult, Screen, UIInfo

log = logging.getLogger(f"{config.name}.{__name__}")

Expand Down Expand Up @@ -43,12 +43,12 @@ def get_opponent_name(self, gameinfo=None) -> str:
if player.name != config.student.name:
return player.name
return None

def get_screens(self) -> UIInfo:
try:
response = requests.get(config.sc2_client_url + "/ui")
if response.status_code == 200:
try:
try:
ui = UIInfo.model_validate_json(response.text)
return ui
except ValidationError as e:
Expand Down

0 comments on commit c8b3e76

Please sign in to comment.