feat(filters): add size filter
This commit is contained in:
parent
b5a775e7d5
commit
0727da3236
@ -7,6 +7,7 @@ import TextField from 'material-ui/TextField'
|
||||
import Slider from 'material-ui/Slider'
|
||||
import SelectField from 'material-ui/SelectField';
|
||||
import MenuItem from 'material-ui/MenuItem';
|
||||
import InputSize from './input-size';
|
||||
|
||||
import fs from 'fs'
|
||||
|
||||
@ -128,6 +129,7 @@ export default class ConfigPage extends Page {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='column w100p'>
|
||||
<Toggle
|
||||
style={{marginTop: '10px'}}
|
||||
label={__('Adult filter')}
|
||||
@ -140,7 +142,27 @@ export default class ConfigPage extends Page {
|
||||
this.forceUpdate()
|
||||
}}
|
||||
/>
|
||||
<div className='fs0-75' style={{color: 'grey'}}>
|
||||
* - {__('* - enabled means ignoring all adult content')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{
|
||||
this.options.filters // bug with props
|
||||
&&
|
||||
<div className='w100p'>
|
||||
<InputSize
|
||||
value={this.options.filters && this.options.filters.size}
|
||||
enabled={this.options.filters && this.options.filters.sizeEnabled}
|
||||
maxSize={this.options.filters && this.options.filters.maxSize}
|
||||
onChange={({size, maxSize, enabled}) => {
|
||||
this.options.filters.size = size
|
||||
this.options.filters.maxSize = maxSize
|
||||
this.options.filters.sizeEnabled = enabled
|
||||
this.forceUpdate()
|
||||
}} />
|
||||
</div>
|
||||
}
|
||||
|
||||
{
|
||||
this.toRemoveProbably && this.toRemoveProbably > 0
|
||||
|
@ -47,6 +47,12 @@ let config = {
|
||||
namingRegExp: '',
|
||||
namingRegExpNegative: false,
|
||||
adultFilter: false,
|
||||
|
||||
size: {max: 0, min: 0},
|
||||
maxSize: 1024 * 1024 * 1024 * 1024,
|
||||
sizeEnabled: false,
|
||||
|
||||
contentType: null
|
||||
},
|
||||
|
||||
cleanup: true,
|
||||
|
@ -427,6 +427,12 @@ app.get('*', function(req, res)
|
||||
return false
|
||||
}
|
||||
|
||||
if(config.filters.sizeEnabled && (torrent.size < config.filters.size.min || torrent.size > config.filters.size.max))
|
||||
{
|
||||
console.log('ignore torrent', torrent.name, 'because size bounds of', torrent.size, ':', config.filters.size)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -177,6 +177,7 @@
|
||||
"Serching metadata in progress... Click will delete this torrent.": "Serching metadata in progress... Click will delete this torrent.",
|
||||
"Pause torrent downloading": "Pause torrent downloading",
|
||||
"P2P torrents replication server": "P2P torrents replication server",
|
||||
"Enable torrents replication server for other rats clients (required for replication)": "Enable torrents replication server for other rats clients (required for replication)"
|
||||
"Enable torrents replication server for other rats clients (required for replication)": "Enable torrents replication server for other rats clients (required for replication)",
|
||||
"* - enabled means ignoring all adult content": "* - enabled means ignoring all adult content"
|
||||
}
|
||||
}
|
@ -177,6 +177,7 @@
|
||||
"Serching metadata in progress... Click will delete this torrent.": "Поиск метаданных в процессе... Нажатие удалит этот торрент.",
|
||||
"Pause torrent downloading": "Пауза скачки торрента",
|
||||
"P2P torrents replication server": "Сервер репликация торрентов через p2p",
|
||||
"Enable torrents replication server for other rats clients (required for replication)": "Включить сервер репликации для остальных крысиных клиентов (необходим для репликации)"
|
||||
"Enable torrents replication server for other rats clients (required for replication)": "Включить сервер репликации для остальных крысиных клиентов (необходим для репликации)",
|
||||
"* - enabled means ignoring all adult content": "* - означает игнорирование всего контента для взрослых"
|
||||
}
|
||||
}
|
@ -177,6 +177,7 @@
|
||||
"Serching metadata in progress... Click will delete this torrent.": "Serching metadata in progress... Click will delete this torrent.",
|
||||
"Pause torrent downloading": "Pause torrent downloading",
|
||||
"P2P torrents replication server": "P2P torrents replication server",
|
||||
"Enable torrents replication server for other rats clients (required for replication)": "Enable torrents replication server for other rats clients (required for replication)"
|
||||
"Enable torrents replication server for other rats clients (required for replication)": "Enable torrents replication server for other rats clients (required for replication)",
|
||||
"* - enabled means ignoring all adult content": "* - enabled means ignoring all adult content"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user