Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
zoton2 committed Mar 30, 2020
2 parents 44ae4d7 + b3cfdb0 commit 421b0fe
Show file tree
Hide file tree
Showing 86 changed files with 3,574 additions and 2,431 deletions.
39 changes: 27 additions & 12 deletions .eslintrc.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,37 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
],
settings: {
'import/extensions': ['.js', '.jsx', '.ts', '.tsx'],
'import/resolver': {
node: {
moduleDirectory: [
'node_modules',
'../..',
'.',
],
},
},
},
rules: {
'import/extensions': ['error', 'ignorePackages', {
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
}],
'import/no-extraneous-dependencies': ['error', {
devDependencies: true, // Some places have dev deps imported where eslint complains.
packageDir: ['.', '../..'], // Check for deps in NodeCG folder as well.
}],
'vue/html-self-closing': ['error', {
html: {
component: 'never', // Transpiler(?) has issues with self closing components.
},
}],
'max-len': ["error", { "code": 100 }],
// I legit think the 5 things below are broken, might be a typescript-eslint issue.
'vue/no-parsing-error': 'off',
'vue/valid-v-on': 'off',
'vue/valid-v-if': 'off',
'vue/valid-v-bind': 'off',
'vue/valid-v-model': 'off',
'import/no-unresolved': [2, { caseSensitive: false }],
'max-len': [
'error',
{
'code': 100,
ignorePattern: '"(.*?)": "(.*?)"' // Pattern for i18n JSON
}
],
'lines-between-class-members': 'off',
}
};
24 changes: 23 additions & 1 deletion .eslintrc.extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,34 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
],
settings: {
'import/extensions': ['.js', '.jsx', '.ts', '.tsx'],
'import/resolver': {
node: {
moduleDirectory: [
'node_modules',
'../..',
'.',
],
},
},
},
rules: {
'import/extensions': ['error', 'ignorePackages', {
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
}],
'import/no-extraneous-dependencies': ['error', {
devDependencies: true, // Some places have dev deps imported where eslint complains.
packageDir: ['.', '../..'], // Check for deps in NodeCG folder as well.
}],
'max-len': ["error", { "code": 100 }],
'import/no-unresolved': [2, { caseSensitive: false }],
'max-len': ['error', { 'code': 100 }],
'lines-between-class-members': 'off',
'require-atomic-updates': 'off',
'no-restricted-syntax': 'off',
'no-await-in-loop': 'off',
},
};
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 zoton2
Copyright (c) 2020 speedcontrol

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
nodecg-speedcontrol, usually known as just "Speedcontrol", is a bundle for the [NodeCG](https://nodecg.com/) broadcast graphics framework/application developed for automating tasks for speedrunning marathons, mainly changing information on overlays and updating the Twitch information.

Some basic information:
- Import schedules from [Horaro](https://horaro.org/).
- Import schedules from [Horaro](https://horaro.org/) and [Oengus](https://oengus.io/) [work in progress].
- By default, can store information on the run and the players, but can also be customised to store more if needed by advanced users.
- Automatically change Twitch title and/or game directory if needed.
- Automatically feature the current player(s) on the [FrankerFaceZ](https://www.frankerfacez.com/) featured channels function below the stream.
- Has an inbuilt timer (powered by [livesplit-core](https://github.com/LiveSplit/livesplit-core)); no need to have a seperate application open.
- Support for some donations trackers can be added with extra bundles (see below).
- User interface avaiable in English and Japanese (partially complete).

This bundle doesn't come with any graphics, you will need to create them yourself in another bundle. If you have no experience in developing, you can check out [speedcontrol-simpletext](https://github.com/speedcontrol/speedcontrol-simpletext) for an simple example bundle, or check out the [API documentation](READMES/API.md) if you're are more advanced user.

Expand All @@ -23,7 +24,7 @@ You will need [Node.js](https://nodejs.org) (10.x LTS tested) and [git](https://

- `nodecg install speedcontrol/nodecg-speedcontrol` to install the latest version of nodecg-speedcontrol

This bundle can run without any extra configuration, but it's needed to use all of the functionality. Please see the [Configuration documentation](READMES/Configuration.md) for more information. You may also want to read the [Schedule Formatting documentation](READMES/Schedule-Formatting.md) for advice on formatting your schedules before importing.
This bundle can run without any extra configuration, but it's needed to use all of the functionality, and if you want to switch to a different localisation. Please see the [Configuration documentation](READMES/Configuration.md) for more information. You may also want to read the [Schedule Formatting documentation](READMES/Schedule-Formatting.md) for advice on formatting your Horaro schedules before importing, if you choose to import via this method.

### tl;dr installation

Expand All @@ -39,6 +40,8 @@ nodecg start

## Basic Usage

***Currently this basic guide assumes you are importing from a Horaro schedule; importing from Oengus is very simple anyway and the other parts of this guide still apply.***

Once installed, go to `https://localhost:9090` (unless you have overridden the defaults in the NodeCG config) to access the dashboard.

To import a schedule, go to the *Run Modifications* workspace along the top, and look for the *Horaro Schedule Import* panel. Paste in a Horaro schedule URL into the text box (it will be automatically pre-filled if you set `schedule.defaultURL` in this bundles config) and click *Load Schedule Data*.
Expand Down Expand Up @@ -86,6 +89,7 @@ To easily install: `nodecg install speedcontrol/BUNDLE-NAME`
*(This is not an exhaustive list.)*

- All [European Speedrunner Assembly](https://www.esamarathon.com/) marathons since Pre-ESA Marathon 2016, including the ESA ran Dreamhack speedrunning events in Sweden
- All on-site based [United Kingdom Speedrunner Gathering](https://www.speedrun.com/uksg) marathons since Fall 2018.
- All [GTA Marathons](https://www.twitch.tv/gtamarathon) since GTA Marathon 2016
- All [SpeedSouls Charity Marathons](https://www.twitch.tv/speedsouls)
- [Themeathon Pre-Marathon 2018](https://www.twitch.tv/themeathon)
Expand All @@ -105,6 +109,8 @@ With help from:
- btrim
- Zephyyrr
- Planks
- cma2819 *(Oengus Support)*
- yagamuu *(Japanese Localisation)*


## Contribution/Development
Expand All @@ -114,3 +120,7 @@ The `master` branch will always be the most recent stable release, while all dev
If you need to report an issue, you can [do that on GitHub](https://github.com/speedcontrol/nodecg-speedcontrol/issues).

Feel free to raise an issue/Pull Request if you have used our bundle(s) for a marathon and would like to be linked above.

### Localisation

This bundle supports additional languages using [Vue I18n](https://kazupon.github.io/vue-i18n/). If you wish to add support for another language, you must add the language code in `configschema.json`, under `language` > `enum`, and then also run `npm run typeschemas` to regenerate the `configschema.d.ts` file. You can then specify this language in the bundle's configuration file. Then, in the `src\dashboard\_misc\i18n.ts` file, add an additional object inside of the `messages` object inside the `VueI18n` instance for your newly added language. There are some reused pieces of text in this file that should be translated, but the rest are stored in the Single File Components (SFC) inside of the `src\dashboard` folder and subfolders, within the `<i18n>` blocks inside of those (in JSON format). If a piece of text is not translated yet, it will fall back to English (`en`).
12 changes: 7 additions & 5 deletions READMES/API/NodeCG-Messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,23 +408,25 @@ Removes all of the runs in the `runDataArray` replicant, and also removes the ac

## twitchStartCommercial

### *No parameters*
### Parameters
- *[`object`]*
- `duration` *[`number`]* How long you want the commercial to run for in seconds. Accepted values: 30, 60, 90, 120, 150, 180.
### Data
- *[`object`]*
- `duration` *[`number`]* How long the commercial will run for in seconds.
### Example code (extension/no acknowledgement)
```javascript
nodecg.sendMessageToBundle('twitchStartCommercial', 'nodecg-speedcontrol');
nodecg.sendMessageToBundle('twitchStartCommercial', 'nodecg-speedcontrol', { duration: 180 });
```
### Example code (callback)
```javascript
nodecg.sendMessageToBundle('twitchStartCommercial', 'nodecg-speedcontrol', (err, data) => {
nodecg.sendMessageToBundle('twitchStartCommercial', 'nodecg-speedcontrol', { duration: 180 }, (err, data) => {
...
});
```
### Example code (promise)
```javascript
nodecg.sendMessageToBundle('twitchStartCommercial', 'nodecg-speedcontrol')
nodecg.sendMessageToBundle('twitchStartCommercial', 'nodecg-speedcontrol', { duration: 180 })
.then((data) => { ... })
.catch((err) => { ... });
```
Expand All @@ -435,7 +437,7 @@ nodecg.sendMessageToBundle('twitchStartCommercial', 'nodecg-speedcontrol')
}
```

Used to tell the Twitch API to run a commercial if applicable to your channel and you have the Twitch API integration enabled. Currently the commercials will all be 180 seconds (3 minutes); there is no way to specify this yet.
Used to tell the Twitch API to run a commercial if applicable to your channel and you have the Twitch API integration enabled. You can specify the length using `duration` in the paramters object; if not specified it will default to 180.


## twitchUpdateChannelInfo
Expand Down
29 changes: 29 additions & 0 deletions READMES/API/Replicants.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [timer](#timer)
- [runFinishTimes](#runFinishTimes)
- [timerChangesDisabled](#timerChangesDisabled)
- [twitchCommercialTimer](#twitchCommercialTimer)


## runDataArray
Expand Down Expand Up @@ -191,3 +192,31 @@ false
```

A `boolean` that can be set by you, which is used to disable any changes of the timer. This can be useful if you know you are in a part of a marathon where you know the timer should not be touched and need to make sure it cannot be, for example an intermission. If this has been set to `true`, it can be overridden/toggled in the *Timer* panel if needed in an emergency.


## twitchCommercialTimer

*Types available in [./schemas/twitchCommercialTimer.d.ts](../../schemas/twitchCommercialTimer.d.ts)*

### Data
- *[`object`]*
- `secondsRemaining` *[`number`]* How long is running on the currently active Twitch commercial if any; will be `0` if none is running.
- `originalDuration` *[`number`]* The length that the commercial triggered lasts for, or how long the previous one lasted for if none is currently running.
- `timestamp` *[`number`]* A `Date.now()` timestamp of the last time a commercial was successfully triggered, used internally for time recovery if NodeCG is closed/quits unexpectedly.
### Example code
```javascript
const twitchCommercialTimer = nodecg.Replicant('twitchCommercialTimer', 'nodecg-speedcontrol');
twitchCommercialTimer.on('change', (newVal, oldVal) => {
...
});
```
### Example data
```javascript
{
secondsRemaining: 46,
originalDuration: 180,
timestamp: 1584143073928
}
```

An object that stores information on if a Twitch commercial is currently active or not via this bundle and if so, more information about it. This is obviously only applicable if you are using the Twitch integration in this bundle. None of these values should ever be `undefined` but `originalDuration` and `timestamp` are not changed when the commercial has ended, so check that `secondsRemaining` is bigger than 0 to see if a commercial is currently running if needed. This timer may be useful if you need to display how long a commercial has left on a graphic.
4 changes: 2 additions & 2 deletions READMES/API/RunData.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ Various places in this bundle store information in the format we refer to as the
- `estimateS` *Number* Same as above but in seconds.
- `setupTime` *[`string`]* Run setup time (to be added to the end of the run) in a human readable string.
- `setupTimeS` *Number* Same as above but in seconds.
- `scheduled` *[`string`]* Timestamp for when the run is scheduled, with the timezone; only applicable for runs imported from Horaro.
- `scheduledS` *[`number`]* Same as above but as a unix timestamp.
- `scheduled` *[`string`]* ISO 8601 timestamp for when the run is scheduled; for Horaro this will also have the timezone, but for Oengus it will always be in UTC.
- `scheduledS` *[`number`]* Same as above but as a unix timestamp in seconds.
- `teams` *[`array`[`object`]]* Teams that are doing this run. Length can be 0 (no teams/players), 1 (single player run or co-op) or 2 or more (race and/or co-op race); this will always be an array even if no teams are contained within it.
- `customData` *[`object`]* Contains keyed strings, with the key(s) from your configuration for custom data; this will always be an object even if no data is contained within it.
- `id` *[`string`]* Unique ID; will always be set.
Expand Down
Loading

0 comments on commit 421b0fe

Please sign in to comment.