nfo-to-json
v1.0.0
Published
Crawl directories of .nfo files and convert them to JSON
Downloads
99
Maintainers
Readme
nfo-to-json
Recursive directory crawler that parses Kodi/Jellyfin .nfo files and converts them to JSON.
This package is a complete rewrite based on nfo-parser, utilizing nfo-create for robust type definitions and standardized media metadata interfaces.
Features
- Recursive Scanning: Crawls entire directory trees for
.nfofiles. - Type-Safe Parsing: Supports Movie, TV Show, and Episode NFO formats.
- Aggregate Output: Can produce unified
movies.jsonandtv-shows.jsonfiles. - Detailed Metadata: Extracts actors (with roles and thumbs), unique IDs (IMDb, TMDb, TVDb), artwork (posters, fanart), and more.
- Security-Minded: Includes file size caps and prototype pollution protection.
- Modern Tooling: Built with TypeScript, Vitest, and tsup for high performance and reliability.
Installation
npm install -g nfo-to-jsonCLI Usage
Basic Conversion
Converts each .nfo file into a corresponding .json file in the same directory.
nfo-to-json --input /path/to/mediaAggregate Mode
Collects all discovered records and writes them into two unified files: movies.json and tv-shows.json.
nfo-to-json --input /path/to/media --aggregate --output /path/to/outputOptions
-i, --input <path>: Directory to scan for.nfofiles (required).--aggregate: Writemovies.json+tv-shows.jsoninstead of individual files.--output <path>: Output directory for aggregate files (defaults to input path).--dry-run: Preview actions without touching the filesystem.-v, --verbose: Show detailed per-file processing logs.
Programmatic API
import { parseNfo, crawlDir, buildMoviesJson, buildTvShowsJson } from 'nfo-to-json';
// Parse a single file
const result = await parseNfo('movie.nfo');
console.log(result.type); // 'movie', 'episode', or 'tvshow'
console.log(result.data.title);
// Crawl a directory
for await (const filePath of crawlDir('./media')) {
console.log('Found:', filePath);
}Attribution
This project is a modern rewrite of metarr-media/nfo-parser. It has been refactored to use ESM, Vitest, and shared interfaces from nfo-create.
License
MIT
