tangled
alpha
login
or
join now
dunkirk.sh
/
pstream-ng
1
fork
atom
pstream is dead; long live pstream
taciturnaxolotl.github.io/pstream-ng/
1
fork
atom
overview
issues
pulls
pipelines
no more quickwatch api
Pas
2 months ago
45ecb9d8
6f67a7c7
+55
-55
2 changed files
expand all
collapse all
unified
split
src
components
player
hooks
useSkipTime.ts
internals
Backend
SkipTracker.tsx
+52
-52
src/components/player/hooks/useSkipTime.ts
···
9
9
10
10
// Thanks Nemo for this API
11
11
const THE_INTRO_DB_BASE_URL = "https://api.theintrodb.org/v1";
12
12
-
const QUICKWATCH_BASE_URL = "https://skips.quickwatch.co";
12
12
+
// const QUICKWATCH_BASE_URL = "https://skips.quickwatch.co";
13
13
const FED_SKIPS_BASE_URL = "https://fed-skips.pstream.mov";
14
14
// const VELORA_BASE_URL = "https://veloratv.ru/api/intro-end/confirmed";
15
15
const INTRODB_BASE_URL = "https://api.introdb.app/intro";
···
20
20
| "fed-skips"
21
21
| "introdb"
22
22
| "theintrodb"
23
23
-
| "quickwatch"
23
23
+
// | "quickwatch"
24
24
| null = null;
25
25
26
26
export function useSkipTimeSource(): typeof currentSkipTimeSource {
···
119
119
// }
120
120
// };
121
121
122
122
-
const fetchQuickWatchTime = async (): Promise<number | null> => {
123
123
-
if (!meta?.title || meta.type === "movie") return null;
124
124
-
if (!meta.season?.number || !meta.episode?.number) return null;
122
122
+
// const fetchQuickWatchTime = async (): Promise<number | null> => {
123
123
+
// if (!meta?.title || meta.type === "movie") return null;
124
124
+
// if (!meta.season?.number || !meta.episode?.number) return null;
125
125
126
126
-
try {
127
127
-
const encodedName = encodeURIComponent(meta.title);
128
128
-
const apiUrl = `${QUICKWATCH_BASE_URL}/api/skip-times?name=${encodedName}&season=${meta.season.number}&episode=${meta.episode.number}`;
126
126
+
// try {
127
127
+
// const encodedName = encodeURIComponent(meta.title);
128
128
+
// const apiUrl = `${QUICKWATCH_BASE_URL}/api/skip-times?name=${encodedName}&season=${meta.season.number}&episode=${meta.episode.number}`;
129
129
130
130
-
const data = await proxiedFetch(apiUrl);
130
130
+
// const data = await proxiedFetch(apiUrl);
131
131
132
132
-
if (!Array.isArray(data) || data.length === 0) return null;
132
132
+
// if (!Array.isArray(data) || data.length === 0) return null;
133
133
134
134
-
// Find the first result with intro or credits data
135
135
-
for (const item of data) {
136
136
-
if (item.data) {
137
137
-
// Check for intro end time
138
138
-
if (
139
139
-
item.data.intro?.end &&
140
140
-
typeof item.data.intro.end === "number"
141
141
-
) {
142
142
-
// Convert milliseconds to seconds
143
143
-
return Math.floor(item.data.intro.end / 1000);
144
144
-
}
145
145
-
// Check for credits start time (use as intro end)
146
146
-
if (
147
147
-
item.data.credits?.start &&
148
148
-
typeof item.data.credits.start === "number"
149
149
-
) {
150
150
-
// Convert milliseconds to seconds
151
151
-
return Math.floor(item.data.credits.start / 1000);
152
152
-
}
153
153
-
}
154
154
-
}
134
134
+
// // Find the first result with intro or credits data
135
135
+
// for (const item of data) {
136
136
+
// if (item.data) {
137
137
+
// // Check for intro end time
138
138
+
// if (
139
139
+
// item.data.intro?.end &&
140
140
+
// typeof item.data.intro.end === "number"
141
141
+
// ) {
142
142
+
// // Convert milliseconds to seconds
143
143
+
// return Math.floor(item.data.intro.end / 1000);
144
144
+
// }
145
145
+
// // Check for credits start time (use as intro end)
146
146
+
// if (
147
147
+
// item.data.credits?.start &&
148
148
+
// typeof item.data.credits.start === "number"
149
149
+
// ) {
150
150
+
// // Convert milliseconds to seconds
151
151
+
// return Math.floor(item.data.credits.start / 1000);
152
152
+
// }
153
153
+
// }
154
154
+
// }
155
155
156
156
-
return null;
157
157
-
} catch (error) {
158
158
-
console.error("Error fetching QuickWatch time:", error);
159
159
-
return null;
160
160
-
}
161
161
-
};
156
156
+
// return null;
157
157
+
// } catch (error) {
158
158
+
// console.error("Error fetching QuickWatch time:", error);
159
159
+
// return null;
160
160
+
// }
161
161
+
// };
162
162
163
163
const fetchFedSkipsTime = async (retries = 0): Promise<number | null> => {
164
164
if (!meta?.imdbId || meta.type === "movie") return null;
···
237
237
return;
238
238
}
239
239
240
240
-
// Try QuickWatch API (TV shows only) - convert to intro segment
241
241
-
const quickWatchTime = await fetchQuickWatchTime();
242
242
-
if (quickWatchTime !== null) {
243
243
-
currentSkipTimeSource = "quickwatch";
244
244
-
setSegments([
245
245
-
{
246
246
-
type: "intro",
247
247
-
start_ms: 0, // Assume starts at beginning
248
248
-
end_ms: quickWatchTime * 1000, // Convert seconds to milliseconds
249
249
-
confidence: null,
250
250
-
submission_count: 1,
251
251
-
},
252
252
-
]);
253
253
-
return;
254
254
-
}
240
240
+
// QuickWatch API disabled
241
241
+
// const quickWatchTime = await fetchQuickWatchTime();
242
242
+
// if (quickWatchTime !== null) {
243
243
+
// currentSkipTimeSource = "quickwatch";
244
244
+
// setSegments([
245
245
+
// {
246
246
+
// type: "intro",
247
247
+
// start_ms: 0, // Assume starts at beginning
248
248
+
// end_ms: quickWatchTime * 1000, // Convert seconds to milliseconds
249
249
+
// confidence: null,
250
250
+
// submission_count: 1,
251
251
+
// },
252
252
+
// ]);
253
253
+
// return;
254
254
+
// }
255
255
256
256
// Fall back to Fed-skips if TheIntroDB and QuickWatch don't have anything
257
257
// Note: Fed-skips only supports TV shows, not movies
+3
-3
src/components/player/internals/Backend/SkipTracker.tsx
···
19
19
startTime: number;
20
20
endTime: number;
21
21
hasBackwardMovement: boolean;
22
22
-
skipTimeSource: "fed-skips" | "introdb" | "theintrodb" | "quickwatch" | null;
22
22
+
skipTimeSource: "fed-skips" | "introdb" | "theintrodb" | null; // | "quickwatch"
23
23
timer: ReturnType<typeof setTimeout>;
24
24
}
25
25
···
77
77
// Only send analytics if skip time came from fed-skips or introdb (not theintrodb)
78
78
if (
79
79
pendingSkip.skipTimeSource === "fed-skips" ||
80
80
-
pendingSkip.skipTimeSource === "introdb" ||
81
81
-
pendingSkip.skipTimeSource === "quickwatch"
80
80
+
pendingSkip.skipTimeSource === "introdb"
81
81
+
// pendingSkip.skipTimeSource === "quickwatch"
82
82
) {
83
83
// Send analytics
84
84
sendSkipAnalytics(pendingSkip.skip, adjustedConfidence);