mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2024-11-22 16:56:16 +00:00
Finished AbstractFileManager, I think.
This commit is contained in:
parent
3a4508012a
commit
584069a130
@ -50,17 +50,21 @@ abstract class AbstractMediaFileManager(protected var message: TLMessage, protec
|
|||||||
|
|
||||||
fun isDownloaded() { return File(targetPathAndFilename).isFile() }
|
fun isDownloaded() { return File(targetPathAndFilename).isFile() }
|
||||||
fun isDownloading() {return File(targetPathAndFilename + ".downloading").isFile() }
|
fun isDownloading() {return File(targetPathAndFilename + ".downloading").isFile() }
|
||||||
fun targetPath() {
|
fun getTargetPath() {
|
||||||
val path = user.getFileBase() + Config.FILE_FILES_BASE + File.separatorChar
|
val path = user.getFileBase() + Config.FILE_FILES_BASE + File.separatorChar
|
||||||
File(path).mkdirs()
|
File(path).mkdirs()
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
val targetFilename: String
|
fun getTargetFilename() {
|
||||||
get() = if (message.getToId() is TLPeerChannel) {
|
val message_id = message.getId()
|
||||||
"channel_" + (message.getToId() as TLPeerChannel).getChannelId() + "_" + message.getId() + "." + extension
|
if (message.getToId() is TLPeerChannel) {
|
||||||
} else "" + message.getId() + "." + extension
|
val channel_id = message.getToId().getChannelId()
|
||||||
val targetPathAndFilename: String
|
return "channel_${channel_id}_${message_id}.$extension"
|
||||||
get() = targetPath + targetFilename
|
} else return "${message_id}.$extension"
|
||||||
|
}
|
||||||
|
val getTargetPathAndFilename() {
|
||||||
|
return getTargetPath() + getTargetFilename()
|
||||||
|
}
|
||||||
|
|
||||||
abstract val letter: String
|
abstract val letter: String
|
||||||
abstract val name: String
|
abstract val name: String
|
||||||
@ -80,9 +84,7 @@ abstract class AbstractMediaFileManager(protected var message: TLMessage, protec
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
fun throwUnexpectedObjectError(o: Object) {
|
||||||
fun throwUnexpectedObjectError(o: Object) {
|
throw RuntimeException("Unexpected " + o.getClass().getName())
|
||||||
throw RuntimeException("Unexpected " + o.getClass().getName())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user