From abcea96728cb5fdc6593bd6da2fe64c52dfc3b3e Mon Sep 17 00:00:00 2001 From: yourok <8yourok8@mail.ru> Date: Tue, 18 Sep 2018 19:51:24 +0300 Subject: [PATCH] add filter for m2ts --- .../ru/yourok/torrserve/server/torrent/Torrent.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/ru/yourok/torrserve/server/torrent/Torrent.kt b/app/src/main/java/ru/yourok/torrserve/server/torrent/Torrent.kt index c6fe7a62..05a0cadc 100644 --- a/app/src/main/java/ru/yourok/torrserve/server/torrent/Torrent.kt +++ b/app/src/main/java/ru/yourok/torrserve/server/torrent/Torrent.kt @@ -3,6 +3,7 @@ package ru.yourok.torrserve.server.torrent import ru.yourok.torrserve.server.api.Api import ru.yourok.torrserve.server.api.JSObject import ru.yourok.torrserve.utils.Mime +import java.io.File import kotlin.concurrent.thread object Torrent { @@ -27,8 +28,17 @@ object Torrent { val files = getFiles(torr) val retList = mutableListOf() files.forEach { - if (Mime.getMimeType(it.getString("Name", "")) != "*/*") + val name = it.get("Name", "") + if (Mime.getMimeType(name) != "*/*") { + val size = it.getLong("Size", 0L) + if (File(name).extension.toLowerCase() == "m2ts") { + if (size > 1073741824L) + retList.add(it) + } else + retList.add(it) + } else if (name.toLowerCase().contains("bdmv/index.bdmv")) { retList.add(it) + } } return retList }