mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2024-12-25 22:35:35 +00:00
Added '--stats'.
This commit is contained in:
parent
6d772a3be1
commit
c945f05c3d
@ -29,6 +29,8 @@ import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import java.util.Vector;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.Logger;
|
||||
@ -92,6 +94,11 @@ public class CommandLineController {
|
||||
}
|
||||
}
|
||||
|
||||
if (CommandLineOptions.cmd_stats) {
|
||||
cmd_stats();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
if (CommandLineOptions.val_test != null) {
|
||||
if (CommandLineOptions.val_test == 1) {
|
||||
TestFeatures.test1();
|
||||
@ -210,6 +217,18 @@ public class CommandLineController {
|
||||
return account;
|
||||
}
|
||||
|
||||
private void cmd_stats() {
|
||||
HashMap<String, Integer> map = new HashMap<String, Integer>();
|
||||
map.put("count.accounts", Utils.getAccounts().size());
|
||||
map.put("count.messages", Database.getInstance().getMessageCount());
|
||||
map.put("messages.top_id", Database.getInstance().getTopMessageID());
|
||||
for(Map.Entry<String, Integer> pair : Database.getInstance().getMessageMediaTypesWithCount().entrySet()) {
|
||||
map.put(pair.getKey(), pair.getValue());
|
||||
}
|
||||
|
||||
System.out.println(map.toString());
|
||||
}
|
||||
|
||||
private void cmd_login(String phone) throws RpcErrorException, IOException {
|
||||
UserManager user = UserManager.getInstance();
|
||||
if (phone==null) {
|
||||
@ -267,6 +286,7 @@ public class CommandLineController {
|
||||
System.out.println(" --license Displays the license of this program.");
|
||||
System.out.println(" -d, --daemon Keep running and automatically save new messages.");
|
||||
System.out.println(" --anonymize (Try to) Remove all sensitive information from output. Useful for requesting support.");
|
||||
System.out.println(" --stats Print some usage statistics.");
|
||||
}
|
||||
|
||||
private void list_accounts() {
|
||||
|
@ -29,6 +29,7 @@ class CommandLineOptions {
|
||||
public static boolean cmd_daemon = false;
|
||||
public static boolean cmd_no_media = false;
|
||||
public static boolean cmd_anonymize = false;
|
||||
public static boolean cmd_stats = false;
|
||||
|
||||
public static String val_account = null;
|
||||
public static Integer val_limit_messages = null;
|
||||
@ -112,6 +113,9 @@ class CommandLineOptions {
|
||||
|
||||
case "--anonymize":
|
||||
cmd_anonymize = true; break;
|
||||
|
||||
case "--stats":
|
||||
cmd_stats = true; break;
|
||||
|
||||
default:
|
||||
throw new RuntimeException("Unknown command " + arg);
|
||||
|
Loading…
Reference in New Issue
Block a user