1 package net.pterodactylus.rhynodge.filters
3 import net.pterodactylus.rhynodge.Filter
4 import net.pterodactylus.rhynodge.State
5 import net.pterodactylus.rhynodge.states.FailedState
6 import net.pterodactylus.rhynodge.states.TorrentState
9 * Blacklist that filters torrents with a certain size.
11 class SizeBlacklistFilter(private val blacklistedSizes: Iterable<String> = listOf("313.97 MiB", "331.97 MiB", "716.05 MiB", "314.21 MiB")): Filter {
13 override fun filter(state: State): State {
14 val torrentState = state as? TorrentState ?: return FailedState()
15 return TorrentState(torrentState.torrentFiles().filterNot { it.size() in blacklistedSizes })