|
|
|
@ -45,14 +45,12 @@ object RemoteBookWebDav : RemoteBookManager() { |
|
|
|
|
//转化远程文件信息到本地对象 |
|
|
|
|
remoteWebDavFileList.forEach { webDavFile -> |
|
|
|
|
var webDavFileName = webDavFile.displayName |
|
|
|
|
var webDavUrlName = "${remoteBookUrl}${File.separator}${webDavFile.displayName}" |
|
|
|
|
webDavFileName = URLDecoder.decode(webDavFileName, "utf-8") |
|
|
|
|
webDavUrlName = URLDecoder.decode(webDavUrlName, "utf-8") |
|
|
|
|
|
|
|
|
|
if (webDavFile.isDir) { |
|
|
|
|
remoteBooks.add( |
|
|
|
|
RemoteBook( |
|
|
|
|
webDavFileName, webDavUrlName, webDavFile.size, |
|
|
|
|
webDavFileName, webDavFile.path, webDavFile.size, |
|
|
|
|
"folder", webDavFile.lastModify, false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
@ -65,7 +63,7 @@ object RemoteBookWebDav : RemoteBookManager() { |
|
|
|
|
val isOnBookShelf = LocalBook.isOnBookShelf(webDavFileName) |
|
|
|
|
remoteBooks.add( |
|
|
|
|
RemoteBook( |
|
|
|
|
webDavFileName, webDavUrlName, webDavFile.size, |
|
|
|
|
webDavFileName, webDavFile.path, webDavFile.size, |
|
|
|
|
fileExtension, webDavFile.lastModify, isOnBookShelf |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
@ -81,7 +79,7 @@ object RemoteBookWebDav : RemoteBookManager() { |
|
|
|
|
*/ |
|
|
|
|
override suspend fun getRemoteBook(remoteBook: RemoteBook): Uri? { |
|
|
|
|
return AppWebDav.authorization?.let { |
|
|
|
|
val webdav = WebDav(remoteBook.urlName, it) |
|
|
|
|
val webdav = WebDav(remoteBook.path, it) |
|
|
|
|
webdav.download().let { bytes -> |
|
|
|
|
LocalBook.saveBookFile(bytes, remoteBook.filename) |
|
|
|
|
} |
|
|
|
|