Skip to content

Commit

Permalink
autosplit option on end download
Browse files Browse the repository at this point in the history
related to #474
  • Loading branch information
MrBrax committed Nov 13, 2023
1 parent 9847907 commit ebd742e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions common/ServerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,13 @@ export const settingsFields: Record<string, SettingField> = {
type: "string",
},

"capture.autosplit-enabled": {
group: "Capture",
text: "Enable video autosplit",
type: "boolean",
default: false,
},

// sub_lease: { group: "Advanced", text: "Subscription lease", type: "number", default: 604800 },
api_client_id: {
group: "Twitch",
Expand Down
20 changes: 20 additions & 0 deletions server/src/Core/Providers/Base/BaseAutomator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ export class BaseAutomator {
// download chat and optionally burn it
// TODO: call this when a non-captured stream ends too
if (this.channel && this.vod) {
// download chat
if (
this.vod instanceof TwitchVOD &&
this.channel.download_chat &&
Expand Down Expand Up @@ -613,6 +614,7 @@ export class BaseAutomator {
}
}

// run auto exporter
if (Config.getInstance().cfg("exporter.auto.enabled")) {
const options: ExporterOptions = {
vod: this.vod.uuid,
Expand Down Expand Up @@ -742,6 +744,24 @@ export class BaseAutomator {
}
}

// run auto splitter
if (
isTwitchVOD(this.vod) &&
Config.getInstance().cfg("capture.autosplit-enabled")
) {
try {
await this.vod.splitSegmentVideoByChapters();
} catch (error) {
log(
LOGLEVEL.ERROR,
"automator.onEndDownload",
`Failed to split ${this.vod.basename}: ${
(error as Error).message
}`
);
}
}

// if there's no eventsub hook the stream will never actually end
if (Config.getInstance().cfg<boolean>("isolated_mode")) {
await this.end();
Expand Down

0 comments on commit ebd742e

Please sign in to comment.