|
|
@ -24,11 +24,6 @@ import javax.script.SimpleBindings |
|
|
|
|
|
|
|
|
|
|
|
object LocalBook { |
|
|
|
object LocalBook { |
|
|
|
|
|
|
|
|
|
|
|
private const val folderName = "bookTxt" |
|
|
|
|
|
|
|
val cacheFolder: File by lazy { |
|
|
|
|
|
|
|
FileUtils.createFolderIfNotExist(appCtx.externalFiles, folderName) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Throws(FileNotFoundException::class, SecurityException::class) |
|
|
|
@Throws(FileNotFoundException::class, SecurityException::class) |
|
|
|
fun getBookInputStream(book: Book): InputStream { |
|
|
|
fun getBookInputStream(book: Book): InputStream { |
|
|
|
val uri = Uri.parse(book.bookUrl) |
|
|
|
val uri = Uri.parse(book.bookUrl) |
|
|
@ -168,15 +163,6 @@ object LocalBook { |
|
|
|
|
|
|
|
|
|
|
|
fun deleteBook(book: Book, deleteOriginal: Boolean) { |
|
|
|
fun deleteBook(book: Book, deleteOriginal: Boolean) { |
|
|
|
kotlin.runCatching { |
|
|
|
kotlin.runCatching { |
|
|
|
if (book.isLocalTxt() || book.isUmd()) { |
|
|
|
|
|
|
|
cacheFolder.getFile(book.originName).delete() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (book.isEpub()) { |
|
|
|
|
|
|
|
FileUtils.delete( |
|
|
|
|
|
|
|
cacheFolder.getFile(book.getFolderName()) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (deleteOriginal) { |
|
|
|
if (deleteOriginal) { |
|
|
|
if (book.bookUrl.isContentScheme()) { |
|
|
|
if (book.bookUrl.isContentScheme()) { |
|
|
|
val uri = Uri.parse(book.bookUrl) |
|
|
|
val uri = Uri.parse(book.bookUrl) |
|
|
|