Skip to content

Commit

Permalink
Merge pull request #63 from timotheeg/restream_update
Browse files Browse the repository at this point in the history
Restream script: Store overall crop per user too
  • Loading branch information
alex-ong authored Aug 2, 2020
2 parents 9d8147d + 7107d4e commit 537ad82
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions scripts/restream.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,26 +106,33 @@ def setup_player(twitch_name, player_num, local_vlc=True):
# ==================================
# 3. write player config file from template

has_existing_config = False
player_config_file = "scripts/restream_configs/{}.json".format(twitch_name)

template = (
player_config_file if os.path.isfile(player_config_file) else TEMPLATE_FILE
)
if os.path.isfile(player_config_file):
template = player_config_file
has_existing_config = True
else:
template = TEMPLATE_FILE

config = Config(player_config_file, auto_save=False, default_config=template)

config["player.name"] = twitch_name
config["player.twitch_url"] = twitch_url
config["performance.scan_rate"] = fps
config["calibration.game_coords"] = [
0,
0,
round(width * CAP_RATIOS[0]),
round(height * CAP_RATIOS[1]),
]
config["network.port"] = ocr_dest_port
config["capture.source_id"] = source_url

if not has_existing_config:
# set overall crop to follow stencil
# dont modified existing configs however, to store config for non-stencil streams too
config["calibration.game_coords"] = [
0,
0,
round(width * CAP_RATIOS[0]),
round(height * CAP_RATIOS[1]),
]

config.save()

# ==================================
Expand Down

0 comments on commit 537ad82

Please sign in to comment.