mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-30 06:34:34 +02:00
JSDOM, optional packages, Channel not crash if opened without plugin, downloads ordering fixes/naming
This commit is contained in:
parent
72f5b5fbc0
commit
d6e045ea4e
11
app/src/main/assets/scripts/JSDOM.js
Normal file
11
app/src/main/assets/scripts/JSDOM.js
Normal file
File diff suppressed because one or more lines are too long
@ -32,6 +32,7 @@ import com.futo.platformplayer.engine.internal.V8Converter
|
|||||||
import com.futo.platformplayer.engine.packages.PackageBridge
|
import com.futo.platformplayer.engine.packages.PackageBridge
|
||||||
import com.futo.platformplayer.engine.packages.PackageDOMParser
|
import com.futo.platformplayer.engine.packages.PackageDOMParser
|
||||||
import com.futo.platformplayer.engine.packages.PackageHttp
|
import com.futo.platformplayer.engine.packages.PackageHttp
|
||||||
|
import com.futo.platformplayer.engine.packages.PackageJSDOM
|
||||||
import com.futo.platformplayer.engine.packages.PackageUtilities
|
import com.futo.platformplayer.engine.packages.PackageUtilities
|
||||||
import com.futo.platformplayer.engine.packages.V8Package
|
import com.futo.platformplayer.engine.packages.V8Package
|
||||||
import com.futo.platformplayer.getOrThrow
|
import com.futo.platformplayer.getOrThrow
|
||||||
@ -264,6 +265,7 @@ class V8Plugin {
|
|||||||
"DOMParser" -> PackageDOMParser(this)
|
"DOMParser" -> PackageDOMParser(this)
|
||||||
"Http" -> PackageHttp(this, config)
|
"Http" -> PackageHttp(this, config)
|
||||||
"Utilities" -> PackageUtilities(this, config)
|
"Utilities" -> PackageUtilities(this, config)
|
||||||
|
"JSDOM" -> PackageJSDOM(this, config)
|
||||||
else -> if(allowNull) null else throw ScriptCompilationException(config, "Unknown package [${packageName}] required for plugin ${config.name}");
|
else -> if(allowNull) null else throw ScriptCompilationException(config, "Unknown package [${packageName}] required for plugin ${config.name}");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.futo.platformplayer.engine.packages
|
||||||
|
|
||||||
|
import com.futo.platformplayer.engine.IV8PluginConfig
|
||||||
|
import com.futo.platformplayer.engine.V8Plugin
|
||||||
|
import com.futo.platformplayer.states.StateApp
|
||||||
|
|
||||||
|
|
||||||
|
class PackageJSDOM : V8Package {
|
||||||
|
@Transient
|
||||||
|
private val _config: IV8PluginConfig;
|
||||||
|
|
||||||
|
override val name: String get() = "JSDOM";
|
||||||
|
override val variableName: String get() = "packageJSDOM";
|
||||||
|
|
||||||
|
constructor(plugin: V8Plugin, config: IV8PluginConfig): super(plugin) {
|
||||||
|
_config = config;
|
||||||
|
plugin.withDependency(StateApp.instance.contextOrNull ?: return, "scripts/JSDOM.js");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -476,8 +476,13 @@ class ChannelFragment : MainFragment() {
|
|||||||
R.string.subscribers
|
R.string.subscribers
|
||||||
).lowercase() else ""
|
).lowercase() else ""
|
||||||
|
|
||||||
val supportsPlaylists =
|
var supportsPlaylists = false;
|
||||||
StatePlatform.instance.getChannelClient(channel.url).capabilities.hasGetChannelPlaylists
|
try {
|
||||||
|
supportsPlaylists = StatePlatform.instance.getChannelClient(channel.url).capabilities.hasGetChannelPlaylists
|
||||||
|
} catch (ex: Throwable) {
|
||||||
|
//Ignore error
|
||||||
|
Logger.e(TAG, "Failed to check if supports playlists", ex);
|
||||||
|
}
|
||||||
val playlistPosition = 1
|
val playlistPosition = 1
|
||||||
if (supportsPlaylists && !(_viewPager.adapter as ChannelViewPagerAdapter).containsItem(
|
if (supportsPlaylists && !(_viewPager.adapter as ChannelViewPagerAdapter).containsItem(
|
||||||
ChannelTab.PLAYLISTS.ordinal.toLong()
|
ChannelTab.PLAYLISTS.ordinal.toLong()
|
||||||
|
@ -233,8 +233,8 @@ class DownloadsFragment : MainFragment() {
|
|||||||
vidsToReturn = when(ordering){
|
vidsToReturn = when(ordering){
|
||||||
"downloadDateAsc" -> vidsToReturn.sortedBy { it.downloadDate ?: OffsetDateTime.MAX };
|
"downloadDateAsc" -> vidsToReturn.sortedBy { it.downloadDate ?: OffsetDateTime.MAX };
|
||||||
"downloadDateDesc" -> vidsToReturn.sortedByDescending { it.downloadDate ?: OffsetDateTime.MIN };
|
"downloadDateDesc" -> vidsToReturn.sortedByDescending { it.downloadDate ?: OffsetDateTime.MIN };
|
||||||
"nameAsc" -> vidsToReturn.sortedBy { it.name }
|
"nameAsc" -> vidsToReturn.sortedBy { it.name.lowercase() }
|
||||||
"nameDesc" -> vidsToReturn.sortedByDescending { it.name }
|
"nameDesc" -> vidsToReturn.sortedByDescending { it.name.lowercase() }
|
||||||
"releasedAsc" -> vidsToReturn.sortedBy { it.datetime ?: OffsetDateTime.MAX }
|
"releasedAsc" -> vidsToReturn.sortedBy { it.datetime ?: OffsetDateTime.MAX }
|
||||||
"releasedDesc" -> vidsToReturn.sortedByDescending { it.datetime ?: OffsetDateTime.MIN }
|
"releasedDesc" -> vidsToReturn.sortedByDescending { it.datetime ?: OffsetDateTime.MIN }
|
||||||
else -> vidsToReturn
|
else -> vidsToReturn
|
||||||
|
@ -959,12 +959,12 @@
|
|||||||
<item>Watchtime Descending</item>
|
<item>Watchtime Descending</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="downloads_sortby_array">
|
<string-array name="downloads_sortby_array">
|
||||||
<item>Name Ascending</item>
|
<item>Name (Ascending)</item>
|
||||||
<item>Name Descending</item>
|
<item>Name (Descending)</item>
|
||||||
<item>Downloaded Ascending</item>
|
<item>Download Date (Oldest)</item>
|
||||||
<item>Downloaded Descending</item>
|
<item>Download Date (Newest)</item>
|
||||||
<item>Released Ascending</item>
|
<item>Release Date (Oldest)</item>
|
||||||
<item>Released Descending</item>
|
<item>Release Date (Newest)</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="feed_style">
|
<string-array name="feed_style">
|
||||||
<item>Preview</item>
|
<item>Preview</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user