mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-06-13 05:37:48 +02:00
fix(media_downloader): two images overlay merge
This commit is contained in:
@ -380,14 +380,15 @@ class DownloadProcessor (
|
|||||||
|
|
||||||
if (shouldMergeOverlay) {
|
if (shouldMergeOverlay) {
|
||||||
assert(downloadedMedias.size == 2)
|
assert(downloadedMedias.size == 2)
|
||||||
val media = downloadedMedias.values.first { it.fileType.isVideo }
|
//TODO: convert "mp4 images" into real images
|
||||||
val overlayMedia = downloadedMedias.values.first { it.fileType.isImage }
|
val media = downloadedMedias.entries.first { !it.key.isOverlay }.value
|
||||||
|
val overlayMedia = downloadedMedias.entries.first { it.key.isOverlay }.value
|
||||||
|
|
||||||
val renamedMedia = renameFromFileType(media.file, media.fileType)
|
val renamedMedia = renameFromFileType(media.file, media.fileType)
|
||||||
val renamedOverlayMedia = renameFromFileType(overlayMedia.file, overlayMedia.fileType)
|
val renamedOverlayMedia = renameFromFileType(overlayMedia.file, overlayMedia.fileType)
|
||||||
val mergedOverlay: File = File.createTempFile("merged", "." + media.fileType.fileExtension)
|
val mergedOverlay: File = File.createTempFile("merged", ".mp4")
|
||||||
runCatching {
|
runCatching {
|
||||||
callbackOnProgress(translation.format("download_toast", "path" to media.file.nameWithoutExtension))
|
callbackOnProgress(translation.format("processing_toast", "path" to media.file.nameWithoutExtension))
|
||||||
downloadObjectObject.downloadStage = DownloadStage.MERGING
|
downloadObjectObject.downloadStage = DownloadStage.MERGING
|
||||||
|
|
||||||
ffmpegProcessor.execute(FFMpegProcessor.Request(
|
ffmpegProcessor.execute(FFMpegProcessor.Request(
|
||||||
|
@ -7,6 +7,7 @@ data class InputMedia(
|
|||||||
val type: DownloadMediaType,
|
val type: DownloadMediaType,
|
||||||
val encryption: MediaEncryptionKeyPair? = null,
|
val encryption: MediaEncryptionKeyPair? = null,
|
||||||
val messageContentType: String? = null,
|
val messageContentType: String? = null,
|
||||||
|
val isOverlay: Boolean = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
class DownloadRequest(
|
class DownloadRequest(
|
||||||
|
@ -199,7 +199,8 @@ class MediaDownloader : MessagingRuleFeature("MediaDownloader", MessagingRuleTyp
|
|||||||
overlay = InputMedia(
|
overlay = InputMedia(
|
||||||
overlayReference,
|
overlayReference,
|
||||||
DownloadMediaType.fromUri(Uri.parse(overlayReference)),
|
DownloadMediaType.fromUri(Uri.parse(overlayReference)),
|
||||||
overlay.encryption?.toKeyPair()
|
overlay.encryption?.toKeyPair(),
|
||||||
|
isOverlay = true
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
@ -372,7 +373,7 @@ class MediaDownloader : MessagingRuleFeature("MediaDownloader", MessagingRuleTyp
|
|||||||
mediaAuthor = storyName
|
mediaAuthor = storyName
|
||||||
).downloadDashMedia(playlistUrl, 0, null)
|
).downloadDashMedia(playlistUrl, 0, null)
|
||||||
}
|
}
|
||||||
setPositiveButton("Download") { dialog, which ->
|
setPositiveButton("Download") { _, _ ->
|
||||||
val groups = mutableListOf<MutableList<SnapChapterInfo>>()
|
val groups = mutableListOf<MutableList<SnapChapterInfo>>()
|
||||||
var currentGroup = mutableListOf<SnapChapterInfo>()
|
var currentGroup = mutableListOf<SnapChapterInfo>()
|
||||||
var lastChapterIndex = -1
|
var lastChapterIndex = -1
|
||||||
|
Reference in New Issue
Block a user