From 05ca01185dd1ebc1f3ecaa9abc604859d7a56563 Mon Sep 17 00:00:00 2001
From: Luna712 <142361265+Luna712@users.noreply.github.com>
Date: Tue, 31 Dec 2024 10:01:41 -0700
Subject: [PATCH] Add new TVTypes for generic Audio and Podcast (#1442)
* Add new TVTypes for generic Audio and Podcast
* Use when
---
.../ui/result/ResultViewModel2.kt | 4 ++++
app/src/main/res/values/strings.xml | 2 ++
.../com/lagradost/cloudstream3/MainAPI.kt | 24 ++++++++++++++++---
3 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultViewModel2.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultViewModel2.kt
index 976aa702f9..1066adb70d 100644
--- a/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultViewModel2.kt
+++ b/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultViewModel2.kt
@@ -249,6 +249,8 @@ fun LoadResponse.toResultData(repo: APIRepository): ResultData {
TvType.Music -> R.string.music_singlar
TvType.AudioBook -> R.string.audio_book_singular
TvType.CustomMedia -> R.string.custom_media_singluar
+ TvType.Audio -> R.string.audio_singluar
+ TvType.Podcast -> R.string.podcast_singluar
}
),
yearText = txt(year?.toString()),
@@ -650,6 +652,8 @@ class ResultViewModel2 : ViewModel() {
TvType.Music -> "Music"
TvType.AudioBook -> "AudioBooks"
TvType.CustomMedia -> "Media"
+ TvType.Audio -> "Audio"
+ TvType.Podcast -> "Podcasts"
}
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5d0c3d3df4..6c35b8bf95 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -373,6 +373,8 @@
Music
Audio Book
Media
+ Audio
+ Podcast
Source error
Remote error
Renderer error
diff --git a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/MainAPI.kt b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/MainAPI.kt
index 50dd667b45..fb5ef8479c 100644
--- a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/MainAPI.kt
+++ b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/MainAPI.kt
@@ -681,8 +681,11 @@ enum class TvType(value: Int?) {
Music(13),
AudioBook(14),
- /** Wont load the built in player, make your own interaction */
+ /** Won't load the built in player, make your own interaction */
CustomMedia(15),
+
+ Audio(16),
+ Podcast(17),
}
public enum class AutoDownloadMode(val value: Int) {
@@ -698,9 +701,24 @@ public enum class AutoDownloadMode(val value: Int) {
}
}
-// IN CASE OF FUTURE ANIME MOVIE OR SMTH
fun TvType.isMovieType(): Boolean {
- return this == TvType.Movie || this == TvType.AnimeMovie || this == TvType.Torrent || this == TvType.Live
+ return when (this) {
+ TvType.AnimeMovie,
+ TvType.Live,
+ TvType.Movie,
+ TvType.Torrent -> true
+ else -> false
+ }
+}
+
+fun TvType.isAudioType(): Boolean {
+ return when (this) {
+ TvType.Audio,
+ TvType.AudioBook,
+ TvType.Music,
+ TvType.Podcast -> true
+ else -> false
+ }
}
fun TvType.isLiveStream(): Boolean {