testing seq torrent

This commit is contained in:
LagradOst 2023-10-26 01:51:38 +02:00
parent d394f0e1d0
commit 8105231a6b
5 changed files with 20 additions and 11 deletions

View file

@ -260,6 +260,8 @@ dependencies {
// color palette for images -> colors // color palette for images -> colors
implementation("androidx.palette:palette-ktx:1.0.0") implementation("androidx.palette:palette-ktx:1.0.0")
implementation("com.github.recloudstream:Aria2cStream:0.0.1")
} }
tasks.register("androidSourcesJar", Jar::class) { tasks.register("androidSourcesJar", Jar::class) {

View file

@ -5,6 +5,7 @@ import android.app.Application
import android.content.Context import android.content.Context
import android.content.ContextWrapper import android.content.ContextWrapper
import android.content.Intent import android.content.Intent
import android.util.Log
import android.widget.Toast import android.widget.Toast
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
@ -41,7 +42,7 @@ import kotlin.system.exitProcess
class CustomReportSender : ReportSender { class CustomReportSender : ReportSender {
// Sends all your crashes to google forms // Sends all your crashes to google forms
override fun send(context: Context, errorContent: CrashReportData) { override fun send(context: Context, errorContent: CrashReportData) {
println("Sending report") Log.i("Acra", "Sending report: ${errorContent.toMap().map { "${it.key}:${it.value}" }.joinToString()}")
val url = val url =
"https://docs.google.com/forms/d/e/1FAIpQLSfO4r353BJ79TTY_-t5KWSIJT2xfqcQWY81xjAA1-1N0U2eSg/formResponse" "https://docs.google.com/forms/d/e/1FAIpQLSfO4r353BJ79TTY_-t5KWSIJT2xfqcQWY81xjAA1-1N0U2eSg/formResponse"
val data = mapOf( val data = mapOf(

View file

@ -1567,7 +1567,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
setKey(HAS_DONE_SETUP_KEY, true) setKey(HAS_DONE_SETUP_KEY, true)
} }
/*val defaultDirectory = "${filesDir.path}/torrent_tmp" //val defaultDirectory = "${filesDir.path}/torrent_tmp"
//File(defaultDirectory).deleteRecursively() //File(defaultDirectory).deleteRecursively()
navigate( navigate(
R.id.global_to_navigation_player, GeneratorPlayer.newInstance( R.id.global_to_navigation_player, GeneratorPlayer.newInstance(
@ -1576,7 +1576,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
ExtractorLink( ExtractorLink(
source = "", source = "",
name = "hello world", name = "hello world",
url = "", url = "magnet:?xt=urn:btih:bbeb7617fb6240230b862edac6221f47d59e586b&dn=%5BOhys-Raws%5D%20Kamierabi%20-%2004%20%28CX%201280x720%20x264%20AAC%29.mp4&tr=http%3A%2F%2Fnyaa.tracker.wf%3A7777%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce",
"", "",
Qualities.Unknown.value, Qualities.Unknown.value,
type = INFER_TYPE type = INFER_TYPE
@ -1585,7 +1585,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
emptyList() emptyList()
) )
) )
)*/ )
// Used to check current focus for TV // Used to check current focus for TV
// main { // main {

View file

@ -262,6 +262,7 @@ class CS3IPlayer : IPlayer {
link: ExtractorLink, link: ExtractorLink,
requestId: Long, requestId: Long,
) { ) {
val minimumBytes : Long = 30 shl 20
var hasFileChecked = false var hasFileChecked = false
while (true) { while (true) {
val gid = DownloadListener.sessionIdToGid[requestId] val gid = DownloadListener.sessionIdToGid[requestId]
@ -294,15 +295,16 @@ class CS3IPlayer : IPlayer {
} }
DownloadStatusTell.Active -> { DownloadStatusTell.Active -> {
if (metadata.downloadedLength >= metadata.totalLength && getPlayableFile( //metadata.downloadedLength >= metadata.totalLength &&
if (getPlayableFile(
metadata, metadata,
minimumBytes = 10 shl 20 minimumBytes = minimumBytes
) != null ) != null
) break ) break
// as we don't want to waste the users time with torrents that is useless // as we don't want to waste the users time with torrents that is useless
// we do this to check that at a video file exists // we do this to check that at a video file exists
if (!hasFileChecked && metadata.totalLength > (10 shl 20)) { if (!hasFileChecked && metadata.totalLength > minimumBytes) {
hasFileChecked = true hasFileChecked = true
if (getPlayableFile( if (getPlayableFile(
metadata, metadata,
@ -334,7 +336,10 @@ class CS3IPlayer : IPlayer {
continue continue
} }
null -> break null -> {
delay(1000)
continue
}
} }
} }
@ -345,7 +350,7 @@ class CS3IPlayer : IPlayer {
when (metadata.status) { when (metadata.status) {
DownloadStatusTell.Active, DownloadStatusTell.Complete -> { DownloadStatusTell.Active, DownloadStatusTell.Complete -> {
val uri = getPlayableFile(metadata, minimumBytes = 10 shl 20) val uri = getPlayableFile(metadata, minimumBytes = minimumBytes)
?: throw Exception("Not downloaded enough") ?: throw Exception("Not downloaded enough")
activity.runOnUiThread { activity.runOnUiThread {
//Log.i(TAG, "downloaded data: $metadata") //Log.i(TAG, "downloaded data: $metadata")
@ -400,7 +405,8 @@ class CS3IPlayer : IPlayer {
id = requestId, id = requestId,
uri = link.url, uri = link.url,
fileName = null, fileName = null,
seed = false seed = false,
stream = true,
) )
val metadata = val metadata =

View file

@ -30,13 +30,13 @@
app:show_timeout="0" /> app:show_timeout="0" />
<FrameLayout <FrameLayout
android:id="@+id/download_header"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@android:color/black" android:background="@android:color/black"
android:backgroundTint="@android:color/black"> android:backgroundTint="@android:color/black">
<LinearLayout <LinearLayout
android:id="@+id/download_header"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"