1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2025-07-17 11:16:23 +00:00

Added a setting max_file_size to ignore files bigger than that size in MB.

This commit is contained in:
2018-04-20 06:08:17 +02:00
parent b1e9346203
commit 7e2d49ef09
5 changed files with 14 additions and 7 deletions

View File

@@ -256,18 +256,20 @@ class DownloadManager(val client: TelegramClient, val prog: DownloadProgressInte
} else if (m.downloaded) {
prog.onMediaAlreadyPresent(m)
} else if (settings.max_file_age>0 && (System.currentTimeMillis() / 1000) - msg.date > settings.max_file_age * 24 * 60 * 60) {
prog.onMediaTooOld()
prog.onMediaSkipped()
} else if (settings.max_file_size>0 && settings.max_file_size*1024*1024 > m.size) {
prog.onMediaSkipped()
} else {
try {
val result = m.download()
if (result) {
prog.onMediaDownloaded(m)
} else {
prog.onMediaSkipped()
prog.onMediaFailed()
}
} catch (e: TimeoutException) {
// do nothing - skip this file
prog.onMediaSkipped()
prog.onMediaFailed()
}
}
}