feat: support for multiple audio/subtitle downloads
This commit is contained in:
parent
fd8dd26435
commit
f1d16ba16a
10 changed files with 137 additions and 117 deletions
|
@ -10,7 +10,7 @@ sealed class DownloadAddon : Addon() {
|
|||
override val pkgName: String,
|
||||
override val versionName: String,
|
||||
override val versionCode: Long,
|
||||
val extension: DownloadAddonApi,
|
||||
val extension: DownloadAddonApiV2,
|
||||
val icon: Drawable?,
|
||||
val hasUpdate: Boolean = false,
|
||||
) : Addon.Installed(name, pkgName, versionName, versionCode)
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
package ani.dantotsu.addons.download
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
|
||||
interface DownloadAddonApi {
|
||||
|
||||
fun cancelDownload(sessionId: Long)
|
||||
|
||||
fun setDownloadPath(context: Context, uri: Uri): String
|
||||
|
||||
suspend fun executeFFProbe(request: String, logCallback: (String) -> Unit)
|
||||
|
||||
suspend fun executeFFMpeg(request: String, statCallback: (Double) -> Unit): Long
|
||||
|
||||
fun getState(sessionId: Long): String
|
||||
|
||||
fun getStackTrace(sessionId: Long): String?
|
||||
|
||||
fun hadError(sessionId: Long): Boolean
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package ani.dantotsu.addons.download
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
|
||||
interface DownloadAddonApiV2 {
|
||||
|
||||
fun cancelDownload(sessionId: Long)
|
||||
|
||||
fun setDownloadPath(context: Context, uri: Uri): String
|
||||
|
||||
suspend fun executeFFProbe(
|
||||
videoUrl: String,
|
||||
headers: Map<String, String> = emptyMap(),
|
||||
logCallback: (String) -> Unit
|
||||
)
|
||||
|
||||
suspend fun executeFFMpeg(
|
||||
videoUrl: String,
|
||||
downloadPath: String,
|
||||
headers: Map<String, String> = emptyMap(),
|
||||
subtitleUrls: List<Pair<String, String>> = emptyList(),
|
||||
audioUrls: List<Pair<String, String>> = emptyList(),
|
||||
statCallback: (Double) -> Unit
|
||||
): Long
|
||||
|
||||
fun getState(sessionId: Long): String
|
||||
|
||||
fun getStackTrace(sessionId: Long): String?
|
||||
|
||||
fun hadError(sessionId: Long): Boolean
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue