Skip to content

Commit a66a61f

Browse files
committed
feat: Support for autoSelect none and disabled
1 parent 3c0a4be commit a66a61f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

apps/stitcher/src/filters.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { MasterPlaylist } from "./parser";
44
export interface Filter {
55
resolution?: string;
66
audioLanguage?: string;
7-
disableAutoSelect?: boolean;
7+
autoSelect?: "none" | "disabled";
88
}
99

1010
export const filterQuerySchema = z
@@ -94,10 +94,15 @@ export function filterMasterPlaylist(master: MasterPlaylist, filter: Filter) {
9494
return true;
9595
});
9696
}
97-
if (filter.disableAutoSelect) {
97+
if (filter.autoSelect) {
9898
master.renditions.forEach((rendition) => {
99-
if (!rendition.default && rendition.autoSelect) {
100-
rendition.autoSelect = false;
99+
if (filter.autoSelect === "disabled") {
100+
rendition.default = false;
101+
}
102+
if (filter.autoSelect === "disabled" || filter.autoSelect === "none") {
103+
if (!rendition.default && rendition.autoSelect) {
104+
rendition.autoSelect = false;
105+
}
101106
}
102107
});
103108
}

apps/stitcher/src/routes/sessions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const sessionsApp = new Hono()
8484
.object({
8585
resolution: z.string().optional(),
8686
audioLanguage: z.string().optional(),
87-
disableAutoSelect: z.boolean().optional(),
87+
autoSelect: z.enum(["none", "disabled"]).optional(),
8888
})
8989
.optional()
9090
.openapi({

0 commit comments

Comments
 (0)