feat(formatters): add prism predefined format

This commit is contained in:
Viren070
2025-09-25 22:12:49 +01:00
parent 735623ec8d
commit 5dadd98f00
3 changed files with 31 additions and 0 deletions
+3
View File
@@ -10,6 +10,7 @@ import {
GDriveFormatter,
LightGDriveFormatter,
MinimalisticGdriveFormatter,
PrismFormatter,
} from './predefined.js';
import { CustomFormatter } from './custom.js';
import { UserData } from '../db/schemas.js';
@@ -26,6 +27,8 @@ export function createFormatter(userData: UserData): BaseFormatter {
return new LightGDriveFormatter(userData);
case 'minimalisticgdrive':
return new MinimalisticGdriveFormatter(userData);
case 'prism':
return new PrismFormatter(userData);
case 'custom':
if (!userData.formatter.definition) {
throw new Error('Definition is required for custom formatter');
@@ -85,6 +85,27 @@ export class LightGDriveFormatter extends BaseFormatter {
}
}
export class PrismFormatter extends BaseFormatter {
constructor(userData: UserData) {
super(
{
name: `
{stream.resolution::exists["{stream.resolution::replace('2160p', '🔥4K UHD')::replace('1440p','✨ QHD')::replace('1080p','🚀 FHD')::replace('720p','💿 HD')::replace('576p','💩 Low Quality')::replace('480p','💩 Low Quality')::replace('360p','💩 Low Quality')::replace('240p','💩 Low Quality')::replace('144p','💩 Low Quality')}"||""]}
`,
description: `
{stream.title::exists["🎬 {stream.title::title} "||""]}{stream.year::exists["({stream.year}) "||""]}{stream.season::>=0["🍂 S"||""]}{stream.season::<=9["0"||""]}{stream.season::>0["{stream.season} "||""]}{stream.episode::>=0["🎞️ E"||""]}{stream.episode::<=9["0"||""]}{stream.episode::>0["{stream.episode} "||""]}{stream.regexMatched::exists["🎚️ {stream.regexMatched} "||""]}
{stream.quality::exists["🎥 {stream.quality} "||""]}{stream.visualTags::exists["📺 {stream.visualTags::join(' | ')} "||""]}{stream.encode::exists["🎞️ {stream.encode} "||""]}{stream.duration::>0["⏱️ {stream.duration::time} "||""]}
{stream.audioTags::exists["🎧 {stream.audioTags::join(' | ')} "||""]}{stream.audioChannels::exists["🔊 {stream.audioChannels::join(' | ')} "||""]}{stream.languages::exists["🗣️ {stream.languageEmojis::join(' / ')}"||""]}
{stream.size::>0["📦 {stream.size::bytes} "||""]}{stream.folderSize::>0["/ 📦 {stream.folderSize::bytes} "||""]}{service.cached::isfalse::or::stream.type::=p2p::and::stream.seeders::>0["🌱 {stream.seeders} "||""]}{stream.type::=usenet::and::stream.age::exists["📅 {stream.age} "||""]}{stream.releaseGroup::exists["🏷️ {stream.releaseGroup} "||""]}{stream.indexer::exists["📡 {stream.indexer} "||""]}
{service.cached::istrue["⚡Ready "||""]}{service.cached::isfalse["❌ Not Ready "||""]}{service.id::exists["({service.shortName}) "||""]}{stream.library::istrue["📌 Library "||""]}{stream.type::=Usenet["📰 Usenet "||""]}{stream.type::=p2p["⚠️ P2P "||""]}{stream.type::=http["💻 Web Link "||""]}{stream.type::=youtube["▶️ Youtube "||""]}{stream.type::=live["📺 Live "||""]}{stream.proxied::istrue["🔒 Proxied "||"🔓 Not Proxied "]}🔍{addon.name}
{stream.message::exists["️ {stream.message}"||""]}
`,
},
userData
);
}
}
export class MinimalisticGdriveFormatter extends BaseFormatter {
constructor(userData: UserData) {
super(
+7
View File
@@ -125,6 +125,7 @@ export const LIGHT_GDRIVE_FORMATTER = 'lightgdrive';
export const MINIMALISTIC_GDRIVE_FORMATTER = 'minimalisticgdrive';
export const TORRENTIO_FORMATTER = 'torrentio';
export const TORBOX_FORMATTER = 'torbox';
export const PRISM_FORMATTER = 'prism';
export const CUSTOM_FORMATTER = 'custom';
export const FORMATTERS = [
@@ -133,6 +134,7 @@ export const FORMATTERS = [
MINIMALISTIC_GDRIVE_FORMATTER,
TORRENTIO_FORMATTER,
TORBOX_FORMATTER,
PRISM_FORMATTER,
CUSTOM_FORMATTER,
] as const;
@@ -154,6 +156,11 @@ export const FORMATTER_DETAILS: Record<FormatterType, FormatterDetail> = {
description:
'A lighter version of the GDrive formatter, focused on asthetics',
},
[PRISM_FORMATTER]: {
id: PRISM_FORMATTER,
name: 'Prism',
description: 'An aesthetic formatter with every detail within 5 lines.',
},
[MINIMALISTIC_GDRIVE_FORMATTER]: {
id: MINIMALISTIC_GDRIVE_FORMATTER,
name: 'Minimalistic Google Drive',