Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup redundant warnings in MainAPI #1513

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions library/src/commonMain/kotlin/com/lagradost/cloudstream3/MainAPI.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
@file:Suppress(
"UNUSED",
"UnusedReceiverParameter",
"MemberVisibilityCanBePrivate"
)

package com.lagradost.cloudstream3

import com.fasterxml.jackson.annotation.JsonProperty
Expand Down Expand Up @@ -49,8 +55,6 @@ object APIHolder {
val unixTimeMS: Long
get() = System.currentTimeMillis()

private const val defProvider = 0

// ConcurrentModificationException is possible!!!
val allProviders = threadSafeListOf<MainAPI>()

Expand Down Expand Up @@ -728,6 +732,7 @@ enum class DubStatus(val id: Int) {
Subbed(0),
}

@Suppress("UNUSED_PARAMETER")
enum class TvType(value: Int?) {
Movie(1),
AnimeMovie(2),
Expand All @@ -751,16 +756,15 @@ enum class TvType(value: Int?) {
Podcast(17),
}

public enum class AutoDownloadMode(val value: Int) {
enum class AutoDownloadMode(val value: Int) {
Disable(0),
FilterByLang(1),
All(2),
NsfwOnly(3)
;
NsfwOnly(3);

companion object {
infix fun getEnum(value: Int): AutoDownloadMode? =
AutoDownloadMode.values().firstOrNull { it.value == value }
entries.firstOrNull { it.value == value }
}
}

Expand Down Expand Up @@ -837,6 +841,7 @@ data class HomePageList(
/** enum class holds search quality.
*
* [Movie release types](https://en.wikipedia.org/wiki/Pirated_movie_release_types)**/
@Suppress("UNUSED_PARAMETER")
enum class SearchQuality(value: Int?) {
Cam(1),
CamRip(2),
Expand Down Expand Up @@ -1374,6 +1379,7 @@ interface LoadResponse {
}

/**better to call addTrailer with multiple trailers directly instead of calling this multiple times*/
@Suppress("RedundantSuspendModifier")
suspend fun LoadResponse.addTrailer(
trailerUrl: String?,
referer: String? = null,
Expand Down Expand Up @@ -1413,6 +1419,7 @@ interface LoadResponse {
trailers.addAll(newTrailers.map { TrailerData(listOf(it)) })
}*/

@Suppress("RedundantSuspendModifier")
suspend fun LoadResponse.addTrailer(
trailerUrls: List<String>?,
referer: String? = null,
Expand Down Expand Up @@ -1451,10 +1458,12 @@ interface LoadResponse {
this.addSimklId(SimklSyncServices.Imdb, id)
}

@Suppress("UNUSED_PARAMETER")
fun LoadResponse.addTrackId(id: String?) {
// TODO add trackt sync
}

@Suppress("UNUSED_PARAMETER")
fun LoadResponse.addkitsuId(id: String?) {
// TODO add kitsu sync
}
Expand Down Expand Up @@ -1487,10 +1496,10 @@ fun getDurationFromString(input: String?): Int? {
Regex("(\\d+\\shr)|(\\d+\\shour)|(\\d+\\smin)|(\\d+\\ssec)").findAll(input).let { values ->
var seconds = 0
values.forEach {
val time_text = it.value
if (time_text.isNotBlank()) {
val time = time_text.filter { s -> s.isDigit() }.trim().toInt()
val scale = time_text.filter { s -> !s.isDigit() }.trim()
val timeText = it.value
if (timeText.isNotBlank()) {
val time = timeText.filter { s -> s.isDigit() }.trim().toInt()
val scale = timeText.filter { s -> !s.isDigit() }.trim()
//println("Scale: $scale")
val timeval = when (scale) {
"hr", "hour" -> time * 60 * 60
Expand All @@ -1516,9 +1525,9 @@ fun getDurationFromString(input: String?): Int? {
}
Regex("([0-9]*)m").find(cleanInput)?.groupValues?.let { values ->
if (values.size == 2) {
val return_value = values[1].toIntOrNull()
if (return_value != null) {
return return_value
val returnValue = values[1].toIntOrNull()
if (returnValue != null) {
return returnValue
}
}
}
Expand Down
Loading