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