mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-04 21:30:11 +00:00
e1629ce516
- jwt.ts: Use JWT_DOWNLOAD_SECRET instead of JWT_SECRET for download tokens - audio-formats.ts: Add EBOOK_EXTENSIONS export alongside AUDIO_EXTENSIONS - request-statuses.ts: New shared COMPLETED_STATUSES constant used across requests API, download route, and RequestCard - requests/route.ts: Import COMPLETED_STATUSES; strip filePath from audiobook in API response - download/route.ts: Import format/status constants; add archiver dependency and replace adm-zip with streaming archiver for multi-file zips - RequestCard.tsx: Use shared COMPLETED_STATUSES constant
83 lines
2.1 KiB
TypeScript
83 lines
2.1 KiB
TypeScript
/**
|
|
* Component: Audio Format Constants
|
|
* Documentation: documentation/phase3/file-organization.md
|
|
*
|
|
* Centralized audio format definitions used across the application.
|
|
* Add new formats here to enable support in all subsystems.
|
|
*/
|
|
|
|
/**
|
|
* All supported audio file extensions for audiobook detection and file organization.
|
|
* Used by: file-organizer.ts, files-hash.ts
|
|
*/
|
|
export const AUDIO_EXTENSIONS = [
|
|
'.m4b',
|
|
'.m4a',
|
|
'.mp3',
|
|
'.mp4',
|
|
'.aa',
|
|
'.aax',
|
|
'.flac',
|
|
'.ogg',
|
|
] as const;
|
|
|
|
/**
|
|
* Audio formats supported by the chapter merger (FFmpeg concat + M4B output).
|
|
* Formats here can be detected, probed, ordered, and merged into a single M4B.
|
|
* Note: .aa/.aax excluded (DRM-protected, cannot be decoded by FFmpeg without keys).
|
|
* Note: .ogg excluded (FFmpeg concat demuxer does not support Ogg container).
|
|
*/
|
|
export const CHAPTER_MERGE_FORMATS = [
|
|
'.mp3',
|
|
'.m4a',
|
|
'.m4b',
|
|
'.mp4',
|
|
'.aac',
|
|
'.flac',
|
|
] as const;
|
|
|
|
/**
|
|
* Audio formats supported by metadata tagging via FFmpeg.
|
|
* Each format maps to a specific FFmpeg output format flag and tagging strategy.
|
|
*/
|
|
export const METADATA_TAG_FORMATS = [
|
|
'.m4b',
|
|
'.m4a',
|
|
'.mp3',
|
|
'.mp4',
|
|
'.flac',
|
|
] as const;
|
|
|
|
/**
|
|
* Formats that use MP4/M4A container tags (iTunes-style metadata).
|
|
* These use `-f mp4` output format in FFmpeg.
|
|
*/
|
|
export const MP4_CONTAINER_FORMATS = ['.m4b', '.m4a', '.mp4'] as const;
|
|
|
|
/**
|
|
* Audio format identifiers detectable in torrent/NZB titles.
|
|
* Used by Prowlarr service for metadata extraction and ranking algorithm for scoring.
|
|
*/
|
|
export const TORRENT_TITLE_FORMATS = ['M4B', 'M4A', 'MP3', 'FLAC'] as const;
|
|
|
|
export type TorrentTitleFormat = (typeof TORRENT_TITLE_FORMATS)[number];
|
|
|
|
/**
|
|
* Type helper for the format field on TorrentResult.
|
|
* 'OTHER' is used when no recognized format is detected in the title.
|
|
*/
|
|
export type AudioFormat = TorrentTitleFormat | 'OTHER';
|
|
|
|
/**
|
|
* All supported ebook file extensions for ebook detection and file serving.
|
|
*/
|
|
export const EBOOK_EXTENSIONS = [
|
|
'.epub',
|
|
'.pdf',
|
|
'.mobi',
|
|
'.azw3',
|
|
'.fb2',
|
|
'.cbz',
|
|
'.cbr',
|
|
] as const;
|