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