[feat] Fix local detection logic defects
This commit is contained in:
@@ -227,7 +227,7 @@ class TransmissionScreenViewModel @Inject constructor(
|
||||
|
||||
downloads.clear()
|
||||
idToState.clear()
|
||||
downloaded.sortedWith(compareBy(naturalOrder()) { it.extras.getString("name", "") })
|
||||
downloaded.filter { it.extras.getString("type", "") == "main" }.sortedWith(compareBy(naturalOrder()) { it.extras.getString("name", "") })
|
||||
.forEach { d ->
|
||||
val s = downloadToState(d)
|
||||
downloads.add(s)
|
||||
|
||||
@@ -110,6 +110,8 @@ class VideoPlayerViewModel @Inject constructor(
|
||||
{
|
||||
vs = oId.split("|")[0].split(",").map { it.split("/") }.toMutableList()
|
||||
spec = oId.split("|")[1]
|
||||
}else{
|
||||
vs = oId.split(",").map { it.split("/") }.toMutableList()
|
||||
}
|
||||
|
||||
imageLoader = ImageLoader.Builder(context)
|
||||
|
||||
@@ -71,8 +71,9 @@ class VideoScreenViewModel @Inject constructor(
|
||||
|
||||
if (vl != null) {
|
||||
val r = vl.sortedWith(compareBy(naturalOrder()) { it.video.name })
|
||||
videoLibrary.classesMap[videoLibrary.classes[0]]?.addAll(r)
|
||||
videoLibrary.classesMap[videoLibrary.classes[0]]?.distinctBy { it.id }
|
||||
val existsId = videoLibrary.classesMap[videoLibrary.classes[0]]?.map { it.id }
|
||||
|
||||
videoLibrary.classesMap[videoLibrary.classes[0]]?.addAll(r.filter { existsId == null || it.id !in existsId })
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -110,8 +111,8 @@ class VideoScreenViewModel @Inject constructor(
|
||||
|
||||
if (vl != null) {
|
||||
val r = vl.sortedWith(compareBy(naturalOrder()) { it.video.name })
|
||||
videoLibrary.classesMap[videoLibrary.classes[index]]?.addAll(r)
|
||||
videoLibrary.classesMap[videoLibrary.classes[index]]?.distinctBy { it.id }
|
||||
val existsId = videoLibrary.classesMap[videoLibrary.classes[index]]?.map { it.id }
|
||||
videoLibrary.classesMap[videoLibrary.classes[index]]?.addAll(r.filter { existsId == null || it.id !in existsId })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user