mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-20 03:24:50 +00:00
Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay into media3-migration
This commit is contained in:
commit
7f1cb22c12
23 changed files with 70 additions and 179 deletions
|
@ -43,18 +43,19 @@ let Type = {
|
|||
|
||||
let Language = {
|
||||
UNKNOWN: "Unknown",
|
||||
ARABIC: "Arabic",
|
||||
SPANISH: "Spanish",
|
||||
FRENCH: "French",
|
||||
HINDI: "Hindi",
|
||||
INDONESIAN: "Indonesian",
|
||||
KOREAN: "Korean",
|
||||
PORTBRAZIL: "Portuguese Brazilian",
|
||||
RUSSIAN: "Russian",
|
||||
THAI: "Thai",
|
||||
TURKISH: "Turkish",
|
||||
VIETNAMESE: "Vietnamese",
|
||||
ENGLISH: "English"
|
||||
ARABIC: "ar",
|
||||
SPANISH: "es",
|
||||
FRENCH: "fr",
|
||||
HINDI: "hi",
|
||||
INDONESIAN: "id",
|
||||
KOREAN: "ko",
|
||||
PORTUGUESE: "pt",
|
||||
PORTBRAZIL: "pt",
|
||||
RUSSIAN: "ru",
|
||||
THAI: "th",
|
||||
TURKISH: "tr",
|
||||
VIETNAMESE: "vi",
|
||||
ENGLISH: "en"
|
||||
}
|
||||
|
||||
class ScriptException extends Error {
|
||||
|
|
|
@ -324,7 +324,28 @@ class Settings : FragmentedStorageFileJson() {
|
|||
@DropdownFieldOptionsId(R.array.audio_languages)
|
||||
var primaryLanguage: Int = 0;
|
||||
|
||||
fun getPrimaryLanguage(context: Context) = context.resources.getStringArray(R.array.audio_languages)[primaryLanguage];
|
||||
fun getPrimaryLanguage(context: Context): String? {
|
||||
return when(primaryLanguage) {
|
||||
0 -> "en";
|
||||
1 -> "es";
|
||||
2 -> "de";
|
||||
3 -> "fr";
|
||||
4 -> "ja";
|
||||
5 -> "ko";
|
||||
6 -> "th";
|
||||
7 -> "vi";
|
||||
8 -> "id";
|
||||
9 -> "hi";
|
||||
10 -> "ar";
|
||||
11 -> "tu";
|
||||
12 -> "ru";
|
||||
13 -> "pt";
|
||||
14 -> "zh";
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
//= context.resources.getStringArray(R.array.audio_languages)[primaryLanguage];
|
||||
|
||||
@FormField(R.string.default_playback_speed, FieldForm.DROPDOWN, -1, 1)
|
||||
@DropdownFieldOptionsId(R.array.playback_speeds)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.futo.platformplayer.activities
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
|
@ -852,6 +853,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
|
|||
* Navigate takes a MainFragment, and makes them the current main visible view
|
||||
* A parameter can be provided which becomes available in the onShow of said fragment
|
||||
*/
|
||||
@SuppressLint("CommitTransaction")
|
||||
fun navigate(segment: MainFragment, parameter: Any? = null, withHistory: Boolean = true, isBack: Boolean = false) {
|
||||
Logger.i(TAG, "Navigate to $segment (parameter=$parameter, withHistory=$withHistory, isBack=$isBack)")
|
||||
|
||||
|
@ -897,11 +899,6 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
|
|||
}
|
||||
transaction.commitNow();
|
||||
} else {
|
||||
//Special cases
|
||||
if(segment is VideoDetailFragment) {
|
||||
_fragContainerVideoDetail.visibility = View.VISIBLE;
|
||||
_fragVideoDetail.maximizeVideoDetail();
|
||||
}
|
||||
|
||||
if(!segment.hasBottomBar) {
|
||||
supportFragmentManager.beginTransaction()
|
||||
|
|
|
@ -191,7 +191,7 @@ class ManagedHttpServer(private val _requestedPort: Int = 0) {
|
|||
}
|
||||
}
|
||||
fun addBridgeHandlers(obj: Any, tag: String? = null) {
|
||||
val tagToUse = tag ?: obj.javaClass.name;
|
||||
//val tagToUse = tag ?: obj.javaClass.name;
|
||||
val getMethods = obj::class.java.declaredMethods
|
||||
.filter { it.getAnnotation(HttpGET::class.java) != null }
|
||||
.map { Pair<Method, HttpGET>(it, it.getAnnotation(HttpGET::class.java)!!) }
|
||||
|
|
|
@ -41,7 +41,7 @@ class SingleAsyncItemPager<T> {
|
|||
fun getCurrentItem(scope: CoroutineScope) : Deferred<T?>? {
|
||||
synchronized(_requestedPageItems) {
|
||||
if (_currentResultPos >= _requestedPageItems.size) {
|
||||
val startPos = fillDeferredUntil(_currentResultPos);
|
||||
fillDeferredUntil(_currentResultPos);
|
||||
if(!_pager.hasMorePages()) {
|
||||
Logger.i("SingleAsyncItemPager", "end of async page reached");
|
||||
completeRemainder { it?.complete(null) };
|
||||
|
@ -49,7 +49,7 @@ class SingleAsyncItemPager<T> {
|
|||
if(_isRequesting)
|
||||
return _requestedPageItems[_currentResultPos];
|
||||
_isRequesting = true;
|
||||
StateApp.instance.scopeOrNull?.launch(Dispatchers.IO) {
|
||||
scope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
Logger.i("SingleAsyncItemPager", "Started Pager");
|
||||
val timeForPage = measureTimeMillis { _pager.nextPage() };
|
||||
|
|
|
@ -269,7 +269,7 @@ class V8Plugin {
|
|||
throwExceptionFromV8(
|
||||
config,
|
||||
result.getOrThrow(config, "plugin_type", "V8Plugin"),
|
||||
result.getOrThrow(config, "message", "V8Plugin"),
|
||||
context + ":" + result.getOrThrow(config, "message", "V8Plugin"),
|
||||
null,
|
||||
null,
|
||||
codeStripped
|
||||
|
@ -280,7 +280,7 @@ class V8Plugin {
|
|||
return result;
|
||||
}
|
||||
catch(scriptEx: JavetCompilationException) {
|
||||
throw ScriptCompilationException(config, "Compilation: ${scriptEx.message}\n(${scriptEx.scriptingError.lineNumber})[${scriptEx.scriptingError.startColumn}-${scriptEx.scriptingError.endColumn}]: ${scriptEx.scriptingError.sourceLine}", null, codeStripped);
|
||||
throw ScriptCompilationException(config, "Compilation: [${context}]: ${scriptEx.message}\n(${scriptEx.scriptingError.lineNumber})[${scriptEx.scriptingError.startColumn}-${scriptEx.scriptingError.endColumn}]: ${scriptEx.scriptingError.sourceLine}", null, codeStripped);
|
||||
}
|
||||
catch(executeEx: JavetExecutionException) {
|
||||
if(executeEx.scriptingError?.context?.containsKey("plugin_type") == true) {
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.futo.platformplayer.api.media.models.video.IPlatformVideoDetails
|
|||
import com.futo.platformplayer.api.media.platforms.js.models.sources.JSAudioUrlRangeSource
|
||||
import com.futo.platformplayer.api.media.platforms.js.models.sources.JSVideoUrlRangeSource
|
||||
import com.futo.platformplayer.logging.Logger
|
||||
import com.futo.platformplayer.others.Language
|
||||
import kotlin.math.abs
|
||||
|
||||
class VideoHelper {
|
||||
|
@ -83,13 +84,14 @@ class VideoHelper {
|
|||
fun selectBestAudioSource(altSources : Iterable<IAudioSource>, prefContainers : Array<String>, preferredLanguage: String? = null, targetBitrate: Long? = null) : IAudioSource? {
|
||||
val languageToFilter = if(preferredLanguage != null && altSources.any { it.language == preferredLanguage }) {
|
||||
preferredLanguage
|
||||
} else if(preferredLanguage == null) {
|
||||
null
|
||||
} else {
|
||||
"Unknown"
|
||||
if(altSources.any { it.language == Language.ENGLISH })
|
||||
Language.ENGLISH
|
||||
else
|
||||
Language.UNKNOWN;
|
||||
}
|
||||
|
||||
var usableSources = if(languageToFilter != null && altSources.any { it.language == languageToFilter }) {
|
||||
var usableSources = if(altSources.any { it.language == languageToFilter }) {
|
||||
altSources.filter { it.language == languageToFilter }.sortedBy { it.bitrate }.toList();
|
||||
} else {
|
||||
altSources.sortedBy { it.bitrate }
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
package com.futo.platformplayer.others
|
||||
|
||||
class Language {
|
||||
//TODO: Do this differently, somehow map them to ids for multilanguage?
|
||||
companion object {
|
||||
val UNKNOWN = "Unknown";
|
||||
val ARABIC = "Arabic";
|
||||
val SPANISH = "Spanish";
|
||||
val FRENCH = "French";
|
||||
val HINDI = "Hindi";
|
||||
val INDONESIAN = "Indonesian";
|
||||
val KOREAN = "Korean";
|
||||
val PORTBRAZIL = "Portuguese Brazilian";
|
||||
val RUSSIAN = "Russian";
|
||||
val THAI = "Thai";
|
||||
val TURKISH = "Turkish";
|
||||
val VIETNAMESE = "Vietnamese";
|
||||
val ENGLISH = "English";
|
||||
val ARABIC = "ar";
|
||||
val SPANISH = "es";
|
||||
val FRENCH = "fr";
|
||||
val HINDI = "hi";
|
||||
val INDONESIAN = "id";
|
||||
val KOREAN = "ko";
|
||||
val PORTBRAZIL = "pt";
|
||||
val RUSSIAN = "ru";
|
||||
val THAI = "th";
|
||||
val TURKISH = "tr";
|
||||
val VIETNAMESE = "vi";
|
||||
val ENGLISH = "en";
|
||||
}
|
||||
}
|
|
@ -731,7 +731,6 @@ class StateApp {
|
|||
StatePlatform.instance.reloadClient(context, client.config.id);
|
||||
} catch (e: Throwable) {
|
||||
Logger.e(SourceDetailFragment.TAG, "Failed to reload client.", e)
|
||||
return@launch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -676,7 +676,7 @@ class StatePlatform {
|
|||
}
|
||||
}
|
||||
|
||||
fun getChannelContent(baseClient: IPlatformClient, channelUrl: String, isSubscriptionOptimized: Boolean = false, usePooledClients: Int = 0, ignorePlugins: List<String>? = null): IPager<IPlatformContent> {
|
||||
fun getChannelContent(baseClient: IPlatformClient, channelUrl: String, isSubscriptionOptimized: Boolean = false, usePooledClients: Int = 0): IPager<IPlatformContent> {
|
||||
val clientCapabilities = baseClient.getChannelCapabilities();
|
||||
val client = if(usePooledClients > 1)
|
||||
_channelClientPool.getClientPooled(baseClient, usePooledClients);
|
||||
|
@ -796,7 +796,7 @@ class StatePlatform {
|
|||
fun getChannelContent(channelUrl: String, isSubscriptionOptimized: Boolean = false, usePooledClients: Int = 0, ignorePlugins: List<String>? = null): IPager<IPlatformContent> {
|
||||
Logger.i(TAG, "Platform - getChannelVideos");
|
||||
val baseClient = getChannelClient(channelUrl, ignorePlugins);
|
||||
return getChannelContent(baseClient, channelUrl, isSubscriptionOptimized, usePooledClients, ignorePlugins);
|
||||
return getChannelContent(baseClient, channelUrl, isSubscriptionOptimized, usePooledClients);
|
||||
}
|
||||
fun getChannelContent(channelUrl: String, type: String?, ordering: String = ResultCapabilities.ORDER_CHONOLOGICAL): IPager<IPlatformContent> {
|
||||
val client = getChannelClient(channelUrl);
|
||||
|
@ -899,18 +899,13 @@ class StatePlatform {
|
|||
devId = newClient.devID;
|
||||
try {
|
||||
StateDeveloper.instance.initializeDev(devId!!);
|
||||
var didEnable = false;
|
||||
if (isPrimary) {
|
||||
_primaryClientObj = newClient;
|
||||
_enabledClients.add(0, newClient);
|
||||
newClient.initialize();
|
||||
didEnable = true;
|
||||
} else if (isEnabled) {
|
||||
_enabledClients.add(newClient);
|
||||
if(!didEnable) {
|
||||
newClient.initialize();
|
||||
didEnable = true;
|
||||
}
|
||||
newClient.initialize();
|
||||
}
|
||||
_availableClients.add(newClient);
|
||||
} catch (ex: Exception) {
|
||||
|
|
|
@ -153,7 +153,7 @@ class SimpleSubscriptionAlgorithm(
|
|||
try {
|
||||
val platformClient = StatePlatform.instance.getChannelClientOrNull(url, toIgnore) ?: continue;
|
||||
val time = measureTimeMillis {
|
||||
pager = StatePlatform.instance.getChannelContent(platformClient, url, true, threadPool.poolSize, toIgnore);
|
||||
pager = StatePlatform.instance.getChannelContent(platformClient, url, true, threadPool.poolSize);
|
||||
pager = StateCache.cachePagerResults(scope, pager!!) {
|
||||
onNewCacheHit.emit(sub, it);
|
||||
};
|
||||
|
|
|
@ -701,20 +701,6 @@
|
|||
<item>استئناف بعد 10 ثوان</item>
|
||||
<item>استئناف دائم</item>
|
||||
</string-array>
|
||||
<string-array name="audio_languages">
|
||||
<item>الإنجليزية</item>
|
||||
<item>الإسبانية</item>
|
||||
<item>الفرنسية</item>
|
||||
<item>الفرنسية</item>
|
||||
<item>الكورية</item>
|
||||
<item>التايلاندية</item>
|
||||
<item>الفيتنامية</item>
|
||||
<item>الإندونيسية</item>
|
||||
<item>الهندية</item>
|
||||
<item>العربية</item>
|
||||
<item>التركية</item>
|
||||
<item>الروسية</item>
|
||||
</string-array>
|
||||
<string-array name="log_levels">
|
||||
<item>لا شيء</item>
|
||||
<item>خطأ</item>
|
||||
|
|
|
@ -701,20 +701,6 @@
|
|||
<item>Nach 10 Sekunden fortsetzen</item>
|
||||
<item>Immer fortsetzen</item>
|
||||
</string-array>
|
||||
<string-array name="audio_languages">
|
||||
<item>Englisch</item>
|
||||
<item>Spanisch</item>
|
||||
<item>Französisch</item>
|
||||
<item>Französisch</item>
|
||||
<item>Koreanisch</item>
|
||||
<item>Thailändisch</item>
|
||||
<item>Vietnamesisch</item>
|
||||
<item>Indonesisch</item>
|
||||
<item>Hindi</item>
|
||||
<item>Arabisch</item>
|
||||
<item>Türkisch</item>
|
||||
<item>Russisch</item>
|
||||
</string-array>
|
||||
<string-array name="log_levels">
|
||||
<item>Keine</item>
|
||||
<item>Fehler</item>
|
||||
|
|
|
@ -717,20 +717,6 @@
|
|||
<item>Reanudar Después de 10s</item>
|
||||
<item>Siempre Reanudar</item>
|
||||
</string-array>
|
||||
<string-array name="audio_languages">
|
||||
<item>Inglés</item>
|
||||
<item>Español</item>
|
||||
<item>Francés</item>
|
||||
<item>Francés</item>
|
||||
<item>Coreano</item>
|
||||
<item>Tailandés</item>
|
||||
<item>Vietnamita</item>
|
||||
<item>Indonesio</item>
|
||||
<item>Hindi</item>
|
||||
<item>Árabe</item>
|
||||
<item>Turco</item>
|
||||
<item>Ruso</item>
|
||||
</string-array>
|
||||
<string-array name="log_levels">
|
||||
<item>Ninguno</item>
|
||||
<item>Error</item>
|
||||
|
|
|
@ -701,20 +701,6 @@
|
|||
<item>Reprendre après 10s</item>
|
||||
<item>Toujours reprendre</item>
|
||||
</string-array>
|
||||
<string-array name="audio_languages">
|
||||
<item>Anglais</item>
|
||||
<item>Espagnol</item>
|
||||
<item>Français</item>
|
||||
<item>Français</item>
|
||||
<item>Coréen</item>
|
||||
<item>Thaï</item>
|
||||
<item>Vietnamien</item>
|
||||
<item>Indonésien</item>
|
||||
<item>Hindi</item>
|
||||
<item>Arabe</item>
|
||||
<item>Turc</item>
|
||||
<item>Russe</item>
|
||||
</string-array>
|
||||
<string-array name="log_levels">
|
||||
<item>Aucun</item>
|
||||
<item>Erreur</item>
|
||||
|
|
|
@ -701,20 +701,6 @@
|
|||
<item>10秒後から再開</item>
|
||||
<item>常に再開</item>
|
||||
</string-array>
|
||||
<string-array name="audio_languages">
|
||||
<item>英語</item>
|
||||
<item>スペイン語</item>
|
||||
<item>フランス語</item>
|
||||
<item>フランス語</item>
|
||||
<item>韓国語</item>
|
||||
<item>タイ語</item>
|
||||
<item>ベトナム語</item>
|
||||
<item>インドネシア語</item>
|
||||
<item>ヒンディー語</item>
|
||||
<item>アラビア語</item>
|
||||
<item>トルコ語</item>
|
||||
<item>ロシア語</item>
|
||||
</string-array>
|
||||
<string-array name="log_levels">
|
||||
<item>なし</item>
|
||||
<item>エラー</item>
|
||||
|
|
|
@ -701,20 +701,6 @@
|
|||
<item>10초 후에 이어서</item>
|
||||
<item>항상 이어서</item>
|
||||
</string-array>
|
||||
<string-array name="audio_languages">
|
||||
<item>영어</item>
|
||||
<item>스페인어</item>
|
||||
<item>프랑스어</item>
|
||||
<item>프랑스어</item>
|
||||
<item>한국어</item>
|
||||
<item>태국어</item>
|
||||
<item>베트남어</item>
|
||||
<item>인도네시아어</item>
|
||||
<item>힌디어</item>
|
||||
<item>아랍어</item>
|
||||
<item>터키어</item>
|
||||
<item>러시아어</item>
|
||||
</string-array>
|
||||
<string-array name="log_levels">
|
||||
<item>없음</item>
|
||||
<item>오류</item>
|
||||
|
|
|
@ -701,20 +701,6 @@
|
|||
<item>Continuar Após 10s</item>
|
||||
<item>Sempre Continuar</item>
|
||||
</string-array>
|
||||
<string-array name="audio_languages">
|
||||
<item>Inglês</item>
|
||||
<item>Espanhol</item>
|
||||
<item>Francês</item>
|
||||
<item>Francês</item>
|
||||
<item>Coreano</item>
|
||||
<item>Tailandês</item>
|
||||
<item>Vietnamita</item>
|
||||
<item>Indonésio</item>
|
||||
<item>Hindi</item>
|
||||
<item>Árabe</item>
|
||||
<item>Turco</item>
|
||||
<item>Russo</item>
|
||||
</string-array>
|
||||
<string-array name="log_levels">
|
||||
<item>Nenhum</item>
|
||||
<item>Erro</item>
|
||||
|
|
|
@ -701,20 +701,6 @@
|
|||
<item>Продолжить после 10 секунд</item>
|
||||
<item>Всегда продолжать</item>
|
||||
</string-array>
|
||||
<string-array name="audio_languages">
|
||||
<item>Английский</item>
|
||||
<item>Испанский</item>
|
||||
<item>Французский</item>
|
||||
<item>Французский</item>
|
||||
<item>Корейский</item>
|
||||
<item>Тайский</item>
|
||||
<item>Вьетнамский</item>
|
||||
<item>Индонезийский</item>
|
||||
<item>Хинди</item>
|
||||
<item>Арабский</item>
|
||||
<item>Турецкий</item>
|
||||
<item>Русский</item>
|
||||
</string-array>
|
||||
<string-array name="log_levels">
|
||||
<item>Нет</item>
|
||||
<item>Ошибка</item>
|
||||
|
|
|
@ -701,20 +701,6 @@
|
|||
<item>预览后10秒继续</item>
|
||||
<item>始终继续</item>
|
||||
</string-array>
|
||||
<string-array name="audio_languages">
|
||||
<item>英语</item>
|
||||
<item>西班牙语</item>
|
||||
<item>法语</item>
|
||||
<item>法语</item>
|
||||
<item>韩语</item>
|
||||
<item>泰语</item>
|
||||
<item>越南语</item>
|
||||
<item>印度尼西亚语</item>
|
||||
<item>印地语</item>
|
||||
<item>阿拉伯语</item>
|
||||
<item>土耳其语</item>
|
||||
<item>俄语</item>
|
||||
</string-array>
|
||||
<string-array name="log_levels">
|
||||
<item>无</item>
|
||||
<item>错误</item>
|
||||
|
|
|
@ -854,8 +854,9 @@
|
|||
<string-array name="audio_languages">
|
||||
<item>English</item>
|
||||
<item>Spanish</item>
|
||||
<item>German</item>
|
||||
<item>French</item>
|
||||
<item>French</item>
|
||||
<item>Japanese</item>
|
||||
<item>Korean</item>
|
||||
<item>Thai</item>
|
||||
<item>Vietnamese</item>
|
||||
|
@ -864,6 +865,8 @@
|
|||
<item>Arabic</item>
|
||||
<item>Turkish</item>
|
||||
<item>Russian</item>
|
||||
<item>Portuguese</item>
|
||||
<item>Chinese</item>
|
||||
</string-array>
|
||||
<string-array name="casting_device_type_array" translatable="false">
|
||||
<item>FCast</item>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit fc5d17e19067efc0d28192b43de31f9bc499d288
|
||||
Subproject commit d41cc8e848891ef8e949e6d49384b754e7c305c7
|
|
@ -1 +1 @@
|
|||
Subproject commit fc5d17e19067efc0d28192b43de31f9bc499d288
|
||||
Subproject commit d41cc8e848891ef8e949e6d49384b754e7c305c7
|
Loading…
Add table
Reference in a new issue