commit 3cde2aba9ac0aae2889ef77ce7b01ccb63c35837
parent e4c511ca47c2afdc0885dd8c8e073c25edd3c0e1
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Fri,  1 Sep 2023 20:54:04 +0200

feat(media_downloader): download the whole dash media

Diffstat:
Mapp/src/main/kotlin/me/rhunk/snapenhance/ui/manager/sections/downloads/DownloadsSection.kt | 1+
Mcore/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt | 8++++++++
2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/sections/downloads/DownloadsSection.kt b/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/sections/downloads/DownloadsSection.kt @@ -229,6 +229,7 @@ class DownloadsSection : Section() { } //open FilledIconButton(onClick = { + if (download.outputFile == null) return@FilledIconButton val fileType = runCatching { context.androidContext.contentResolver.openInputStream(Uri.parse(download.outputFile))?.use { input -> FileType.fromInputStream(input) diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt b/core/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt @@ -364,6 +364,14 @@ class MediaDownloader : MessagingRuleFeature("MediaDownloader", MessagingRuleTyp selectedChapters.remove(which) } } + setNegativeButton("Cancel") { dialog, _ -> dialog.dismiss() } + setNeutralButton("Download all") { _, _ -> + provideDownloadManagerClient( + mediaIdentifier = paramMap["STORY_ID"].toString(), + downloadSource = MediaDownloadSource.PUBLIC_STORY, + mediaAuthor = storyName + ).downloadDashMedia(playlistUrl, 0, null) + } setPositiveButton("Download") { dialog, which -> val groups = mutableListOf<MutableList<SnapChapterInfo>>() var currentGroup = mutableListOf<SnapChapterInfo>()