Rename player variable, reorganize assets and directories
6
.github/workflows/gen_windows_release.yml
vendored
@@ -1,7 +1,7 @@
|
||||
name: Generate Windows Release
|
||||
|
||||
on:
|
||||
#push:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -18,8 +18,8 @@ jobs:
|
||||
with:
|
||||
python-version: 3.10
|
||||
|
||||
- run: pip install -r requirements.txt pyinstaller
|
||||
- run: pyinstaller main.py --onefile -w --icon icons\icon.ico
|
||||
- run: pip install -r dependencies/requirements.txt pyinstaller
|
||||
- run: pyinstaller main.py --onefile -w --icon assets\icons\icon.ico
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
|
||||
18
.gitignore
vendored
@@ -1,5 +1,5 @@
|
||||
assets/games/*
|
||||
assets/alerts_red.json
|
||||
user_data/games/*
|
||||
user_data/alerts_red.json
|
||||
out/
|
||||
character_icon/chara_0*
|
||||
character_icon/chara_1*
|
||||
@@ -8,18 +8,18 @@ character_icon/*.tar.xz
|
||||
powerrankings_player_data.json
|
||||
tournament_players.json
|
||||
local_players*.csv
|
||||
settings.json
|
||||
user_data/settings.json
|
||||
update.tar.gz
|
||||
__pycache__/
|
||||
.vscode/
|
||||
log_error.txt
|
||||
log.txt
|
||||
sponsor_logo/*
|
||||
!sponsor_logo/*.txt
|
||||
player_avatar/*
|
||||
!player_avatar/*.txt
|
||||
team_logo/*
|
||||
!team_logo/*.txt
|
||||
user_data/sponsor_logo/*
|
||||
!user_data/sponsor_logo/*.txt
|
||||
user_data/player_avatar*
|
||||
!user_data/player_avatar*.txt
|
||||
user_data/team_logo/*
|
||||
!user_data/team_logo/*.txt
|
||||
layout_custom/*
|
||||
dist
|
||||
build
|
||||
@@ -130,7 +130,7 @@ It's not possible to animate these elements unless there's an OBS plugin for tha
|
||||
|
||||
## Sponsor logos
|
||||
|
||||
You can find a directory called `/sponsor_logo/` in the program's directory. If you put an image, say, `google.png` (has to be a lowercase png), and a player has its prefix set as `GOOGLE`, `google` (or any casing variations) this file will also get copied to the output.
|
||||
You can find a directory called `/user_data/sponsor_logo/` in the program's directory. If you put an image, say, `google.png` (has to be a lowercase png), and a player has its prefix set as `GOOGLE`, `google` (or any casing variations) this file will also get copied to the output.
|
||||
|
||||
## Donations
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 699 B After Width: | Height: | Size: 699 B |
|
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 357 B |
|
Before Width: | Height: | Size: 219 B After Width: | Height: | Size: 219 B |
|
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 220 B |
|
Before Width: | Height: | Size: 353 B After Width: | Height: | Size: 353 B |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 608 B After Width: | Height: | Size: 608 B |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
@@ -8,7 +8,7 @@
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
sodipodi:docname="icon.svg"
|
||||
inkscape:export-filename="/home/joao/SmashStreamHelper/icons/icon.png"
|
||||
inkscape:export-filename="/home/joao/SmashStreamHelper/assets/icons/icon.png"
|
||||
inkscape:export-xdpi="3072.0002"
|
||||
inkscape:export-ydpi="3072.0002"
|
||||
inkscape:version="1.1.2 (76b9e6a115, 2022-02-25)"
|
||||
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 669 B After Width: | Height: | Size: 669 B |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 639 B After Width: | Height: | Size: 639 B |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 767 B After Width: | Height: | Size: 767 B |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
@@ -1,2 +0,0 @@
|
||||
@echo off
|
||||
python .\src\generate_thumbnail.py
|
||||
@@ -11,7 +11,7 @@
|
||||
data = await getData();
|
||||
|
||||
let characters =
|
||||
data.score.team[window.team].players[window.player].character;
|
||||
data.score.team[window.team].player[window.player].character;
|
||||
|
||||
if (JSON.stringify(characters) != JSON.stringify(oldCharacters)) {
|
||||
TweenMax.to(".container", 0.1, { autoAlpha: 0 }).then(() => {
|
||||
|
||||
@@ -1,55 +1,52 @@
|
||||
(($) => {
|
||||
function Start(){
|
||||
|
||||
}
|
||||
(($) => {
|
||||
function Start() {}
|
||||
|
||||
var data = {}
|
||||
var oldData = {}
|
||||
var data = {};
|
||||
var oldData = {};
|
||||
|
||||
let oldCharacters = {}
|
||||
let oldCharacters = {};
|
||||
|
||||
async function Update(){
|
||||
oldData = data;
|
||||
data = await getData();
|
||||
async function Update() {
|
||||
oldData = data;
|
||||
data = await getData();
|
||||
|
||||
let characters = data.score.team["1"].players["1"].character;
|
||||
let characters = data.score.team["1"].player["1"].character;
|
||||
|
||||
if(JSON.stringify(characters) != JSON.stringify(oldCharacters)){
|
||||
oldCharacters = characters;
|
||||
if (JSON.stringify(characters) != JSON.stringify(oldCharacters)) {
|
||||
oldCharacters = characters;
|
||||
|
||||
assetToUse = "base_files/icon";
|
||||
characterAssets = []
|
||||
|
||||
Object.values(characters).forEach((character)=>{
|
||||
if(character.assets){
|
||||
if(character.assets.hasOwnProperty(assetToUse)){
|
||||
characterAssets.push(character.assets[assetToUse])
|
||||
} else {
|
||||
characterAssets.push({})
|
||||
}
|
||||
}
|
||||
})
|
||||
assetToUse = "base_files/icon";
|
||||
characterAssets = [];
|
||||
|
||||
let elements = "";
|
||||
|
||||
characterAssets.forEach((asset, i)=>{
|
||||
elements += `<div class="icon" id="character${i}" style='background-image: url(../../${asset.asset})'></div>`;
|
||||
})
|
||||
|
||||
elements += `<div class="index_display"></div>`
|
||||
|
||||
$(".container").html(elements);
|
||||
|
||||
imgs = $.makeArray($('.icon'));
|
||||
Object.values(characters).forEach((character) => {
|
||||
if (character.assets) {
|
||||
if (character.assets.hasOwnProperty(assetToUse)) {
|
||||
characterAssets.push(character.assets[assetToUse]);
|
||||
} else {
|
||||
characterAssets.push({});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let elements = "";
|
||||
|
||||
characterAssets.forEach((asset, i) => {
|
||||
elements += `<div class="icon" id="character${i}" style='background-image: url(../../${asset.asset})'></div>`;
|
||||
});
|
||||
|
||||
elements += `<div class="index_display"></div>`;
|
||||
|
||||
$(".container").html(elements);
|
||||
|
||||
imgs = $.makeArray($(".icon"));
|
||||
}
|
||||
}
|
||||
|
||||
Update();
|
||||
$(window).on("load", () => {
|
||||
$('body').fadeTo(500, 1, async () => {
|
||||
Start();
|
||||
setInterval(Update, 1000);
|
||||
});
|
||||
Update();
|
||||
$(window).on("load", () => {
|
||||
$("body").fadeTo(500, 1, async () => {
|
||||
Start();
|
||||
setInterval(Update, 1000);
|
||||
});
|
||||
})(jQuery);
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
@@ -48,7 +48,7 @@ baseMap.addTo(map);
|
||||
let servers = [];
|
||||
|
||||
Object.values(data.score.team).forEach((team) => {
|
||||
Object.values(team.players).forEach((player) => {
|
||||
Object.values(team.player).forEach((player) => {
|
||||
let pos = [
|
||||
player.state.latitude != null
|
||||
? parseFloat(player.state.latitude)
|
||||
@@ -274,10 +274,10 @@ baseMap.addTo(map);
|
||||
|
||||
if (
|
||||
Object.keys(oldData).length == 0 ||
|
||||
JSON.stringify(oldData.score.team["1"].players) !=
|
||||
JSON.stringify(data.score.team["1"].players) ||
|
||||
JSON.stringify(oldData.score.team["2"].players) !=
|
||||
JSON.stringify(data.score.team["2"].players)
|
||||
JSON.stringify(oldData.score.team["1"].player) !=
|
||||
JSON.stringify(data.score.team["1"].player) ||
|
||||
JSON.stringify(oldData.score.team["2"].player) !=
|
||||
JSON.stringify(data.score.team["2"].player)
|
||||
) {
|
||||
UpdateMap();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
data = await getData();
|
||||
|
||||
[data.score.team["1"], data.score.team["2"]].forEach((team, t) => {
|
||||
[team.players["1"]].forEach((player, p) => {
|
||||
[team.player["1"]].forEach((player, p) => {
|
||||
if (player) {
|
||||
SetInnerHtml(
|
||||
$(`.p${t + 1}.container .name`),
|
||||
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 28 KiB |
@@ -1,93 +1,148 @@
|
||||
(($) => {
|
||||
let startingAnimation = gsap.timeline({ paused: true })
|
||||
.from(['.left .container'], { duration: 1, x: '-100%', ease: "power2.inOut" }, 0)
|
||||
.from(['.right .container'], { duration: 1, x: '+100%', ease: "power2.inOut" }, 0)
|
||||
.from(['.score'], { duration: 1, autoAlpha: '0', ease: "power2.inOut" }, 0)
|
||||
.from(['.left .character_container'], { duration: 1, x: '+50%', ease: "power2.inOut" }, 0)
|
||||
.from(['.right .character_container'], { duration: 1, x: '-50%', ease: "power2.inOut" }, 0)
|
||||
.from(['.container_top'], { duration: 1, y: "-100%", ease: "power2.inOut" }, 0)
|
||||
.from(['.container_bottom'], { duration: 1, y: '+100%', ease: "power2.inOut" }, 0)
|
||||
|
||||
function Start(){
|
||||
startingAnimation.restart();
|
||||
}
|
||||
let startingAnimation = gsap
|
||||
.timeline({ paused: true })
|
||||
.from(
|
||||
[".left .container"],
|
||||
{ duration: 1, x: "-100%", ease: "power2.inOut" },
|
||||
0
|
||||
)
|
||||
.from(
|
||||
[".right .container"],
|
||||
{ duration: 1, x: "+100%", ease: "power2.inOut" },
|
||||
0
|
||||
)
|
||||
.from([".score"], { duration: 1, autoAlpha: "0", ease: "power2.inOut" }, 0)
|
||||
.from(
|
||||
[".left .character_container"],
|
||||
{ duration: 1, x: "+50%", ease: "power2.inOut" },
|
||||
0
|
||||
)
|
||||
.from(
|
||||
[".right .character_container"],
|
||||
{ duration: 1, x: "-50%", ease: "power2.inOut" },
|
||||
0
|
||||
)
|
||||
.from(
|
||||
[".container_top"],
|
||||
{ duration: 1, y: "-100%", ease: "power2.inOut" },
|
||||
0
|
||||
)
|
||||
.from(
|
||||
[".container_bottom"],
|
||||
{ duration: 1, y: "+100%", ease: "power2.inOut" },
|
||||
0
|
||||
);
|
||||
|
||||
var data = {}
|
||||
var oldData = {}
|
||||
function Start() {
|
||||
startingAnimation.restart();
|
||||
}
|
||||
|
||||
async function Update(){
|
||||
oldData = data;
|
||||
data = await getData();
|
||||
var data = {};
|
||||
var oldData = {};
|
||||
|
||||
Object.values(data.score.team).forEach((team, t) => {
|
||||
console.log(team)
|
||||
async function Update() {
|
||||
oldData = data;
|
||||
data = await getData();
|
||||
|
||||
let team_id = ["left", "right"][t];
|
||||
Object.values(data.score.team).forEach((team, t) => {
|
||||
console.log(team);
|
||||
|
||||
SetInnerHtml($(`.${team_id} .score`), String(team.score));
|
||||
let team_id = ["left", "right"][t];
|
||||
|
||||
let team_size = Object.values(team.players).length;
|
||||
SetInnerHtml($(`.${team_id} .score`), String(team.score));
|
||||
|
||||
let firstRun = Object.keys(oldData).length == 0;
|
||||
let time = firstRun ? 0 : 1;
|
||||
let team_size = Object.values(team.player).length;
|
||||
|
||||
if(team_size == 1){
|
||||
gsap.timeline().to($(`.${team_id} .p${2}.container`), {height: 0}, time);
|
||||
} else {
|
||||
gsap.timeline().to($(`.${team_id} .p${2}.container`), {height: "420px"}, time);
|
||||
}
|
||||
|
||||
Object.values(team.players).forEach((player, p)=>{
|
||||
if(player){
|
||||
SetInnerHtml($(`.${team_id} .p${p+1} .name`), `
|
||||
<span class="sponsor">${player.team ? player.team+" " : ""}</span>${String(player.name)}
|
||||
`);
|
||||
|
||||
SetInnerHtml($(`.${team_id} .p${p+1} .flagcountry`), `
|
||||
<div class='flag' style='background-image: url(../../${String(player.country.asset).toLowerCase()})'></div>
|
||||
`);
|
||||
|
||||
SetInnerHtml($(`.${team_id} .p${p+1} .flagstate`), `
|
||||
let firstRun = Object.keys(oldData).length == 0;
|
||||
let time = firstRun ? 0 : 1;
|
||||
|
||||
if (team_size == 1) {
|
||||
gsap
|
||||
.timeline()
|
||||
.to($(`.${team_id} .p${2}.container`), { height: 0 }, time);
|
||||
} else {
|
||||
gsap
|
||||
.timeline()
|
||||
.to($(`.${team_id} .p${2}.container`), { height: "420px" }, time);
|
||||
}
|
||||
|
||||
Object.values(team.player).forEach((player, p) => {
|
||||
if (player) {
|
||||
SetInnerHtml(
|
||||
$(`.${team_id} .p${p + 1} .name`),
|
||||
`
|
||||
<span class="sponsor">${
|
||||
player.team ? player.team + " " : ""
|
||||
}</span>${String(player.name)}
|
||||
`
|
||||
);
|
||||
|
||||
SetInnerHtml(
|
||||
$(`.${team_id} .p${p + 1} .flagcountry`),
|
||||
`
|
||||
<div class='flag' style='background-image: url(../../${String(
|
||||
player.country.asset
|
||||
).toLowerCase()})'></div>
|
||||
`
|
||||
);
|
||||
|
||||
SetInnerHtml(
|
||||
$(`.${team_id} .p${p + 1} .flagstate`),
|
||||
`
|
||||
<div class='flag' style='background-image: url(../../${player.state.asset})'></div>
|
||||
`);
|
||||
|
||||
let charactersHtml = ""
|
||||
|
||||
Object.values(player.character).forEach((character)=>{
|
||||
if(character.assets["full"]){
|
||||
charactersHtml += `
|
||||
`
|
||||
);
|
||||
|
||||
let charactersHtml = "";
|
||||
|
||||
Object.values(player.character).forEach((character) => {
|
||||
if (character.assets["full"]) {
|
||||
charactersHtml += `
|
||||
<div class='character' style='background-image: url(../../${character.assets["full"].asset})'></div>
|
||||
`
|
||||
}
|
||||
})
|
||||
|
||||
SetInnerHtml($(`.${team_id} .p${p+1} .character_container`), charactersHtml);
|
||||
|
||||
SetInnerHtml($(`.${team_id} .p${p+1} .twitter`), player.twitter);
|
||||
|
||||
SetInnerHtml($(`.${team_id} .p${p+1} .sponsor_logo`),
|
||||
`<div class='sponsor_logo' style='background-image: url(../../${String(player.sponsor_logo)})'></div>`);
|
||||
}
|
||||
})
|
||||
`;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
SetInnerHtml(
|
||||
$(`.${team_id} .p${p + 1} .character_container`),
|
||||
charactersHtml
|
||||
);
|
||||
|
||||
SetInnerHtml($(".info.container.top"), data.tournamentInfo.tournamentName);
|
||||
SetInnerHtml($(`.${team_id} .p${p + 1} .twitter`), player.twitter);
|
||||
|
||||
SetInnerHtml($(".info.container.bottom"), `
|
||||
<div class="info container_inner">
|
||||
${data.score.phase? `<div>${data.score.phase}</div>` : ""}
|
||||
${data.score.match? `<div>${data.score.match}</div>` : ""}
|
||||
${data.score.best_of? `<div>Best of ${data.score.best_of}</div>` : ""}
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
|
||||
Update();
|
||||
$(window).on("load", () => {
|
||||
$('body').fadeTo(500, 1, async () => {
|
||||
Start();
|
||||
setInterval(Update, 1000);
|
||||
});
|
||||
SetInnerHtml(
|
||||
$(`.${team_id} .p${p + 1} .sponsor_logo`),
|
||||
`<div class='sponsor_logo' style='background-image: url(../../${String(
|
||||
player.sponsor_logo
|
||||
)})'></div>`
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
SetInnerHtml($(".info.container.top"), data.tournamentInfo.tournamentName);
|
||||
|
||||
SetInnerHtml(
|
||||
$(".info.container.bottom"),
|
||||
`
|
||||
<div class="info container_inner">
|
||||
${data.score.phase ? `<div>${data.score.phase}</div>` : ""}
|
||||
${data.score.match ? `<div>${data.score.match}</div>` : ""}
|
||||
${
|
||||
data.score.best_of
|
||||
? `<div>Best of ${data.score.best_of}</div>`
|
||||
: ""
|
||||
}
|
||||
</div>
|
||||
`
|
||||
);
|
||||
}
|
||||
|
||||
Update();
|
||||
$(window).on("load", () => {
|
||||
$("body").fadeTo(500, 1, async () => {
|
||||
Start();
|
||||
setInterval(Update, 1000);
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 28 KiB |
@@ -28,14 +28,14 @@
|
||||
oldData = data;
|
||||
data = await getData();
|
||||
|
||||
let isDoubles = Object.keys(data.score.team["1"].players).length == 2;
|
||||
let isDoubles = Object.keys(data.score.team["1"].player).length == 2;
|
||||
|
||||
if (
|
||||
oldData.score == null ||
|
||||
Object.keys(oldData.score.team["1"].players).length !=
|
||||
Object.keys(data.score.team["1"].players).length
|
||||
Object.keys(oldData.score.team["1"].player).length !=
|
||||
Object.keys(data.score.team["1"].player).length
|
||||
) {
|
||||
if (Object.keys(data.score.team["1"].players).length == 1) {
|
||||
if (Object.keys(data.score.team["1"].player).length == 1) {
|
||||
gsap
|
||||
.timeline()
|
||||
.fromTo(
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
if (!team.teamName || team.teamName == "") {
|
||||
let names = [];
|
||||
Object.values(team.players).forEach((player, p) => {
|
||||
Object.values(team.player).forEach((player, p) => {
|
||||
if (player) {
|
||||
names.push(player.name);
|
||||
}
|
||||
@@ -87,7 +87,7 @@
|
||||
`
|
||||
);
|
||||
|
||||
Object.values(team.players).forEach((player, p) => {
|
||||
Object.values(team.player).forEach((player, p) => {
|
||||
if (player) {
|
||||
SetInnerHtml(
|
||||
$(`.t${t + 1}.p${p + 1} .name`),
|
||||
|
||||
BIN
layout/scoreboard_simple/logo.png
Normal file → Executable file
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 28 KiB |
@@ -70,11 +70,11 @@ body {
|
||||
height: 64px;
|
||||
}
|
||||
.stamp.stage-striked {
|
||||
background-image: url(../../icons/stage_strike.svg);
|
||||
background-image: url(../../assets/icons/stage_strike.svg);
|
||||
}
|
||||
.stamp.stage-dsr {
|
||||
background-image: url(../../icons/stage_dsr.svg);
|
||||
background-image: url(../../assets/icons/stage_dsr.svg);
|
||||
}
|
||||
.stamp.stage-selected {
|
||||
background-image: url(../../icons/stage_select.svg);
|
||||
background-image: url(../../assets/icons/stage_select.svg);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
(($) => {
|
||||
// Change this to the name of the assets pack you want to use
|
||||
// It's basically the folder name: assets/games/game/ASSETPACK
|
||||
// It's basically the folder name: user_data/games/game/ASSETPACK
|
||||
var ASSET_TO_USE = "full";
|
||||
|
||||
// Change this to select wether to flip P2 character asset or not
|
||||
@@ -40,7 +40,7 @@
|
||||
body: JSON.stringify({
|
||||
operationName: "UserSetQuery",
|
||||
variables: {
|
||||
userId: data.score.team["1"].players["1"].id,
|
||||
userId: data.score.team["1"].player["1"].id,
|
||||
},
|
||||
query: `
|
||||
query UserSetQuery($userId: ID!) {
|
||||
@@ -72,7 +72,7 @@
|
||||
body: JSON.stringify({
|
||||
operationName: "UserSetQuery",
|
||||
variables: {
|
||||
userId: data.score.team["2"].players["1"].id,
|
||||
userId: data.score.team["2"].player["1"].id,
|
||||
},
|
||||
query: `
|
||||
query UserSetQuery($userId: ID!) {
|
||||
@@ -112,7 +112,7 @@
|
||||
body: JSON.stringify({
|
||||
operationName: "UserSetQuery",
|
||||
variables: {
|
||||
userId: data.score.team["1"].players["1"].id,
|
||||
userId: data.score.team["1"].player["1"].id,
|
||||
},
|
||||
query: `
|
||||
query UserSetQuery($userId: ID!) {
|
||||
@@ -256,7 +256,7 @@
|
||||
data = await getData();
|
||||
|
||||
Object.values(data.score.team).forEach((team, t) => {
|
||||
Object.values(team.players).forEach((player, p) => {
|
||||
Object.values(team.player).forEach((player, p) => {
|
||||
SetInnerHtml(
|
||||
$(`.p${t + 1} .name`),
|
||||
`
|
||||
@@ -323,7 +323,7 @@
|
||||
!oldData.score ||
|
||||
JSON.stringify(player.character) !=
|
||||
JSON.stringify(
|
||||
oldData.score.team[String(t + 1)].players[String(p + 1)].character
|
||||
oldData.score.team[String(t + 1)].player[String(p + 1)].character
|
||||
)
|
||||
) {
|
||||
let html = "";
|
||||
@@ -442,10 +442,10 @@
|
||||
|
||||
if (
|
||||
!oldData.score ||
|
||||
data.score.team["1"].players["1"].id !=
|
||||
oldData.score.team["1"].players["1"].id ||
|
||||
data.score.team["2"].players["1"].id !=
|
||||
oldData.score.team["2"].players["1"].id
|
||||
data.score.team["1"].player["1"].id !=
|
||||
oldData.score.team["1"].player["1"].id ||
|
||||
data.score.team["2"].player["1"].id !=
|
||||
oldData.score.team["2"].player["1"].id
|
||||
) {
|
||||
playersRecentSets = [];
|
||||
GetPlayersRecentSets();
|
||||
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 28 KiB |
@@ -1,6 +1,6 @@
|
||||
(($) => {
|
||||
// Change this to the name of the assets pack you want to use
|
||||
// It's basically the folder name: assets/games/game/ASSETPACK
|
||||
// It's basically the folder name: user_data/games/game/ASSETPACK
|
||||
var ASSET_TO_USE = "full";
|
||||
|
||||
// Change this to select wether to flip P2 character asset or not
|
||||
@@ -37,7 +37,7 @@
|
||||
data = await getData();
|
||||
|
||||
Object.values(data.score.team).forEach((team, t) => {
|
||||
Object.values(team.players).forEach((player, p) => {
|
||||
Object.values(team.player).forEach((player, p) => {
|
||||
SetInnerHtml(
|
||||
$(`.p${t + 1} .name`),
|
||||
`
|
||||
@@ -104,7 +104,7 @@
|
||||
!oldData.score ||
|
||||
JSON.stringify(player.character) !=
|
||||
JSON.stringify(
|
||||
oldData.score.team[String(t + 1)].players[String(p + 1)].character
|
||||
oldData.score.team[String(t + 1)].player[String(p + 1)].character
|
||||
)
|
||||
) {
|
||||
let html = "";
|
||||
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 28 KiB |
@@ -1,144 +1,186 @@
|
||||
(($) => {
|
||||
// Change this to the name of the assets pack you want to use
|
||||
// It's basically the folder name: assets/games/game/ASSETPACK
|
||||
var ASSET_TO_USE = "full";
|
||||
// Change this to the name of the assets pack you want to use
|
||||
// It's basically the folder name: user_data/games/game/ASSETPACK
|
||||
var ASSET_TO_USE = "full";
|
||||
|
||||
// Change this to select wether to flip P2 character asset or not
|
||||
// Set it to true or false
|
||||
var FLIP_P2_ASSET = false;
|
||||
// Change this to select wether to flip P2 character asset or not
|
||||
// Set it to true or false
|
||||
var FLIP_P2_ASSET = false;
|
||||
|
||||
let startingAnimation = gsap.timeline({ paused: true })
|
||||
.from(['.phase'], { duration: .8, opacity: '0', ease: "power2.inOut" }, 0)
|
||||
.from(['.score_container'], { duration: .8, opacity: '0', ease: "power2.inOut" }, 0)
|
||||
.from(['.best_of'], { duration: .8, opacity: '0', ease: "power2.inOut" }, 0)
|
||||
.from(['.vs'], { duration: .4, opacity: '0', scale: 4, ease: "out" }, 0.5)
|
||||
.from(['.p1.character'], { duration: 1, x: "-200px", ease: "out" }, 0)
|
||||
.from(['.p1.container'], { duration: 1, x: "-100px", ease: "out" }, 0)
|
||||
.from(['.p2.character'], { duration: 1, x: "200px", ease: "out" }, 0)
|
||||
.from(['.p2.container'], { duration: 1, x: "100px", ease: "out" }, 0)
|
||||
|
||||
function Start(){
|
||||
startingAnimation.restart();
|
||||
}
|
||||
let startingAnimation = gsap
|
||||
.timeline({ paused: true })
|
||||
.from([".phase"], { duration: 0.8, opacity: "0", ease: "power2.inOut" }, 0)
|
||||
.from(
|
||||
[".score_container"],
|
||||
{ duration: 0.8, opacity: "0", ease: "power2.inOut" },
|
||||
0
|
||||
)
|
||||
.from(
|
||||
[".best_of"],
|
||||
{ duration: 0.8, opacity: "0", ease: "power2.inOut" },
|
||||
0
|
||||
)
|
||||
.from([".vs"], { duration: 0.4, opacity: "0", scale: 4, ease: "out" }, 0.5)
|
||||
.from([".p1.character"], { duration: 1, x: "-200px", ease: "out" }, 0)
|
||||
.from([".p1.container"], { duration: 1, x: "-100px", ease: "out" }, 0)
|
||||
.from([".p2.character"], { duration: 1, x: "200px", ease: "out" }, 0)
|
||||
.from([".p2.container"], { duration: 1, x: "100px", ease: "out" }, 0);
|
||||
|
||||
var data = {}
|
||||
var oldData = {}
|
||||
function Start() {
|
||||
startingAnimation.restart();
|
||||
}
|
||||
|
||||
async function Update(){
|
||||
oldData = data;
|
||||
data = await getData();
|
||||
var data = {};
|
||||
var oldData = {};
|
||||
|
||||
["p1", "p2"].forEach((p)=>{
|
||||
SetInnerHtml($(`.${p} .name`), `
|
||||
async function Update() {
|
||||
oldData = data;
|
||||
data = await getData();
|
||||
|
||||
["p1", "p2"].forEach((p) => {
|
||||
SetInnerHtml(
|
||||
$(`.${p} .name`),
|
||||
`
|
||||
<span>
|
||||
<span class='sponsor'>
|
||||
${data[p+"_org"] ? (data[p+"_org"]+" ") : ""}
|
||||
${data[p + "_org"] ? data[p + "_org"] + " " : ""}
|
||||
</span>
|
||||
${data[p+"_name"]}
|
||||
${data[p+"_losers"] ? " [L]" : ""}
|
||||
${data[p + "_name"]}
|
||||
${data[p + "_losers"] ? " [L]" : ""}
|
||||
</span>
|
||||
`);
|
||||
`
|
||||
);
|
||||
|
||||
SetInnerHtml($(`.${p} .sponsor_logo`),
|
||||
data[p+"_org"] ? `
|
||||
SetInnerHtml(
|
||||
$(`.${p} .sponsor_logo`),
|
||||
data[p + "_org"]
|
||||
? `
|
||||
<div>
|
||||
<div class='sponsor_logo' style='background-image: url(../../sponsor_logos/${data[p+"_org"].toUpperCase()}.png)'></div>
|
||||
<div class='sponsor_logo' style='background-image: url(../../sponsor_logos/${data[
|
||||
p + "_org"
|
||||
].toUpperCase()}.png)'></div>
|
||||
</div>`
|
||||
:
|
||||
""
|
||||
, oldData[p+"_org"] != data[p+"_org"]);
|
||||
|
||||
SetInnerHtml($(`.${p} .real_name`), `${data[p+"_real_name"]}`);
|
||||
|
||||
SetInnerHtml($(`.${p} .twitter`), `
|
||||
${data[p+"_twitter"] ? `
|
||||
: "",
|
||||
oldData[p + "_org"] != data[p + "_org"]
|
||||
);
|
||||
|
||||
SetInnerHtml($(`.${p} .real_name`), `${data[p + "_real_name"]}`);
|
||||
|
||||
SetInnerHtml(
|
||||
$(`.${p} .twitter`),
|
||||
`
|
||||
${
|
||||
data[p + "_twitter"]
|
||||
? `
|
||||
<div class="twitter_logo"></div>
|
||||
${data[p+"_twitter"]}
|
||||
${data[p + "_twitter"]}
|
||||
`
|
||||
:
|
||||
""
|
||||
: ""
|
||||
}
|
||||
`);
|
||||
|
||||
SetInnerHtml($(`.${p} .flagcountry`),
|
||||
data[p+"_country"] ? `
|
||||
`
|
||||
);
|
||||
|
||||
SetInnerHtml(
|
||||
$(`.${p} .flagcountry`),
|
||||
data[p + "_country"]
|
||||
? `
|
||||
<div>
|
||||
<div class='flag' style='background-image: url(../../assets/country_flag/${data[p+"_country"].toLowerCase()}.png)'>
|
||||
<div class="flagname">${data[p+"_country"].toUpperCase()}</div>
|
||||
<div class='flag' style='background-image: url(../../assets/country_flag/${data[
|
||||
p + "_country"
|
||||
].toLowerCase()}.png)'>
|
||||
<div class="flagname">${data[
|
||||
p + "_country"
|
||||
].toUpperCase()}</div>
|
||||
</div>
|
||||
</div>`
|
||||
:
|
||||
""
|
||||
);
|
||||
|
||||
SetInnerHtml($(`.${p} .flagstate`),
|
||||
data[p+"_state"] ? `
|
||||
: ""
|
||||
);
|
||||
|
||||
SetInnerHtml(
|
||||
$(`.${p} .flagstate`),
|
||||
data[p + "_state"]
|
||||
? `
|
||||
<div>
|
||||
<div class='flag' style='background-image: url(../../assets/state_flag/${data[p+"_country"].toUpperCase()}/${data[p+"_state"].toUpperCase()}.png)'>
|
||||
<div class="flagname">${data[p+"_state"].toUpperCase()}</div>
|
||||
<div class='flag' style='background-image: url(../../assets/state_flag/${data[
|
||||
p + "_country"
|
||||
].toUpperCase()}/${data[
|
||||
p + "_state"
|
||||
].toUpperCase()}.png)'>
|
||||
<div class="flagname">${data[
|
||||
p + "_state"
|
||||
].toUpperCase()}</div>
|
||||
</div>
|
||||
</div>`
|
||||
:
|
||||
""
|
||||
);
|
||||
|
||||
if(oldData[p+"_character_codename"] != data[p+"_character_codename"] ||
|
||||
oldData[p+"_character_color"] != data[p+"_character_color"]){
|
||||
if(!data[p+"_assets_path"][ASSET_TO_USE].endsWith(".webm")){
|
||||
// if asset is a image, add a image element
|
||||
$(`.${p}.character`).html(`
|
||||
: ""
|
||||
);
|
||||
|
||||
if (
|
||||
oldData[p + "_character_codename"] != data[p + "_character_codename"] ||
|
||||
oldData[p + "_character_color"] != data[p + "_character_color"]
|
||||
) {
|
||||
if (!data[p + "_assets_path"][ASSET_TO_USE].endsWith(".webm")) {
|
||||
// if asset is a image, add a image element
|
||||
$(`.${p}.character`).html(`
|
||||
<div class="bg">
|
||||
<div
|
||||
class="portrait"
|
||||
style='
|
||||
background-image: url(../../${data[p+"_assets_path"][ASSET_TO_USE]});
|
||||
${p == "p2" && FLIP_P2_ASSET ? "transform: scaleX(-1)" : ""}
|
||||
background-image: url(../../${
|
||||
data[p + "_assets_path"][ASSET_TO_USE]
|
||||
});
|
||||
${
|
||||
p == "p2" && FLIP_P2_ASSET
|
||||
? "transform: scaleX(-1)"
|
||||
: ""
|
||||
}
|
||||
'>
|
||||
</div>
|
||||
</div>
|
||||
`)
|
||||
} else {
|
||||
// if asset is a video, add a video element
|
||||
$(`.${p}.character`).html(`
|
||||
`);
|
||||
} else {
|
||||
// if asset is a video, add a video element
|
||||
$(`.${p}.character`).html(`
|
||||
<div class="bg">
|
||||
<video id="video_${p}" class="video" width="auto" height="100%" autoplay muted>
|
||||
<source src="../../${data[p+"_assets_path"][ASSET_TO_USE]}">
|
||||
<source src="../../${
|
||||
data[p + "_assets_path"][ASSET_TO_USE]
|
||||
}">
|
||||
</video>
|
||||
</div>
|
||||
`)
|
||||
}
|
||||
|
||||
gsap.timeline()
|
||||
.from(
|
||||
`.${p}.character .portrait`,
|
||||
{duration: .5, opacity: 0}
|
||||
)
|
||||
.from(
|
||||
`.${p}.character .portrait`,
|
||||
{ duration: .4, filter: 'brightness(0%)', onUpdate: function(tl) {
|
||||
var tlp = (this.progress() * 100) >> 0;
|
||||
TweenMax.set(`.${p}.character .portrait`, {'filter': 'brightness(' + tlp + '%)'});
|
||||
},
|
||||
onUpdateParams: ["{self}"] }
|
||||
)
|
||||
}
|
||||
|
||||
})
|
||||
`);
|
||||
}
|
||||
|
||||
SetInnerHtml($(`.p1 .score`), String(data.score_left));
|
||||
SetInnerHtml($(`.p2 .score`), String(data.score_right));
|
||||
|
||||
SetInnerHtml($(".phase"), data.tournament_phase);
|
||||
SetInnerHtml($(".best_of"), data.best_of ? "Best of "+data.best_of : "");
|
||||
}
|
||||
|
||||
// Using update here to set images as soon as possible
|
||||
// so that on window.load they are already preloaded
|
||||
Update();
|
||||
$(window).on("load", () => {
|
||||
$('body').fadeTo(0, 1, async () => {
|
||||
Start();
|
||||
setInterval(Update, 1000);
|
||||
});
|
||||
gsap
|
||||
.timeline()
|
||||
.from(`.${p}.character .portrait`, { duration: 0.5, opacity: 0 })
|
||||
.from(`.${p}.character .portrait`, {
|
||||
duration: 0.4,
|
||||
filter: "brightness(0%)",
|
||||
onUpdate: function (tl) {
|
||||
var tlp = (this.progress() * 100) >> 0;
|
||||
TweenMax.set(`.${p}.character .portrait`, {
|
||||
filter: "brightness(" + tlp + "%)",
|
||||
});
|
||||
},
|
||||
onUpdateParams: ["{self}"],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
SetInnerHtml($(`.p1 .score`), String(data.score_left));
|
||||
SetInnerHtml($(`.p2 .score`), String(data.score_right));
|
||||
|
||||
SetInnerHtml($(".phase"), data.tournament_phase);
|
||||
SetInnerHtml($(".best_of"), data.best_of ? "Best of " + data.best_of : "");
|
||||
}
|
||||
|
||||
// Using update here to set images as soon as possible
|
||||
// so that on window.load they are already preloaded
|
||||
Update();
|
||||
$(window).on("load", () => {
|
||||
$("body").fadeTo(0, 1, async () => {
|
||||
Start();
|
||||
setInterval(Update, 1000);
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 28 KiB |
40
main.spec
@@ -1,40 +0,0 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
|
||||
block_cipher = None
|
||||
|
||||
|
||||
a = Analysis(['main.py'],
|
||||
pathex=[],
|
||||
binaries=[],
|
||||
datas=[],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher,
|
||||
noarchive=False)
|
||||
pyz = PYZ(a.pure, a.zipped_data,
|
||||
cipher=block_cipher)
|
||||
|
||||
exe = EXE(pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
name='main',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=True,
|
||||
disable_windowed_traceback=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None )
|
||||
@@ -1,88 +0,0 @@
|
||||
{
|
||||
"Mario": "Mario",
|
||||
"Donkey Kong": "Donkey Kong",
|
||||
"Link": "Link",
|
||||
"Samus": "Samus",
|
||||
"Dark Samus": "Dark Samus",
|
||||
"Yoshi": "Yoshi",
|
||||
"Kirby": "Kirby",
|
||||
"Fox": "Fox",
|
||||
"Pikachu": "Pikachu",
|
||||
"Luigi": "Luigi",
|
||||
"Ness": "Ness",
|
||||
"Captain Falcon": "Captain Falcon",
|
||||
"Jigglypuff": "Jigglypuff",
|
||||
"Peach": "Peach",
|
||||
"Daisy": "Daisy",
|
||||
"Bowser": "Bowser",
|
||||
"Ice Climbers": "Ice Climbers",
|
||||
"Sheik": "Sheik",
|
||||
"Zelda": "Zelda",
|
||||
"Dr Mario": "Dr. Mario",
|
||||
"Pichu": "Pichu",
|
||||
"Falco": "Falco",
|
||||
"Marth": "Marth",
|
||||
"Lucina": "Lucina",
|
||||
"Young Link": "Young Link",
|
||||
"Ganondorf": "Ganondorf",
|
||||
"Mewtwo": "Mewtwo",
|
||||
"Roy": "Roy",
|
||||
"Chrom": "Chrom",
|
||||
"Mr Game And Watch": "Mr. Game & Watch",
|
||||
"Meta Knight": "Meta Knight",
|
||||
"Pit": "Pit",
|
||||
"Dark Pit": "Dark Pit",
|
||||
"Zero Suit Samus": "Zero Suit Samus",
|
||||
"Wario": "Wario",
|
||||
"Snake": "Snake",
|
||||
"Ike": "Ike",
|
||||
"Pokemon Trainer": "Pokemon Trainer",
|
||||
"Diddy Kong": "Diddy Kong",
|
||||
"Lucas": "Lucas",
|
||||
"Sonic": "Sonic",
|
||||
"King Dedede": "King Dedede",
|
||||
"Olimar": "Olimar",
|
||||
"Lucario": "Lucario",
|
||||
"Rob": "R.O.B.",
|
||||
"Toon Link": "Toon Link",
|
||||
"Wolf": "Wolf",
|
||||
"Villager": "Villager",
|
||||
"Mega Man": "Mega Man",
|
||||
"Wii Fit Trainer": "Wii Fit Trainer",
|
||||
"Rosalina And Luma": "Rosalina",
|
||||
"Little Mac": "Little Mac",
|
||||
"Greninja": "Greninja",
|
||||
"Mii Brawler": "Mii Brawler",
|
||||
"Mii Swordfighter": "Mii Swordfighter",
|
||||
"Mii Gunner": "Mii Gunner",
|
||||
"Palutena": "Palutena",
|
||||
"Pac Man": "Pac-Man",
|
||||
"Robin": "Robin",
|
||||
"Shulk": "Shulk",
|
||||
"Bowser Jr": "Bowser Jr.",
|
||||
"Duck Hunt": "Duck Hunt",
|
||||
"Ryu": "Ryu",
|
||||
"Ken": "Ken",
|
||||
"Cloud": "Cloud",
|
||||
"Corrin": "Corrin",
|
||||
"Bayonetta": "Bayonetta",
|
||||
"Inkling": "Inkling",
|
||||
"Ridley": "Ridley",
|
||||
"Simon": "Simon Belmont",
|
||||
"Richter": "Richter",
|
||||
"King K Rool": "King K. Rool",
|
||||
"Isabelle": "Isabelle",
|
||||
"Incineroar": "Incineroar",
|
||||
"Piranha Plant": "Piranha Plant",
|
||||
"Joker": "Joker",
|
||||
"Hero": "Hero",
|
||||
"Banjo-Kazooie": "Banjo-Kazooie",
|
||||
"Terry": "Terry",
|
||||
"Byleth": "Byleth",
|
||||
"Min Min": "Min Min",
|
||||
"Steve": "Steve",
|
||||
"Sephiroth": "Sephiroth",
|
||||
"Pyra & Mythra": "Pyra & Mythra",
|
||||
"Kazuya": "Kazuya",
|
||||
"Random": "Random Character"
|
||||
}
|
||||
2
scripts/generate_thumbnail.bat
Normal file
@@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
python .\generate_thumbnail.py
|
||||
353
scripts/generate_thumbnail.py
Normal file
@@ -0,0 +1,353 @@
|
||||
# This script can be used to generate thumbnails using ./out/program_state.json and ./thumbnail_base
|
||||
# Run as python ./src/generate_thumbnail in order to test it
|
||||
|
||||
from PIL import Image, ImageFont, ImageDraw
|
||||
from pathlib import Path
|
||||
import json
|
||||
import requests
|
||||
import zipfile
|
||||
import shutil
|
||||
import string
|
||||
from copy import deepcopy
|
||||
import datetime
|
||||
|
||||
display_phase = True
|
||||
use_team_names = False
|
||||
use_sponsors = True
|
||||
|
||||
foreground_path = "./thumbnail_base/foreground.png"
|
||||
background_path = "./thumbnail_base/background.png"
|
||||
separator_h_path = "./thumbnail_base/separator_h.png"
|
||||
separator_v_path = "./thumbnail_base/separator_v.png"
|
||||
data_path = "../out/program_state.json"
|
||||
out_path = "./out/thumbnails"
|
||||
tmp_path = "./tmp"
|
||||
icon_path = "./assets/icons/icon.png"
|
||||
|
||||
Path(tmp_path).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
||||
def download_opensans():
|
||||
http_path = "https://www.fontsquirrel.com/fonts/download/open-sans"
|
||||
local_path = f"{tmp_path}/opensans"
|
||||
response = requests.get(http_path)
|
||||
with open(f"{local_path}.zip", 'wb') as f:
|
||||
f.write(response.content)
|
||||
with zipfile.ZipFile(f"{local_path}.zip", 'r') as zip_ref:
|
||||
Path(local_path).mkdir(parents=True, exist_ok=True)
|
||||
zip_ref.extractall(local_path)
|
||||
return(local_path)
|
||||
|
||||
|
||||
opensans_path = download_opensans()
|
||||
|
||||
|
||||
def find(element, json):
|
||||
keys = element.split('.')
|
||||
rv = json
|
||||
for key in keys:
|
||||
rv = rv[key]
|
||||
return rv
|
||||
|
||||
|
||||
def calculate_new_dimensions(current_size, max_size):
|
||||
# Use -1 if you do not want to constrain in that dimension
|
||||
x_ratio = max_size[0]/current_size[0]
|
||||
y_ratio = max_size[1]/current_size[1]
|
||||
|
||||
if max_size[0] < 0 and max_size[1] < 0:
|
||||
raise ValueError(
|
||||
msg=f"Size cannot be negative, given max size is {max_size}")
|
||||
|
||||
if (x_ratio*current_size[1] > max_size[1]) or x_ratio < 0:
|
||||
new_x = y_ratio*current_size[0]
|
||||
new_y = max_size[1]
|
||||
else:
|
||||
new_x = max_size[0]
|
||||
new_y = x_ratio*current_size[1]
|
||||
return((round(new_x), round(new_y)))
|
||||
|
||||
|
||||
def resize_image_to_max_size(image: Image, max_size):
|
||||
current_size = image.size
|
||||
x_ratio = max_size[0]/current_size[0]
|
||||
y_ratio = max_size[1]/current_size[1]
|
||||
|
||||
if max_size[0] < 0 or max_size[1] < 0:
|
||||
raise ValueError(
|
||||
msg=f"Size cannot be negative, given max size is {max_size}")
|
||||
|
||||
if (x_ratio < y_ratio):
|
||||
new_x = y_ratio*current_size[0]
|
||||
new_y = max_size[1]
|
||||
else:
|
||||
new_x = max_size[0]
|
||||
new_y = x_ratio*current_size[1]
|
||||
|
||||
new_size = (round(new_x), round(new_y))
|
||||
image = image.resize(new_size, resample=Image.BICUBIC)
|
||||
|
||||
# crop
|
||||
left = round(-(max_size[0] - new_x)/2)
|
||||
top = round(-(max_size[1] - new_y)/2)
|
||||
right = round((max_size[0] + new_x)/2)
|
||||
bottom = round((max_size[1] + new_y)/2)
|
||||
image = image.crop((left, top, right, bottom))
|
||||
|
||||
return(image)
|
||||
|
||||
|
||||
def create_composite_image(image, size, coordinates):
|
||||
background = Image.new('RGBA', size, (0, 0, 0, 0))
|
||||
background.paste(image, coordinates, image)
|
||||
return(background)
|
||||
|
||||
|
||||
def paste_image_matrix(thumbnail, path_matrix, max_size, paste_coordinates):
|
||||
num_line = len(path_matrix)
|
||||
|
||||
for line_index in range(0, len(path_matrix)):
|
||||
line = path_matrix[line_index]
|
||||
num_col = len(line)
|
||||
for col_index in range(0, len(line)):
|
||||
individual_max_size = (
|
||||
round(max_size[0]/num_col), round(max_size[1]/num_line))
|
||||
image_path = line[col_index]
|
||||
print(f"Processing asset: {image_path}")
|
||||
individual_paste_x = round(
|
||||
paste_coordinates[0] + col_index*individual_max_size[0])
|
||||
individual_paste_y = round(
|
||||
paste_coordinates[1] + line_index*individual_max_size[1])
|
||||
individual_paste_coordinates = (
|
||||
individual_paste_x, individual_paste_y)
|
||||
character_image = Image.open("../"+image_path).convert('RGBA')
|
||||
character_image = resize_image_to_max_size(
|
||||
character_image, individual_max_size)
|
||||
composite_image = create_composite_image(
|
||||
character_image, thumbnail.size, individual_paste_coordinates)
|
||||
thumbnail = Image.alpha_composite(thumbnail, composite_image)
|
||||
|
||||
separator_v_image = Image.open(separator_v_path).convert('RGBA')
|
||||
# crop
|
||||
left = round(0)
|
||||
top = round(0)
|
||||
right = round(separator_v_image.size[0])
|
||||
bottom = round(individual_max_size[1])
|
||||
separator_v_image = separator_v_image.crop(
|
||||
((left, top, right, bottom)))
|
||||
separator_v_offset = max_size[0]/num_col
|
||||
for i in range(1, num_col):
|
||||
separator_paste_x = round(
|
||||
paste_coordinates[0]-(separator_v_image.size[0]/2)+i*separator_v_offset)
|
||||
separator_paste_y = individual_paste_y
|
||||
separator_paste_coordinates = (
|
||||
separator_paste_x, separator_paste_y)
|
||||
composite_image = create_composite_image(
|
||||
separator_v_image, thumbnail.size, separator_paste_coordinates)
|
||||
thumbnail = Image.alpha_composite(thumbnail, composite_image)
|
||||
|
||||
separator_h_image = Image.open(separator_h_path).convert('RGBA')
|
||||
# crop
|
||||
left = round(0)
|
||||
top = round(0)
|
||||
right = round(max_size[0])
|
||||
bottom = round(separator_h_image.size[1])
|
||||
separator_h_image = separator_h_image.crop(
|
||||
((left, top, right, bottom)))
|
||||
separator_h_offset = max_size[1]/num_line
|
||||
for i in range(1, num_line):
|
||||
separator_paste_x = paste_coordinates[0]
|
||||
separator_paste_y = round(
|
||||
paste_coordinates[1]-(separator_h_image.size[1]/2)+i*separator_h_offset)
|
||||
separator_paste_coordinates = (
|
||||
separator_paste_x, separator_paste_y)
|
||||
composite_image = create_composite_image(
|
||||
separator_h_image, thumbnail.size, separator_paste_coordinates)
|
||||
thumbnail = Image.alpha_composite(thumbnail, composite_image)
|
||||
|
||||
return(thumbnail)
|
||||
|
||||
|
||||
def paste_characters(thumbnail, data):
|
||||
used_assets = "full"
|
||||
|
||||
max_x_size = round(thumbnail.size[0]/2)
|
||||
max_y_size = thumbnail.size[1]
|
||||
max_size = (max_x_size, max_y_size)
|
||||
origin_x_coordinates = [0, max_x_size]
|
||||
origin_y_coordinates = [0, 0]
|
||||
|
||||
for i in [0, 1]:
|
||||
team_index = i+1
|
||||
path_matrix = []
|
||||
current_team = find(f"score.team.{team_index}.player", data)
|
||||
for player_key in current_team.keys():
|
||||
character_list = []
|
||||
characters = find(f"{player_key}.character", current_team)
|
||||
for character_key in characters.keys():
|
||||
try:
|
||||
image_path = find(
|
||||
f"{character_key}.assets.{used_assets}.asset", characters)
|
||||
if image_path:
|
||||
character_list.append(image_path)
|
||||
except KeyError:
|
||||
None
|
||||
if character_list:
|
||||
path_matrix.append(character_list)
|
||||
|
||||
paste_x = origin_x_coordinates[i]
|
||||
paste_y = origin_y_coordinates[i]
|
||||
paste_coordinates = (paste_x, paste_y)
|
||||
thumbnail = paste_image_matrix(
|
||||
thumbnail, path_matrix, max_size, paste_coordinates)
|
||||
|
||||
return(thumbnail)
|
||||
|
||||
|
||||
def get_text_size_for_height(thumbnail, font_path, pixel_height, search_interval=None, recursion_level=0):
|
||||
if pixel_height <= 1:
|
||||
raise ValueError("pixel_height too small")
|
||||
|
||||
tolerance = 0
|
||||
thumbnail_copy = deepcopy(thumbnail)
|
||||
draw = ImageDraw.Draw(thumbnail_copy)
|
||||
if not search_interval:
|
||||
search_interval = [0, pixel_height*2]
|
||||
current_size = round((search_interval[0] + search_interval[1])/2)
|
||||
font = ImageFont.truetype(font_path, current_size)
|
||||
bbox = draw.textbbox((0, 0), string.ascii_letters, font=font)
|
||||
calculated_height = bbox[-1]
|
||||
|
||||
if (calculated_height <= pixel_height+tolerance and calculated_height >= pixel_height-tolerance) or recursion_level > 100:
|
||||
return(current_size)
|
||||
elif calculated_height < pixel_height:
|
||||
result = get_text_size_for_height(
|
||||
thumbnail, font_path, pixel_height, [current_size, search_interval[1]], recursion_level+1)
|
||||
return(result)
|
||||
else:
|
||||
result = get_text_size_for_height(
|
||||
thumbnail, font_path, pixel_height, [search_interval[0], current_size], recursion_level+1)
|
||||
return(result)
|
||||
|
||||
|
||||
def paste_player_text(thumbnail, data, use_team_names=False, use_sponsors=True):
|
||||
text_player_coordinates_center = [
|
||||
(480.0/1920.0, 904.0/1080.0), (1440./1920.0, 904.0/1080.0)]
|
||||
text_player_max_dimensions = (-1, 100.0/1080.0)
|
||||
pixel_height = round(text_player_max_dimensions[1]*thumbnail.size[1])
|
||||
font_path = f"{opensans_path}/OpenSans-Bold.ttf"
|
||||
text_size = get_text_size_for_height(thumbnail, font_path, pixel_height)
|
||||
|
||||
draw = ImageDraw.Draw(thumbnail)
|
||||
|
||||
for i in [0, 1]:
|
||||
team_index = i+1
|
||||
player_list = []
|
||||
if use_team_names:
|
||||
player_name = find(f"score.team.{team_index}.teamName", data)
|
||||
else:
|
||||
current_team = find(f"score.team.{team_index}.player", data)
|
||||
for key in current_team.keys():
|
||||
current_data = current_team[key].get("mergedName")
|
||||
if (not use_sponsors) or (not current_data):
|
||||
current_data = current_team[key].get("name")
|
||||
if current_data:
|
||||
player_list.append(current_data)
|
||||
player_name = " / ".join(player_list)
|
||||
|
||||
if use_team_names or len(player_list) > 1:
|
||||
player_type = "team"
|
||||
else:
|
||||
player_type = "player"
|
||||
|
||||
print(f"Processing {player_type}: {player_name}")
|
||||
|
||||
font = ImageFont.truetype(font_path, text_size)
|
||||
text_x = round(text_player_coordinates_center[i][0]*thumbnail.size[0])
|
||||
text_y = round(text_player_coordinates_center[i][1]*thumbnail.size[1])
|
||||
text_coordinates = (text_x, text_y)
|
||||
|
||||
draw.text(text_coordinates, player_name,
|
||||
(255, 255, 255), font=font, anchor="mm")
|
||||
|
||||
|
||||
def paste_round_text(thumbnail, data, display_phase=True):
|
||||
phase_text_coordinates_center = (960.0/1920.0, 1008.0/1080.0)
|
||||
round_text_coordinates_center = (960.0/1920.0, 1052.0/1080.0)
|
||||
text_max_dimensions = (-1, 40.0/1080.0)
|
||||
|
||||
if not display_phase:
|
||||
round_text_coordinates_center = (round_text_coordinates_center[0], (
|
||||
round_text_coordinates_center[1] + phase_text_coordinates_center[1])/2)
|
||||
text_max_dimensions = (-1, text_max_dimensions[1]*2)
|
||||
|
||||
pixel_height = round(text_max_dimensions[1]*thumbnail.size[1])
|
||||
font_path = f"{opensans_path}/OpenSans-Semibold.ttf"
|
||||
text_size = get_text_size_for_height(thumbnail, font_path, pixel_height)
|
||||
|
||||
draw = ImageDraw.Draw(thumbnail)
|
||||
|
||||
if display_phase:
|
||||
current_phase = find(f"score.phase", data)
|
||||
|
||||
font = ImageFont.truetype(font_path, text_size)
|
||||
text_x = round(phase_text_coordinates_center[0]*thumbnail.size[0])
|
||||
text_y = round(phase_text_coordinates_center[1]*thumbnail.size[1])
|
||||
text_coordinates = (text_x, text_y)
|
||||
draw.text(text_coordinates, current_phase,
|
||||
(255, 255, 255), font=font, anchor="mm")
|
||||
|
||||
current_round = find(f"score.match", data)
|
||||
|
||||
font = ImageFont.truetype(font_path, text_size)
|
||||
text_x = round(round_text_coordinates_center[0]*thumbnail.size[0])
|
||||
text_y = round(round_text_coordinates_center[1]*thumbnail.size[1])
|
||||
text_coordinates = (text_x, text_y)
|
||||
draw.text(text_coordinates, current_round,
|
||||
(255, 255, 255), font=font, anchor="mm")
|
||||
|
||||
|
||||
def paste_icon(thumbnail, icon_path):
|
||||
max_x_size = round(thumbnail.size[0]*(150.0/1920.0))
|
||||
max_y_size = round(thumbnail.size[1]*(150.0/1080.0))
|
||||
max_size = (max_x_size, max_y_size)
|
||||
|
||||
icon_image = Image.open("../"+icon_path).convert('RGBA')
|
||||
icon_size = calculate_new_dimensions(icon_image.size, max_size)
|
||||
icon_image = icon_image.resize(icon_size, resample=Image.BICUBIC)
|
||||
|
||||
icon_x = round(thumbnail.size[0]/2 - icon_size[0]/2)
|
||||
icon_y = round(thumbnail.size[1]*(6.0/1080.0))
|
||||
icon_coordinates = (icon_x, icon_y)
|
||||
composite_image = create_composite_image(
|
||||
icon_image, thumbnail.size, icon_coordinates)
|
||||
thumbnail = Image.alpha_composite(thumbnail, composite_image)
|
||||
return(thumbnail)
|
||||
|
||||
|
||||
Path(out_path).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
foreground = Image.open(foreground_path).convert('RGBA')
|
||||
background = Image.open(background_path).convert('RGBA')
|
||||
with open(data_path, 'rt', encoding='utf-8') as f:
|
||||
data = json.loads(f.read())
|
||||
|
||||
thumbnail = Image.new("RGBA", foreground.size, "PINK")
|
||||
composite_image = create_composite_image(background, thumbnail.size, (0, 0))
|
||||
thumbnail = Image.alpha_composite(thumbnail, composite_image)
|
||||
thumbnail.paste(background, (0, 0), mask=background)
|
||||
thumbnail = paste_characters(thumbnail, data)
|
||||
composite_image = create_composite_image(foreground, thumbnail.size, (0, 0))
|
||||
thumbnail = Image.alpha_composite(thumbnail, composite_image)
|
||||
paste_player_text(thumbnail, data, use_team_names, use_sponsors)
|
||||
paste_round_text(thumbnail, data, display_phase)
|
||||
thumbnail = paste_icon(thumbnail, icon_path)
|
||||
|
||||
thumbnail_filename = f"thumb-{datetime.datetime.utcnow().strftime('%Y-%m-%d-%H-%M-%S')}"
|
||||
thumbnail.save(f"{out_path}/{thumbnail_filename}.png")
|
||||
thumbnail.convert("RGB").save(f"{out_path}/{thumbnail_filename}.jpg")
|
||||
|
||||
shutil.rmtree(tmp_path)
|
||||
|
||||
print(
|
||||
f"Thumbnail successfully saved as {out_path}/{thumbnail_filename}.png and {out_path}/{thumbnail_filename}.jpg")
|
||||
|
Before Width: | Height: | Size: 230 KiB After Width: | Height: | Size: 230 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
@@ -6,11 +6,11 @@ class SettingsManager:
|
||||
settings = {}
|
||||
|
||||
def SaveSettings():
|
||||
with open("./settings.json", 'w') as file:
|
||||
with open("./user_data/settings.json", 'w') as file:
|
||||
json.dump(SettingsManager.settings, file, indent=4)
|
||||
|
||||
def LoadSettings():
|
||||
with open("./settings.json", 'r') as file:
|
||||
with open("./user_data/settings.json", 'r') as file:
|
||||
SettingsManager.settings = json.load(file)
|
||||
|
||||
def Set(key: str, value):
|
||||
@@ -21,7 +21,7 @@ class SettingsManager:
|
||||
return SettingsManager.settings.get(key)
|
||||
|
||||
|
||||
if not os.path.isfile("./settings.json"):
|
||||
if not os.path.isfile("./user_data/settings.json"):
|
||||
SettingsManager.SaveSettings()
|
||||
|
||||
SettingsManager.LoadSettings()
|
||||
|
||||
@@ -35,7 +35,7 @@ class TSHAlertNotification(QObject):
|
||||
|
||||
try:
|
||||
alerts_red = json.load(
|
||||
open('./assets/alerts_red.json', encoding='utf-8'))
|
||||
open('./user_data/alerts_red.json', encoding='utf-8'))
|
||||
except Exception as e:
|
||||
print(traceback.format_exc())
|
||||
|
||||
@@ -98,18 +98,18 @@ class TSHAlertNotification(QObject):
|
||||
|
||||
try:
|
||||
alerts_red = json.load(
|
||||
open('./assets/alerts_red.json', encoding='utf-8'))
|
||||
open('./user_data/alerts_red.json', encoding='utf-8'))
|
||||
except Exception as e:
|
||||
print(traceback.format_exc())
|
||||
|
||||
if alerts_red is not None:
|
||||
alerts_red.append(id)
|
||||
with open("./assets/alerts_red.json", 'w') as outfile:
|
||||
with open("./user_data/alerts_red.json", 'w') as outfile:
|
||||
json.dump(alerts_red, outfile)
|
||||
|
||||
|
||||
if not os.path.exists("./assets/alerts_red.json"):
|
||||
with open("./assets/alerts_red.json", 'w') as outfile:
|
||||
if not os.path.exists("./user_data/alerts_red.json"):
|
||||
with open("./user_data/alerts_red.json", 'w') as outfile:
|
||||
outfile.write("[]")
|
||||
|
||||
TSHAlertNotification.instance = TSHAlertNotification()
|
||||
|
||||
@@ -77,12 +77,12 @@ class TSHCommentaryWidget(QDockWidget):
|
||||
c.textChanged.emit("")
|
||||
|
||||
comm.findChild(QPushButton, "btUp").setIcon(
|
||||
QIcon("./icons/arrow_up.svg"))
|
||||
QIcon("./assets/icons/arrow_up.svg"))
|
||||
comm.findChild(QPushButton, "btUp").clicked.connect(
|
||||
lambda x, index=len(self.commentaryWidgets): self.MoveUp(index))
|
||||
|
||||
comm.findChild(QPushButton, "btDown").setIcon(
|
||||
QIcon("./icons/arrow_down.svg"))
|
||||
QIcon("./assets/icons/arrow_down.svg"))
|
||||
comm.findChild(QPushButton, "btDown").clicked.connect(
|
||||
lambda x, index=len(self.commentaryWidgets): self.MoveDown(index))
|
||||
|
||||
|
||||
@@ -52,28 +52,28 @@ class TSHGameAssetManager(QObject):
|
||||
def run(self):
|
||||
self.parent().games = {}
|
||||
|
||||
gameDirs = os.listdir("./assets/games/")
|
||||
gameDirs = os.listdir("./user_data/games/")
|
||||
|
||||
for game in gameDirs:
|
||||
if os.path.isfile("./assets/games/"+game+"/base_files/config.json"):
|
||||
f = open("./assets/games/"+game +
|
||||
if os.path.isfile("./user_data/games/"+game+"/base_files/config.json"):
|
||||
f = open("./user_data/games/"+game +
|
||||
"/base_files/config.json", encoding='utf-8')
|
||||
self.parent().games[game] = json.load(f)
|
||||
|
||||
self.parent().games[game]["assets"] = {}
|
||||
self.parent(
|
||||
).games[game]["path"] = "./assets/games/"+game+"/"
|
||||
).games[game]["path"] = "./user_data/games/"+game+"/"
|
||||
|
||||
assetDirs = os.listdir("./assets/games/"+game)
|
||||
assetDirs = os.listdir("./user_data/games/"+game)
|
||||
assetDirs += ["base_files/" +
|
||||
f for f in os.listdir("./assets/games/"+game+"/base_files/")]
|
||||
f for f in os.listdir("./user_data/games/"+game+"/base_files/")]
|
||||
|
||||
for dir in assetDirs:
|
||||
if os.path.isdir("./assets/games/"+game+"/"+dir):
|
||||
if os.path.isfile("./assets/games/"+game+"/"+dir+"/config.json"):
|
||||
if os.path.isdir("./user_data/games/"+game+"/"+dir):
|
||||
if os.path.isfile("./user_data/games/"+game+"/"+dir+"/config.json"):
|
||||
print(
|
||||
"Found asset config for ["+game+"]["+dir+"]")
|
||||
f = open("./assets/games/"+game+"/"+dir +
|
||||
f = open("./user_data/games/"+game+"/"+dir +
|
||||
"/config.json", encoding='utf-8')
|
||||
self.parent().games[game]["assets"][dir] = \
|
||||
json.load(f)
|
||||
@@ -151,7 +151,7 @@ class TSHGameAssetManager(QObject):
|
||||
assetsObj = gameObj.get(
|
||||
"assets", {}).get(assetsKey, None)
|
||||
files = sorted(os.listdir(
|
||||
'./assets/games/'+game+'/'+assetsKey))
|
||||
'./user_data/games/'+game+'/'+assetsKey))
|
||||
|
||||
self.parent().stockIcons = {}
|
||||
|
||||
@@ -164,7 +164,7 @@ class TSHGameAssetManager(QObject):
|
||||
|
||||
if len(filteredFiles) == 0:
|
||||
self.parent().stockIcons[c][0] = QImage(
|
||||
'./icons/cancel.svg')
|
||||
'./assets/icons/cancel.svg')
|
||||
|
||||
for i, f in enumerate(filteredFiles):
|
||||
numberStart = f.rfind(
|
||||
@@ -177,7 +177,7 @@ class TSHGameAssetManager(QObject):
|
||||
print(f)
|
||||
pass
|
||||
self.parent().stockIcons[c][number] = QImage(
|
||||
'./assets/games/'+game+'/'+assetsKey+'/'+f)
|
||||
'./user_data/games/'+game+'/'+assetsKey+'/'+f)
|
||||
|
||||
print("Loaded stock icons")
|
||||
|
||||
@@ -189,7 +189,7 @@ class TSHGameAssetManager(QObject):
|
||||
asset = gameObj["assets"][assetsKey]
|
||||
|
||||
files = sorted(os.listdir(
|
||||
'./assets/games/'+game+'/'+assetsKey))
|
||||
'./user_data/games/'+game+'/'+assetsKey))
|
||||
|
||||
filteredFiles = \
|
||||
[f for f in files if f.startswith(asset.get(
|
||||
@@ -233,10 +233,10 @@ class TSHGameAssetManager(QObject):
|
||||
assetsObj = gameObj.get(
|
||||
"assets", {}).get(assetsKey)
|
||||
files = sorted(os.listdir(
|
||||
'./assets/games/'+game+'/'+assetsKey))
|
||||
'./user_data/games/'+game+'/'+assetsKey))
|
||||
|
||||
for stage in self.parent().stages:
|
||||
self.parent().stages[stage]["path"] = './assets/games/'+game+'/'+assetsKey+'/'+assetsObj.get(
|
||||
self.parent().stages[stage]["path"] = './user_data/games/'+game+'/'+assetsKey+'/'+assetsObj.get(
|
||||
"prefix", "")+self.parent().stages[stage].get("codename", "")+assetsObj.get("postfix", "")+".png"
|
||||
|
||||
for s in self.parent().stages.keys():
|
||||
@@ -352,8 +352,8 @@ class TSHGameAssetManager(QObject):
|
||||
return stage
|
||||
|
||||
|
||||
if not os.path.exists("./assets/games"):
|
||||
os.makedirs("./assets/games")
|
||||
if not os.path.exists("./user_data/games"):
|
||||
os.makedirs("./user_data/games")
|
||||
|
||||
if TSHGameAssetManager.instance == None:
|
||||
TSHGameAssetManager.instance = TSHGameAssetManager()
|
||||
|
||||
@@ -27,12 +27,12 @@ class TSHPlayerDB:
|
||||
|
||||
def LoadDB():
|
||||
try:
|
||||
if os.path.exists("./local_players.csv") == False:
|
||||
with open('./local_players.csv', 'w', encoding='utf-8') as outfile:
|
||||
if os.path.exists("./user_data/local_players.csv") == False:
|
||||
with open('./user_data/local_players.csv', 'w', encoding='utf-8') as outfile:
|
||||
spamwriter = csv.writer(outfile)
|
||||
spamwriter.writerow(TSHPlayerDB.fieldnames)
|
||||
|
||||
with open('./local_players.csv', 'r', encoding='utf-8') as csvfile:
|
||||
with open('./user_data/local_players.csv', 'r', encoding='utf-8') as csvfile:
|
||||
reader = csv.DictReader(csvfile, quotechar='\'')
|
||||
for player in reader:
|
||||
tag = player.get(
|
||||
@@ -109,7 +109,7 @@ class TSHPlayerDB:
|
||||
with TSHPlayerDB.modelLock:
|
||||
TSHPlayerDB.model = QStandardItemModel()
|
||||
|
||||
cancelIcon = QIcon(QPixmap.fromImage(QImage("./icons/cancel.svg").scaledToWidth(
|
||||
cancelIcon = QIcon(QPixmap.fromImage(QImage("./assets/icons/cancel.svg").scaledToWidth(
|
||||
32, Qt.TransformationMode.SmoothTransformation)))
|
||||
|
||||
charIcons = {}
|
||||
@@ -165,7 +165,7 @@ class TSHPlayerDB:
|
||||
|
||||
def SaveDB():
|
||||
try:
|
||||
with open('./local_players.csv', 'w', encoding="utf-8", newline='') as outfile:
|
||||
with open('./user_data/local_players.csv', 'w', encoding="utf-8", newline='') as outfile:
|
||||
spamwriter = csv.DictWriter(
|
||||
outfile, fieldnames=TSHPlayerDB.fieldnames, extrasaction="ignore", quotechar='\'')
|
||||
spamwriter.writeheader()
|
||||
|
||||
@@ -48,7 +48,7 @@ class TSHScoreboardPlayerWidget(QGroupBox):
|
||||
self.save_bt = QPushButton("Save new player")
|
||||
self.save_bt.font().setPointSize(10)
|
||||
# self.save_bt.setFont(self.parent.font_small)
|
||||
self.save_bt.setIcon(QIcon('icons/save.svg'))
|
||||
self.save_bt.setIcon(QIcon('assets/icons/save.svg'))
|
||||
bottom_buttons_layout.addWidget(self.save_bt)
|
||||
self.save_bt.clicked.connect(self.SavePlayerToDB)
|
||||
self.findChild(QLineEdit, "name").textChanged.connect(
|
||||
@@ -58,7 +58,7 @@ class TSHScoreboardPlayerWidget(QGroupBox):
|
||||
|
||||
self.delete_bt = QPushButton("Delete player entry")
|
||||
# self.delete_bt.setFont(self.parent.font_small)
|
||||
self.delete_bt.setIcon(QIcon('icons/cancel.svg'))
|
||||
self.delete_bt.setIcon(QIcon('assets/icons/cancel.svg'))
|
||||
bottom_buttons_layout.addWidget(self.delete_bt)
|
||||
self.delete_bt.font().setPointSize(10)
|
||||
self.delete_bt.setEnabled(False)
|
||||
@@ -71,18 +71,18 @@ class TSHScoreboardPlayerWidget(QGroupBox):
|
||||
self.clear_bt = QPushButton("Clear")
|
||||
self.clear_bt.font().setPointSize(10)
|
||||
# self.clear_bt.setFont(self.parent.font_small)
|
||||
self.clear_bt.setIcon(QIcon('icons/undo.svg'))
|
||||
self.clear_bt.setIcon(QIcon('assets/icons/undo.svg'))
|
||||
bottom_buttons_layout.addWidget(self.clear_bt)
|
||||
self.clear_bt.clicked.connect(self.Clear)
|
||||
|
||||
# Move up/down
|
||||
self.btMoveUp = QPushButton()
|
||||
self.btMoveUp.setMaximumWidth(32)
|
||||
self.btMoveUp.setIcon(QIcon("./icons/arrow_up.svg"))
|
||||
self.btMoveUp.setIcon(QIcon("./assets/icons/arrow_up.svg"))
|
||||
bottom_buttons_layout.addWidget(self.btMoveUp)
|
||||
self.btMoveDown = QPushButton()
|
||||
self.btMoveDown.setMaximumWidth(32)
|
||||
self.btMoveDown.setIcon(QIcon("./icons/arrow_down.svg"))
|
||||
self.btMoveDown.setIcon(QIcon("./assets/icons/arrow_down.svg"))
|
||||
bottom_buttons_layout.addWidget(self.btMoveDown)
|
||||
|
||||
self.SetIndex(index, teamNumber)
|
||||
@@ -106,14 +106,14 @@ class TSHScoreboardPlayerWidget(QGroupBox):
|
||||
c.textChanged.connect(
|
||||
lambda text, element=c: [
|
||||
StateManager.Set(
|
||||
f"score.team.{self.teamNumber}.players.{self.index}.{element.objectName()}", text)
|
||||
f"score.team.{self.teamNumber}.player.{self.index}.{element.objectName()}", text)
|
||||
])
|
||||
|
||||
for c in self.findChildren(QComboBox):
|
||||
c.currentIndexChanged.connect(
|
||||
lambda text, element=c: [
|
||||
StateManager.Set(
|
||||
f"score.team.{self.teamNumber}.players.{self.index}.{element.objectName()}", element.currentData(
|
||||
f"score.team.{self.teamNumber}.player.{self.index}.{element.objectName()}", element.currentData(
|
||||
)
|
||||
)
|
||||
]
|
||||
@@ -147,7 +147,7 @@ class TSHScoreboardPlayerWidget(QGroupBox):
|
||||
characters[i+1] = data
|
||||
|
||||
StateManager.Set(
|
||||
f"score.team.{self.teamNumber}.players.{self.index}.character", characters)
|
||||
f"score.team.{self.teamNumber}.player.{self.index}.character", characters)
|
||||
|
||||
def SetLosers(self, value):
|
||||
self.losers = value
|
||||
@@ -167,7 +167,7 @@ class TSHScoreboardPlayerWidget(QGroupBox):
|
||||
merged += " [L]"
|
||||
|
||||
StateManager.Set(
|
||||
f"score.team.{self.teamNumber}.players.{self.index}.mergedName", merged)
|
||||
f"score.team.{self.teamNumber}.player.{self.index}.mergedName", merged)
|
||||
|
||||
def ExportPlayerImages(self, onlineAvatar=None):
|
||||
team = self.findChild(QLineEdit, "team").text()
|
||||
@@ -184,27 +184,27 @@ class TSHScoreboardPlayerWidget(QGroupBox):
|
||||
|
||||
# Online avatar
|
||||
StateManager.Set(
|
||||
f"score.team.{self.teamNumber}.players.{self.index}.online_avatar", onlineAvatar)
|
||||
f"score.team.{self.teamNumber}.player.{self.index}.online_avatar", onlineAvatar)
|
||||
|
||||
# Local avatar
|
||||
if os.path.exists(f"./player_avatar/{merged}.png"):
|
||||
if os.path.exists(f"./user_data/player_avatar{merged}.png"):
|
||||
StateManager.Set(
|
||||
f"score.team.{self.teamNumber}.players.{self.index}.avatar", f"./player_avatar/{merged}.png")
|
||||
f"score.team.{self.teamNumber}.player.{self.index}.avatar", f"./user_data/player_avatar{merged}.png")
|
||||
else:
|
||||
StateManager.Set(
|
||||
f"score.team.{self.teamNumber}.players.{self.index}.avatar", None)
|
||||
f"score.team.{self.teamNumber}.player.{self.index}.avatar", None)
|
||||
|
||||
# Sponsor logo
|
||||
if os.path.exists(f"./sponsor_logo/{team}.png"):
|
||||
if os.path.exists(f"./user_data/sponsor_logo/{team}.png"):
|
||||
StateManager.Set(
|
||||
f"score.team.{self.teamNumber}.players.{self.index}.sponsor_logo", f"./sponsor_logo/{team}.png")
|
||||
f"score.team.{self.teamNumber}.player.{self.index}.sponsor_logo", f"./user_data/sponsor_logo/{team}.png")
|
||||
else:
|
||||
StateManager.Set(
|
||||
f"score.team.{self.teamNumber}.players.{self.index}.sponsor_logo", None)
|
||||
f"score.team.{self.teamNumber}.player.{self.index}.sponsor_logo", None)
|
||||
|
||||
def ExportPlayerId(self, id=None):
|
||||
StateManager.Set(
|
||||
f"score.team.{self.teamNumber}.players.{self.index}.id", id)
|
||||
f"score.team.{self.teamNumber}.player.{self.index}.id", id)
|
||||
|
||||
def SwapWith(self, other: "TSHScoreboardPlayerWidget"):
|
||||
tmpData = []
|
||||
|
||||
@@ -105,23 +105,24 @@ class TSHScoreboardStageWidget(QWidget):
|
||||
self.btAddNeutral = self.findChild(QPushButton, "btAddNeutral")
|
||||
self.btAddNeutral.clicked.connect(
|
||||
lambda x, view=self.stagesNeutral: self.AddStage(view))
|
||||
self.btAddNeutral.setIcon(QIcon("./icons/arrow_right.svg"))
|
||||
self.btAddNeutral.setIcon(QIcon("./assets/icons/arrow_right.svg"))
|
||||
|
||||
self.btRemoveNeutral = self.findChild(QPushButton, "btRemoveNeutral")
|
||||
self.btRemoveNeutral.clicked.connect(
|
||||
lambda x: self.RemoveStage(self.stagesNeutral))
|
||||
self.btRemoveNeutral.setIcon(QIcon("./icons/arrow_left.svg"))
|
||||
self.btRemoveNeutral.setIcon(QIcon("./assets/icons/arrow_left.svg"))
|
||||
|
||||
self.btAddCounterpick = self.findChild(QPushButton, "btAddCounterpick")
|
||||
self.btAddCounterpick.clicked.connect(
|
||||
lambda x, view=self.stagesCounterpick: self.AddStage(view))
|
||||
self.btAddCounterpick.setIcon(QIcon("./icons/arrow_right.svg"))
|
||||
self.btAddCounterpick.setIcon(QIcon("./assets/icons/arrow_right.svg"))
|
||||
|
||||
self.btRemoveCounterpick = self.findChild(
|
||||
QPushButton, "btRemoveCounterpick")
|
||||
self.btRemoveCounterpick.clicked.connect(
|
||||
lambda x: self.RemoveStage(self.stagesCounterpick))
|
||||
self.btRemoveCounterpick.setIcon(QIcon("./icons/arrow_left.svg"))
|
||||
self.btRemoveCounterpick.setIcon(
|
||||
QIcon("./assets/icons/arrow_left.svg"))
|
||||
|
||||
self.noDSR = self.findChild(QRadioButton, "noDSR")
|
||||
self.noDSR.clicked.connect(self.ExportCurrentRuleset)
|
||||
@@ -304,7 +305,7 @@ class TSHScoreboardStageWidget(QWidget):
|
||||
|
||||
item = QStandardItem(ruleset.get("name"))
|
||||
item.setData(myRuleset, Qt.ItemDataRole.UserRole)
|
||||
item.setIcon(QIcon("./icons/db.svg"))
|
||||
item.setIcon(QIcon("./assets/icons/db.svg"))
|
||||
rulesetsModel.appendRow(item)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
@@ -349,7 +350,7 @@ class TSHScoreboardStageWidget(QWidget):
|
||||
|
||||
item = QStandardItem(ruleset.get("name"))
|
||||
item.setData(myRuleset, Qt.ItemDataRole.UserRole)
|
||||
item.setIcon(QIcon("./icons/smashgg.svg"))
|
||||
item.setIcon(QIcon("./assets/icons/smashgg.svg"))
|
||||
rulesetsModel.appendRow(item)
|
||||
|
||||
# Update list
|
||||
|
||||
@@ -95,7 +95,7 @@ class TSHScoreboardWidget(QDockWidget):
|
||||
col.setContentsMargins(0, 0, 0, 0)
|
||||
col.layout().setSpacing(0)
|
||||
self.eyeBt = QToolButton()
|
||||
self.eyeBt.setIcon(QIcon('icons/eye.svg'))
|
||||
self.eyeBt.setIcon(QIcon('assets/icons/eye.svg'))
|
||||
self.eyeBt.setSizePolicy(
|
||||
QSizePolicy.Maximum, QSizePolicy.Fixed)
|
||||
col.layout().addWidget(self.eyeBt, Qt.AlignmentFlag.AlignRight)
|
||||
@@ -147,7 +147,7 @@ class TSHScoreboardWidget(QDockWidget):
|
||||
bottomOptions.layout().addLayout(hbox)
|
||||
|
||||
self.btLoadStreamSet = QPushButton("Load current stream set")
|
||||
self.btLoadStreamSet.setIcon(QIcon("./icons/twitch.svg"))
|
||||
self.btLoadStreamSet.setIcon(QIcon("./assets/icons/twitch.svg"))
|
||||
self.btLoadStreamSet.setEnabled(False)
|
||||
hbox.addWidget(self.btLoadStreamSet)
|
||||
self.btLoadStreamSet.clicked.connect(self.LoadStreamSetClicked)
|
||||
@@ -157,7 +157,8 @@ class TSHScoreboardWidget(QDockWidget):
|
||||
self.btLoadStreamSetOptions = QPushButton()
|
||||
self.btLoadStreamSetOptions.setSizePolicy(
|
||||
QSizePolicy.Maximum, QSizePolicy.Maximum)
|
||||
self.btLoadStreamSetOptions.setIcon(QIcon("./icons/settings.svg"))
|
||||
self.btLoadStreamSetOptions.setIcon(
|
||||
QIcon("./assets/icons/settings.svg"))
|
||||
self.btLoadStreamSetOptions.clicked.connect(
|
||||
self.LoadStreamSetOptionsClicked)
|
||||
hbox.addWidget(self.btLoadStreamSetOptions)
|
||||
@@ -177,7 +178,8 @@ class TSHScoreboardWidget(QDockWidget):
|
||||
self.btLoadPlayerSetOptions = QPushButton()
|
||||
self.btLoadPlayerSetOptions.setSizePolicy(
|
||||
QSizePolicy.Maximum, QSizePolicy.Maximum)
|
||||
self.btLoadPlayerSetOptions.setIcon(QIcon("./icons/settings.svg"))
|
||||
self.btLoadPlayerSetOptions.setIcon(
|
||||
QIcon("./assets/icons/settings.svg"))
|
||||
self.btLoadPlayerSetOptions.clicked.connect(
|
||||
self.LoadUserSetOptionsClicked)
|
||||
hbox.addWidget(self.btLoadPlayerSetOptions)
|
||||
@@ -198,7 +200,7 @@ class TSHScoreboardWidget(QDockWidget):
|
||||
self.timerTime = QLabel("0")
|
||||
self.timerLayout.layout().addWidget(self.timerTime)
|
||||
self.timerCancelBt = QPushButton()
|
||||
self.timerCancelBt.setIcon(QIcon('icons/cancel.svg'))
|
||||
self.timerCancelBt.setIcon(QIcon('assets/icons/cancel.svg'))
|
||||
self.timerCancelBt.setIconSize(QSize(12, 12))
|
||||
self.timerCancelBt.clicked.connect(self.StopAutoUpdate)
|
||||
self.timerLayout.layout().addWidget(self.timerCancelBt)
|
||||
@@ -253,8 +255,8 @@ class TSHScoreboardWidget(QDockWidget):
|
||||
])
|
||||
c.toggled.emit(False)
|
||||
|
||||
StateManager.Unset(f'score.team.1.players')
|
||||
StateManager.Unset(f'score.team.2.players')
|
||||
StateManager.Unset(f'score.team.1.player')
|
||||
StateManager.Unset(f'score.team.2.player')
|
||||
StateManager.Unset(f'score.stage_strike')
|
||||
self.playerNumber.setValue(1)
|
||||
self.charNumber.setValue(1)
|
||||
@@ -305,9 +307,9 @@ class TSHScoreboardWidget(QDockWidget):
|
||||
QPushButton, "btResetScore").clicked.connect(self.ResetScore)
|
||||
|
||||
def ExportTeamLogo(self, team, value):
|
||||
if os.path.exists(f"./team_logo/{value.lower()}.png"):
|
||||
if os.path.exists(f"./user_data/team_logo/{value.lower()}.png"):
|
||||
StateManager.Set(f"score.team.{team}.logo",
|
||||
f"./team_logo/{value.lower()}.png")
|
||||
f"./user_data/team_logo/{value.lower()}.png")
|
||||
else:
|
||||
StateManager.Set(f"score.team.{team}.logo", None)
|
||||
|
||||
@@ -335,7 +337,7 @@ class TSHScoreboardWidget(QDockWidget):
|
||||
def SetPlayersPerTeam(self, number):
|
||||
while len(self.team1playerWidgets) < number:
|
||||
p = TSHScoreboardPlayerWidget(
|
||||
index=len(self.team1playerWidgets)+1, teamNumber=1, path=f'score.team.{1}.players.{len(self.team1playerWidgets)+1}')
|
||||
index=len(self.team1playerWidgets)+1, teamNumber=1, path=f'score.team.{1}.player.{len(self.team1playerWidgets)+1}')
|
||||
self.playerWidgets.append(p)
|
||||
print(self.team1column.findChild(QScrollArea))
|
||||
self.team1column.findChild(
|
||||
@@ -353,7 +355,7 @@ class TSHScoreboardWidget(QDockWidget):
|
||||
self.team1playerWidgets.append(p)
|
||||
|
||||
p = TSHScoreboardPlayerWidget(
|
||||
index=len(self.team2playerWidgets)+1, teamNumber=2, path=f'score.team.{2}.players.{len(self.team2playerWidgets)+1}')
|
||||
index=len(self.team2playerWidgets)+1, teamNumber=2, path=f'score.team.{2}.player.{len(self.team2playerWidgets)+1}')
|
||||
self.playerWidgets.append(p)
|
||||
self.team2column.findChild(
|
||||
QScrollArea).widget().layout().addWidget(p)
|
||||
@@ -382,9 +384,9 @@ class TSHScoreboardWidget(QDockWidget):
|
||||
|
||||
for team in [1, 2]:
|
||||
if StateManager.Get(f'score.team.{team}'):
|
||||
for k in list(StateManager.Get(f'score.team.{team}.players').keys()):
|
||||
for k in list(StateManager.Get(f'score.team.{team}.player').keys()):
|
||||
if int(k) > number:
|
||||
StateManager.Unset(f'score.team.{team}.players.{k}')
|
||||
StateManager.Unset(f'score.team.{team}.player.{k}')
|
||||
|
||||
if number > 1:
|
||||
self.team1column.findChild(QLineEdit, "teamName").setVisible(True)
|
||||
@@ -408,9 +410,9 @@ class TSHScoreboardWidget(QDockWidget):
|
||||
if type(widget) == QComboBox:
|
||||
data[widget.objectName()] = widget.currentIndex()
|
||||
data["online_avatar"] = StateManager.Get(
|
||||
f"score.team.{t+1}.players.{i+1}.online_avatar")
|
||||
f"score.team.{t+1}.player.{i+1}.online_avatar")
|
||||
data["id"] = StateManager.Get(
|
||||
f"score.team.{t+1}.players.{i+1}.id")
|
||||
f"score.team.{t+1}.player.{i+1}.id")
|
||||
tmpData[t].append(data)
|
||||
|
||||
# Load state
|
||||
|
||||
@@ -69,7 +69,7 @@ class Window(QMainWindow):
|
||||
self.signals = WindowSignals()
|
||||
|
||||
splash = QSplashScreen(self, QPixmap(
|
||||
'icons/icon.png').scaled(128, 128))
|
||||
'assets/icons/icon.png').scaled(128, 128))
|
||||
splash.show()
|
||||
|
||||
time.sleep(0.1)
|
||||
@@ -80,13 +80,13 @@ class Window(QMainWindow):
|
||||
self.savedProgramState = {}
|
||||
self.programStateDiff = {}
|
||||
|
||||
self.setWindowIcon(QIcon('icons/icon.png'))
|
||||
self.setWindowIcon(QIcon('assets/icons/icon.png'))
|
||||
|
||||
if not os.path.exists("out/"):
|
||||
os.mkdir("out/")
|
||||
|
||||
if not os.path.exists("./assets/games"):
|
||||
os.makedirs("./assets/games")
|
||||
if not os.path.exists("./user_data/games"):
|
||||
os.makedirs("./user_data/games")
|
||||
|
||||
self.font_small = QFont(
|
||||
"./assets/font/RobotoCondensed.ttf", pointSize=8)
|
||||
@@ -101,7 +101,7 @@ class Window(QMainWindow):
|
||||
|
||||
try:
|
||||
version = json.load(
|
||||
open('versions.json', encoding='utf-8')).get("program", "?")
|
||||
open('./assets/versions.json', encoding='utf-8')).get("program", "?")
|
||||
except Exception as e:
|
||||
version = "?"
|
||||
|
||||
@@ -161,7 +161,7 @@ class Window(QMainWindow):
|
||||
group_box.layout().addLayout(hbox)
|
||||
|
||||
self.btLoadPlayerSet = QPushButton("Load SmashGG user set")
|
||||
self.btLoadPlayerSet.setIcon(QIcon("./icons/smashgg.svg"))
|
||||
self.btLoadPlayerSet.setIcon(QIcon("./assets/icons/smashgg.svg"))
|
||||
self.btLoadPlayerSet.setEnabled(False)
|
||||
self.btLoadPlayerSet.clicked.connect(self.LoadUserSetClicked)
|
||||
hbox.addWidget(self.btLoadPlayerSet)
|
||||
@@ -176,14 +176,15 @@ class Window(QMainWindow):
|
||||
self.btLoadPlayerSetOptions = QPushButton()
|
||||
self.btLoadPlayerSetOptions.setSizePolicy(
|
||||
QSizePolicy.Maximum, QSizePolicy.Maximum)
|
||||
self.btLoadPlayerSetOptions.setIcon(QIcon("./icons/settings.svg"))
|
||||
self.btLoadPlayerSetOptions.setIcon(
|
||||
QIcon("./assets/icons/settings.svg"))
|
||||
self.btLoadPlayerSetOptions.clicked.connect(
|
||||
self.LoadUserSetOptionsClicked)
|
||||
hbox.addWidget(self.btLoadPlayerSetOptions)
|
||||
|
||||
# Settings
|
||||
self.optionsBt = QToolButton()
|
||||
self.optionsBt.setIcon(QIcon('icons/menu.svg'))
|
||||
self.optionsBt.setIcon(QIcon('assets/icons/menu.svg'))
|
||||
self.optionsBt.setToolButtonStyle(
|
||||
Qt.ToolButtonStyle.ToolButtonIconOnly)
|
||||
self.optionsBt.setPopupMode(QToolButton.InstantPopup)
|
||||
@@ -198,10 +199,10 @@ class Window(QMainWindow):
|
||||
action.toggled.connect(self.ToggleAlwaysOnTop)
|
||||
action = self.optionsBt.menu().addAction("Check for updates")
|
||||
self.updateAction = action
|
||||
action.setIcon(QIcon('icons/undo.svg'))
|
||||
action.setIcon(QIcon('assets/icons/undo.svg'))
|
||||
action.triggered.connect(self.CheckForUpdates)
|
||||
action = self.optionsBt.menu().addAction("Download assets")
|
||||
action.setIcon(QIcon('icons/download.svg'))
|
||||
action.setIcon(QIcon('assets/icons/download.svg'))
|
||||
action.triggered.connect(self.DownloadAssets)
|
||||
|
||||
self.gameSelect = QComboBox()
|
||||
@@ -319,7 +320,8 @@ class Window(QMainWindow):
|
||||
messagebox.exec()
|
||||
|
||||
try:
|
||||
versions = json.load(open('versions.json', encoding='utf-8'))
|
||||
versions = json.load(
|
||||
open('./assets/versions.json', encoding='utf-8'))
|
||||
except Exception as e:
|
||||
print("Local version file not found")
|
||||
|
||||
@@ -390,8 +392,6 @@ class Window(QMainWindow):
|
||||
print(tar.getmembers())
|
||||
os.rename(
|
||||
"./layout", f"./layout_backup_{str(time.time())}")
|
||||
os.rename(
|
||||
"./tournament_phases.txt", f"./tournament_phases_backup_{str(time.time())}.txt")
|
||||
for m in tar.getmembers():
|
||||
if "/" in m.name:
|
||||
m.name = m.name.split("/", 1)[1]
|
||||
@@ -399,7 +399,7 @@ class Window(QMainWindow):
|
||||
tar.close()
|
||||
os.remove("update.tar.gz")
|
||||
|
||||
with open('versions.json', 'w') as outfile:
|
||||
with open('./assets/versions.json', 'w') as outfile:
|
||||
versions["program"] = currVersion
|
||||
json.dump(versions, outfile)
|
||||
|
||||
@@ -423,9 +423,10 @@ class Window(QMainWindow):
|
||||
messagebox.exec()
|
||||
else:
|
||||
if myVersion < currVersion:
|
||||
baseIcon = QPixmap(QImage("icons/menu.svg").scaled(32, 32))
|
||||
baseIcon = QPixmap(
|
||||
QImage("assets/icons/menu.svg").scaled(32, 32))
|
||||
updateIcon = QImage(
|
||||
"./icons/update_circle.svg").scaled(12, 12)
|
||||
"./assets/icons/update_circle.svg").scaled(12, 12)
|
||||
p = QPainter(baseIcon)
|
||||
p.drawImage(QPoint(20, 0), updateIcon)
|
||||
p.end()
|
||||
@@ -566,7 +567,7 @@ class Window(QMainWindow):
|
||||
filesToDownload[f]["path"] = \
|
||||
"https://github.com/joaorb64/StreamHelperAssets/releases/latest/download/" + \
|
||||
filesToDownload[f]["name"]
|
||||
filesToDownload[f]["extractpath"] = "./assets/games/"+game
|
||||
filesToDownload[f]["extractpath"] = "./user_data/games/"+game
|
||||
|
||||
self.downloadDialogue = QProgressDialog(
|
||||
"Downloading assets", "Cancel", 0, 100, self)
|
||||
@@ -599,7 +600,7 @@ class Window(QMainWindow):
|
||||
downloaded = 0
|
||||
|
||||
for f in files:
|
||||
with open("assets/games/"+f["name"], 'wb') as downloadFile:
|
||||
with open("user_data/games/"+f["name"], 'wb') as downloadFile:
|
||||
print("Downloading "+f["name"])
|
||||
progress_callback.emit("Downloading "+f["name"]+"...")
|
||||
|
||||
@@ -624,8 +625,8 @@ class Window(QMainWindow):
|
||||
|
||||
progress_callback.emit(100)
|
||||
|
||||
filenames = ["./assets/games/"+f["name"] for f in files]
|
||||
mergedFile = "./assets/games/"+files[0]["name"].split(".")[0]+'.7z'
|
||||
filenames = ["./user_data/games/"+f["name"] for f in files]
|
||||
mergedFile = "./user_data/games/"+files[0]["name"].split(".")[0]+'.7z'
|
||||
|
||||
is7z = next((f for f in files if ".7z" in f["name"]), None)
|
||||
|
||||
@@ -642,14 +643,14 @@ class Window(QMainWindow):
|
||||
parent_zip.extractall(files[0]["extractpath"])
|
||||
|
||||
for f in files:
|
||||
os.remove("./assets/games/"+f["name"])
|
||||
os.remove("./user_data/games/"+f["name"])
|
||||
|
||||
os.remove(mergedFile)
|
||||
else:
|
||||
for f in files:
|
||||
if os.path.isfile(f["extractpath"]+"/"+f["name"]):
|
||||
os.remove(f["extractpath"]+"/"+f["name"])
|
||||
shutil.move("./assets/games/"+f["name"], f["extractpath"])
|
||||
shutil.move("./user_data/games/"+f["name"], f["extractpath"])
|
||||
|
||||
print("OK")
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import json
|
||||
header_old = "org,name,full_name,country_code,state,twitter,main,color (0-7)"
|
||||
header_new = "prefix,gamerTag,name,twitter,country_code,state_code,mains"
|
||||
|
||||
game_dir = "../assets/games"
|
||||
game_dir = "../user_data/games"
|
||||
list_dir = os.listdir(game_dir)
|
||||
|
||||
|
||||
@@ -63,5 +63,5 @@ def convert_database_3_to_4(file_path: str):
|
||||
|
||||
if __name__ == '__main__':
|
||||
new_database_text = convert_database_3_to_4("../local_players_old.csv")
|
||||
with open('../local_players.csv', 'w', encoding='utf-8') as f:
|
||||
with open('../user_data/local_players.csv', 'w', encoding='utf-8') as f:
|
||||
f.write(new_database_text)
|
||||
|
||||
@@ -22,7 +22,7 @@ separator_v_path = "./thumbnail_base/separator_v.png"
|
||||
data_path = "./out/program_state.json"
|
||||
out_path = "./out/thumbnails"
|
||||
tmp_path = "./tmp"
|
||||
icon_path = "./icons/icon.png"
|
||||
icon_path = "./assets/icons/icon.png"
|
||||
|
||||
Path(tmp_path).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
@@ -180,7 +180,7 @@ def paste_characters(thumbnail, data):
|
||||
for i in [0, 1]:
|
||||
team_index = i+1
|
||||
path_matrix = []
|
||||
current_team = find(f"score.team.{team_index}.players", data)
|
||||
current_team = find(f"score.team.{team_index}.player", data)
|
||||
for player_key in current_team.keys():
|
||||
character_list = []
|
||||
characters = find(f"{player_key}.character", current_team)
|
||||
@@ -246,7 +246,7 @@ def paste_player_text(thumbnail, data, use_team_names=False, use_sponsors=True):
|
||||
if use_team_names:
|
||||
player_name = find(f"score.team.{team_index}.teamName", data)
|
||||
else:
|
||||
current_team = find(f"score.team.{team_index}.players", data)
|
||||
current_team = find(f"score.team.{team_index}.player", data)
|
||||
for key in current_team.keys():
|
||||
current_data = current_team[key].get("mergedName")
|
||||
if (not use_sponsors) or (not current_data):
|
||||
|
||||
@@ -94,11 +94,11 @@ body {
|
||||
height: 48px;
|
||||
}
|
||||
.stamp.stage-striked {
|
||||
background-image: url(../../icons/stage_strike.svg);
|
||||
background-image: url(../../assets/icons/stage_strike.svg);
|
||||
}
|
||||
.stamp.stage-dsr {
|
||||
background-image: url(../../icons/stage_dsr.svg);
|
||||
background-image: url(../../assets/icons/stage_dsr.svg);
|
||||
}
|
||||
.stamp.stage-selected {
|
||||
background-image: url(../../icons/stage_select.svg);
|
||||
background-image: url(../../assets/icons/stage_select.svg);
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
start "" pythonw src/TournamentStreamHelper.pyw
|
||||
|
Before Width: | Height: | Size: 17 KiB |