Compare commits

...

6 Commits

Author SHA1 Message Date
Kelvin f17e147b4e Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay 2025-11-15 03:42:17 +01:00
Kelvin 1c569b465b Possible crash fix 2025-11-15 03:42:04 +01:00
Koen J 6289c85bd5 Devportal fix with settings. 2025-11-14 13:20:21 +01:00
Koen J 098599853b Fixed issue where a pending video would not be added to queue when using add to queue feature. 2025-11-14 12:26:38 +01:00
Koen J 68d11f6d58 Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay 2025-11-14 09:39:55 +01:00
Koen J 74f6b9aa62 Language should be optional. 2025-11-14 09:39:19 +01:00
5 changed files with 52 additions and 36 deletions
+15 -12
View File
@@ -1025,18 +1025,21 @@
let settingsToUse = __DEV_SETTINGS ?? {};
if (true) {
for (let setting of this.Plugin?.currentPlugin?.settings) {
if (typeof settingsToUse[setting.variable] == "undefined") {
switch (setting?.type?.toLowerCase()) {
case "boolean":
settingsToUse[setting.variable] = setting.default === 'true';
break;
case "dropdown":
let dropDownIndex = parseInt(setting.default);
if (dropDownIndex) {
settingsToUse[setting.variable] = setting.options[dropDownIndex];
}
break;
const settings = this.Plugin?.currentPlugin?.settings;
if (settings) {
for (let setting of settings) {
if (typeof settingsToUse[setting.variable] == "undefined") {
switch (setting?.type?.toLowerCase()) {
case "boolean":
settingsToUse[setting.variable] = setting.default === 'true';
break;
case "dropdown":
let dropDownIndex = parseInt(setting.default);
if (dropDownIndex) {
settingsToUse[setting.variable] = setting.options[dropDownIndex];
}
break;
}
}
}
}
@@ -5,6 +5,7 @@ import com.caoccao.javet.values.primitive.V8ValueString
import com.caoccao.javet.values.reference.V8ValueObject
import com.futo.platformplayer.api.media.models.subtitles.ISubtitleSource
import com.futo.platformplayer.api.media.platforms.js.SourcePluginConfig
import com.futo.platformplayer.getOrDefault
import com.futo.platformplayer.getOrThrow
import com.futo.platformplayer.getSourcePlugin
import com.futo.platformplayer.invokeV8
@@ -30,7 +31,7 @@ class JSSubtitleSource : ISubtitleSource {
val context = "JSSubtitles";
name = v8Value.getOrThrow(config, "name", context, false);
language = v8Value.getOrThrow(config, "language", context, false);
language = v8Value.getOrDefault(config, "language", context, null);
url = v8Value.getOrThrow(config, "url", context, true);
format = v8Value.getOrThrow(config, "format", context, true);
hasFetch = v8Value.has("getSubtitles");
@@ -1354,6 +1354,7 @@ class VideoDetailView : ConstraintLayout {
_minimize_title.text = video.name;
_minimize_meta.text = video.author.name;
StatePlayer.instance.setCurrentlyPlaying(video);
val subTitleSegments : ArrayList<String> = ArrayList();
if(video.viewCount > 0)
@@ -7,6 +7,7 @@ import android.net.Uri
import android.provider.MediaStore
import android.provider.MediaStore.Audio.Artists
import android.webkit.MimeTypeMap
import androidx.core.database.getStringOrNull
import androidx.core.net.toFile
import androidx.core.net.toUri
import androidx.documentfile.provider.DocumentFile
@@ -185,29 +186,39 @@ class StateLibrary {
fun getVideoBucketNames(): List<Bucket> {
if(_cacheBucketNames != null)
return _cacheBucketNames ?: listOf();
val cur: Cursor = StateApp.instance.contextOrNull?.contentResolver?.query(
MediaStore.Video.Media.EXTERNAL_CONTENT_URI, arrayOf(
MediaStore.Video.Media.BUCKET_ID,
MediaStore.Video.Media.BUCKET_DISPLAY_NAME,
), null, null, null
) ?: return listOf();
try {
val cur: Cursor = StateApp.instance.contextOrNull?.contentResolver?.query(
MediaStore.Video.Media.EXTERNAL_CONTENT_URI, arrayOf(
MediaStore.Video.Media.BUCKET_ID,
MediaStore.Video.Media.BUCKET_DISPLAY_NAME,
), null, null, null
) ?: return listOf();
val buckets = mutableListOf<Bucket>();
val list = HashSet<Long>();
if (cur.moveToFirst()) {
var id: Long;
var bucket: String
do {
id = cur.getLong(0);
bucket = cur.getString(1)
if(!list.contains(id)) {
list.add(id);
buckets.add(Bucket(id, bucket));
}
} while (cur.moveToNext())
val buckets = mutableListOf<Bucket>();
val list = HashSet<Long>();
if (cur.moveToFirst()) {
var id: Long;
var bucket: String
do {
try {
id = cur.getLong(0);
bucket = cur.getStringOrNull(1) ?: continue;
if (!list.contains(id)) {
list.add(id);
buckets.add(Bucket(id, bucket));
}
} catch (ex: Throwable) {
Logger.e(TAG, "Failed to parse bucket due to ${ex.message}", ex);
}
} while (cur.moveToNext())
}
_cacheBucketNames = buckets.toList()
return _cacheBucketNames ?: listOf();
}
catch(ex: Throwable) {
Logger.e(TAG, "Buckets loading failed, returning empty");
return listOf();
}
_cacheBucketNames = buckets.toList()
return _cacheBucketNames ?: listOf();
}
@@ -111,10 +111,10 @@ class StatePlayer {
val onPlayerOpened = Event0();
val onPlayerClosed = Event0();
var currentVideo: IPlatformVideoDetails? = null
var currentVideo: IPlatformVideo? = null
private set;
fun setCurrentlyPlaying(video: IPlatformVideoDetails?) {
fun setCurrentlyPlaying(video: IPlatformVideo?) {
currentVideo = video;
}