Skip to content

Filter movies by parameters

jy95 edited this page Feb 15, 2018 · 1 revision
const MediaScan = require("mediascan");

let paths = [
    "D:/",
];

// create an instance
let libInstance = new MediaScan();

// add these paths inside this lib
libInstance
    .addNewPath(...paths)
    .then( () => {
        return libInstance.scan();
    })
    .then( () => {
        console.log('Now time to search all remastered movies with year >= 2012 in one of following container avi/mp4');
        let filteredSet = libInstance.filterMovies({
          year: '>=2012',
          remastered: true,
          container: ['avi', 'mp4'],
        });
        for (let movie of filteredSet) {
          console.log(`${movie.title + ((movie.year) ? ` - ${movie.year}` : '')} at ${movie.filePath}`);
        }
    })
    .catch( (err) => {
            console.log(err.message);
    });

filterMovies

Clone this wiki locally