отображения типа файла в списке файлов

This commit is contained in:
Alexey Kasyanchuk
2017-02-01 11:04:45 +03:00
parent 0d6cee2ad8
commit 7c6df55780
7 changed files with 137 additions and 134 deletions

View File

@ -274,7 +274,7 @@ const detectSubCategory = (torrent, files, typesPriority, contentType) => {
}
}
const fileDetect = (file) => {
const fileTypeDetect = (file) => {
let name = file.path.split('/').pop();
let extension = name.split('.').pop();
if(name.length == 0)
@ -291,7 +291,7 @@ const torrentTypeDetect = (torrent, files) => {
for(let i = 0; i < files.length; i++) {
let file = files[i];
let type = fileDetect(file)
let type = fileTypeDetect(file)
if(type) {
if(!typesPriority[type])
@ -309,4 +309,4 @@ const torrentTypeDetect = (torrent, files) => {
detectSubCategory(torrent, files, typesPriority, torrent[ContentTypeProp]);
}
module.exports = torrentTypeDetect;
module.exports = {torrentTypeDetect, fileTypeDetect};