Security News
Combatting Alert Fatigue by Prioritizing Malicious Intent
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
A scanner for media files that follows a user-provided naming convention
A scanner for media files that follows a user-provided naming convention
A lot of things :
Don't hesitate to suggest new features : it is always worthy :)
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) :
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;
}
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
});
For npm users :
$ npm install --save mediascan
for Yarn :
$ yarn add mediascan
npm test
If You want, You can have the types definitions used in this lib :
npm install @types/mediascan
npm run lint
to check your code.FAQs
A scanner for media files that follows a user-provided naming convention
We found that mediascan demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.