mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-05-05 17:14:37 +02:00
Download playlist fix for videos without audio file
This commit is contained in:
parent
84b42e9d19
commit
8c9d045e1d
@ -100,6 +100,7 @@ class VideoDownload {
|
|||||||
|
|
||||||
var requireVideoSource: Boolean = false;
|
var requireVideoSource: Boolean = false;
|
||||||
var requireAudioSource: Boolean = false;
|
var requireAudioSource: Boolean = false;
|
||||||
|
var requiredCheck: Boolean = false;
|
||||||
|
|
||||||
@Contextual
|
@Contextual
|
||||||
@Transient
|
@Transient
|
||||||
@ -164,7 +165,7 @@ class VideoDownload {
|
|||||||
onStateChanged.emit(newState);
|
onStateChanged.emit(newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(video: IPlatformVideo, targetPixelCount: Long? = null, targetBitrate: Long? = null) {
|
constructor(video: IPlatformVideo, targetPixelCount: Long? = null, targetBitrate: Long? = null, optionalSources: Boolean = false) {
|
||||||
this.video = SerializedPlatformVideo.fromVideo(video);
|
this.video = SerializedPlatformVideo.fromVideo(video);
|
||||||
this.videoSource = null;
|
this.videoSource = null;
|
||||||
this.audioSource = null;
|
this.audioSource = null;
|
||||||
@ -175,8 +176,9 @@ 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.requireVideoSource = targetPixelCount != null;
|
||||||
this.requireAudioSource = targetBitrate != null; //TODO: May not be a valid check.. can only be determined after live fetch?
|
this.requireAudioSource = targetBitrate != null; //TODO: May not be a valid check.. can only be determined after live fetch?
|
||||||
|
this.requiredCheck = optionalSources;
|
||||||
}
|
}
|
||||||
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);
|
||||||
@ -250,6 +252,30 @@ class VideoDownload {
|
|||||||
if(original !is IPlatformVideoDetails)
|
if(original !is IPlatformVideoDetails)
|
||||||
throw IllegalStateException("Original content is not media?");
|
throw IllegalStateException("Original content is not media?");
|
||||||
|
|
||||||
|
if(requiredCheck) {
|
||||||
|
if(original.video is VideoUnMuxedSourceDescriptor) {
|
||||||
|
if(requireVideoSource) {
|
||||||
|
if((original.video as VideoUnMuxedSourceDescriptor).audioSources.any() && !original.video.videoSources.any()) {
|
||||||
|
requireVideoSource = false;
|
||||||
|
targetPixelCount = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(requireAudioSource) {
|
||||||
|
if(!(original.video as VideoUnMuxedSourceDescriptor).audioSources.any() && original.video.videoSources.any()) {
|
||||||
|
requireAudioSource = false;
|
||||||
|
targetBitrate = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(requireAudioSource) {
|
||||||
|
requireAudioSource = false;
|
||||||
|
targetBitrate = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
requiredCheck = false;
|
||||||
|
}
|
||||||
|
|
||||||
if(original.video.hasAnySource() && !original.isDownloadable()) {
|
if(original.video.hasAnySource() && !original.isDownloadable()) {
|
||||||
Logger.i(TAG, "Attempted to download unsupported video [${original.name}]:${original.url}");
|
Logger.i(TAG, "Attempted to download unsupported video [${original.name}]:${original.url}");
|
||||||
throw DownloadException("Unsupported video for downloading", false);
|
throw DownloadException("Unsupported video for downloading", false);
|
||||||
|
@ -251,7 +251,7 @@ class StateDownloads {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Logger.i(TAG, "New watchlater video ${item.name}");
|
Logger.i(TAG, "New watchlater video ${item.name}");
|
||||||
download(VideoDownload(item, playlistDownload.targetPxCount, playlistDownload.targetBitrate)
|
download(VideoDownload(item, playlistDownload.targetPxCount, playlistDownload.targetBitrate, true)
|
||||||
.withGroup(VideoDownload.GROUP_WATCHLATER, VideoDownload.GROUP_WATCHLATER), false);
|
.withGroup(VideoDownload.GROUP_WATCHLATER, VideoDownload.GROUP_WATCHLATER), false);
|
||||||
hasNew = true;
|
hasNew = true;
|
||||||
}
|
}
|
||||||
@ -296,7 +296,7 @@ class StateDownloads {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Logger.i(TAG, "New playlist video ${item.name}");
|
Logger.i(TAG, "New playlist video ${item.name}");
|
||||||
download(VideoDownload(item, playlistDownload.targetPxCount, playlistDownload.targetBitrate)
|
download(VideoDownload(item, playlistDownload.targetPxCount, playlistDownload.targetBitrate, true)
|
||||||
.withGroup(VideoDownload.GROUP_PLAYLIST, playlist.id), false);
|
.withGroup(VideoDownload.GROUP_PLAYLIST, playlist.id), false);
|
||||||
hasNew = true;
|
hasNew = true;
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 77b9012590ef98afce8659b154028aff85834eb2
|
Subproject commit 8ddb2e2f15bf907bd8523aac4326b92b8e3b0e8e
|
@ -1 +1 @@
|
|||||||
Subproject commit cbfe372bcc7bf9c339809c30291b85c53bfa2f7d
|
Subproject commit 6811ff4b412cfb94ff74c3b2b88f7d87b76e8902
|
@ -1 +1 @@
|
|||||||
Subproject commit e1fa498059f481a81639fef3b62adc2ec05a95dd
|
Subproject commit 59d694b619e9a60d1c2d7315c87c51672383ffc5
|
@ -1 +1 @@
|
|||||||
Subproject commit 77b9012590ef98afce8659b154028aff85834eb2
|
Subproject commit 8ddb2e2f15bf907bd8523aac4326b92b8e3b0e8e
|
@ -1 +1 @@
|
|||||||
Subproject commit cbfe372bcc7bf9c339809c30291b85c53bfa2f7d
|
Subproject commit 6811ff4b412cfb94ff74c3b2b88f7d87b76e8902
|
@ -1 +1 @@
|
|||||||
Subproject commit e1fa498059f481a81639fef3b62adc2ec05a95dd
|
Subproject commit 59d694b619e9a60d1c2d7315c87c51672383ffc5
|
Loading…
x
Reference in New Issue
Block a user