- Ghost downloads resume fix
This commit is contained in:
tonikelope 2020-01-08 10:27:14 +01:00
parent 6ea9eda42b
commit c1e1a287f4
3 changed files with 70 additions and 3 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.tonikelope</groupId>
<artifactId>MegaBasterd</artifactId>
<version>7.6</version>
<version>7.7</version>
<packaging>jar</packaging>
<dependencies>
<dependency>

View File

@ -32,6 +32,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
@ -54,7 +55,7 @@ import javax.swing.UIManager;
*/
public final class MainPanel {
public static final String VERSION = "7.6";
public static final String VERSION = "7.7";
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
public static final int STREAMER_PORT = 1337;
@ -1192,9 +1193,13 @@ public final class MainPanel {
String email = (String) o.get("email");
if (_mega_accounts.get(email) == null) {
email = null;
}
MegaAPI ma = new MegaAPI();
if (!tthis.isUse_mega_account_down() || (_mega_accounts.get(email) != null && (ma = checkMegaAccountLoginAndShowMasterPassDialog(tthis, getView(), email)) != null)) {
if (email == null || !tthis.isUse_mega_account_down() || (ma = checkMegaAccountLoginAndShowMasterPassDialog(tthis, getView(), email)) != null) {
Download download = new Download(tthis, ma, (String) url, (String) o.get("path"), (String) o.get("filename"), (String) o.get("filekey"), (Long) o.get("filesize"), (String) o.get("filepass"), (String) o.get("filenoexpire"), _use_slots_down, false, (String) o.get("custom_chunks_dir"), false);
@ -1203,6 +1208,8 @@ public final class MainPanel {
conta_downloads++;
downloads_queue_iterator.remove();
} else {
tot_downloads--;
}
}
}
@ -1213,6 +1220,34 @@ public final class MainPanel {
DBTools.insertDownloadsQueue(downloads_queue);
}
if (!res.isEmpty()) {
for (Map.Entry<String, HashMap<String, Object>> entry : res.entrySet()) {
String email = (String) entry.getValue().get("email");
if (_mega_accounts.get(email) == null) {
email = null;
}
MegaAPI ma = new MegaAPI();
if (email == null || !tthis.isUse_mega_account_down() || (ma = checkMegaAccountLoginAndShowMasterPassDialog(tthis, getView(), email)) != null) {
Download download = new Download(tthis, ma, (String) entry.getKey(), (String) entry.getValue().get("path"), (String) entry.getValue().get("filename"), (String) entry.getValue().get("filekey"), (Long) entry.getValue().get("filesize"), (String) entry.getValue().get("filepass"), (String) entry.getValue().get("filenoexpire"), _use_slots_down, false, (String) entry.getValue().get("custom_chunks_dir"), false);
getDownload_manager().getTransference_provision_queue().add(download);
conta_downloads++;
} else {
tot_downloads--;
}
}
}
} catch (SQLException ex) {
Logger.getLogger(MainPanel.class.getName()).log(SEVERE, null, ex);
} catch (Exception ex2) {
@ -1382,6 +1417,38 @@ public final class MainPanel {
DBTools.insertUploadsQueue(uploads_queue);
}
if (!res.isEmpty()) {
for (Map.Entry<String, HashMap<String, Object>> entry : res.entrySet()) {
String email = (String) entry.getValue().get("email");
if (_mega_accounts.get(email) != null) {
MegaAPI ma;
if ((ma = checkMegaAccountLoginAndShowMasterPassDialog(tthis, getView(), email)) != null) {
Upload upload = new Upload(tthis, ma, (String) entry.getKey(), (String) entry.getValue().get("parent_node"), (String) entry.getValue().get("ul_key") != null ? bin2i32a(BASE642Bin((String) entry.getValue().get("ul_key"))) : null, (String) entry.getValue().get("url"), (String) entry.getValue().get("root_node"), BASE642Bin((String) entry.getValue().get("share_key")), (String) entry.getValue().get("folder_link"), false);
getUpload_manager().getTransference_provision_queue().add(upload);
conta_uploads++;
uploads_queue_iterator.remove();
}
} else {
deleteUpload((String) entry.getValue().get("filename"), email);
tot_uploads--;
}
}
}
} catch (SQLException ex) {
Logger.getLogger(MainPanel.class.getName()).log(SEVERE, null, ex);
} catch (Exception ex2) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 KiB

After

Width:  |  Height:  |  Size: 191 KiB