feat(filter): naming filtering #17

This commit is contained in:
Alexey Kasyanchuk
2018-04-01 23:35:55 +03:00
parent 5348d1f88f
commit 99d9004906
3 changed files with 47 additions and 14 deletions

View File

@ -38,6 +38,7 @@ let config = {
filters: {
maxFiles: 0,
namingRegExp: ''
},
cleanup: true,

View File

@ -454,6 +454,17 @@ const checkTorrent = (torrent) => {
return false
}
const nameRX = config.filters.namingRegExp && config.filters.namingRegExp.trim()
if(nameRX && nameRX.length > 0)
{
const rx = new RegExp(nameRX)
if(!rx.test(torrent.name))
{
console.log('ignore', torrent.name, 'by naming rx')
return false
}
}
return true
}