1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-11-23 01:06:17 +00:00

Using a special downloaderClient for fiel downloads.

This commit is contained in:
Fabian Schlenz 2016-07-15 07:04:45 +02:00
parent f2b6bc6e16
commit 7181ec69d3

View File

@ -53,6 +53,7 @@ public class DownloadManager {
TelegramClient client; TelegramClient client;
Database db; Database db;
DownloadProgressInterface prog = null; DownloadProgressInterface prog = null;
static TelegramClient download_client;
public DownloadManager(UserManager u, TelegramClient c, DownloadProgressInterface p) { public DownloadManager(UserManager u, TelegramClient c, DownloadProgressInterface p) {
this.user = u; this.user = u;
@ -189,6 +190,7 @@ public class DownloadManager {
} }
public void downloadMedia() throws RpcErrorException, IOException { public void downloadMedia() throws RpcErrorException, IOException {
download_client = client.getDownloaderClient();
boolean completed = true; boolean completed = true;
do { do {
completed = true; completed = true;
@ -290,9 +292,9 @@ public class DownloadManager {
Log.debug("offset: %8d block_size: %7d size: %8d", offset, block_size, size); Log.debug("offset: %8d block_size: %7d size: %8d", offset, block_size, size);
TLRequestUploadGetFile req = new TLRequestUploadGetFile(loc, offset, block_size); TLRequestUploadGetFile req = new TLRequestUploadGetFile(loc, offset, block_size);
if (dcID==null) { if (dcID==null) {
response = (TLFile) client.executeRpcQuery(req); response = (TLFile) download_client.executeRpcQuery(req);
} else { } else {
response = (TLFile) client.executeRpcQuery(req, dcID); response = (TLFile) download_client.executeRpcQuery(req, dcID);
} }
offset += response.getBytes().getData().length; offset += response.getBytes().getData().length;