future proofed SyncID

This commit is contained in:
Blatzar 2023-01-28 23:36:24 +01:00
parent cd166cb0d3
commit df95931d0a
3 changed files with 9 additions and 5 deletions

View file

@ -138,7 +138,11 @@ interface SyncAPI : OAuth2API {
data class LibraryItem( data class LibraryItem(
override val name: String, override val name: String,
override val url: String, override val url: String,
/** Unique unchanging string used for data storage */ /**
* Unique unchanging string used for data storage.
* This should be the actual id when you change scores and status
* since score changes from library might get added in the future.
**/
val syncId: String, val syncId: String,
val episodesCompleted: Int?, val episodesCompleted: Int?,
val episodesTotal: Int?, val episodesTotal: Int?,

View file

@ -72,7 +72,7 @@ class LocalList : SyncAPI {
it.second.stringRes it.second.stringRes
}.mapValues { group -> }.mapValues { group ->
group.value.mapNotNull { group.value.mapNotNull {
getBookmarkedData(it.first)?.toLibraryItem() getBookmarkedData(it.first)?.toLibraryItem(it.first.toString())
} }
} }
} }

View file

@ -55,16 +55,16 @@ object DataStoreHelper {
@JsonProperty("quality") override var quality: SearchQuality? = null, @JsonProperty("quality") override var quality: SearchQuality? = null,
@JsonProperty("posterHeaders") override var posterHeaders: Map<String, String>? = null, @JsonProperty("posterHeaders") override var posterHeaders: Map<String, String>? = null,
) : SearchResponse { ) : SearchResponse {
fun toLibraryItem(): SyncAPI.LibraryItem { fun toLibraryItem(id: String): SyncAPI.LibraryItem {
return SyncAPI.LibraryItem( return SyncAPI.LibraryItem(
name, name,
url, url,
url, id,
null, null,
null, null,
null, null,
null, null,
apiName, type, posterUrl, posterHeaders, quality, id apiName, type, posterUrl, posterHeaders, quality, this.id
) )
} }
} }