mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2024-11-22 16:56:16 +00:00
Some more improvements, while I'm learning more and more about Kotlin. ;-)
This commit is contained in:
parent
584069a130
commit
992c456af5
@ -48,23 +48,30 @@ abstract class AbstractMediaFileManager(protected var message: TLMessage, protec
|
|||||||
abstract val size: Int
|
abstract val size: Int
|
||||||
abstract val extension: String
|
abstract val extension: String
|
||||||
|
|
||||||
fun isDownloaded() { return File(targetPathAndFilename).isFile() }
|
val downloaded: Boolean
|
||||||
fun isDownloading() {return File(targetPathAndFilename + ".downloading").isFile() }
|
get() = File(targetPathAndFilename).isFile()
|
||||||
fun getTargetPath() {
|
|
||||||
val path = user.getFileBase() + Config.FILE_FILES_BASE + File.separatorChar
|
val downloading: Boolean
|
||||||
File(path).mkdirs()
|
get() = File("${targetPathAndFilename}.downloading").isFile()
|
||||||
return path
|
|
||||||
}
|
val targetPath: String
|
||||||
fun getTargetFilename() {
|
get() {
|
||||||
val message_id = message.getId()
|
val path = user.getFileBase() + Config.FILE_FILES_BASE + File.separatorChar
|
||||||
if (message.getToId() is TLPeerChannel) {
|
File(path).mkdirs()
|
||||||
val channel_id = message.getToId().getChannelId()
|
return path
|
||||||
return "channel_${channel_id}_${message_id}.$extension"
|
}
|
||||||
} else return "${message_id}.$extension"
|
|
||||||
}
|
val targetFilename: String
|
||||||
val getTargetPathAndFilename() {
|
get() {
|
||||||
return getTargetPath() + getTargetFilename()
|
val message_id = message.getId()
|
||||||
}
|
if (message.getToId() is TLPeerChannel) {
|
||||||
|
val channel_id = message.getToId().getChannelId()
|
||||||
|
return "channel_${channel_id}_${message_id}.$extension"
|
||||||
|
} else return "${message_id}.$extension"
|
||||||
|
}
|
||||||
|
|
||||||
|
val targetPathAndFilenam: String
|
||||||
|
get() = targetPath + targetFilename
|
||||||
|
|
||||||
abstract val letter: String
|
abstract val letter: String
|
||||||
abstract val name: String
|
abstract val name: String
|
||||||
|
Loading…
Reference in New Issue
Block a user