Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ class ResultFragmentTv : BaseFragment<FragmentResultTvBinding>(
resultEpisodes.setRecycledViewPool(EpisodeAdapter.sharedPool)
resultEpisodes.adapter =
EpisodeAdapter(
false,
true,
{ episodeClick ->
viewModel.handleAction(episodeClick)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,7 @@ class ResultViewModel2 : ViewModel() {
listOf(
txt(R.string.episode_action_auto_download) to ACTION_DOWNLOAD_EPISODE,
txt(R.string.episode_action_download_mirror) to ACTION_DOWNLOAD_MIRROR,
txt("Send to Nova Server (192.168.1.9)") to 9999,
txt(R.string.episode_action_download_subtitle) to ACTION_DOWNLOAD_EPISODE_SUBTITLE_MIRROR,
txt(R.string.episode_action_reload_links) to ACTION_RELOAD_EPISODE,
)
Expand Down Expand Up @@ -1488,6 +1489,62 @@ class ResultViewModel2 : ViewModel() {
)
}

9999 -> {
val response = currentResponse ?: return
acquireSingleLink(
click.data,
LOADTYPE_INAPP_DOWNLOAD,
txt("Send to Nova Server (Choose Source & Quality)")
) { (result, index) ->
ioSafe {
val link = result.links[index]
val fullTitle = activity?.getNameFull(
click.data.name,
click.data.episode,
click.data.season
) ?: response.name

val success = try {
val payload = org.json.JSONObject().apply {
put("title", fullTitle)
put("url", link.url)
put("referer", link.referer)
put("quality", Qualities.getStringByInt(link.quality))
put("type", link.type.name)
val headersJson = org.json.JSONObject()
link.headers.forEach { (k, v) -> headersJson.put(k, v) }
put("headers", headersJson)
}
val conn = (java.net.URL("http://192.168.1.9:8765/api/download").openConnection() as java.net.HttpURLConnection).apply {
requestMethod = "POST"
setRequestProperty("Authorization", "Bearer nova-cloudstream-secure-token-2026")
setRequestProperty("Content-Type", "application/json")
doOutput = true
connectTimeout = 5000
readTimeout = 5000
}
conn.outputStream.use { os ->
os.write(payload.toString().toByteArray(Charsets.UTF_8))
}
val code = conn.responseCode
conn.disconnect()
code in 200..299
} catch (e: Exception) {
com.lagradost.cloudstream3.mvvm.logError(e)
false
}

main {
if (success) {
showToast("Queued on Nova Server: " + fullTitle, Toast.LENGTH_LONG)
} else {
showToast("Failed to connect to Nova Server", Toast.LENGTH_SHORT)
}
}
}
}
}

ACTION_DOWNLOAD_MIRROR -> {
val response = currentResponse ?: return
acquireSingleLink(
Expand Down
Loading
Loading