mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Store all syncData instead of only imdbId to make more extendable in the future
This commit is contained in:
parent
d77cc8f98d
commit
1335a322bc
2 changed files with 23 additions and 12 deletions
|
@ -34,6 +34,7 @@ import com.lagradost.cloudstream3.mvvm.*
|
|||
import com.lagradost.cloudstream3.syncproviders.AccountManager
|
||||
import com.lagradost.cloudstream3.syncproviders.SyncAPI
|
||||
import com.lagradost.cloudstream3.syncproviders.providers.Kitsu
|
||||
import com.lagradost.cloudstream3.syncproviders.providers.SimklApi
|
||||
import com.lagradost.cloudstream3.ui.APIRepository
|
||||
import com.lagradost.cloudstream3.ui.WatchType
|
||||
import com.lagradost.cloudstream3.ui.download.DOWNLOAD_NAVIGATE_TO
|
||||
|
@ -878,7 +879,7 @@ class ResultViewModel2 : ViewModel() {
|
|||
response.type,
|
||||
response.posterUrl,
|
||||
response.year,
|
||||
response.getImdbId()
|
||||
response.syncData
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -956,7 +957,7 @@ class ResultViewModel2 : ViewModel() {
|
|||
response.type,
|
||||
response.posterUrl,
|
||||
response.year,
|
||||
response.getImdbId()
|
||||
response.syncData
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1022,7 +1023,7 @@ class ResultViewModel2 : ViewModel() {
|
|||
response.type,
|
||||
response.posterUrl,
|
||||
response.year,
|
||||
response.getImdbId()
|
||||
response.syncData
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1055,8 +1056,10 @@ class ResultViewModel2 : ViewModel() {
|
|||
}
|
||||
|
||||
val duplicateEntries = data.filter {
|
||||
checkDuplicateData.imdbId != null && it.imdbId == checkDuplicateData.imdbId ||
|
||||
normalizeString(it.name) == normalizeString(checkDuplicateData.name) && it.year == checkDuplicateData.year
|
||||
checkDuplicateData.imdbId != null &&
|
||||
getImdbIdFromSyncData(it.syncData) == checkDuplicateData.imdbId ||
|
||||
normalizeString(it.name) == normalizeString(checkDuplicateData.name) &&
|
||||
it.year == checkDuplicateData.year
|
||||
}
|
||||
|
||||
if (duplicateEntries.isEmpty() || context == null) {
|
||||
|
@ -1117,6 +1120,14 @@ class ResultViewModel2 : ViewModel() {
|
|||
.show().setDefaultFocus()
|
||||
}
|
||||
|
||||
private fun getImdbIdFromSyncData(syncData: Map<String, String>?): String? {
|
||||
return normalSafeApiCall {
|
||||
SimklApi.readIdFromString(
|
||||
syncData?.get(AccountManager.simklApi.idPrefix)
|
||||
)[SimklApi.Companion.SyncServices.Imdb]
|
||||
}
|
||||
}
|
||||
|
||||
private fun startChromecast(
|
||||
activity: Activity?,
|
||||
result: ResultEpisode,
|
||||
|
|
|
@ -361,7 +361,7 @@ object DataStoreHelper {
|
|||
@JsonProperty("type") override var type: TvType?,
|
||||
@JsonProperty("posterUrl") override var posterUrl: String?,
|
||||
@JsonProperty("year") open val year: Int?,
|
||||
@JsonProperty("imdbId") open val imdbId: String?,
|
||||
@JsonProperty("syncData") open val syncData: Map<String, String>?,
|
||||
@JsonProperty("quality") override var quality: SearchQuality?,
|
||||
@JsonProperty("posterHeaders") override var posterHeaders: Map<String, String>?
|
||||
) : SearchResponse
|
||||
|
@ -377,10 +377,10 @@ object DataStoreHelper {
|
|||
override var type: TvType?,
|
||||
override var posterUrl: String?,
|
||||
override val year: Int?,
|
||||
override val imdbId: String? = null,
|
||||
override val syncData: Map<String, String>? = null,
|
||||
override var quality: SearchQuality? = null,
|
||||
override var posterHeaders: Map<String, String>? = null
|
||||
) : LibrarySearchResponse(id, latestUpdatedTime, name, url, apiName, type, posterUrl, year, imdbId, quality, posterHeaders) {
|
||||
) : LibrarySearchResponse(id, latestUpdatedTime, name, url, apiName, type, posterUrl, year, syncData, quality, posterHeaders) {
|
||||
fun toLibraryItem(): SyncAPI.LibraryItem? {
|
||||
return SyncAPI.LibraryItem(
|
||||
name,
|
||||
|
@ -405,10 +405,10 @@ object DataStoreHelper {
|
|||
override var type: TvType?,
|
||||
override var posterUrl: String?,
|
||||
override val year: Int?,
|
||||
override val imdbId: String? = null,
|
||||
override val syncData: Map<String, String>? = null,
|
||||
override var quality: SearchQuality? = null,
|
||||
override var posterHeaders: Map<String, String>? = null
|
||||
) : LibrarySearchResponse(id, latestUpdatedTime, name, url, apiName, type, posterUrl, year, imdbId, quality, posterHeaders) {
|
||||
) : LibrarySearchResponse(id, latestUpdatedTime, name, url, apiName, type, posterUrl, year, syncData, quality, posterHeaders) {
|
||||
fun toLibraryItem(id: String): SyncAPI.LibraryItem {
|
||||
return SyncAPI.LibraryItem(
|
||||
name,
|
||||
|
@ -433,10 +433,10 @@ object DataStoreHelper {
|
|||
override var type: TvType?,
|
||||
override var posterUrl: String?,
|
||||
override val year: Int?,
|
||||
override val imdbId: String? = null,
|
||||
override val syncData: Map<String, String>? = null,
|
||||
override var quality: SearchQuality? = null,
|
||||
override var posterHeaders: Map<String, String>? = null
|
||||
) : LibrarySearchResponse(id, latestUpdatedTime, name, url, apiName, type, posterUrl, year, imdbId, quality, posterHeaders) {
|
||||
) : LibrarySearchResponse(id, latestUpdatedTime, name, url, apiName, type, posterUrl, year, syncData, quality, posterHeaders) {
|
||||
fun toLibraryItem(): SyncAPI.LibraryItem? {
|
||||
return SyncAPI.LibraryItem(
|
||||
name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue