mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-20 03:24:50 +00:00
Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay
This commit is contained in:
commit
bf6530ea81
1 changed files with 11 additions and 2 deletions
|
@ -61,8 +61,17 @@ class StatePlaylists {
|
|||
}
|
||||
fun updateWatchLater(updated: List<SerializedPlatformVideo>) {
|
||||
synchronized(_watchlistStore) {
|
||||
_watchlistStore.deleteAll();
|
||||
_watchlistStore.saveAllAsync(updated);
|
||||
//_watchlistStore.deleteAll();
|
||||
val existing = _watchlistStore.getItems();
|
||||
val toAdd = updated.filter { u -> !existing.any { u.url == it.url } };
|
||||
val toRemove = existing.filter { u -> !updated.any { u.url == it.url } };
|
||||
Logger.i(TAG, "WatchLater changed:\nTo Add:\n" +
|
||||
(if(toAdd.size == 0) "None" else toAdd.map { " + " + it.name }.joinToString("\n")) +
|
||||
"\nTo Remove:\n" +
|
||||
(if(toRemove.size == 0) "None" else toRemove.map { " - " + it.name }.joinToString("\n")));
|
||||
for(remove in toRemove)
|
||||
_watchlistStore.delete(remove);
|
||||
_watchlistStore.saveAllAsync(toAdd);
|
||||
_watchlistOrderStore.set(*updated.map { it.url }.toTypedArray());
|
||||
_watchlistOrderStore.save();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue