Skip to content

Commit

Permalink
8.10
Browse files Browse the repository at this point in the history
Fix pre+pro transfers progress bar
Max wait transfers 1000 -> 10000
Pro workers -> 100
  • Loading branch information
tonikelope committed Oct 27, 2023
1 parent c0bb5f6 commit cd6b453
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 57 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.tonikelope</groupId>
<artifactId>MegaBasterd</artifactId>
<version>8.9</version>
<version>8.10</version>
<packaging>jar</packaging>
<repositories>
<repository>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/tonikelope/megabasterd/MainPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
*/
public final class MainPanel {

public static final String VERSION = "8.9";
public static final String VERSION = "8.10";
public static final boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
Expand Down
49 changes: 14 additions & 35 deletions src/main/java/com/tonikelope/megabasterd/MainPanelView.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,18 +221,19 @@ private void _new_upload_dialog(FileGrabberDialog dialog) {

if (dialog.isUpload() && dialog.getFiles().size() > 0) {

MiscTools.GUIRun(() -> {
upload_status_bar.setIndeterminate(true);
upload_status_bar.setMaximum(getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().size() + dialog.getFiles().size());
upload_status_bar.setVisible(true);
});

getMain_panel().resumeUploads();

getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().addAll(dialog.getFiles());

getMain_panel().getUpload_manager().secureNotify();

MiscTools.GUIRun(() -> {
upload_status_bar.setIndeterminate(true);
upload_status_bar.setValue(upload_status_bar.getMinimum());
upload_status_bar.setMaximum(getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().size() + getMain_panel().getUpload_manager().getTransference_preprocess_queue().size() + getMain_panel().getUpload_manager().getTransference_provision_queue().size());
upload_status_bar.setVisible(true);
});

final String mega_account = (String) dialog.getAccount_combobox().getSelectedItem();

final String base_path = dialog.getBase_path();
Expand Down Expand Up @@ -376,25 +377,12 @@ private void _new_upload_dialog(FileGrabberDialog dialog) {

LOG.log(SEVERE, null, ex);
}

MiscTools.GUIRun(() -> {
upload_status_bar.setIndeterminate(false);
upload_status_bar.setValue(upload_status_bar.getValue() + 1);
});

}

} catch (Exception ex) {

LOG.log(SEVERE, null, ex);
}

if (getMain_panel().getUpload_manager().getTransference_preprocess_queue().isEmpty()) {
MiscTools.GUIRun(() -> {
upload_status_bar.setValue(upload_status_bar.getMinimum());
upload_status_bar.setVisible(false);
});
}
};

getMain_panel().getUpload_manager().getTransference_preprocess_queue().add(run);
Expand Down Expand Up @@ -1100,18 +1088,20 @@ private void new_download_menuActionPerformed(java.awt.event.ActionEvent evt) {/
});

if (!urls.isEmpty()) {
MiscTools.GUIRun(() -> {
download_status_bar.setIndeterminate(true);
download_status_bar.setMaximum(getMain_panel().getDownload_manager().getTransference_preprocess_global_queue().size() + urls.size());
download_status_bar.setVisible(true);
});

Set<String> folder_file_links = new HashSet(findAllRegex("(?:https?|mega)://[^\r\n]+#F\\*[^\r\n!]*?![^\r\n!]+![^\\?\r\n/]+", link_data, 0));

getMain_panel().getDownload_manager().getTransference_preprocess_global_queue().addAll(folder_file_links);

getMain_panel().getDownload_manager().secureNotify();

MiscTools.GUIRun(() -> {
download_status_bar.setIndeterminate(true);
download_status_bar.setValue(download_status_bar.getMinimum());
download_status_bar.setMaximum(getMain_panel().getDownload_manager().getTransference_preprocess_global_queue().size() + getMain_panel().getDownload_manager().getTransference_preprocess_queue().size() + getMain_panel().getDownload_manager().getTransference_provision_queue().size());
download_status_bar.setVisible(true);
});

if (!folder_file_links.isEmpty()) {
ArrayList<String> nlinks = ma.GENERATE_N_LINKS(folder_file_links);

Expand Down Expand Up @@ -1244,19 +1234,8 @@ private void new_download_menuActionPerformed(java.awt.event.ActionEvent evt) {/
Logger.getLogger(MainPanelView.class.getName()).log(Level.SEVERE, ex.getMessage());
}

MiscTools.GUIRun(() -> {
download_status_bar.setIndeterminate(false);
download_status_bar.setValue(upload_status_bar.getValue() + 1);
});

}

if (getMain_panel().getDownload_manager().getTransference_preprocess_global_queue().isEmpty()) {
MiscTools.GUIRun(() -> {
download_status_bar.setValue(download_status_bar.getMinimum());
download_status_bar.setVisible(false);
});
}
} else {
MiscTools.GUIRun(() -> {
new_download_menu.setEnabled(true);
Expand Down
40 changes: 20 additions & 20 deletions src/main/java/com/tonikelope/megabasterd/TransferenceManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
*/
abstract public class TransferenceManager implements Runnable, SecureSingleThreadNotifiable {

public static final int MAX_WAIT_QUEUE = 1000;
public static final int MAX_PROVISION_WORKERS = 25;
public static final int MAX_WAIT_QUEUE = 10000;
public static final int MAX_PROVISION_WORKERS = 50;
private static final Logger LOG = Logger.getLogger(TransferenceManager.class.getName());

protected final ConcurrentLinkedQueue<Object> _transference_preprocess_global_queue;
Expand Down Expand Up @@ -680,24 +680,6 @@ private void _updateView() {

_status.setText(_genStatus());

/*if (_transference_preprocess_queue.isEmpty() && !_transference_provision_queue.isEmpty()) {
if (this instanceof DownloadManager) {
this._main_panel.getView().getDownload_status_bar().setIndeterminate(true);
this._main_panel.getView().getDownload_status_bar().setVisible(true);
} else {
this._main_panel.getView().getUpload_status_bar().setIndeterminate(true);
this._main_panel.getView().getUpload_status_bar().setVisible(true);
}
} else if (_transference_preprocess_queue.isEmpty()) {
if (this instanceof DownloadManager) {
this._main_panel.getView().getDownload_status_bar().setIndeterminate(false);
this._main_panel.getView().getDownload_status_bar().setVisible(false);
} else {
this._main_panel.getView().getUpload_status_bar().setIndeterminate(false);
this._main_panel.getView().getUpload_status_bar().setVisible(false);
}
}*/
_main_panel.getView().getUnfreeze_transferences_button().setVisible(_main_panel.getDownload_manager().hasFrozenTransferences() || _main_panel.getUpload_manager().hasFrozenTransferences());

_main_panel.getView().revalidate();
Expand Down Expand Up @@ -832,6 +814,24 @@ public void run() {
try {
bounded_executor.submitTask(() -> {
provision(transference);

if (this instanceof DownloadManager) {
MiscTools.GUIRun(() -> {

_main_panel.getView().getDownload_status_bar().setIndeterminate(false);
_main_panel.getView().getDownload_status_bar().setValue(_main_panel.getView().getDownload_status_bar().getValue() + 1);
_main_panel.getView().getDownload_status_bar().setVisible((_main_panel.getView().getDownload_status_bar().getValue() < _main_panel.getView().getDownload_status_bar().getMaximum()));

});
} else {
MiscTools.GUIRun(() -> {

_main_panel.getView().getUpload_status_bar().setIndeterminate(false);
_main_panel.getView().getUpload_status_bar().setValue(_main_panel.getView().getUpload_status_bar().getValue() + 1);
_main_panel.getView().getUpload_status_bar().setVisible((_main_panel.getView().getUpload_status_bar().getValue() < _main_panel.getView().getUpload_status_bar().getMaximum()));

});
}
});
} catch (InterruptedException ex) {
Logger.getLogger(TransferenceManager.class.getName()).log(Level.SEVERE, null, ex);
Expand Down
Binary file modified src/main/resources/images/mbasterd_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cd6b453

Please sign in to comment.