Skip to content

Commit

Permalink
add filter for m2ts
Browse files Browse the repository at this point in the history
  • Loading branch information
YouROK committed Sep 18, 2018
1 parent c9bb93c commit abcea96
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/src/main/java/ru/yourok/torrserve/server/torrent/Torrent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -27,8 +28,17 @@ object Torrent {
val files = getFiles(torr)
val retList = mutableListOf<JSObject>()
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
}
Expand Down

0 comments on commit abcea96

Please sign in to comment.