mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-19 19:14:51 +00:00
JSDOM, optional packages, Channel not crash if opened without plugin, downloads ordering fixes/naming
This commit is contained in:
parent
72f5b5fbc0
commit
d6e045ea4e
6 changed files with 48 additions and 10 deletions
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.PackageDOMParser
|
||||
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.V8Package
|
||||
import com.futo.platformplayer.getOrThrow
|
||||
|
@ -264,6 +265,7 @@ class V8Plugin {
|
|||
"DOMParser" -> PackageDOMParser(this)
|
||||
"Http" -> PackageHttp(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}");
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
).lowercase() else ""
|
||||
|
||||
val supportsPlaylists =
|
||||
StatePlatform.instance.getChannelClient(channel.url).capabilities.hasGetChannelPlaylists
|
||||
var supportsPlaylists = false;
|
||||
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
|
||||
if (supportsPlaylists && !(_viewPager.adapter as ChannelViewPagerAdapter).containsItem(
|
||||
ChannelTab.PLAYLISTS.ordinal.toLong()
|
||||
|
|
|
@ -233,8 +233,8 @@ class DownloadsFragment : MainFragment() {
|
|||
vidsToReturn = when(ordering){
|
||||
"downloadDateAsc" -> vidsToReturn.sortedBy { it.downloadDate ?: OffsetDateTime.MAX };
|
||||
"downloadDateDesc" -> vidsToReturn.sortedByDescending { it.downloadDate ?: OffsetDateTime.MIN };
|
||||
"nameAsc" -> vidsToReturn.sortedBy { it.name }
|
||||
"nameDesc" -> vidsToReturn.sortedByDescending { it.name }
|
||||
"nameAsc" -> vidsToReturn.sortedBy { it.name.lowercase() }
|
||||
"nameDesc" -> vidsToReturn.sortedByDescending { it.name.lowercase() }
|
||||
"releasedAsc" -> vidsToReturn.sortedBy { it.datetime ?: OffsetDateTime.MAX }
|
||||
"releasedDesc" -> vidsToReturn.sortedByDescending { it.datetime ?: OffsetDateTime.MIN }
|
||||
else -> vidsToReturn
|
||||
|
|
|
@ -959,12 +959,12 @@
|
|||
<item>Watchtime Descending</item>
|
||||
</string-array>
|
||||
<string-array name="downloads_sortby_array">
|
||||
<item>Name Ascending</item>
|
||||
<item>Name Descending</item>
|
||||
<item>Downloaded Ascending</item>
|
||||
<item>Downloaded Descending</item>
|
||||
<item>Released Ascending</item>
|
||||
<item>Released Descending</item>
|
||||
<item>Name (Ascending)</item>
|
||||
<item>Name (Descending)</item>
|
||||
<item>Download Date (Oldest)</item>
|
||||
<item>Download Date (Newest)</item>
|
||||
<item>Release Date (Oldest)</item>
|
||||
<item>Release Date (Newest)</item>
|
||||
</string-array>
|
||||
<string-array name="feed_style">
|
||||
<item>Preview</item>
|
||||
|
|
Loading…
Add table
Reference in a new issue