mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-08-03 14:50:49 +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>) {
|
fun updateWatchLater(updated: List<SerializedPlatformVideo>) {
|
||||||
synchronized(_watchlistStore) {
|
synchronized(_watchlistStore) {
|
||||||
_watchlistStore.deleteAll();
|
//_watchlistStore.deleteAll();
|
||||||
_watchlistStore.saveAllAsync(updated);
|
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.set(*updated.map { it.url }.toTypedArray());
|
||||||
_watchlistOrderStore.save();
|
_watchlistOrderStore.save();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue