Spaces:
Build error
Build error
File size: 1,162 Bytes
0bfe2e3 |
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 |
export * from './base';
export * from './predefined';
export * from './custom';
export * from './utils';
import { BaseFormatter, FormatterConfig } from './base';
import {
TorrentioFormatter,
TorboxFormatter,
GDriveFormatter,
LightGDriveFormatter,
MinimalisticGdriveFormatter,
} from './predefined';
import { CustomFormatter } from './custom';
import { FormatterType } from '../utils/constants';
export function createFormatter(
type: FormatterType,
config?: FormatterConfig,
addonName?: string
): BaseFormatter {
switch (type) {
case 'torrentio':
return new TorrentioFormatter(addonName);
case 'torbox':
return new TorboxFormatter(addonName);
case 'gdrive':
return new GDriveFormatter(addonName);
case 'lightgdrive':
return new LightGDriveFormatter(addonName);
case 'minimalisticgdrive':
return new MinimalisticGdriveFormatter(addonName);
case 'custom':
if (!config) {
throw new Error('Config is required for custom formatter');
}
return CustomFormatter.fromConfig(config, addonName);
default:
throw new Error(`Unknown formatter type: ${type}`);
}
}
|