feat(filter): naming filtering #17
This commit is contained in:
parent
5348d1f88f
commit
99d9004906
@ -77,20 +77,26 @@ export default class ConfigPage extends Page {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='column w100p'>
|
||||
<div className='row inline w100p'>
|
||||
<div style={{flex: 1}}>Torrent name regular extension filtering</div>
|
||||
<TextField
|
||||
hintText="regex"
|
||||
className='pad0-75'
|
||||
style={{width: 400}}
|
||||
value={this.options.filters && this.options.filters.namingRegExp}
|
||||
onChange={(e, value) => {
|
||||
if(!this.options.filters)
|
||||
return
|
||||
|
||||
<div className='row center pad0-75'>
|
||||
<RaisedButton label="Check torrents" primary={true} onClick={() => {
|
||||
window.torrentSocket.emit('removeTorrents', true, window.customLoader((toRemove) => {
|
||||
this.toRemoveProbably = toRemove
|
||||
this.options.filters.namingRegExp = value
|
||||
this.forceUpdate()
|
||||
}));
|
||||
}} />
|
||||
<RaisedButton label="Clean torrents" secondary={true} onClick={() => {
|
||||
window.torrentSocket.emit('removeTorrents', false, window.customLoader((toRemove) => {
|
||||
this.toRemove = toRemove
|
||||
this.forceUpdate()
|
||||
}));
|
||||
}} />
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className='fs0-75' style={{color: 'grey'}}>
|
||||
* - clean string means disabled
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{
|
||||
@ -114,6 +120,21 @@ export default class ConfigPage extends Page {
|
||||
<div style={{color: 'green'}}>Settings saved</div>
|
||||
}
|
||||
|
||||
<div className='row center pad0-75'>
|
||||
<RaisedButton label="Check torrents" primary={true} onClick={() => {
|
||||
window.torrentSocket.emit('removeTorrents', true, window.customLoader((toRemove) => {
|
||||
this.toRemoveProbably = toRemove
|
||||
this.forceUpdate()
|
||||
}));
|
||||
}} />
|
||||
<RaisedButton label="Clean torrents" secondary={true} onClick={() => {
|
||||
window.torrentSocket.emit('removeTorrents', false, window.customLoader((toRemove) => {
|
||||
this.toRemove = toRemove
|
||||
this.forceUpdate()
|
||||
}));
|
||||
}} />
|
||||
</div>
|
||||
|
||||
<div className='row center pad0-75'>
|
||||
<RaisedButton label="Save Settings" primary={true} onClick={() => {
|
||||
this.saveSettings()
|
||||
|
@ -38,6 +38,7 @@ let config = {
|
||||
|
||||
filters: {
|
||||
maxFiles: 0,
|
||||
namingRegExp: ''
|
||||
},
|
||||
|
||||
cleanup: true,
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user