npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mediascan

v2.0.1

Published

A scanner for media files that follows a user-provided naming convention

Downloads

25

Readme

mediascan Build Status codecov Dependency Status License: MIT semantic-release Greenkeeper badge Join the chat at https://gitter.im/mediaScan/Lobby

A scanner for media files that follows a user-provided naming convention

What to do with this library ?

A lot of things :

Don't hesitate to suggest new features : it is always worthy :)

FAQ

Which naming convention can I use with this lib ?

ANYTHING. All You have to do is to implement a parser function : A function that takes a single string argument fullPathFile (the full path to the file) that returns an object that minimal contains a title string property. For example :

const ptt = require("parse-torrent-title");
const information = ptt.parse("Game.of.Thrones.S01E01.720p.HDTV.x264-CTU");

console.log(information.title);      // Game of Thrones
console.log(information.season);     // 1
console.log(information.episode);    // 1
console.log(information.resolution); // 720p
console.log(information.codec);      // x264
console.log(information.source);     // HDTV
console.log(information.group);      // CTU

This lib was tested with these parsers that follows torrent naming conventions (see their readme for more info) :

How the library detects the category of a media file ?

The default implementation determines it is a tv-show if there is season and episode attributes can be found in the information provided by the parser. Here is a example if you want to implement one :

// Default implementation to know which category is this file
function defaultWhichCategoryFunction(object : MediaScanLib.TPN) : MediaScanLib.Category{
    // workaround : const string enum aren't compiled correctly with Babel
    return (checkProperties(object, ['season', 'episode']))
        ? 'TV_SERIES' as MediaScanLib.Category.TV_SERIES_TYPE : 'MOVIES' as MediaScanLib.Category.MOVIES_TYPE;
}

Using custom parameters in the lib

Check the constructor for more detail - an illustration :

const MediaScan = require("mediascan");
let libInstance = new MediaScan({
    defaultPath = process.cwd(), // Default path to explore , if paths is empty
    paths = [], // all the paths that will be explored
    allFilesWithCategory = new Map(), // the mapping between file and Category
    movies = new Set(), // Set<ParserResult> (all the movies)
    series = new Map(), // <tvShowName , Set<ParserResult>> (all the tv-series episodes)
}, {
    parser = nameParser, // the explained parser
    whichCategory = defaultWhichCategoryFunction, // the previously explained detection function
});

Installation

For npm users :

$ npm install --save mediascan

for Yarn :

$ yarn add mediascan

Test

npm test

Types definitions

If You want, You can have the types definitions used in this lib :

npm install @types/mediascan

Contributing

  • If you're unsure if a feature would make a good addition, you can always create an issue first.
  • We aim for 100% test coverage. Please write tests for any new functionality or changes.
  • Any API changes should be fully documented.
  • Make sure your code meets our linting standards. Run npm run lint to check your code.
  • Be mindful of others when making suggestions and/or code reviewing.