libi
v0.1.0
Published
### Getting Started ```js const p = require('path') const Libi = require('libi')({ homedir: p.resolve(__dirname, /* some path*/), watchdir: p.resolve(__dirname, /* some path*/), // optional agent: 'meta-agent', mask: require('./mask'), //
Downloads
7
Readme
libi
Getting Started
const p = require('path')
const Libi = require('libi')({
homedir: p.resolve(__dirname, /* some path*/),
watchdir: p.resolve(__dirname, /* some path*/), // optional
agent: 'meta-agent',
mask: require('./mask'), // optional
keymap: require('./keymap') // optional
})
const library = Libi('SomeMediaType', /* optional folder name */) // creates a library object
Watch Path
Media Type
Example Mask
module.exports = {
movie: {
folder: 'name (year)',
file: {
mp4: 'name.ext',
vtt: 'name.lang.ext',
jpg: 'name.ext'
}
},
show: {
folder: 'name (year)',
file: {
mp4: 'name.ext'
}
},
season: {
folder: 'season - S00E000'
},
episode: {
file: {
mp4: 'name.ext',
vtt: 'S00E000 - name.lang.ext'
}
},
}
Example Keymap
This map renames all the fields in the matched metadata object that was returned by your agent accordingly.
module.exports = {
title: 'name',
first_air_date: 'year',
release_date: 'year',
season_number: 's',
episode_number: 'e',
}
API
const matches = {
movie: { ... },
file: { ... }
}
const commonObj = {ext: '.mp4', lang:'en'}
const valueMutator = (k, v) => {
/*
key and value for each object property are given as the object is being itterated.
You can modify the property values here ...
*/
if(k == 'year') v = new Date(v).getFullYear()
return v
}
const data = library.mapkeys(matches, commonObj, valueMutator)
const matches = {
show: { ... },
episode: { ... },
file: { ... }
}
const data = library.getMask(matches)
/* outputs =>
{
movie: { folder: 'name (year)', file: 'name.ext' },
show: { folder: 'That is so raven (2003)' },
season: { folder: 'season - 04' },
episode: { file: 'S48E003 - Raven is Back.mp4' }
}
*/