Add migration ability.
Various bug fixes and code cleanup.
This commit is contained in:
@@ -9,15 +9,22 @@ class MetadataHelper {
|
||||
= exGalleryBook().write(galleryMetadata.galleryUniqueIdentifier(), galleryMetadata)
|
||||
|
||||
fun fetchMetadata(url: String, exh: Boolean): ExGalleryMetadata?
|
||||
= ExGalleryMetadata().apply {
|
||||
this.url = url
|
||||
this.exh = exh
|
||||
return exGalleryBook().read<ExGalleryMetadata>(galleryUniqueIdentifier())
|
||||
= ExGalleryMetadata().let {
|
||||
it.url = url
|
||||
it.exh = exh
|
||||
return exGalleryBook().read<ExGalleryMetadata>(it.galleryUniqueIdentifier())
|
||||
}
|
||||
|
||||
fun getAllGalleries() = exGalleryBook().allKeys.map {
|
||||
exGalleryBook().read<ExGalleryMetadata>(it)
|
||||
}
|
||||
|
||||
fun hasMetadata(url: String, exh: Boolean): Boolean
|
||||
= ExGalleryMetadata().let {
|
||||
it.url = url
|
||||
it.exh = exh
|
||||
return exGalleryBook().exist(it.galleryUniqueIdentifier())
|
||||
}
|
||||
|
||||
fun exGalleryBook() = Paper.book("gallery-ex")!!
|
||||
}
|
||||
Reference in New Issue
Block a user