Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | 1x 1x | import { FFProbeResult } from "ffprobe";
import {
EpisodeInfo,
MediaInfo,
Progress,
SeasonInfo,
ShowInfo,
MovieInfo,
User as ClientUser,
DevicePreferences,
} from "@rewind-media/rewind-protocol";
export interface LibraryScanTask {
readonly libraryName: string;
}
export interface StreamSegmentMetadata {
readonly index: number;
readonly duration: number;
}
export interface Mime {
readonly mimeType: string;
readonly codecs: string[]; // RFC 6381
}
export interface StreamMetadataWrapper {
metadata?: StreamMetadata;
}
export interface StreamMetadata {
readonly streamProps: StreamProps;
readonly segments: StreamSegmentMetadata[];
readonly subtitles?: SubtitleMetadata;
readonly mime: Mime;
readonly complete: boolean;
readonly processedSecs: number;
readonly totalDurationSecs: number;
}
export interface SubtitleSegment {
readonly duration: number;
readonly content: string;
}
export interface SubtitleMetadata {
readonly segments: SubtitleSegment[];
readonly complete: boolean;
}
export interface ServerConfig {
readonly key: string;
readonly value: string;
}
export interface FfProbeInfoFormat {
readonly duration?: number;
readonly filename?: string;
}
export interface FfProbeInfo extends FFProbeResult {
readonly format: FfProbeInfoFormat;
}
export interface SearchProps {
readonly text: string;
}
export interface SearchIndexProps {
readonly user: ClientUser;
}
export interface StreamProps {
readonly id: string;
readonly mediaInfo: ServerMediaInfo;
readonly audioStreamName?: string;
readonly videoStreamName?: string;
readonly subtitleStreamName?: string;
readonly startOffset: number; // Seconds
readonly duration: number; // Seconds
}
export interface User extends ClientUser {
readonly hashedPass: Buffer;
readonly salt: string;
}
export const LibraryDataTypes = [
"episode",
"show",
"season",
"movie",
"image",
] as const;
export type LibraryDataType = (typeof LibraryDataTypes)[number];
export interface LibraryData {
readonly libraryId: string;
readonly lastUpdated: number; // epoch millis
readonly type: LibraryDataType;
}
export interface LocalPath {
readonly localPath: string;
}
export type FileLocation = LocalPath;
export interface UserProgress extends Progress {
readonly username: string;
}
export interface ServerUser extends User {
readonly hashedPass: Buffer;
readonly salt: string;
}
export function isFileLocation(obj: unknown): obj is FileLocation {
return isLocalPath(obj);
}
export function isLocalPath(obj: unknown): obj is LocalPath {
return (
!!obj &&
typeof obj == "object" &&
"localPath" in obj &&
typeof obj.localPath == "string"
);
}
export type ServerMovieInfo = MovieInfo & ServerMediaInfo & { type: "movie" };
export type ServerEpisodeInfo = EpisodeInfo &
ServerMediaInfo & { type: "episode" };
export type ServerSeasonInfo = SeasonInfo & LibraryData & { type: "season" };
export type ServerShowInfo = ShowInfo & LibraryData & { type: "show" };
export interface ServerFileInfo extends LibraryData {
readonly location: FileLocation;
}
export interface ServerImageInfo extends ServerFileInfo {
readonly id: string;
readonly name: string;
readonly type: "image";
}
export interface ServerMediaInfo extends ServerFileInfo, Readonly<MediaInfo> {
readonly runTime: number;
readonly ffProbeInfo: FfProbeInfo;
readonly subtitleFiles: Record<string, FileLocation>;
}
export interface ServerUserDevicePreferences extends DevicePreferences {
readonly username: string;
}
export function isServerShowInfo(obj: unknown): obj is ServerShowInfo {
return (
!!obj &&
typeof obj == "object" &&
"type" in obj &&
typeof obj.type == "string" &&
obj.type == "show"
);
}
export function isServerEpisodeInfo(obj: unknown): obj is ServerEpisodeInfo {
return (
!!obj &&
typeof obj == "object" &&
"type" in obj &&
typeof obj.type == "string" &&
obj.type == "episode"
);
}
export function isServerSeasonInfo(obj: unknown): obj is ServerSeasonInfo {
return (
!!obj &&
typeof obj == "object" &&
"type" in obj &&
typeof obj.type == "string" &&
obj.type == "season"
);
}
export function isServerMovieInfo(obj: unknown): obj is ServerMovieInfo {
return (
!!obj &&
typeof obj == "object" &&
"type" in obj &&
typeof obj.type == "string" &&
obj.type == "movie"
);
}
|