diff --git a/Dockerfile b/Dockerfile index 1578325e..4094eab6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,6 +28,7 @@ RUN apt-get update && apt-get install -y \ ffmpeg mediainfo \ python3 python3-pip python3-wheel libxml2-dev libxslt-dev python3-dev \ bash git curl unzip rclone \ + libicu76 \ && apt-get clean # copy over pipenv files and install dependencies for python diff --git a/docker-compose.yml b/docker-compose.yml index 5e69e6ba..4e585141 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.8" services: web: build: . - image: mrbrax/twitchautomator:master + image: ghcr.io/second2falcon/livestreamdvr:latest ports: - "8082:8080" volumes: diff --git a/server/src/Controllers/Channels.ts b/server/src/Controllers/Channels.ts index 4c453a7c..8cc491b5 100644 --- a/server/src/Controllers/Channels.ts +++ b/server/src/Controllers/Channels.ts @@ -1779,20 +1779,36 @@ export function GetHistory(req: express.Request, res: express.Response): void { BaseConfigCacheFolder.history, `${channel.internalName}.jsonline` ); - if (!fs.existsSync(file)) { - res.api(400, { - status: "ERROR", - message: req.t("route.channels.no-history-found"), - }); - return; - } - - const lines = fs.readFileSync(file, "utf8").split("\n"); - for (const line of lines) { - if (line.length > 0) { - const chapter = JSON.parse(line) as HistoryEntry; - history.push(chapter); + if (fs.existsSync(file)) { + const lines = fs.readFileSync(file, "utf8").split("\n"); + for (const line of lines) { + if (line.length > 0) { + const chapter = JSON.parse(line) as HistoryEntry; + history.push(chapter); + } } + } else { + // Fall back to building history from the last 5 VODs' chapters for imported channels + const vods = channel.getVods().slice(-5); + for (const vod of vods) { + if (isTwitchChannel(channel) && vod instanceof TwitchVOD) { + for (const chapter of vod.chapters_raw) { + history.push(chapter); + } + } + } + if (history.length === 0) { + res.api(400, { + status: "ERROR", + message: req.t("route.channels.no-history-found"), + }); + return; + } + history.sort((a, b) => { + const aTime = (a as TwitchVODChapterJSON).started_at ?? (a as StreamEvent).time ?? ""; + const bTime = (b as TwitchVODChapterJSON).started_at ?? (b as StreamEvent).time ?? ""; + return aTime < bTime ? -1 : aTime > bTime ? 1 : 0; + }); } res.api(200, { diff --git a/server/src/Helpers/Software.ts b/server/src/Helpers/Software.ts index a62f1679..af9f89bd 100644 --- a/server/src/Helpers/Software.ts +++ b/server/src/Helpers/Software.ts @@ -27,7 +27,7 @@ export function DVRBinaries(): Record { }, twitchdownloader: { binary: Helper.path_twitchdownloader(), - version_args: ["--version", "2>&1"], + version_args: ["--version"], version_regex: /TwitchDownloaderCLI (\d+\.\d+\.\d+)/m, }, python: {