1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-12-26 06:45:33 +00:00

Added command line option --no-media to skip downloading media files.

This commit is contained in:
Fabian Schlenz 2016-08-31 07:03:49 +02:00
parent 34cca18009
commit dfd714e481
2 changed files with 13 additions and 2 deletions

View File

@ -154,8 +154,14 @@ public class CommandLineController {
DownloadManager d = new DownloadManager(user, client, new CommandLineDownloadProgress());
logger.debug("Calling DownloadManager.downloadMessages with limit {}", CommandLineOptions.val_limit_messages);
d.downloadMessages(CommandLineOptions.val_limit_messages);
logger.debug("Calling DownloadManager.downloadMedia");
d.downloadMedia();
logger.debug("CommandLineOptions.cmd_no_media: {}", CommandLineOptions.cmd_no_media);
if (!CommandLineOptions.cmd_no_media) {
logger.debug("Calling DownloadManager.downloadMedia");
d.downloadMedia();
} else {
System.out.println("Skipping media download because --no-media is set.");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
@ -219,6 +225,7 @@ public class CommandLineController {
System.out.println(" --debug-telegram Shows lots of debug messages from the library used to access Telegram.");
System.out.println(" -A, --list-accounts List all existing accounts ");
System.out.println(" --limit-messages <x> Downloads at most the most recent <x> messages.");
System.out.println(" --no-media Do not download media files.");
System.out.println(" -t, --target <x> Target directory for the files.");
System.out.println(" -e, --export <format> Export the database. Valid formats are:");
System.out.println(" html - Creates HTML files.");

View File

@ -26,6 +26,7 @@ class CommandLineOptions {
public static boolean cmd_version = false;
public static boolean cmd_license = false;
public static boolean cmd_daemon = false;
public static boolean cmd_no_media = false;
public static String val_account = null;
public static Integer val_limit_messages = null;
@ -93,6 +94,9 @@ class CommandLineOptions {
case "-d": case "--daemon":
cmd_daemon = true; break;
case "--no-media":
cmd_no_media = true; break;
default:
throw new RuntimeException("Unknown command " + arg);