mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
优化
This commit is contained in:
parent
d737f048b2
commit
f8c33b207a
@ -175,6 +175,13 @@ interface BookSourceDao {
|
||||
@get:Query("select * from book_sources order by customOrder asc")
|
||||
val all: List<BookSource>
|
||||
|
||||
@get:Query(
|
||||
"""select bookSourceUrl, bookSourceName, bookSourceGroup, customOrder, enabled, enabledExplore,
|
||||
trim(loginUrl) <> '' hasLoginUrl, lastUpdateTime, respondTime, weight, trim(exploreUrl) <> '' hasExploreUrl
|
||||
from book_sources order by customOrder asc"""
|
||||
)
|
||||
val allPart: List<BookSourcePart>
|
||||
|
||||
@get:Query("select * from book_sources where enabled = 1 order by customOrder")
|
||||
val allEnabled: List<BookSource>
|
||||
|
||||
|
@ -92,6 +92,10 @@ object BookHelp {
|
||||
}
|
||||
}
|
||||
FileUtils.delete(ArchiveUtils.TEMP_PATH)
|
||||
val filesDir = appCtx.filesDir
|
||||
FileUtils.delete("$filesDir/shareBookSource.json")
|
||||
FileUtils.delete("$filesDir/shareRssSource.json")
|
||||
FileUtils.delete("$filesDir/books.json")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,9 +82,11 @@ object SourceHelp {
|
||||
appDb.bookSourceDao.maxOrder > 99999
|
||||
|| appDb.bookSourceDao.minOrder < -99999
|
||||
) {
|
||||
appDb.bookSourceDao.all.forEachIndexed { index, bookSource ->
|
||||
appDb.bookSourceDao.upOrder(bookSource.bookSourceUrl, index)
|
||||
val sources = appDb.bookSourceDao.allPart
|
||||
sources.forEachIndexed { index, bookSource ->
|
||||
bookSource.customOrder = index
|
||||
}
|
||||
appDb.bookSourceDao.upOrder(sources)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ object Backup {
|
||||
val backupPath: String by lazy {
|
||||
appCtx.filesDir.getFile("backup").createFolderIfNotExist().absolutePath
|
||||
}
|
||||
val zipFilePath = "${appCtx.externalFiles.absolutePath}${File.separator}backup.zip"
|
||||
val zipFilePath = "${appCtx.externalFiles.absolutePath}${File.separator}tmp_backup.zip"
|
||||
|
||||
private val backupFileNames by lazy {
|
||||
arrayOf(
|
||||
@ -166,6 +166,7 @@ object Backup {
|
||||
paths[i] = backupPath + File.separator + paths[i]
|
||||
}
|
||||
FileUtils.delete(zipFilePath)
|
||||
FileUtils.delete(zipFilePath.replace("tmp_", ""))
|
||||
val backupFileName = if (AppConfig.onlyLatestBackup) {
|
||||
"backup.zip"
|
||||
} else {
|
||||
@ -188,6 +189,7 @@ object Backup {
|
||||
AppWebDav.backUpWebDav(zipFileName)
|
||||
}
|
||||
FileUtils.delete(backupPath)
|
||||
FileUtils.delete(zipFilePath)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user