diff --git a/README.md b/README.md index 060bfd4..57f8451 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@ # Better KQB Scoreboard -Better KQB Scoreboard helps casters keep track of the score and display it beautifully. KQB Scoreboard was written in Go and provides a front end interface for use with OBS. It will import the teams and standings from IGL to display within your cast. +Better KQB Scoreboard helps casters keep track of scores and display them beautifully within OBS. It is primarily targeted at IGL match casters, but will be adding support for custom matches as well. It allows you to directly import team data (teams, standings, avatars, etc.) directly from IGL so there is no room for error when setting up your stream. It will prompt you to record map wins and will tally the results for you and they will be displayed properly within the widget. Thus allowing you to focus on streaming and let the widget handle the legwork for you. + +KQB Scoreboard was written in Go and provides a browser widget interface for use with OBS. ## Instructions 1. Download the entire release zip file from github 2. Unzip the directory and run the kqb-scoreboard executable (Mac and Windows compatible) 3. Create a browser source in OBS pointed at http://localhost:8080 -* Within the browser source set the dimensions to 1920 x 450 +* Within the browser source set the dimensions to 1440 x 450 (Large) or 1920 x 450 (Smaller) * Then add a green chroma filter to make it transparent 4. Profit diff --git a/go.mod b/go.mod index 5f22f43..a6474f7 100644 --- a/go.mod +++ b/go.mod @@ -4,10 +4,8 @@ go 1.14 require ( github.com/gorilla/websocket v1.4.2 - github.com/joho/godotenv v1.3.0 github.com/lunixbochs/vtclean v1.0.0 // indirect github.com/manifoldco/promptui v0.7.0 github.com/mattn/go-colorable v0.1.6 // indirect - github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd // indirect golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f // indirect ) diff --git a/go.sum b/go.sum index 10c47ce..43b2729 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,6 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWs github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a h1:FaWFmfWdAUKbSCtOU2QjDaorUexogfaMgbipgYATUMU= github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -29,8 +27,6 @@ github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd h1:ug7PpSOB5RBPK1Kg6qskGBoP3Vnj/aNYFTznWvlkGo0= -github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/kqb-scoreboard b/kqb-scoreboard index 5f12c5f..ae49101 100755 Binary files a/kqb-scoreboard and b/kqb-scoreboard differ diff --git a/kqb-scoreboard.exe b/kqb-scoreboard.exe index b4bc810..39466f1 100755 Binary files a/kqb-scoreboard.exe and b/kqb-scoreboard.exe differ diff --git a/main.go b/main.go index c9bbebe..9f207b8 100644 --- a/main.go +++ b/main.go @@ -21,6 +21,7 @@ const ( IglWestID = "5e4c6b5178d46abdfeb49e71" IglEastID = "5e4b295560f132acbb31b8f5" PlaceholderImage = "https://bulma.io/images/placeholders/128x128.png" + KQBAvatarImage = "/avatar.png" ) type Team struct { @@ -38,8 +39,8 @@ type Stats struct { MatchesLost int } -var h Team = Team{"Home Team", PlaceholderImage, 1, 1, Stats{1, 1, 1, 1}} -var a Team = Team{"Away Team", PlaceholderImage, 1, 1, Stats{1, 1, 1, 1}} +var h Team = Team{"Blue Team", PlaceholderImage, 1, 1, Stats{1, 1, 1, 1}} +var a Team = Team{"Gold Team", PlaceholderImage, 1, 1, Stats{1, 1, 1, 1}} var s Scoreboard = Scoreboard{&h, &a, 0, 0, 0, 0} func setupLogs() { @@ -61,13 +62,16 @@ func main() { wg.Add(1) StartHTTPServer() SetupCloseHandler() - apiUrl, _ := PromptIglCircuit() + apiUrl, err := PromptIglCircuit() + if err != nil { + os.Exit(0) + } teams := GetTeamInfo(apiUrl) - home, err := PromptTeam("Home", teams) + home, err := PromptTeam("Blue", teams) if err != nil { os.Exit(0) } - away, err := PromptTeam("Away", teams) + away, err := PromptTeam("Gold", teams) if err != nil { os.Exit(0) } @@ -116,6 +120,8 @@ func GetTeamInfo(url string) []Team { test.Div = int(t.(map[string]interface{})["div"].(float64)) if t.(map[string]interface{})["logo"] != nil { test.Img = t.(map[string]interface{})["logo"].(string) + } else { + test.Img = KQBAvatarImage } test.Stats.GamesWon, _ = strconv.Atoi(s.(map[string]interface{})["Games Won"].(string)) test.Stats.GamesLost, _ = strconv.Atoi(s.(map[string]interface{})["Games Lost"].(string)) @@ -197,8 +203,8 @@ func RecordMapScore(s *Scoreboard) error { ID int } m := []MapWinPrompt{ - {fmt.Sprintf("%s (Home) Won Map", s.Home.Name), "cyan", 0}, - {fmt.Sprintf("%s (Away) Won Map", s.Away.Name), "yellow", 1}, + {fmt.Sprintf("%s (Blue) Won Map", s.Home.Name), "cyan", 0}, + {fmt.Sprintf("%s (Gold) Won Map", s.Away.Name), "yellow", 1}, } templates := &promptui.SelectTemplates{ Label: "{{ . | red | bold }}?", diff --git a/prompts.go b/prompts.go new file mode 100644 index 0000000..c706904 --- /dev/null +++ b/prompts.go @@ -0,0 +1,35 @@ +package main + +import ( + "fmt" + + "github.com/manifoldco/promptui" +) + +func PromptIGLCustom() { + // Each template displays the data received from the prompt with some formatting. + templates := &promptui.PromptTemplates{ + Prompt: "{{ . }} ", + Valid: "{{ . | green }} ", + Invalid: "{{ . | red }} ", + Success: "{{ . | bold }} ", + Confirm: "Is this an IGL Match or Custom Match?", + } + + prompt := promptui.Prompt{ + Label: "Select Match Type?", + Templates: templates, + IsConfirm: true, + } + + result, err := prompt.Run() + + if err != nil { + fmt.Printf("Prompt failed %v\n", err) + return + } + + // The result of the prompt, if valid, is displayed in a formatted message. + fmt.Printf("You answered %s\n", result) + return +} diff --git a/screenshots/scoreboard-ss-1.png b/screenshots/scoreboard-ss-1.png index 628a77a..4c4dfb2 100644 Binary files a/screenshots/scoreboard-ss-1.png and b/screenshots/scoreboard-ss-1.png differ diff --git a/screenshots/scoreboard-ss-2.png b/screenshots/scoreboard-ss-2.png index f1d352a..7b9ed89 100644 Binary files a/screenshots/scoreboard-ss-2.png and b/screenshots/scoreboard-ss-2.png differ diff --git a/static/avatar.png b/static/avatar.png new file mode 100644 index 0000000..af435ea Binary files /dev/null and b/static/avatar.png differ diff --git a/static/fitty.min.js b/static/fitty.min.js new file mode 100644 index 0000000..a5d8801 --- /dev/null +++ b/static/fitty.min.js @@ -0,0 +1,5 @@ +/* + * fitty v2.3.0 - Snugly resizes text to fit its parent container + * Copyright (c) 2020 Rik Schennink (https://pqina.nl/) + */ +!function(e,t){if("function"==typeof define&&define.amd)define(["module","exports"],t);else if("undefined"!=typeof exports)t(module,exports);else{var n={exports:{}};t(n,n.exports),e.fitty=n.exports}}(this,function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var E=Object.assign||function(e){for(var t=1;t + + + +Created by FontForge 20170924 at Fri Jul 20 01:08:29 2012 + By www-data +(c) 2004-2009 Typodermic Fonts. This font is not freely distributable. Languages by Chikako Larabie + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/fonts/pirulenrg.ttf b/static/fonts/pirulenrg.ttf new file mode 100644 index 0000000..62392ed Binary files /dev/null and b/static/fonts/pirulenrg.ttf differ diff --git a/static/fonts/pirulenrg.woff b/static/fonts/pirulenrg.woff new file mode 100644 index 0000000..329b679 Binary files /dev/null and b/static/fonts/pirulenrg.woff differ diff --git a/static/fonts/pirulenrg.woff2 b/static/fonts/pirulenrg.woff2 new file mode 100644 index 0000000..dc0dd29 Binary files /dev/null and b/static/fonts/pirulenrg.woff2 differ diff --git a/static/index.html b/static/index.html index 701b89b..d64fd93 100644 --- a/static/index.html +++ b/static/index.html @@ -5,6 +5,7 @@ + + + + + +
+
+
+
+ Image +
+
+
+
+ Blue Team +
+ (0-0) +
+
+
+
+
+
+
+     +

