Skip to content

Commit

Permalink
update for playoff win counters, and open / invitational string on pr…
Browse files Browse the repository at this point in the history
…e-screen. start moving some of the resources to the leauge site.
  • Loading branch information
KonoTyran committed Dec 7, 2022
1 parent 5b58a7d commit fe15eac
Show file tree
Hide file tree
Showing 8 changed files with 575 additions and 851 deletions.
21 changes: 18 additions & 3 deletions src/main/java/com/alttprleague/LeagueRestreamTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.time.ZonedDateTime;
import java.util.Timer;
import java.util.*;
import java.util.prefs.Preferences;
import java.util.stream.Collectors;

import static org.slf4j.LoggerFactory.getLogger;
Expand All @@ -47,8 +46,6 @@ public class LeagueRestreamTool {
private final int BOTTOM_LEFT_PORT = 27772;
private final int BOTTOM_RIGHT_PORT = 27773;

private Preferences root;

private final HttpClient httpClient = HttpClient.newHttpClient();

public final Settings settings = new Settings();
Expand Down Expand Up @@ -300,6 +297,12 @@ private void ProcessWebsiteResponse(String json) {
raceTemplate.getElementById("t1_name").text(channel.episode.players[0].team.name + " ("+ channel.episode.players[0].team.points +")");
preRaceTemplate.getElementById("t1_logo").attr("src",channel.episode.players[0].team.logo_url);
preRaceTemplate.getElementById("t1_name").text(channel.episode.players[0].team.name + " ("+ channel.episode.players[0].team.points +")");
if(channel.episode.is_playoff) {
raceTemplate.getElementById("t1_wins").removeClass("hidden");
raceTemplate.getElementById("t1_wins").attr("data-wins", String.valueOf(channel.episode.players[0].team.stage_wins));
raceTemplate.getElementById("t1_name").text(channel.episode.players[0].team.name);
preRaceTemplate.getElementById("t1_name").text(channel.episode.players[0].team.name + " ("+ channel.episode.players[0].team.stage_wins +")");
}

// LEFT TEAM PLAYER 1
startStreamLink(Screen.TOP_LEFT,channel.episode.players[0].streaming_from);
Expand Down Expand Up @@ -327,6 +330,12 @@ private void ProcessWebsiteResponse(String json) {
raceTemplate.getElementById("t2_name").text(channel.episode.players[1].team.name + " ("+ channel.episode.players[1].team.points +")");
preRaceTemplate.getElementById("t2_logo").attr("src",channel.episode.players[1].team.logo_url);
preRaceTemplate.getElementById("t2_name").text(channel.episode.players[1].team.name + " ("+ channel.episode.players[1].team.points +")");
if(channel.episode.is_playoff) {
raceTemplate.getElementById("t2_wins").removeClass("hidden");
raceTemplate.getElementById("t2_wins").attr("data-wins", String.valueOf(channel.episode.players[1].team.stage_wins));
raceTemplate.getElementById("t2_name").text(channel.episode.players[1].team.name);
preRaceTemplate.getElementById("t2_name").text(channel.episode.players[1].team.name + " ("+ channel.episode.players[1].team.stage_wins +")");
}


// RIGHT TEAM PLAYER 1
Expand All @@ -352,6 +361,12 @@ private void ProcessWebsiteResponse(String json) {
// Stage & MODE
preRaceTemplate.getElementById("stage").text(channel.episode.stage);
preRaceTemplate.getElementById("mode").text(channel.episode.mode);
preRaceTemplate.getElementById("open").text(channel.episode.season.open ? "Open":"Invitational");
if(channel.episode.is_playoff && (channel.episode.background.toLowerCase().contains("power") || channel.episode.background.toLowerCase().contains("game4"))) {
raceTemplate.getElementById("mode").removeClass("hidden");
raceTemplate.getElementById("mode").text(channel.episode.mode);
}


// BACKGROUND
raceTemplate.getElementById("layout").attr("src", channel.episode.background);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ public class Episode {
public String racetime_room = "";
public String stage = "";
public String mode = "";
public Season season = new Season();
public String[] playlist = new String[]{};
public boolean is_playoff = false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.alttprleague.networkObjects.league;

public class Season {
public boolean in_playoffs = false;
public String name = "";
public boolean open = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ public class Team {
public String name;
public int points;
public String standings;
public int stage_wins = 0;
}
Loading

0 comments on commit fe15eac

Please sign in to comment.