Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.8"
services:
web:
build: .
image: mrbrax/twitchautomator:master
image: ghcr.io/second2falcon/livestreamdvr:latest
ports:
- "8082:8080"
volumes:
Expand Down
42 changes: 29 additions & 13 deletions server/src/Controllers/Channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ApiErrorResponse>(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<ApiErrorResponse>(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<ApiResponse>(200, {
Expand Down
2 changes: 1 addition & 1 deletion server/src/Helpers/Software.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function DVRBinaries(): Record<string, BinaryDef> {
},
twitchdownloader: {
binary: Helper.path_twitchdownloader(),
version_args: ["--version", "2>&1"],
version_args: ["--version"],
version_regex: /TwitchDownloaderCLI (\d+\.\d+\.\d+)/m,
},
python: {
Expand Down
Loading