+ 0 +

+
+
+
+
+
+
+
+
+
+

+ 0 +

+     +
+
+
+
+
+
+
+

+ Gold Team +
+ (0-0) +

+
+
+
+
+ Image +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/static/scoreboard.css b/static/scoreboard.css index cf8ab58..48c8564 100644 --- a/static/scoreboard.css +++ b/static/scoreboard.css @@ -1,19 +1,37 @@ +@font-face { + font-family: "PirulenRg-Regular"; + src: url("./fonts/pirulenrg.eot"); /* IE9 Compat Modes */ + src: url("./fonts/pirulenrg.eot?#iefix") format("embedded-opentype"), /* IE6-IE8 */ + url("./fonts/pirulenrg.otf") format("opentype"), /* Open Type Font */ + url("./fonts/pirulenrg.svg") format("svg"), /* Legacy iOS */ + url("./fonts/pirulenrg.ttf") format("truetype"), /* Safari, Android, iOS */ + url("./fonts/pirulenrg.woff") format("woff"), /* Modern Browsers */ + url("./fonts/pirulenrg.woff2") format("woff2"); /* Modern Browsers */ + font-weight: normal; + font-style: normal; +} + +body { + font-family: PirulenRg-Regular !important; + overflow: hidden; + line-height: 1 !important; +} .is-transparent{ background-color: #00ff00 !important; } .left { - height: 20vh; - width: 30vw; + height: 100px; + width: 480px; left: 0vw; top: 0vh; position: absolute; } .right { - height: 20vh; - width: 30vw; + height: 100px; + width: 480px; right: 0vh; top: 0vh; position: absolute; @@ -60,7 +78,8 @@ } .score-text { - transform: translateY(-50%); + /* transform: translateY(-50%); */ + font-size: 3em; } .home-oval-filled { @@ -106,4 +125,36 @@ figure { border: 3px black solid; +} + + +.wrapper-left { + display: grid; + grid-template-columns: 80px 200px 100px 60px; + grid-gap: 10px; + grid-auto-rows: 80px; +} + +.wrapper-right { + display: grid; + grid-template-columns: 60px 100px 200px 80px; + grid-gap: 10px; + grid-auto-rows: 80px; +} + +.one { + grid-column: 1; + grid-row: 1; +} +.two { + grid-column: 2; + grid-row: 1 +} +.three { + grid-column: 3; + grid-row: 1; +} +.four { + grid-column: 4; + grid-row: 1; } \ No newline at end of file