From 019e9a0c4fdecccb53a8fb04b0c9a3270375e1f9 Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Sat, 21 Jan 2023 14:21:36 +0100 Subject: [PATCH] More work on local list support --- .../cloudstream3/syncproviders/SyncAPI.kt | 62 +++++++++++++++++-- .../cloudstream3/syncproviders/SyncRepo.kt | 3 +- .../syncproviders/providers/AniListApi.kt | 27 ++++---- .../syncproviders/providers/LocalList.kt | 29 +++++++-- .../syncproviders/providers/MALApi.kt | 12 ++-- .../ui/library/LibraryFragment.kt | 13 ++-- .../ui/library/LibraryViewModel.kt | 20 ++++-- .../cloudstream3/ui/library/PageAdapter.kt | 7 ++- .../ui/library/ViewpagerAdapter.kt | 52 +--------------- .../lagradost/cloudstream3/utils/AppUtils.kt | 16 ++--- .../cloudstream3/utils/DataStoreHelper.kt | 11 ++-- 11 files changed, 143 insertions(+), 109 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/SyncAPI.kt b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/SyncAPI.kt index a52745dd..ca562e88 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/SyncAPI.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/SyncAPI.kt @@ -1,7 +1,8 @@ package com.lagradost.cloudstream3.syncproviders import com.lagradost.cloudstream3.* -import com.lagradost.cloudstream3.ui.library.LibraryItem +import com.lagradost.cloudstream3.ui.library.ListSorting +import me.xdrop.fuzzywuzzy.FuzzySearch enum class SyncIdName { Anilist, @@ -37,9 +38,9 @@ interface SyncAPI : OAuth2API { suspend fun search(name: String): List? - suspend fun getPersonalLibrary(): List? + suspend fun getPersonalLibrary(): LibraryMetadata? - fun getIdFromUrl(url : String) : String + fun getIdFromUrl(url: String): String data class SyncSearchResult( override val name: String, @@ -59,7 +60,7 @@ interface SyncAPI : OAuth2API { val score: Int?, val watchedEpisodes: Int?, var isFavorite: Boolean? = null, - var maxEpisodes : Int? = null, + var maxEpisodes: Int? = null, ) data class SyncResult( @@ -80,9 +81,9 @@ interface SyncAPI : OAuth2API { var genres: List? = null, var synonyms: List? = null, var trailers: List? = null, - var isAdult : Boolean? = null, + var isAdult: Boolean? = null, var posterUrl: String? = null, - var backgroundPosterUrl : String? = null, + var backgroundPosterUrl: String? = null, /** In unixtime */ var startDate: Long? = null, @@ -93,4 +94,53 @@ interface SyncAPI : OAuth2API { var prevSeason: SyncSearchResult? = null, var actors: List? = null, ) + + + data class Page( + val title: String, var items: List + ) { + fun sort(method: ListSorting?, query: String? = null) { + items = when (method) { + ListSorting.Query -> + if (query != null) { + items.sortedBy { + -FuzzySearch.partialRatio( + query.lowercase(), it.name.lowercase() + ) + } + } else items + ListSorting.RatingHigh -> items.sortedBy { -(it.personalRating ?: 0) } + ListSorting.RatingLow -> items.sortedBy { (it.personalRating ?: 0) } + ListSorting.AlphabeticalA -> items.sortedBy { it.name } + ListSorting.AlphabeticalZ -> items.sortedBy { it.name }.reversed() + else -> items + } + } + } + + data class LibraryMetadata( + /** List of all available pages, useful to show empty pages + * if the user has no entry on that page */ + val allListNames: List, + /** Not necessarily sorted list of all library items, will be grouped by listName */ + val allLibraryItems: List + ) + + data class LibraryItem( + override val name: String, + override val url: String, + /** Unique unchanging string used for data storage */ + val syncId: String, + val listName: String, + val episodesCompleted: Int?, + val episodesTotal: Int?, + /** Out of 100 */ + val personalRating: Int?, + override val apiName: String, + override var type: TvType?, + override var posterUrl: String?, + override var posterHeaders: Map?, + override var quality: SearchQuality?, + override var id: Int? = null, + ) : SearchResponse } \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/SyncRepo.kt b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/SyncRepo.kt index dea58434..6331cb9d 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/SyncRepo.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/SyncRepo.kt @@ -4,7 +4,6 @@ import com.lagradost.cloudstream3.ErrorLoadingException import com.lagradost.cloudstream3.mvvm.Resource import com.lagradost.cloudstream3.mvvm.normalSafeApiCall import com.lagradost.cloudstream3.mvvm.safeApiCall -import com.lagradost.cloudstream3.ui.library.LibraryItem class SyncRepo(private val repo: SyncAPI) { val idPrefix = repo.idPrefix @@ -30,7 +29,7 @@ class SyncRepo(private val repo: SyncAPI) { return safeApiCall { repo.search(query) ?: throw ErrorLoadingException() } } - suspend fun getPersonalLibrary(): Resource> { + suspend fun getPersonalLibrary(): Resource { return safeApiCall { repo.getPersonalLibrary() ?: throw ErrorLoadingException() } } diff --git a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/AniListApi.kt b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/AniListApi.kt index edc82746..def5f122 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/AniListApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/AniListApi.kt @@ -11,7 +11,6 @@ import com.lagradost.cloudstream3.syncproviders.AccountManager import com.lagradost.cloudstream3.syncproviders.AuthAPI import com.lagradost.cloudstream3.syncproviders.SyncAPI import com.lagradost.cloudstream3.syncproviders.SyncIdName -import com.lagradost.cloudstream3.ui.library.LibraryItem import com.lagradost.cloudstream3.utils.AppUtils.parseJson import com.lagradost.cloudstream3.utils.AppUtils.splitQuery import com.lagradost.cloudstream3.utils.AppUtils.toJson @@ -598,8 +597,8 @@ class AniListApi(index: Int) : AccountManager(index), SyncAPI { @JsonProperty("private") val private: Boolean, @JsonProperty("media") val media: Media ) { - fun toLibraryItem(listName: String?): LibraryItem? { - return LibraryItem( + fun toLibraryItem(listName: String?): SyncAPI.LibraryItem? { + return SyncAPI.LibraryItem( // English title first this.media.title.english ?: this.media.title.romaji ?: this.media.synonyms.firstOrNull() @@ -612,7 +611,8 @@ class AniListApi(index: Int) : AccountManager(index), SyncAPI { this.score, "AniList", TvType.Anime, - this.media.coverImage.extraLarge ?: this.media.coverImage.large ?: this.media.coverImage.medium, + this.media.coverImage.extraLarge ?: this.media.coverImage.large + ?: this.media.coverImage.medium, null, null, null @@ -653,14 +653,17 @@ class AniListApi(index: Int) : AccountManager(index), SyncAPI { } } - override suspend fun getPersonalLibrary(): List? { - return getAniListAnimeListSmart()?.map { - it.entries.mapNotNull { entry -> - entry.toLibraryItem( - entry.status ?: it.status - ) - } - }?.flatten() + override suspend fun getPersonalLibrary(): SyncAPI.LibraryMetadata { + return SyncAPI.LibraryMetadata( + emptyList(), + getAniListAnimeListSmart()?.map { + it.entries.mapNotNull { entry -> + entry.toLibraryItem( + entry.status ?: it.status + ) + } + }?.flatten() ?: emptyList() + ) } private suspend fun getFullAniListList(): FullAnilistList? { diff --git a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/LocalList.kt b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/LocalList.kt index d3dc5314..41ea30f7 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/LocalList.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/LocalList.kt @@ -1,10 +1,12 @@ package com.lagradost.cloudstream3.syncproviders.providers +import com.lagradost.cloudstream3.AcraApplication import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.syncproviders.AuthAPI import com.lagradost.cloudstream3.syncproviders.SyncAPI import com.lagradost.cloudstream3.syncproviders.SyncIdName -import com.lagradost.cloudstream3.ui.library.LibraryItem +import com.lagradost.cloudstream3.ui.WatchType +import com.lagradost.cloudstream3.ui.result.txt import com.lagradost.cloudstream3.utils.Coroutines.ioWork import com.lagradost.cloudstream3.utils.DataStoreHelper.getAllWatchStateIds import com.lagradost.cloudstream3.utils.DataStoreHelper.getBookmarkedData @@ -17,8 +19,12 @@ class LocalList : SyncAPI { override val createAccountUrl: Nothing? = null override val idPrefix = "local" - override fun loginInfo(): AuthAPI.LoginInfo? { - return null + override fun loginInfo(): AuthAPI.LoginInfo { + return AuthAPI.LoginInfo( + null, + null, + 0 + ) } override fun logOut() { @@ -52,18 +58,29 @@ class LocalList : SyncAPI { return null } - override suspend fun getPersonalLibrary(): List { + override suspend fun getPersonalLibrary(): SyncAPI.LibraryMetadata? { val watchStatusIds = ioWork { getAllWatchStateIds()?.map { id -> Pair(id, getResultWatchState(id)) } - }?.distinctBy { it.first } ?: return emptyList() + }?.distinctBy { it.first } ?: return null - return ioWork { + val list = ioWork { watchStatusIds.mapNotNull { getBookmarkedData(it.first)?.toLibraryItem(it.second) } } + + return SyncAPI.LibraryMetadata( + WatchType.values().mapNotNull { + // None is not something to display + if (it == WatchType.NONE) return@mapNotNull null + + // Dirty hack for context! + txt(it.stringRes).asStringNull(AcraApplication.context) + }, + list + ) } override fun getIdFromUrl(url: String): String { diff --git a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/MALApi.kt b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/MALApi.kt index c202e7bc..2c155ae7 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/MALApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/MALApi.kt @@ -14,7 +14,6 @@ import com.lagradost.cloudstream3.syncproviders.AccountManager import com.lagradost.cloudstream3.syncproviders.AuthAPI import com.lagradost.cloudstream3.syncproviders.SyncAPI import com.lagradost.cloudstream3.syncproviders.SyncIdName -import com.lagradost.cloudstream3.ui.library.LibraryItem import com.lagradost.cloudstream3.utils.AppUtils.parseJson import com.lagradost.cloudstream3.utils.AppUtils.splitQuery import com.lagradost.cloudstream3.utils.DataStore.toKotlinObject @@ -386,8 +385,8 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI { @JsonProperty("node") val node: Node, @JsonProperty("list_status") val list_status: ListStatus?, ) { - fun toLibraryItem(): LibraryItem { - return LibraryItem( + fun toLibraryItem(): SyncAPI.LibraryItem { + return SyncAPI.LibraryItem( this.node.title, "https://myanimelist.net/anime/${this.node.id}/", this.node.id.toString(), @@ -445,8 +444,11 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI { } } - override suspend fun getPersonalLibrary(): List? { - return getMalAnimeListSmart()?.map { it.toLibraryItem() } + override suspend fun getPersonalLibrary(): SyncAPI.LibraryMetadata { + return SyncAPI.LibraryMetadata( + emptyList(), + getMalAnimeListSmart()?.map { it.toLibraryItem() } ?: emptyList() + ) } private suspend fun getMalAnimeList(): Array { diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryFragment.kt index 2009afba..996c5a33 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryFragment.kt @@ -15,6 +15,7 @@ import com.lagradost.cloudstream3.AcraApplication.Companion.setKey import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.mvvm.debugAssert import com.lagradost.cloudstream3.mvvm.observe +import com.lagradost.cloudstream3.syncproviders.SyncAPI import com.lagradost.cloudstream3.syncproviders.SyncIdName import com.lagradost.cloudstream3.ui.result.txt import com.lagradost.cloudstream3.ui.search.SEARCH_ACTION_LOAD @@ -126,7 +127,8 @@ class LibraryFragment : Fragment() { // If provider savedSelection.openType == LibraryOpenerType.Provider && savedSelection.providerData?.apiName != null -> { - availableProviders.indexOf(savedSelection.providerData.apiName).takeIf { it != -1 } + availableProviders.indexOf(savedSelection.providerData.apiName) + .takeIf { it != -1 } ?.plus(baseOptions.size) ?: -1 } // Else base option @@ -167,7 +169,7 @@ class LibraryFragment : Fragment() { viewpager?.setPageTransformer(LibraryScrollTransformer()) viewpager?.adapter = - viewpager.adapter ?: ViewpagerAdapter(emptyList(), { isScrollingDown: Boolean -> + viewpager.adapter ?: ViewpagerAdapter(mutableListOf(), { isScrollingDown: Boolean -> if (isScrollingDown) { sort_fab?.shrink() } else { @@ -177,11 +179,11 @@ class LibraryFragment : Fragment() { // To prevent future accidents debugAssert({ - searchClickCallback.card !is LibraryItem + searchClickCallback.card !is SyncAPI.LibraryItem }, { "searchClickCallback ${searchClickCallback.card} is not a LibraryItem" }) - val syncId = (searchClickCallback.card as LibraryItem).syncId + val syncId = (searchClickCallback.card as SyncAPI.LibraryItem).syncId println("SEARCH CLICK $searchClickCallback") when (searchClickCallback.action) { @@ -200,7 +202,8 @@ class LibraryFragment : Fragment() { observe(libraryViewModel.pages) { pages -> (viewpager.adapter as? ViewpagerAdapter)?.pages = pages - viewpager.adapter?.notifyItemChanged(viewpager?.currentItem ?: 0) + // Using notifyItemRangeChanged keeps the animations when sorting + viewpager.adapter?.notifyItemRangeChanged(0, viewpager.adapter?.itemCount ?: 0) TabLayoutMediator( library_tab_layout, diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryViewModel.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryViewModel.kt index 8548bf5c..266ae94a 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryViewModel.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryViewModel.kt @@ -7,6 +7,7 @@ import androidx.lifecycle.ViewModel import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.mvvm.Resource import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.SyncApis +import com.lagradost.cloudstream3.syncproviders.SyncAPI import com.lagradost.cloudstream3.utils.Coroutines.ioSafe enum class ListSorting(@StringRes val stringRes: Int) { @@ -20,8 +21,8 @@ enum class ListSorting(@StringRes val stringRes: Int) { } class LibraryViewModel : ViewModel() { - private val _pages: MutableLiveData> = MutableLiveData(emptyList()) - val pages: LiveData> = _pages + private val _pages: MutableLiveData> = MutableLiveData(emptyList()) + val pages: LiveData> = _pages private val _currentApiName: MutableLiveData = MutableLiveData("") val currentApiName: LiveData = _currentApiName @@ -65,15 +66,22 @@ class LibraryViewModel : ViewModel() { fun loadPages() { ioSafe { currentSyncApi?.let { repo -> - val list = (repo.getPersonalLibrary() as? Resource.Success)?.value - val pages = (list ?: emptyList()).groupBy { it.listName }.map { - Page( + _currentApiName.postValue(repo.name) + val library = (repo.getPersonalLibrary() as? Resource.Success)?.value ?: return@let + + val listSubset = library.allLibraryItems.groupBy { it.listName } + val allLists = library.allListNames.associateWith { emptyList() } + + val filledLists = allLists + listSubset + + val pages = filledLists.map { + SyncAPI.Page( it.key, it.value ) } + println("PAGES $pages") _pages.postValue(pages) - _currentApiName.postValue(repo.name) } } } diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/library/PageAdapter.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/library/PageAdapter.kt index 4bac94e2..26872b10 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/library/PageAdapter.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/library/PageAdapter.kt @@ -6,16 +6,17 @@ import android.view.ViewGroup import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView import com.lagradost.cloudstream3.R +import com.lagradost.cloudstream3.syncproviders.SyncAPI import com.lagradost.cloudstream3.ui.search.SearchClickCallback import com.lagradost.cloudstream3.ui.search.SearchResultBuilder import com.lagradost.cloudstream3.utils.AppUtils import kotlinx.android.synthetic.main.search_result_grid_expanded.view.* class PageAdapter( - override val items: MutableList, + override val items: MutableList, val clickCallback: (SearchClickCallback) -> Unit ) : - AppUtils.DiffAdapter(items) { + AppUtils.DiffAdapter(items) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { return LibraryItemViewHolder( @@ -33,7 +34,7 @@ class PageAdapter( } inner class LibraryItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { - fun bind(item: LibraryItem, position: Int) { + fun bind(item: SyncAPI.LibraryItem, position: Int) { SearchResultBuilder.bind( this@PageAdapter.clickCallback, item, diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/library/ViewpagerAdapter.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/library/ViewpagerAdapter.kt index cab6066e..3a439ffa 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/library/ViewpagerAdapter.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/library/ViewpagerAdapter.kt @@ -4,62 +4,16 @@ import android.os.Build import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import androidx.core.widget.NestedScrollView import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView.OnFlingListener -import androidx.recyclerview.widget.RecyclerView.OnScrollListener import com.lagradost.cloudstream3.R -import com.lagradost.cloudstream3.SearchQuality -import com.lagradost.cloudstream3.SearchResponse -import com.lagradost.cloudstream3.TvType +import com.lagradost.cloudstream3.syncproviders.SyncAPI import com.lagradost.cloudstream3.ui.search.SearchClickCallback import com.lagradost.cloudstream3.utils.UIHelper.getSpanCount import kotlinx.android.synthetic.main.library_viewpager_page.view.* -import me.xdrop.fuzzywuzzy.FuzzySearch - -data class Page( - val title: String, var items: List -) { - fun sort(method: ListSorting?, query: String? = null) { - items = when (method) { - ListSorting.Query -> - if (query != null) { - items.sortedBy { - -FuzzySearch.partialRatio( - query.lowercase(), it.name.lowercase() - ) - } - } else items - ListSorting.RatingHigh -> items.sortedBy { -(it.personalRating ?: 0) } - ListSorting.RatingLow -> items.sortedBy { (it.personalRating ?: 0) } - ListSorting.AlphabeticalA -> items.sortedBy { it.name } - ListSorting.AlphabeticalZ -> items.sortedBy { it.name }.reversed() - else -> items - } - } -} - -data class LibraryItem( - override val name: String, - override val url: String, - /** Unique unchanging string used for data storage */ - val syncId: String, - val listName: String, - val episodesCompleted: Int?, - val episodesTotal: Int?, - /** Out of 100 */ - val personalRating: Int?, - override val apiName: String, - override var type: TvType?, - override var posterUrl: String?, - override var posterHeaders: Map?, - override var quality: SearchQuality?, - override var id: Int? = null, -) : SearchResponse - class ViewpagerAdapter( - var pages: List, + var pages: List, val scrollCallback: (isScrollingDown: Boolean) -> Unit, val clickCallback: (SearchClickCallback) -> Unit ) : RecyclerView.Adapter() { @@ -80,7 +34,7 @@ class ViewpagerAdapter( inner class PageViewHolder(private val itemViewTest: View) : RecyclerView.ViewHolder(itemViewTest) { - fun bind(page: Page) { + fun bind(page: SyncAPI.Page) { if (itemViewTest.page_recyclerview?.adapter == null) { itemViewTest.page_recyclerview?.adapter = PageAdapter(page.items.toMutableList(), clickCallback) itemView.page_recyclerview?.spanCount = diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/AppUtils.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/AppUtils.kt index 2e9e0c88..f25d20ba 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/AppUtils.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/AppUtils.kt @@ -277,18 +277,14 @@ object AppUtils { } fun updateList(newList: List) { - val time = measureTimeMillis { + val diffResult = DiffUtil.calculateDiff( + GenericDiffCallback(this.items, newList) + ) - val diffResult = DiffUtil.calculateDiff( - GenericDiffCallback(this.items, newList) - ) + items.clear() + items.addAll(newList) - items.clear() - items.addAll(newList) - - diffResult.dispatchUpdatesTo(this) - } - println("TIME TAKEn $time") + diffResult.dispatchUpdatesTo(this) } inner class GenericDiffCallback( diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/DataStoreHelper.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/DataStoreHelper.kt index bd40586a..b5684662 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/DataStoreHelper.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/DataStoreHelper.kt @@ -11,10 +11,8 @@ import com.lagradost.cloudstream3.DubStatus import com.lagradost.cloudstream3.SearchQuality import com.lagradost.cloudstream3.SearchResponse import com.lagradost.cloudstream3.TvType -import com.lagradost.cloudstream3.syncproviders.SyncIdName -import com.lagradost.cloudstream3.syncproviders.providers.LocalList +import com.lagradost.cloudstream3.syncproviders.SyncAPI import com.lagradost.cloudstream3.ui.WatchType -import com.lagradost.cloudstream3.ui.library.LibraryItem const val VIDEO_POS_DUR = "video_pos_dur" const val RESULT_WATCH_STATE = "result_watch_state" @@ -54,8 +52,8 @@ object DataStoreHelper { @JsonProperty("quality") override var quality: SearchQuality? = null, @JsonProperty("posterHeaders") override var posterHeaders: Map? = null, ) : SearchResponse { - fun toLibraryItem(state: WatchType): LibraryItem { - return LibraryItem( + fun toLibraryItem(state: WatchType): SyncAPI.LibraryItem { + return SyncAPI.LibraryItem( name, url, url, @@ -86,6 +84,9 @@ object DataStoreHelper { @JsonProperty("posterHeaders") override var posterHeaders: Map? = null, ) : SearchResponse + /** + * A datastore wide account for future implementations of a multiple account system + **/ private var currentAccount: String = "0" //TODO ACCOUNT IMPLEMENTATION fun getAllWatchStateIds(): List? {