import { TorrentMetadataInClient } from "./clients/TorrentClient.js";
import { MediaType } from "./constants.js";
import { Metafile } from "./parseTorrent.js";
import { Candidate } from "./pipeline.js";
import { Result } from "./Result.js";
import { File, SearcheeLabel, SearcheeWithInfoHash, SearcheeWithoutInfoHash } from "./searchee.js";
export interface TorrentLocator {
    infoHash?: string;
    path?: string;
}
export interface FilenameMetadata {
    mediaType: string;
    tracker: string;
    name: string;
    infoHash?: string;
    cached: boolean;
}
export declare enum SnatchError {
    ABORTED = "ABORTED",
    RATE_LIMITED = "RATE_LIMITED",
    MAGNET_LINK = "MAGNET_LINK",
    INVALID_CONTENTS = "INVALID_CONTENTS",
    UNKNOWN_ERROR = "UNKNOWN_ERROR"
}
export interface EnsembleEntry {
    client_host: string | null;
    path: string;
    info_hash: string | null;
    ensemble: string;
    element: string | number;
}
export declare function parseTorrentFromPath(filePath: string): Promise<Metafile>;
export declare function parseTorrentWithMetadata(filePath: string, torrentInfos: TorrentMetadataInClient[]): Promise<Metafile>;
export declare const snatchHistory: Map<string, {
    initialFailureAt: number;
    numFailures: number;
}>;
export declare function snatch(candidate: Candidate, label: SearcheeLabel, options: {
    retries: number;
    delayMs: number;
}): Promise<Result<Metafile, SnatchError>>;
/**
 * Be sure to update parseMetadataFromFilename if changing the format
 */
export declare function getTorrentSavePath(meta: Metafile, mediaType: MediaType, tracker: string, dir: string, options: {
    cached: boolean;
}): string;
/**
 * Depends on getTorrentSavePath format
 */
export declare function parseMetadataFromFilename(filename: string): Partial<FilenameMetadata>;
export declare function findAllTorrentFilesInDir(dir: string): Promise<string[]>;
export declare function createEnsemblePieces(title: string, files: File[]): {
    key: string;
    element: string | number;
    largestFile: File;
}[] | null;
export declare function cacheEnsembleTorrentEntry(searchee: SearcheeWithInfoHash, torrentSavePaths?: Map<string, string>): Promise<EnsembleEntry[] | null>;
export declare function indexTorrentsAndDataDirs(options?: {
    startup: boolean;
}): Promise<void>;
export declare function getInfoHashesToExclude(): Promise<Set<string>>;
export declare function loadTorrentDirLight(torrentDir: string): Promise<SearcheeWithInfoHash[]>;
export declare function getSimilarByName(name: string): Promise<{
    keys: string[];
    clientSearchees: SearcheeWithInfoHash[];
    dataSearchees: SearcheeWithoutInfoHash[];
}>;
export declare function getTorrentByCriteria(criteria: TorrentLocator): Promise<SearcheeWithInfoHash[]>;
