feat: add private torrent detection for stremthru torz (#499)

Co-authored-by: Viren070 <viren070@protonmail.com>
This commit is contained in:
MidnightKittenCat
2025-11-21 02:04:37 +10:00
committed by Viren070
parent 49610148ca
commit 32d21193b1
4 changed files with 21 additions and 2 deletions
+4 -2
View File
@@ -695,7 +695,8 @@ export const ParsedStreamSchema = z.object({
infoHash: z.string().min(1).optional(), infoHash: z.string().min(1).optional(),
fileIdx: z.number().optional(), fileIdx: z.number().optional(),
seeders: z.number().optional(), seeders: z.number().optional(),
sources: z.array(z.string().min(1)).optional(), // array of tracker urls and DHT nodes sources: z.array(z.string().min(1)).optional(),
private: z.boolean().optional(),
}) })
.optional(), .optional(),
countryWhitelist: z.array(z.string().length(3)).optional(), countryWhitelist: z.array(z.string().length(3)).optional(),
@@ -899,7 +900,8 @@ export const AIOStream = StreamSchema.extend({
infoHash: z.string().min(1).optional(), infoHash: z.string().min(1).optional(),
fileIdx: z.number().optional(), fileIdx: z.number().optional(),
seeders: z.number().optional(), seeders: z.number().optional(),
sources: z.array(z.string().min(1)).optional(), // array of tracker urls and DHT nodes sources: z.array(z.string().min(1)).optional(),
private: z.boolean().optional(),
}) })
.optional(), .optional(),
duration: z.number().optional(), duration: z.number().optional(),
+2
View File
@@ -96,6 +96,7 @@ export interface ParseValue {
seasonEpisode: string[] | null; seasonEpisode: string[] | null;
seasonPack: boolean; seasonPack: boolean;
seeders: number | null; seeders: number | null;
private: boolean;
age: string | null; age: string | null;
ageHours: number | null; ageHours: number | null;
duration: number | null; duration: number | null;
@@ -296,6 +297,7 @@ export abstract class BaseFormatter {
audioChannels: stream.parsedFile?.audioChannels || null, audioChannels: stream.parsedFile?.audioChannels || null,
indexer: stream.indexer || null, indexer: stream.indexer || null,
seeders: stream.torrent?.seeders ?? null, seeders: stream.torrent?.seeders ?? null,
private: stream.torrent?.private ?? false,
year: stream.parsedFile?.year || null, year: stream.parsedFile?.year || null,
type: stream.type || null, type: stream.type || null,
title: stream.parsedFile?.title || null, title: stream.parsedFile?.title || null,
+8
View File
@@ -137,6 +137,7 @@ class StreamParser {
sources: stream.sources ?? undefined, sources: stream.sources ?? undefined,
fileIdx: fileIdx:
stream.fileIdx ?? this.getFileIdx(stream, parsedStream) ?? undefined, stream.fileIdx ?? this.getFileIdx(stream, parsedStream) ?? undefined,
private: this.isPrivate(stream, parsedStream),
}; };
return parsedStream; return parsedStream;
@@ -327,6 +328,13 @@ class StreamParser {
return false; return false;
} }
protected isPrivate(
stream: Stream,
currentParsedStream: ParsedStream
): boolean | undefined {
return false;
}
protected getIndexer( protected getIndexer(
stream: Stream, stream: Stream,
currentParsedStream: ParsedStream currentParsedStream: ParsedStream
+7
View File
@@ -13,6 +13,13 @@ export const stremthruSpecialCases: Partial<
}; };
export class StremThruStreamParser extends StreamParser { export class StremThruStreamParser extends StreamParser {
protected override isPrivate(
stream: Stream,
_currentParsedStream: ParsedStream
): boolean | undefined {
return stream.name?.includes('🔑') ? true : false;
}
protected override getIndexer( protected override getIndexer(
stream: Stream, stream: Stream,
currentParsedStream: ParsedStream currentParsedStream: ParsedStream