Skip to content

Commit

Permalink
small comments and var namings
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBrax committed Nov 26, 2023
1 parent eaf5e54 commit 3481dcd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
24 changes: 24 additions & 0 deletions server/src/Core/Providers/Base/BaseAutomator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ export class BaseAutomator {
return await Promise.resolve(false);
}

/**
* Notifies the chapter change to the providers.
*
* @param channel - The Twitch channel.
*/
public notifyChapterChange(channel: TwitchChannel) {
const vod = channel.latest_vod;
if (!vod) return;
Expand Down Expand Up @@ -762,6 +767,12 @@ export class BaseAutomator {
this.vod_absolute_episode = s.absolute_stream_number;
}

/**
* Starts the capture of the stream.
* @param tries The number of download attempts made (optional, default is 0).
* @returns A Promise that resolves to a boolean indicating whether the download was successful.
* @throws An error if the channel is not found, no VOD ID is supplied, or if the download fails.
*/
public async download(tries = 0): Promise<boolean> {
// const data_title = this.getTitle();
const dataStarted = this.getStartDate();
Expand Down Expand Up @@ -1273,10 +1284,23 @@ export class BaseAutomator {
return true;
}

/**
* Returns an array of provider arguments.
* Override this method to add custom arguments.
*
* @returns {string[]} The provider arguments.
*/
public providerArgs(): string[] {
return [];
}

/**
* A function to do things with the incoming log data from streamlink.
* For example, check for errors or ad-breaks.
*
* @param source - The source of the data, either "stdout" or "stderr".
* @param data - The ticker data received from the streamlink.
*/
public captureTicker(source: "stdout" | "stderr", data: string) {
if (data == null || data == undefined || typeof data !== "string") {
log(
Expand Down
14 changes: 7 additions & 7 deletions server/src/Core/Providers/Twitch/TwitchAutomator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,12 @@ export class TwitchAutomator extends BaseAutomator {
return false;
}

const capture_vod = TwitchVOD.getVodByCaptureId(event.id);
if (capture_vod) {
const captureVodCheck = TwitchVOD.getVodByCaptureId(event.id);
if (captureVodCheck) {
log(
LOGLEVEL.INFO,
"automator.handle",
`Channel ${this.broadcaster_user_login} online, but vod ${event.id} already exists (${capture_vod.basename}), skipping`
`Channel ${this.broadcaster_user_login} online, but vod ${event.id} already exists (${captureVodCheck.basename}), skipping`
);
this.fallbackCapture()
.then(() => {
Expand Down Expand Up @@ -454,7 +454,7 @@ export class TwitchAutomator extends BaseAutomator {
);
return false;
}
event = this.payload_eventsub.event as ChannelUpdateEvent;
event = this.payload_eventsub.event;
chapterData = await this.getChapterData(event);
} else {
log(
Expand Down Expand Up @@ -774,12 +774,12 @@ export class TwitchAutomator extends BaseAutomator {
);
}

const proxy_match = data.match(/Using playlist proxy: '(.*)'/);
if (proxy_match) {
const proxyMatch = data.match(/Using playlist proxy: '(.*)'/);
if (proxyMatch) {
log(
LOGLEVEL.INFO,
"automator.captureVideo",
`Using playlist proxy: ${proxy_match[1]}`
`Using playlist proxy: ${proxyMatch[1]}`
);
}
}
Expand Down

0 comments on commit 3481dcd

Please sign in to comment.