mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-28 20:40:13 +02:00
2.72
This commit is contained in:
parent
6c267ef67d
commit
c14e52130b
@ -159,7 +159,7 @@ public class ChunkUploaderMono extends ChunkUploader {
|
||||
setError_wait(false);
|
||||
}
|
||||
|
||||
} else if (!error) {
|
||||
} else if (!error && chunk.getOffset() + tot_bytes_up < getUpload().getFile_size()) {
|
||||
|
||||
Logger.getLogger(getClass().getName()).log(Level.INFO, "{0} Worker {1} has uploaded chunk {2}", new Object[]{Thread.currentThread().getName(), getId(), chunk.getId()});
|
||||
|
||||
@ -202,6 +202,14 @@ public class ChunkUploaderMono extends ChunkUploader {
|
||||
|
||||
if (!error && chunk.getOffset() + tot_bytes_up == getUpload().getFile_size() && futureTask != null) {
|
||||
|
||||
Logger.getLogger(getClass().getName()).log(Level.INFO, "{0} Worker {1} has uploaded chunk {2}", new Object[]{Thread.currentThread().getName(), getId(), chunk.getId()});
|
||||
|
||||
Logger.getLogger(getClass().getName()).log(Level.INFO, "{0} {1} {2}", new Object[]{chunk.getOffset(), tot_bytes_up, getUpload().getFile_size()});
|
||||
|
||||
getUpload().getMac_generator().getChunk_queue().put(chunk.getId(), chunk);
|
||||
|
||||
getUpload().getMac_generator().secureNotify();
|
||||
|
||||
Logger.getLogger(getClass().getName()).log(Level.WARNING, "{0} has finished uploading all chunks. Waiting for completion handle...", new Object[]{Thread.currentThread().getName()});
|
||||
|
||||
try {
|
||||
|
@ -48,7 +48,7 @@ import org.apache.http.auth.UsernamePasswordCredentials;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "2.71";
|
||||
public static final String VERSION = "2.72";
|
||||
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;
|
||||
|
@ -621,61 +621,60 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
if (!urls.isEmpty()) {
|
||||
|
||||
getMain_panel().getDownload_manager().addPre_count(urls.size());
|
||||
getMain_panel().getDownload_manager().getTransference_pre_queue().addAll(urls);
|
||||
|
||||
getMain_panel().getDownload_manager().secureNotify();
|
||||
|
||||
for (String url : urls) {
|
||||
|
||||
if (getMain_panel().getDownload_manager().getPre_count() > 0) {
|
||||
try {
|
||||
url = URLDecoder.decode(url, "UTF-8").replaceAll("^mega://", "https://mega.nz").trim();
|
||||
try {
|
||||
url = URLDecoder.decode(url, "UTF-8").replaceAll("^mega://", "https://mega.nz").trim();
|
||||
|
||||
Download download;
|
||||
Download download;
|
||||
|
||||
if (findFirstRegex("#F!", url, 0) != null) {
|
||||
if (findFirstRegex("#F!", url, 0) != null) {
|
||||
|
||||
FolderLinkDialog fdialog = new FolderLinkDialog(_main_panel.getView(), true, url);
|
||||
FolderLinkDialog fdialog = new FolderLinkDialog(_main_panel.getView(), true, url);
|
||||
|
||||
if (!fdialog.isMega_error()) {
|
||||
if (!fdialog.isMega_error()) {
|
||||
|
||||
fdialog.setLocationRelativeTo(_main_panel.getView());
|
||||
fdialog.setLocationRelativeTo(_main_panel.getView());
|
||||
|
||||
fdialog.setVisible(true);
|
||||
fdialog.setVisible(true);
|
||||
|
||||
if (fdialog.isDownload()) {
|
||||
if (fdialog.isDownload()) {
|
||||
|
||||
List<HashMap> folder_links = fdialog.getDownload_links();
|
||||
List<HashMap> folder_links = fdialog.getDownload_links();
|
||||
|
||||
fdialog.dispose();
|
||||
fdialog.dispose();
|
||||
|
||||
for (HashMap folder_link : folder_links) {
|
||||
for (HashMap folder_link : folder_links) {
|
||||
|
||||
download = new Download(getMain_panel(), ma, (String) folder_link.get("url"), dl_path, (String) folder_link.get("filename"), (String) folder_link.get("filekey"), (long) folder_link.get("filesize"), null, null, getMain_panel().isUse_slots_down(), getMain_panel().getDefault_slots_down(), true);
|
||||
download = new Download(getMain_panel(), ma, (String) folder_link.get("url"), dl_path, (String) folder_link.get("filename"), (String) folder_link.get("filekey"), (long) folder_link.get("filesize"), null, null, getMain_panel().isUse_slots_down(), getMain_panel().getDefault_slots_down(), true);
|
||||
|
||||
getMain_panel().getDownload_manager().getTransference_provision_queue().add(download);
|
||||
}
|
||||
getMain_panel().getDownload_manager().getTransference_provision_queue().add(download);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fdialog.dispose();
|
||||
|
||||
} else {
|
||||
|
||||
download = new Download(getMain_panel(), ma, url, dl_path, null, null, null, null, null, getMain_panel().isUse_slots_down(), getMain_panel().getDefault_slots_down(), false);
|
||||
|
||||
getMain_panel().getDownload_manager().getTransference_provision_queue().add(download);
|
||||
}
|
||||
|
||||
getMain_panel().getDownload_manager().addPre_count(-1);
|
||||
fdialog.dispose();
|
||||
|
||||
getMain_panel().getDownload_manager().secureNotify();
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
|
||||
} else {
|
||||
|
||||
download = new Download(getMain_panel(), ma, url, dl_path, null, null, null, null, null, getMain_panel().isUse_slots_down(), getMain_panel().getDefault_slots_down(), false);
|
||||
|
||||
getMain_panel().getDownload_manager().getTransference_provision_queue().add(download);
|
||||
}
|
||||
|
||||
getMain_panel().getDownload_manager().getTransference_pre_queue().remove(url);
|
||||
|
||||
getMain_panel().getDownload_manager().secureNotify();
|
||||
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -919,7 +918,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
if (dialog.isUpload() && dialog.getFiles().size() > 0) {
|
||||
|
||||
getMain_panel().getUpload_manager().addPre_count(dialog.getFiles().size());
|
||||
getMain_panel().getUpload_manager().getTransference_pre_queue().addAll(dialog.getFiles());
|
||||
|
||||
getMain_panel().getUpload_manager().secureNotify();
|
||||
|
||||
@ -957,47 +956,45 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
for (File f : dialog.getFiles()) {
|
||||
|
||||
if (getMain_panel().getUpload_manager().getPre_count() > 0) {
|
||||
String file_path = f.getParentFile().getAbsolutePath().replace(base_path, "");
|
||||
String file_path = f.getParentFile().getAbsolutePath().replace(base_path, "");
|
||||
|
||||
String[] dirs = file_path.split("/");
|
||||
String[] dirs = file_path.split("/");
|
||||
|
||||
MegaDirNode current_node = file_paths;
|
||||
MegaDirNode current_node = file_paths;
|
||||
|
||||
String file_parent = current_node.getNode_id();
|
||||
String file_parent = current_node.getNode_id();
|
||||
|
||||
for (String d : dirs) {
|
||||
for (String d : dirs) {
|
||||
|
||||
if (!d.isEmpty()) {
|
||||
if (!d.isEmpty()) {
|
||||
|
||||
if (current_node.getChildren().get(d) != null) {
|
||||
if (current_node.getChildren().get(d) != null) {
|
||||
|
||||
current_node = current_node.getChildren().get(d);
|
||||
current_node = current_node.getChildren().get(d);
|
||||
|
||||
file_parent = current_node.getNode_id();
|
||||
file_parent = current_node.getNode_id();
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
res = ma.createDirInsideAnotherSharedDir(d, current_node.getNode_id(), ma.genFolderKey(), i32a2bin(ma.getMaster_key()), parent_node, share_key);
|
||||
res = ma.createDirInsideAnotherSharedDir(d, current_node.getNode_id(), ma.genFolderKey(), i32a2bin(ma.getMaster_key()), parent_node, share_key);
|
||||
|
||||
file_parent = (String) ((Map) ((List) res.get("f")).get(0)).get("h");
|
||||
file_parent = (String) ((Map) ((List) res.get("f")).get(0)).get("h");
|
||||
|
||||
current_node.getChildren().put(d, new MegaDirNode(file_parent));
|
||||
current_node.getChildren().put(d, new MegaDirNode(file_parent));
|
||||
|
||||
current_node = current_node.getChildren().get(d);
|
||||
}
|
||||
current_node = current_node.getChildren().get(d);
|
||||
}
|
||||
}
|
||||
|
||||
Upload upload = new Upload(getMain_panel(), ma, f.getAbsolutePath(), file_parent, null, null, parent_node, share_key, folder_link, getMain_panel().isUse_slots_up(), getMain_panel().getDefault_slots_up());
|
||||
|
||||
getMain_panel().getUpload_manager().getTransference_provision_queue().add(upload);
|
||||
|
||||
getMain_panel().getUpload_manager().addPre_count(-1);
|
||||
|
||||
getMain_panel().getUpload_manager().secureNotify();
|
||||
}
|
||||
|
||||
Upload upload = new Upload(getMain_panel(), ma, f.getAbsolutePath(), file_parent, null, null, parent_node, share_key, folder_link, getMain_panel().isUse_slots_up(), getMain_panel().getDefault_slots_up());
|
||||
|
||||
getMain_panel().getUpload_manager().getTransference_provision_queue().add(upload);
|
||||
|
||||
getMain_panel().getUpload_manager().getTransference_pre_queue().remove(f);
|
||||
|
||||
getMain_panel().getUpload_manager().secureNotify();
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
@ -17,6 +17,7 @@ import static megabasterd.MiscTools.*;
|
||||
*/
|
||||
abstract public class TransferenceManager implements Runnable, SecureSingleThreadNotifiable {
|
||||
|
||||
private final ConcurrentLinkedQueue<Object> _transference_pre_queue;
|
||||
private final ConcurrentLinkedQueue<Transference> _transference_provision_queue;
|
||||
private final ConcurrentLinkedQueue<Transference> _transference_waitstart_queue;
|
||||
private final ConcurrentLinkedQueue<Transference> _transference_remove_queue;
|
||||
@ -31,14 +32,12 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
private int _max_running_trans;
|
||||
private final MainPanel _main_panel;
|
||||
private final Object _secure_notify_lock;
|
||||
private final Object _pre_count_lock;
|
||||
private final Object _queue_flag_lock;
|
||||
private boolean _notified;
|
||||
private volatile boolean _removing_transferences;
|
||||
private volatile boolean _provisioning_transferences;
|
||||
private volatile boolean _starting_transferences;
|
||||
private volatile boolean _preprocessing_transferences;
|
||||
private volatile int _pre_count;
|
||||
private boolean _tray_icon_finish;
|
||||
protected long _total_transferences_size;
|
||||
|
||||
@ -49,7 +48,6 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
_starting_transferences = false;
|
||||
_preprocessing_transferences = false;
|
||||
_tray_icon_finish = false;
|
||||
_pre_count = 0;
|
||||
_main_panel = main_panel;
|
||||
_max_running_trans = max_running_trans;
|
||||
_scroll_panel = scroll_panel;
|
||||
@ -59,8 +57,8 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
_clean_all_menu = clean_all_menu;
|
||||
_total_transferences_size = 0L;
|
||||
_secure_notify_lock = new Object();
|
||||
_pre_count_lock = new Object();
|
||||
_queue_flag_lock = new Object();
|
||||
_transference_pre_queue = new ConcurrentLinkedQueue<>();
|
||||
_transference_waitstart_queue = new ConcurrentLinkedQueue<>();
|
||||
_transference_provision_queue = new ConcurrentLinkedQueue<>();
|
||||
_transference_remove_queue = new ConcurrentLinkedQueue<>();
|
||||
@ -69,6 +67,10 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
_transference_preprocess_queue = new ConcurrentLinkedQueue<>();
|
||||
}
|
||||
|
||||
public ConcurrentLinkedQueue<Object> getTransference_pre_queue() {
|
||||
return _transference_pre_queue;
|
||||
}
|
||||
|
||||
abstract public void provision(Transference transference);
|
||||
|
||||
abstract public void remove(Transference[] transference);
|
||||
@ -133,19 +135,6 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
return _transference_preprocess_queue;
|
||||
}
|
||||
|
||||
public void addPre_count(int pre_count) {
|
||||
|
||||
synchronized (_pre_count_lock) {
|
||||
|
||||
_pre_count += pre_count;
|
||||
|
||||
if (_pre_count < 0) {
|
||||
|
||||
_pre_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setMax_running_trans(int max_running_trans) {
|
||||
_max_running_trans = max_running_trans;
|
||||
}
|
||||
@ -181,10 +170,6 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
return _main_panel;
|
||||
}
|
||||
|
||||
public int getPre_count() {
|
||||
return _pre_count;
|
||||
}
|
||||
|
||||
public boolean isPreprocessing_transferences() {
|
||||
|
||||
synchronized (_queue_flag_lock) {
|
||||
@ -234,7 +219,7 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
public void closeAllPreProWaiting() {
|
||||
_transference_preprocess_queue.clear();
|
||||
|
||||
_pre_count = 0;
|
||||
_transference_pre_queue.clear();
|
||||
|
||||
_transference_provision_queue.clear();
|
||||
|
||||
@ -336,6 +321,8 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
|
||||
private String _genStatus() {
|
||||
|
||||
int pre = _transference_pre_queue.size();
|
||||
|
||||
int prov = _transference_provision_queue.size();
|
||||
|
||||
int rem = _transference_remove_queue.size();
|
||||
@ -346,14 +333,14 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
|
||||
int finish = _transference_finished_queue.size();
|
||||
|
||||
if (!_tray_icon_finish && finish > 0 && _pre_count + prov + wait + run == 0 && !_main_panel.getView().isVisible()) {
|
||||
if (!_tray_icon_finish && finish > 0 && pre + prov + wait + run == 0 && !_main_panel.getView().isVisible()) {
|
||||
|
||||
_tray_icon_finish = true;
|
||||
|
||||
_main_panel.getTrayicon().displayMessage("MegaBasterd says:", "All your transferences have finished", TrayIcon.MessageType.INFO);
|
||||
}
|
||||
|
||||
return (_pre_count + prov + rem + wait + run + finish > 0) ? "Pre: " + _pre_count + " / Pro: " + prov + " / Wait: " + wait + " / Run: " + run + " / Finish: " + finish + " / Rem: " + rem : "";
|
||||
return (pre + prov + rem + wait + run + finish > 0) ? "Pre: " + pre + " / Pro: " + prov + " / Wait: " + wait + " / Run: " + run + " / Finish: " + finish + " / Rem: " + rem : "";
|
||||
}
|
||||
|
||||
private boolean _isOKFinishedInQueue() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user