Skip to content

Commit

Permalink
used is-video in place of video-extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
beatfreaker committed Sep 24, 2015
1 parent 8544228 commit 7e4ac6d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
"crypto": "0.0.3",
"fs": "0.0.2",
"http": "0.0.0",
"is-video": "^1.0.1",
"meow": "^3.3.0",
"path": "^0.11.14",
"progress": "^1.1.8",
"q": "^1.4.1",
"video-extensions": "^1.0.0"
"q": "^1.4.1"
},
"devDependencies": {
"tape": "^4.2.0"
Expand Down
17 changes: 3 additions & 14 deletions subdownloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ var path = require('path');
var http = require('http');
var Q = require('q');
var ProgressBar = require('progress');
var videoExtensions = require('video-extensions');
var isVideo = require('is-video');
var chalk = require('chalk');
var meow = require('meow');
var p = process.cwd();
var extns = Object.create(null);
var filesArray = [];

var cli = meow({
Expand All @@ -27,20 +26,10 @@ var cli = meow({
]
});

videoExtensions.forEach(function (el) {
el = extns[el] = true;
});

var filterFiles = function (files) {
try {
return files.filter(function (file) {
var returnMessage = false;
if (fs.statSync(file).isFile() && path.extname(file).slice(1).toLowerCase() in extns) {
returnMessage = true;
} else {
returnMessage = false;
}
return returnMessage;
return fs.statSync(file).isFile() && isVideo(file);
});
} catch (err) {
console.log('Please check if all the file name given exists or not.');
Expand Down Expand Up @@ -161,7 +150,7 @@ var getDeepFiles = function (currentDir) {
fs.readdirSync(currentDir).forEach(function (name) {
var filePath = path.join(currentDir, name);
var stat = fs.statSync(filePath);
if (stat.isFile() && path.extname(filePath).slice(1).toLowerCase() in extns) {
if (stat.isFile() && isVideo(filePath)) {
filesArray.push(filePath);
} else if (stat.isDirectory()) {
getDeepFiles(filePath);
Expand Down

0 comments on commit 7e4ac6d

Please sign in to comment.