Convert more classes to data classes
This commit is contained in:
@@ -77,7 +77,7 @@ class LocalMangaDirInput(root: File) : LocalMangaInput(root) {
|
||||
largeCoverUrl = null,
|
||||
description = null,
|
||||
)
|
||||
LocalManga(root, manga)
|
||||
LocalManga(manga, root)
|
||||
}
|
||||
|
||||
override suspend fun getMangaInfo(): Manga? = runInterruptible(Dispatchers.IO) {
|
||||
|
||||
@@ -94,7 +94,7 @@ class LocalMangaZipInput(root: File) : LocalMangaInput(root) {
|
||||
)
|
||||
}
|
||||
}
|
||||
return LocalManga(root, manga)
|
||||
return LocalManga(manga, root)
|
||||
}
|
||||
|
||||
override suspend fun getMangaInfo(): Manga? = runInterruptible(Dispatchers.IO) {
|
||||
|
||||
@@ -6,13 +6,11 @@ import org.koitharu.kotatsu.parsers.model.Manga
|
||||
import org.koitharu.kotatsu.parsers.model.MangaTag
|
||||
import java.io.File
|
||||
|
||||
class LocalManga(
|
||||
val file: File,
|
||||
data class LocalManga(
|
||||
val manga: Manga,
|
||||
val file: File = manga.url.toUri().toFile(),
|
||||
) {
|
||||
|
||||
constructor(manga: Manga) : this(manga.url.toUri().toFile(), manga)
|
||||
|
||||
var createdAt: Long = -1L
|
||||
private set
|
||||
get() {
|
||||
@@ -31,22 +29,6 @@ class LocalManga(
|
||||
return manga.tags.containsAll(tags)
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as LocalManga
|
||||
|
||||
if (manga != other.manga) return false
|
||||
return file == other.file
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = manga.hashCode()
|
||||
result = 31 * result + file.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "LocalManga(${file.path}: ${manga.title})"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user