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

Added blacklist_extensions to skip some file types completely from being downloaded.

This commit is contained in:
Fabian Schlenz 2018-04-20 06:54:29 +02:00
parent bce5996643
commit 223a0fdde3
3 changed files with 7 additions and 0 deletions

View File

@ -261,6 +261,8 @@ class DownloadManager(val client: TelegramClient, val prog: DownloadProgressInte
prog.onMediaSkipped() prog.onMediaSkipped()
} else if (settings.max_file_size>0 && settings.max_file_size*1024*1024 > m.size) { } else if (settings.max_file_size>0 && settings.max_file_size*1024*1024 > m.size) {
prog.onMediaSkipped() prog.onMediaSkipped()
} else if (settings.blacklist_extensions.contains(m.extension)) {
prog.onMediaSkipped()
} else { } else {
try { try {
val result = m.download(prog) val result = m.download(prog)

View File

@ -29,6 +29,7 @@ class Settings(val file_base: String, val database: Database, val cli_settings:
val blacklist_channels = sf.getStringList("blacklist_channels", default=LinkedList<String>()) val blacklist_channels = sf.getStringList("blacklist_channels", default=LinkedList<String>())
val max_file_age = sf.getInt("max_file_age", default=-1) val max_file_age = sf.getInt("max_file_age", default=-1)
val max_file_size = sf.getInt("max_file_size", default=-1) val max_file_size = sf.getInt("max_file_size", default=-1)
val blacklist_extensions = sf.getStringList("blacklist_extensions", default=LinkedList<String>())
private fun get_setting_list(name: String): List<String>? { private fun get_setting_list(name: String): List<String>? {
return ini_settings[name] return ini_settings[name]

View File

@ -26,6 +26,10 @@
## Leave unset to download media files regardless of their size. ## Leave unset to download media files regardless of their size.
# max_file_size = 5 # max_file_size = 5
## Don't download media files having these extensions.
## You can add this line multiple times to blacklist more than one extension.
# blacklist_extensions = jpg
# blacklist_extensions = avi
## Downloads of channels and supergroups ## Downloads of channels and supergroups
## Here you can specify which channels and supergroups ## Here you can specify which channels and supergroups