mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-05-29 13:00:21 +02:00
Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay into download-fixes
This commit is contained in:
commit
9376bb05fa
12
.gitmodules
vendored
12
.gitmodules
vendored
@ -70,3 +70,15 @@
|
|||||||
[submodule "app/src/unstable/assets/sources/spotify"]
|
[submodule "app/src/unstable/assets/sources/spotify"]
|
||||||
path = app/src/unstable/assets/sources/spotify
|
path = app/src/unstable/assets/sources/spotify
|
||||||
url = ../plugins/spotify.git
|
url = ../plugins/spotify.git
|
||||||
|
[submodule "app/src/stable/assets/sources/bitchute"]
|
||||||
|
path = app/src/stable/assets/sources/bitchute
|
||||||
|
url = ../plugins/bitchute.git
|
||||||
|
[submodule "app/src/unstable/assets/sources/bitchute"]
|
||||||
|
path = app/src/unstable/assets/sources/bitchute
|
||||||
|
url = ../plugins/bitchute.git
|
||||||
|
[submodule "app/src/unstable/assets/sources/dailymotion"]
|
||||||
|
path = app/src/unstable/assets/sources/dailymotion
|
||||||
|
url = ../plugins/dailymotion.git
|
||||||
|
[submodule "app/src/stable/assets/sources/dailymotion"]
|
||||||
|
path = app/src/stable/assets/sources/dailymotion
|
||||||
|
url = ../plugins/dailymotion.git
|
||||||
|
@ -50,7 +50,7 @@ abstract class JSSource {
|
|||||||
_requestExecutor = obj.getOrDefault<V8ValueObject>(_config, "requestExecutor", "JSSource.requestExecutor", null)?.let {
|
_requestExecutor = obj.getOrDefault<V8ValueObject>(_config, "requestExecutor", "JSSource.requestExecutor", null)?.let {
|
||||||
JSRequest(plugin, it, null, null, true);
|
JSRequest(plugin, it, null, null, true);
|
||||||
}
|
}
|
||||||
hasRequestExecutor = _requestModifier != null || obj.has("getRequestExecutor");
|
hasRequestExecutor = _requestExecutor != null || obj.has("getRequestExecutor");
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getRequestModifier(): IRequestModifier? {
|
fun getRequestModifier(): IRequestModifier? {
|
||||||
|
@ -94,6 +94,18 @@ class VideoDownload {
|
|||||||
@Transient
|
@Transient
|
||||||
val audioSourceToUse: IAudioSource? get () = if(requiresLiveAudioSource) audioSourceLive as IAudioSource? else audioSource as IAudioSource?;
|
val audioSourceToUse: IAudioSource? get () = if(requiresLiveAudioSource) audioSourceLive as IAudioSource? else audioSource as IAudioSource?;
|
||||||
|
|
||||||
|
var requireVideoSource: Boolean = false;
|
||||||
|
var requireAudioSource: Boolean = false;
|
||||||
|
|
||||||
|
@Contextual
|
||||||
|
@Transient
|
||||||
|
val isVideoDownloadReady: Boolean get() = !requireVideoSource ||
|
||||||
|
((requiresLiveVideoSource && isLiveVideoSourceValid) || (!requiresLiveVideoSource && videoSource != null));
|
||||||
|
@Contextual
|
||||||
|
@Transient
|
||||||
|
val isAudioDownloadReady: Boolean get() = !requireAudioSource ||
|
||||||
|
((requiresLiveAudioSource && isLiveAudioSourceValid) || (!requiresLiveAudioSource && audioSource != null));
|
||||||
|
|
||||||
|
|
||||||
var subtitleSource: SubtitleRawSource?;
|
var subtitleSource: SubtitleRawSource?;
|
||||||
@kotlinx.serialization.Serializable(with = OffsetDateTimeNullableSerializer::class)
|
@kotlinx.serialization.Serializable(with = OffsetDateTimeNullableSerializer::class)
|
||||||
@ -159,6 +171,8 @@ class VideoDownload {
|
|||||||
this.requiresLiveVideoSource = false;
|
this.requiresLiveVideoSource = false;
|
||||||
this.requiresLiveAudioSource = false;
|
this.requiresLiveAudioSource = false;
|
||||||
this.targetVideoName = videoSource?.name;
|
this.targetVideoName = videoSource?.name;
|
||||||
|
this.requireVideoSource = targetPixelCount != null
|
||||||
|
this.requireAudioSource = targetBitrate != null; //TODO: May not be a valid check.. can only be determined after live fetch?
|
||||||
}
|
}
|
||||||
constructor(video: IPlatformVideoDetails, videoSource: IVideoSource?, audioSource: IAudioSource?, subtitleSource: SubtitleRawSource?) {
|
constructor(video: IPlatformVideoDetails, videoSource: IVideoSource?, audioSource: IAudioSource?, subtitleSource: SubtitleRawSource?) {
|
||||||
this.video = SerializedPlatformVideo.fromVideo(video);
|
this.video = SerializedPlatformVideo.fromVideo(video);
|
||||||
@ -177,6 +191,8 @@ class VideoDownload {
|
|||||||
this.targetAudioName = audioSource?.name;
|
this.targetAudioName = audioSource?.name;
|
||||||
this.targetPixelCount = if(videoSource != null) (videoSource.width * videoSource.height).toLong() else null;
|
this.targetPixelCount = if(videoSource != null) (videoSource.width * videoSource.height).toLong() else null;
|
||||||
this.targetBitrate = if(audioSource != null) audioSource.bitrate.toLong() else null;
|
this.targetBitrate = if(audioSource != null) audioSource.bitrate.toLong() else null;
|
||||||
|
this.requireVideoSource = videoSource != null;
|
||||||
|
this.requireAudioSource = audioSource != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
fun withGroup(groupType: String, groupID: String): VideoDownload {
|
fun withGroup(groupType: String, groupID: String): VideoDownload {
|
||||||
@ -322,8 +338,10 @@ class VideoDownload {
|
|||||||
throw DownloadException("Audio source is not supported for downloading (yet)", false);
|
throw DownloadException("Audio source is not supported for downloading (yet)", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(((!requiresLiveVideoSource && videoSource == null) || (requiresLiveVideoSource && !isLiveVideoSourceValid)) || ((!requiresLiveAudioSource && audioSource == null) || (requiresLiveAudioSource && !isLiveAudioSourceValid)))
|
if(!isVideoDownloadReady)
|
||||||
throw DownloadException("No valid sources found for video/audio");
|
throw DownloadException("No valid sources found for video");
|
||||||
|
if(!isAudioDownloadReady)
|
||||||
|
throw DownloadException("No valid sources found for audio");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,6 +387,7 @@ class VideoDownload {
|
|||||||
sourcesToDownload.add(async {
|
sourcesToDownload.add(async {
|
||||||
Logger.i(TAG, "Started downloading video");
|
Logger.i(TAG, "Started downloading video");
|
||||||
|
|
||||||
|
var lastEmit = 0L;
|
||||||
val progressCallback = { length: Long, totalRead: Long, speed: Long ->
|
val progressCallback = { length: Long, totalRead: Long, speed: Long ->
|
||||||
synchronized(progressLock) {
|
synchronized(progressLock) {
|
||||||
lastVideoLength = length;
|
lastVideoLength = length;
|
||||||
@ -381,9 +400,14 @@ class VideoDownload {
|
|||||||
val total = lastVideoRead + lastAudioRead;
|
val total = lastVideoRead + lastAudioRead;
|
||||||
if(totalLength > 0) {
|
if(totalLength > 0) {
|
||||||
val percentage = (total / totalLength.toDouble());
|
val percentage = (total / totalLength.toDouble());
|
||||||
onProgress?.invoke(percentage);
|
|
||||||
progress = percentage;
|
progress = percentage;
|
||||||
onProgressChanged.emit(percentage);
|
|
||||||
|
val now = System.currentTimeMillis();
|
||||||
|
if(now - lastEmit > 200) {
|
||||||
|
lastEmit = System.currentTimeMillis();
|
||||||
|
onProgress?.invoke(percentage);
|
||||||
|
onProgressChanged.emit(percentage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -403,6 +427,7 @@ class VideoDownload {
|
|||||||
sourcesToDownload.add(async {
|
sourcesToDownload.add(async {
|
||||||
Logger.i(TAG, "Started downloading audio");
|
Logger.i(TAG, "Started downloading audio");
|
||||||
|
|
||||||
|
var lastEmit = 0L;
|
||||||
val progressCallback = { length: Long, totalRead: Long, speed: Long ->
|
val progressCallback = { length: Long, totalRead: Long, speed: Long ->
|
||||||
synchronized(progressLock) {
|
synchronized(progressLock) {
|
||||||
lastAudioLength = length;
|
lastAudioLength = length;
|
||||||
@ -415,9 +440,14 @@ class VideoDownload {
|
|||||||
val total = lastVideoRead + lastAudioRead;
|
val total = lastVideoRead + lastAudioRead;
|
||||||
if(totalLength > 0) {
|
if(totalLength > 0) {
|
||||||
val percentage = (total / totalLength.toDouble());
|
val percentage = (total / totalLength.toDouble());
|
||||||
onProgress?.invoke(percentage);
|
|
||||||
progress = percentage;
|
progress = percentage;
|
||||||
onProgressChanged.emit(percentage);
|
|
||||||
|
val now = System.currentTimeMillis();
|
||||||
|
if(now - lastEmit > 200) {
|
||||||
|
lastEmit = System.currentTimeMillis();
|
||||||
|
onProgress?.invoke(percentage);
|
||||||
|
onProgressChanged.emit(percentage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ class VideoHelper {
|
|||||||
|
|
||||||
fun estimateSourceSize(source: IVideoSource?): Int {
|
fun estimateSourceSize(source: IVideoSource?): Int {
|
||||||
if(source == null) return 0;
|
if(source == null) return 0;
|
||||||
if(source is IVideoUrlSource) {
|
if(source is IVideoSource) {
|
||||||
if(source.bitrate ?: 0 <= 0 || source.duration.toInt() == 0)
|
if(source.bitrate ?: 0 <= 0 || source.duration.toInt() == 0)
|
||||||
return 0;
|
return 0;
|
||||||
return (source.duration / 8).toInt() * source.bitrate!!;
|
return (source.duration / 8).toInt() * source.bitrate!!;
|
||||||
@ -202,7 +202,7 @@ class VideoHelper {
|
|||||||
}
|
}
|
||||||
fun estimateSourceSize(source: IAudioSource?): Int {
|
fun estimateSourceSize(source: IAudioSource?): Int {
|
||||||
if(source == null) return 0;
|
if(source == null) return 0;
|
||||||
if(source is IAudioUrlSource) {
|
if(source is IAudioSource) {
|
||||||
if(source.bitrate <= 0 || source.duration?.toInt() ?: 0 == 0)
|
if(source.bitrate <= 0 || source.duration?.toInt() ?: 0 == 0)
|
||||||
return 0;
|
return 0;
|
||||||
return (source.duration!! / 8).toInt() * source.bitrate;
|
return (source.duration!! / 8).toInt() * source.bitrate;
|
||||||
|
@ -205,9 +205,7 @@ class DownloadService : Service() {
|
|||||||
download.targetBitrate = download.audioSource!!.bitrate.toLong();
|
download.targetBitrate = download.audioSource!!.bitrate.toLong();
|
||||||
download.audioSource = null;
|
download.audioSource = null;
|
||||||
}
|
}
|
||||||
if(download.videoDetails == null ||
|
if(download.videoDetails == null || (!download.isVideoDownloadReady || !download.isAudioDownloadReady))
|
||||||
((download.videoSource == null && download.audioSource == null) &&
|
|
||||||
(download.requiresLiveVideoSource && !download.isLiveVideoSourceValid) && (download.requiresLiveAudioSource && !download.isLiveAudioSourceValid)))
|
|
||||||
download.changeState(VideoDownload.State.PREPARING);
|
download.changeState(VideoDownload.State.PREPARING);
|
||||||
notifyDownload(download);
|
notifyDownload(download);
|
||||||
|
|
||||||
@ -224,7 +222,7 @@ class DownloadService : Service() {
|
|||||||
download.progress = progress;
|
download.progress = progress;
|
||||||
|
|
||||||
val currentTime = System.currentTimeMillis();
|
val currentTime = System.currentTimeMillis();
|
||||||
if (currentTime - lastNotifyTime > 500) {
|
if (currentTime - lastNotifyTime > 800) {
|
||||||
notifyDownload(download);
|
notifyDownload(download);
|
||||||
lastNotifyTime = currentTime;
|
lastNotifyTime = currentTime;
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,11 @@
|
|||||||
<data android:host="bilibili.com" />
|
<data android:host="bilibili.com" />
|
||||||
<data android:host="bilibili.tv" />
|
<data android:host="bilibili.tv" />
|
||||||
<data android:host="spotify.com" />
|
<data android:host="spotify.com" />
|
||||||
|
<data android:host="dailymotion.com" />
|
||||||
|
<data android:host="www.dailymotion.com" />
|
||||||
|
<data android:host="bitchute.com" />
|
||||||
|
<data android:host="www.bitchute.com" />
|
||||||
|
<data android:host="old.bitchute.com" />
|
||||||
<data android:pathPrefix="/" />
|
<data android:pathPrefix="/" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter android:autoVerify="true">
|
<intent-filter android:autoVerify="true">
|
||||||
@ -57,6 +62,11 @@
|
|||||||
<data android:host="bilibili.com" />
|
<data android:host="bilibili.com" />
|
||||||
<data android:host="bilibili.tv" />
|
<data android:host="bilibili.tv" />
|
||||||
<data android:host="spotify.com" />
|
<data android:host="spotify.com" />
|
||||||
|
<data android:host="dailymotion.com" />
|
||||||
|
<data android:host="www.dailymotion.com" />
|
||||||
|
<data android:host="bitchute.com" />
|
||||||
|
<data android:host="www.bitchute.com" />
|
||||||
|
<data android:host="old.bitchute.com" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
1
app/src/stable/assets/sources/bitchute
Submodule
1
app/src/stable/assets/sources/bitchute
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 41fe8f79735176cd8a0ae8c971936cafed00fa16
|
1
app/src/stable/assets/sources/dailymotion
Submodule
1
app/src/stable/assets/sources/dailymotion
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 069aa3d31a35559e45c1fe1ea1eb2a94d3b5d120
|
@ -10,7 +10,9 @@
|
|||||||
"aac9e9f0-24b5-11ee-be56-0242ac120002": "sources/patreon/PatreonConfig.json",
|
"aac9e9f0-24b5-11ee-be56-0242ac120002": "sources/patreon/PatreonConfig.json",
|
||||||
"9d703ff5-c556-4962-a990-4f000829cb87": "sources/nebula/NebulaConfig.json",
|
"9d703ff5-c556-4962-a990-4f000829cb87": "sources/nebula/NebulaConfig.json",
|
||||||
"cf8ea74d-ad9b-489e-a083-539b6aa8648c": "sources/bilibili/build/BiliBiliConfig.json",
|
"cf8ea74d-ad9b-489e-a083-539b6aa8648c": "sources/bilibili/build/BiliBiliConfig.json",
|
||||||
"4e365633-6d3f-4267-8941-fdc36631d813": "sources/spotify/build/SpotifyConfig.json"
|
"4e365633-6d3f-4267-8941-fdc36631d813": "sources/spotify/build/SpotifyConfig.json",
|
||||||
|
"9c87e8db-e75d-48f4-afe5-2d203d4b95c5": "sources/dailymotion/build/DailymotionConfig.json",
|
||||||
|
"e8b1ad5f-0c6d-497d-a5fa-0a785a16d902": "sources/bitchute/BitchuteConfig.json"
|
||||||
},
|
},
|
||||||
"SOURCES_EMBEDDED_DEFAULT": [
|
"SOURCES_EMBEDDED_DEFAULT": [
|
||||||
"35ae969a-a7db-11ed-afa1-0242ac120002"
|
"35ae969a-a7db-11ed-afa1-0242ac120002"
|
||||||
|
@ -34,6 +34,11 @@
|
|||||||
<data android:host="bilibili.com" />
|
<data android:host="bilibili.com" />
|
||||||
<data android:host="bilibili.tv" />
|
<data android:host="bilibili.tv" />
|
||||||
<data android:host="spotify.com" />
|
<data android:host="spotify.com" />
|
||||||
|
<data android:host="dailymotion.com" />
|
||||||
|
<data android:host="www.dailymotion.com" />
|
||||||
|
<data android:host="bitchute.com" />
|
||||||
|
<data android:host="www.bitchute.com" />
|
||||||
|
<data android:host="old.bitchute.com" />
|
||||||
<data android:pathPrefix="/" />
|
<data android:pathPrefix="/" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter android:autoVerify="true">
|
<intent-filter android:autoVerify="true">
|
||||||
@ -58,6 +63,11 @@
|
|||||||
<data android:host="bilibili.com" />
|
<data android:host="bilibili.com" />
|
||||||
<data android:host="bilibili.tv" />
|
<data android:host="bilibili.tv" />
|
||||||
<data android:host="spotify.com" />
|
<data android:host="spotify.com" />
|
||||||
|
<data android:host="dailymotion.com" />
|
||||||
|
<data android:host="www.dailymotion.com" />
|
||||||
|
<data android:host="bitchute.com" />
|
||||||
|
<data android:host="www.bitchute.com" />
|
||||||
|
<data android:host="old.bitchute.com" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
1
app/src/unstable/assets/sources/bitchute
Submodule
1
app/src/unstable/assets/sources/bitchute
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 41fe8f79735176cd8a0ae8c971936cafed00fa16
|
1
app/src/unstable/assets/sources/dailymotion
Submodule
1
app/src/unstable/assets/sources/dailymotion
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 069aa3d31a35559e45c1fe1ea1eb2a94d3b5d120
|
@ -10,7 +10,9 @@
|
|||||||
"aac9e9f0-24b5-11ee-be56-0242ac120002": "sources/patreon/PatreonConfig.json",
|
"aac9e9f0-24b5-11ee-be56-0242ac120002": "sources/patreon/PatreonConfig.json",
|
||||||
"9d703ff5-c556-4962-a990-4f000829cb87": "sources/nebula/NebulaConfig.json",
|
"9d703ff5-c556-4962-a990-4f000829cb87": "sources/nebula/NebulaConfig.json",
|
||||||
"cf8ea74d-ad9b-489e-a083-539b6aa8648c": "sources/bilibili/build/BiliBiliConfig.json",
|
"cf8ea74d-ad9b-489e-a083-539b6aa8648c": "sources/bilibili/build/BiliBiliConfig.json",
|
||||||
"4e365633-6d3f-4267-8941-fdc36631d813": "sources/spotify/build/SpotifyConfig.json"
|
"4e365633-6d3f-4267-8941-fdc36631d813": "sources/spotify/build/SpotifyConfig.json",
|
||||||
|
"9c87e8db-e75d-48f4-afe5-2d203d4b95c5": "sources/dailymotion/build/DailymotionConfig.json",
|
||||||
|
"e8b1ad5f-0c6d-497d-a5fa-0a785a16d902": "sources/bitchute/BitchuteConfig.json"
|
||||||
},
|
},
|
||||||
"SOURCES_EMBEDDED_DEFAULT": [
|
"SOURCES_EMBEDDED_DEFAULT": [
|
||||||
"35ae969a-a7db-11ed-afa1-0242ac120002"
|
"35ae969a-a7db-11ed-afa1-0242ac120002"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user