1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-11-22 16:56:16 +00:00

Started partial rewrite because the converter isn't thaaat intelligent.

This commit is contained in:
Fabian Schlenz 2017-12-08 06:09:16 +01:00
parent deb5e316cb
commit 3a4508012a

View File

@ -45,19 +45,16 @@ import org.apache.commons.io.FileUtils
abstract class AbstractMediaFileManager(protected var message: TLMessage, protected var user: UserManager, protected var client: TelegramClient) { abstract class AbstractMediaFileManager(protected var message: TLMessage, protected var user: UserManager, protected var client: TelegramClient) {
var isEmpty = false var isEmpty = false
protected set
abstract val size: Int abstract val size: Int
abstract val extension: String abstract val extension: String
val isDownloaded: Boolean
get() = File(targetPathAndFilename).isFile() fun isDownloaded() { return File(targetPathAndFilename).isFile() }
val isDownloading: Boolean fun isDownloading() {return File(targetPathAndFilename + ".downloading").isFile() }
get() = File(targetPathAndFilename + ".downloading").isFile() fun targetPath() {
val targetPath: String val path = user.getFileBase() + Config.FILE_FILES_BASE + File.separatorChar
get() { File(path).mkdirs()
val path = user.getFileBase() + Config.FILE_FILES_BASE + File.separatorChar return path
File(path).mkdirs() }
return path
}
val targetFilename: String val targetFilename: String
get() = if (message.getToId() is TLPeerChannel) { get() = if (message.getToId() is TLPeerChannel) {
"channel_" + (message.getToId() as TLPeerChannel).getChannelId() + "_" + message.getId() + "." + extension "channel_" + (message.getToId() as TLPeerChannel).getChannelId() + "_" + message.getId() + "." + extension