diff --git a/common/ServerConfig.ts b/common/ServerConfig.ts index 215e38e9..e064236a 100644 --- a/common/ServerConfig.ts +++ b/common/ServerConfig.ts @@ -622,6 +622,17 @@ export const settingsFields: Record = { type: "boolean", default: true, }, + "video.chapters.title": { + group: "Video", + text: "Video chapters title", + type: "object", + default: "title_and_game", + choices: { + title_and_game: "Title and game", + title: "Title", + game: "Game", + }, + }, create_kodi_nfo: { group: "Video", text: "Create kodi nfo", diff --git a/server/src/Core/Providers/Base/BaseVOD.ts b/server/src/Core/Providers/Base/BaseVOD.ts index 887515d0..a4f38888 100644 --- a/server/src/Core/Providers/Base/BaseVOD.ts +++ b/server/src/Core/Providers/Base/BaseVOD.ts @@ -1200,14 +1200,26 @@ export class BaseVOD { if (this.started_at) meta.setDate(this.started_at); + const titleConfig = Config.getInstance().cfg("video.chapters.title"); + this.chapters.forEach((chapter) => { const offset = chapter.offset || 0; const duration = chapter.duration || 0; const start = Math.floor(offset * 1000); const end = Math.floor((offset + duration) * 1000); - const title = isTwitchVODChapter(chapter) - ? `${chapter.title} (${chapter.game_name})` - : chapter.title; + // const title = isTwitchVODChapter(chapter) + // ? `${chapter.title} (${chapter.game_name})` + // : chapter.title; + let title = chapter.title; + if ( + titleConfig == "title_and_game" && + isTwitchVODChapter(chapter) + ) { + title = `${chapter.title} (${chapter.game_name})`; + } else if (titleConfig == "game" && isTwitchVODChapter(chapter)) { + title = `${chapter.game_name ?? chapter.title}`; + } + try { meta.addChapter(start, end, title, "1/1000", [ isTwitchVODChapter(chapter)