Skip to content

Commit

Permalink
Move shared folder locally (#16)
Browse files Browse the repository at this point in the history
Also fixes prize display
  • Loading branch information
duncte123 authored Aug 8, 2024
1 parent 8a309f0 commit d0a84e6
Show file tree
Hide file tree
Showing 402 changed files with 8,592 additions and 119 deletions.
65 changes: 33 additions & 32 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,37 +57,38 @@ jobs:
run: |
git merge --no-commit ${{ inputs.base_branch || 'master' }}
# Do the 2nd part of the merge. This will ignore the branch's "shared" submodule stuff.
# This can "error" if the merge commit is empty but we want to continue regardless.
# Will only run if the checkout step was successful.
- name: Merge base into build (2)
if: ${{ steps.checkout.outcome == 'success' }}
continue-on-error: true
run: |
rm -rf shared~${{ inputs.base_branch || 'master' }}
git rm --ignore-unmatch --cached -r shared~${{ inputs.base_branch || 'master' }}
git reset HEAD shared
git commit -m "Merge branch '${{ inputs.base_branch || 'master' }}' into ${{ inputs.build_branch || 'build' }}"
# Returns the submodule back so we can get the latest files to build from that.
# Will only run if the checkout step was successful.
- name: Re-add esa-layouts-shared submodule
if: ${{ steps.checkout.outcome == 'success' }}
run: |
rm -rf shared
git rm --ignore-unmatch --cached -r shared
git checkout ${{ inputs.base_branch || 'master' }} shared
git commit -m "Re-add submodule" -a --allow-empty
# Converts the esa-layouts-shared submodule into a normal directory of files.
# This is done as we want to freeze the build at a point in time and this works well.
- name: Convert esa-layouts-shared submodule to regular directory
run: |
git submodule update --init
git rm --cached shared
git config -f .git/config --remove-section submodule.shared
rm -rf shared/.git
git add shared
# TODO: remove if everything works fine
# # Do the 2nd part of the merge. This will ignore the branch's "shared" submodule stuff.
# # This can "error" if the merge commit is empty but we want to continue regardless.
# # Will only run if the checkout step was successful.
# - name: Merge base into build (2)
# if: ${{ steps.checkout.outcome == 'success' }}
# continue-on-error: true
# run: |
# rm -rf shared~${{ inputs.base_branch || 'master' }}
# git rm --ignore-unmatch --cached -r shared~${{ inputs.base_branch || 'master' }}
# git reset HEAD shared
# git commit -m "Merge branch '${{ inputs.base_branch || 'master' }}' into ${{ inputs.build_branch || 'build' }}"
#
# # Returns the submodule back so we can get the latest files to build from that.
# # Will only run if the checkout step was successful.
# - name: Re-add esa-layouts-shared submodule
# if: ${{ steps.checkout.outcome == 'success' }}
# run: |
# rm -rf shared
# git rm --ignore-unmatch --cached -r shared
# git checkout ${{ inputs.base_branch || 'master' }} shared
# git commit -m "Re-add submodule" -a --allow-empty
#
# # Converts the esa-layouts-shared submodule into a normal directory of files.
# # This is done as we want to freeze the build at a point in time and this works well.
# - name: Convert esa-layouts-shared submodule to regular directory
# run: |
# git submodule update --init
# git rm --cached shared
# git config -f .git/config --remove-section submodule.shared
# rm -rf shared/.git
# git add shared

# Setup some Node stuff
- name: Node.js setup
Expand Down Expand Up @@ -131,7 +132,7 @@ jobs:
- name: Commit built files (1)
run: |
git add -f dashboard graphics extension
git add -f ':(glob)./shared/extension/*/dist/**'
git add -f ':(glob)./zoton_shared/extension/*/dist/**'
git commit -m "Built files" -a --allow-empty
# Squash the previous 2 commits down for convenience and create the final build commit.
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "shared"]
path = shared
url = https://github.com/esamarathon/esa-layouts-shared
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"eslint.workingDirectories": [
"shared",
"zoton_shared",
"streamdeck-plugin",
"companion-plugin\\companion-module-esa"
],
"typescript.tsdk": "node_modules\\typescript\\lib"
}
}
45 changes: 10 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Next, clone the `build` branch of this repository into the NodeCG `bundles` fold
> cd bundles
> git clone https://github.com/bsgmarathon/esa-layouts.git --branch build
> cd esa-layouts
> npm install --production
> pnpm install --frozen-lockfile
> ```
You will probably also want a default configuration you can fill in, which can be created using:
Expand All @@ -28,7 +28,7 @@ Then, to get the most recent changes for [nodecg-speedcontrol](https://github.co
> cd ..
> git clone https://github.com/speedcontrol/nodecg-speedcontrol.git --branch build
> cd nodecg-speedcontrol
> npm install --production
> pnpm install --frozen-lockfile
> ```
In addition, to have the `videos` assets automatically audio normalised, you must have `python` (v3), `ffmpeg`, and [`ffmpeg-normalize`](https://github.com/slhck/ffmpeg-normalize) available in your system's `PATH`. If you don't have all of these, the check will fail and videos will just not be touched. For Windows, `python` (v3) should be automatically installed when you install Node.js built tools, if you chose to do that.
Expand All @@ -43,15 +43,13 @@ This bundle also heavily relies on information from a RabbitMQ server, and an in

### Stream Deck Plugin

Deprecated in favor of companion plugin.

Included with this bundle is a plugin for the Elgato Stream Deck software that can be used by various crew members during events. Once you have the Stream Deck software installed, you can install the plugin by running the file `com.esamarathon.streamdeck.streamDeckPlugin` in the `streamdeck-plugin/Release` directory. Currently, you need to set the actions up yourself in the software, so it can easily be customised on the fly.

### FlagCarrier Configuration

You will need to install the [speedcontrol-flagcarrier](https://github.com/speedcontrol/speedcontrol-flagcarrier) bundle to use this part, along with using one of the FlagCarrier applications to set them.

**Hosts (the ones on camera):**
- group_id: `hosts`
- positions: `left,midleft,middle,midright,right`
While this bundle still contains something called FlagCarrier, it has been repurposed for something else internally

### Text-To-Speech Donations

Expand All @@ -61,33 +59,9 @@ This can be enabled via the config, controlled via Stream Deck buttons available

This bundle can interface with [foobar2000](https://www.foobar2000.org/) using the [beefweb](https://github.com/hyperblast/beefweb) plugin. Set up foobar2000 however you want it to play music (we use a long playlist on shuffle, and set a fade in/out on pause), make sure the correct username/password are set in the configuration file, and this bundle with automatically play music when needed. It will only play if the scene name ends in `[M]`, for example, `Intermission [M]`.

## Other Information
Alternatively, you can use [DeaDBeeF](https://deadbeef.sourceforge.io/) with the same beefweb plugin if you are using linux.

### Events Used For

Here's a list of events this bundle has been used at so far, most recent first.

* UKSG Autumn 2021
* ESA Summer 2021
* UKSG Summer 2021
* UKSG Spring 2021
* ESA Winter 2021
* UKSG Winter 2021
* UKSG Autumn 2020
* ESA Summer 2020
* UKSG Summer 2020
* ESA Corona Relief
* ESA Together
* UKSG Spring 2020
* ESA Winter 2020
* UKSG Winter 2020
* ESA @ Malmö Vinterspelen 2019
* ESA @ DreamHack Winter 2019
* UKSG Autumn 2019
* ESA Summer 2019 (including some streams on [SpeedGaming](https://www.twitch.tv/speedgaming) during the event).
* UKSG Summer 2019
* All BSG's from BSG @Home 2020 onwards (Aug 2020)
* All Hekathon events from 2021 onwards
## Other Information

### Credits

Expand All @@ -96,11 +70,12 @@ Here's a list of events this bundle has been used at so far, most recent first.
* https://calculateaspectratio.com/ for helping me (duncte) wiht some math

## Development
To get this bundle set-up for development run the following commands
To get this bundle set-up for development run the following commands.
***Make sure to install speedcontrol!***
> ```
> cd bundles
> git clone https://github.com/bsgmarathon/esa-layouts.git
> cd esa-layouts
> git submodule update --init --recursive
> npm install --production
> pnpm install
> ```
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"watch": "run-p watch:*",
"watch:browser": "webpack -w",
"watch:extension": "tsc -b tsconfig.extension.json -w",
"postinstall": "cd shared && node postinstall.js"
"postinstall": "cd zoton_shared && node postinstall.js"
},
"dependencies": {
"@esamarathon/mq-events": "^1.0.1",
Expand Down Expand Up @@ -362,7 +362,7 @@
],
"mount": [
{
"directory": "shared/flags",
"directory": "zoton_shared/flags",
"endpoint": "flags"
},
{
Expand Down
4 changes: 2 additions & 2 deletions schemas/capturePositions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/draft-07/schema",
"allOf": [
{
"$ref": "../shared/schemas/capturePositions.json"
"$ref": "../zoton_shared/schemas/capturePositions.json"
}
]
}
}
4 changes: 2 additions & 2 deletions schemas/countdown.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/draft-07/schema",
"allOf": [
{
"$ref": "../shared/schemas/countdown.json"
"$ref": "../zoton_shared/schemas/countdown.json"
}
]
}
}
4 changes: 2 additions & 2 deletions schemas/mediaBox.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/draft-07/schema",
"allOf": [
{
"$ref": "../shared/schemas/mediaBox.json"
"$ref": "../zoton_shared/schemas/mediaBox.json"
}
]
}
}
4 changes: 2 additions & 2 deletions schemas/musicData.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/draft-07/schema",
"allOf": [
{
"$ref": "../shared/schemas/musicData.json"
"$ref": "../zoton_shared/schemas/musicData.json"
}
]
}
}
4 changes: 2 additions & 2 deletions schemas/prizes.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/draft-07/schema",
"allOf": [
{
"$ref": "../shared/schemas/prizes.json"
"$ref": "../zoton_shared/schemas/prizes.json"
}
]
}
}
1 change: 0 additions & 1 deletion shared
Submodule shared deleted from 52c03e
2 changes: 1 addition & 1 deletion src/extension/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// This must go first so we can use module aliases!
/* eslint-disable import/first */
require('module-alias').addAlias('@esa-layouts', require('path').join(__dirname, '.'));
require('module-alias').addAlias('@shared', require('path').join(__dirname, '../shared'));
require('module-alias').addAlias('@shared', require('path').join(__dirname, '../zoton_shared'));

