libroadcast-cli 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cmd/delay.js +27 -24
- package/dist/cmd/setPGN.js +7 -6
- package/dist/utils.js +3 -1
- package/package.json +1 -1
package/dist/cmd/delay.js
CHANGED
|
@@ -2,30 +2,33 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.delayCommand = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
|
-
const setDelayRounds = (rounds, delay, onlyDelay, noDelay) =>
|
|
6
|
-
|
|
7
|
-
.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
5
|
+
const setDelayRounds = async (rounds, delay, onlyDelay, noDelay) => {
|
|
6
|
+
for (const round of rounds) {
|
|
7
|
+
await utils_1.client
|
|
8
|
+
.POST("/broadcast/round/{broadcastRoundId}/edit", {
|
|
9
|
+
params: {
|
|
10
|
+
path: { broadcastRoundId: round.id },
|
|
11
|
+
query: { patch: 1 },
|
|
12
|
+
},
|
|
13
|
+
body: {
|
|
14
|
+
delay: noDelay ? undefined : delay,
|
|
15
|
+
startsAt: round.startsAt && !onlyDelay
|
|
16
|
+
? round.startsAt + delay * 1000
|
|
17
|
+
: undefined,
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
.then((response) => {
|
|
21
|
+
if (response.response.ok)
|
|
22
|
+
console.log(`Successfully set delay for round ${round.id} to ${delay} seconds.`);
|
|
23
|
+
else
|
|
24
|
+
console.error(`Failed to set delay for round ${round.id}: ${response.response.statusText}`);
|
|
25
|
+
})
|
|
26
|
+
.catch((error) => {
|
|
27
|
+
console.error(`Error setting delay for round ${round.id}:`, error);
|
|
28
|
+
});
|
|
29
|
+
await (0, utils_1.sleep)(200);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
29
32
|
const delayCommand = async (args) => {
|
|
30
33
|
const [broadcastId, delay] = args.slice(0, 2);
|
|
31
34
|
if (args.includes("--help") || args.includes("-h")) {
|
package/dist/cmd/setPGN.js
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setPGNCommand = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
|
-
const setPGN = (rounds, urlRound, setRoundFilter, setSliceFilter = null) => {
|
|
6
|
-
let rN = 1;
|
|
7
|
-
|
|
5
|
+
const setPGN = async (rounds, urlRound, setRoundFilter, setSliceFilter = null) => {
|
|
6
|
+
for (let rN = 1; rN <= rounds.length; rN++) {
|
|
7
|
+
const round = rounds[rN - 1];
|
|
8
|
+
console.log(round);
|
|
8
9
|
const url = urlRound(rN);
|
|
9
|
-
utils_1.client
|
|
10
|
+
await utils_1.client
|
|
10
11
|
.POST("/broadcast/round/{broadcastRoundId}/edit", {
|
|
11
12
|
params: {
|
|
12
13
|
path: { broadcastRoundId: round.id },
|
|
@@ -28,8 +29,8 @@ const setPGN = (rounds, urlRound, setRoundFilter, setSliceFilter = null) => {
|
|
|
28
29
|
.catch((error) => {
|
|
29
30
|
console.error(`Error setting source LCC for round ${round.id}:`, error);
|
|
30
31
|
});
|
|
31
|
-
|
|
32
|
-
}
|
|
32
|
+
await (0, utils_1.sleep)(200);
|
|
33
|
+
}
|
|
33
34
|
};
|
|
34
35
|
const setPGNCommand = async (args) => {
|
|
35
36
|
const [bId, sourcePGN] = args.slice(0, 2);
|
package/dist/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getBroadcast = exports.showHelp = exports.Command = exports.client = exports.LICHESS_TOKEN = void 0;
|
|
6
|
+
exports.sleep = exports.getBroadcast = exports.showHelp = exports.Command = exports.client = exports.LICHESS_TOKEN = void 0;
|
|
7
7
|
const process_1 = require("process");
|
|
8
8
|
const openapi_fetch_1 = __importDefault(require("openapi-fetch"));
|
|
9
9
|
exports.LICHESS_TOKEN = process_1.env.LICHESS_TOKEN;
|
|
@@ -67,3 +67,5 @@ const getBroadcast = (broadcastId) => exports.client
|
|
|
67
67
|
return null;
|
|
68
68
|
});
|
|
69
69
|
exports.getBroadcast = getBroadcast;
|
|
70
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
71
|
+
exports.sleep = sleep;
|