import { ExtensionReturn } from '@esa-layouts/types';
import type { Configschema } from '@esa-layouts/types/schemas/configschema';
Expand Down
17 changes: 11 additions & 6 deletions src/extension/tracker/prizes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ const refreshTime = 60 * 1000; // Get prizes every 60s.

// Processes the response from the API above.
function processRawPrizes(rawPrizes: Tracker.Prize[]): Tracker.FormattedPrize[] {
return rawPrizes.filter((prize) => prize.fields.state === 'ACCEPTED').map((prize) => {
// Somehow the the state is gone LMAO
return rawPrizes/* .filter((prize) => prize.fields.state === 'ACCEPTED') */.map((prize) => {
const startTime = prize.fields.startrun__starttime || prize.fields.starttime;
const endTime = prize.fields.endrun__endtime || prize.fields.endtime;
return {
id: prize.pk,
name: prize.fields.name,
provided: prize.fields.provider || undefined,
minimumBid: parseFloat(prize.fields.minimumbid),
image: prize.fields.image || undefined,
image: prize.fields.altimage || prize.fields.image || undefined,
startTime: startTime ? Date.parse(startTime) : undefined,
endTime: endTime ? Date.parse(endTime) : undefined,
};
Expand Down Expand Up @@ -60,7 +61,8 @@ async function updatePrizes(): Promise<void> {
// eslint-disable-next-line import/prefer-default-export
export function setup(): void {
if (!useTestData) {
updatePrizes();
updatePrizes()
.catch((e) => nodecg().log.error('Failed to update prizes:', e));
} else {
// Test Data
prizes.value = [
Expand All @@ -69,7 +71,8 @@ export function setup(): void {
name: 'Test Prize Name (Old)',
provided: 'Anonymous',
minimumBid: Math.floor(Math.random() * 50),
image: 'https://homepages.cae.wisc.edu/~ece533/images/airplane.png',
// eslint-disable-next-line max-len
image: 'https://web.archive.org/web/20100620045843/https://homepages.cae.wisc.edu/~ece533/images/airplane.png',
startTime: Date.now() - 43200000, // Now - 12 hours
endTime: Date.now() - 21600000, // Now + 6 hours
},
Expand All @@ -78,7 +81,8 @@ export function setup(): void {
name: 'Test Prize Name (Active)',
provided: 'Anonymous',
minimumBid: Math.floor(Math.random() * 50),
image: 'https://homepages.cae.wisc.edu/~ece533/images/cat.png',
// eslint-disable-next-line max-len
image: 'https://web.archive.org/web/20100620045843/https://homepages.cae.wisc.edu/~ece533/images/cat.png',
startTime: Date.now(),
endTime: Date.now() + 21600000, // Now + 6 hours
},
Expand All @@ -87,7 +91,8 @@ export function setup(): void {
name: 'Test Prize Name (Future)',
provided: 'Anonymous',
minimumBid: Math.floor(Math.random() * 50),
image: 'https://homepages.cae.wisc.edu/~ece533/images/tulips.png',
// eslint-disable-next-line max-len
image: 'https://web.archive.org/web/20100620045843/https://homepages.cae.wisc.edu/~ece533/images/tulips.png',
startTime: Date.now() + 21600000, // Now + 6 hours
endTime: Date.now() + 43200000, // Now + 12 hours
},
Expand Down
1 change: 1 addition & 0 deletions src/graphics/game-layout/16x9-1p.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
>
<flashing-lights-warning/>
<media-box-box
vertical
line-right
:style="{
width: '469px',
Expand Down
1 change: 1 addition & 0 deletions src/graphics/game-layout/16x9-3p.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
>
<flashing-lights-warning/>
<media-box-box
vertical
line-right
line-left
:style="{
Expand Down
8 changes: 4 additions & 4 deletions src/graphics/game-layout/3dsv-1p.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,20 @@
left: '0px',
top: '732px',
width: '574px',
height: '101px',
height: '106px',
}"
>
<timer line-right/>
<timer line-right line-bottom/>
</div>

<!-- Media Box -->
<div
class="Fixed FlexColumn"
:style="{
left: '0px',
top: '825px',
top: '838px',
width: '574px',
height: '176px',
height: '160px',
}"
>
<flashing-lights-warning class="Flex" style="align-self: flex-end" />
Expand Down
2 changes: 1 addition & 1 deletion src/types/ExtensionReturn.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DeepReadonly } from 'ts-essentials';
import type OBS from '../../shared/extension/obs'; // eslint-disable-line import/no-relative-packages
import type OBS from '../../zoton_shared/extension/obs'; // eslint-disable-line import/no-relative-packages
import { Configschema } from './schemas';

export interface ExtensionReturn {
Expand Down
Loading

0 comments on commit d0a84e6

Please sign in to comment.