Fix -> https://github.com/tonikelope/megabasterd/issues/596

New progressbar for pre-processing link status
This commit is contained in:
tonikelope 2023-10-25 18:08:08 +02:00
parent 78beea10ef
commit acc52fdae0
6 changed files with 63 additions and 18 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.tonikelope</groupId>
<artifactId>MegaBasterd</artifactId>
<version>8.4</version>
<version>8.5</version>
<packaging>jar</packaging>
<repositories>
<repository>

View File

@ -70,7 +70,7 @@ import javax.swing.UIManager;
*/
public final class MainPanel {
public static final String VERSION = "8.4";
public static final String VERSION = "8.5";
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;

View File

@ -381,7 +381,6 @@
<Component id="pause_all_down_button" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="status_down_label" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="close_all_finished_down_button" min="-2" max="-2" attributes="0"/>
@ -390,12 +389,13 @@
</Group>
<Component id="jScrollPane_down" alignment="0" max="32767" attributes="0"/>
<Component id="down_remtime_label" alignment="0" max="32767" attributes="0"/>
<Component id="download_status_bar" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="close_all_finished_down_button" alignment="3" max="32767" attributes="0"/>
@ -403,8 +403,10 @@
</Group>
<Component id="status_down_label" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane_down" pref="288" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="download_status_bar" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane_down" pref="277" max="32767" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="down_remtime_label" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
@ -531,6 +533,8 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="force_chunk_reset_buttonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JProgressBar" name="download_status_bar">
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="uploads_panel">
@ -549,30 +553,32 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="global_speed_up_label" max="32767" attributes="0"/>
<Component id="global_speed_up_label" pref="839" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="pause_all_up_button" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="status_up_label" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="close_all_finished_up_button" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jScrollPane_up" alignment="0" max="32767" attributes="0"/>
<Component id="up_remtime_label" alignment="0" max="32767" attributes="0"/>
<Component id="upload_status_bar" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="close_all_finished_up_button" alignment="0" max="32767" attributes="0"/>
<Component id="status_up_label" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane_up" pref="288" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="upload_status_bar" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane_up" pref="277" max="32767" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="up_remtime_label" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
@ -665,6 +671,8 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JProgressBar" name="upload_status_bar">
</Component>
</SubComponents>
</Container>
</SubComponents>

View File

@ -206,6 +206,12 @@ public final class MainPanelView extends javax.swing.JFrame {
if (dialog.isUpload() && dialog.getFiles().size() > 0) {
MiscTools.GUIRun(() -> {
upload_status_bar.setIndeterminate(true);
upload_status_bar.setVisible(true);
});
getMain_panel().resumeUploads();
getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().addAll(dialog.getFiles());
@ -371,6 +377,12 @@ public final class MainPanelView extends javax.swing.JFrame {
LOG.log(SEVERE, null, ex);
}
if (getMain_panel().getUpload_manager().getTransference_preprocess_queue().isEmpty()) {
MiscTools.GUIRun(() -> {
upload_status_bar.setVisible(false);
});
}
};
getMain_panel().getUpload_manager().getTransference_preprocess_queue().add(run);
@ -447,7 +459,7 @@ public final class MainPanelView extends javax.swing.JFrame {
translateLabels(this);
for (JComponent c : new JComponent[]{force_chunk_reset_button, unfreeze_transferences_button, global_speed_down_label, global_speed_up_label, down_remtime_label, up_remtime_label, close_all_finished_down_button, close_all_finished_up_button, pause_all_down_button, pause_all_up_button}) {
for (JComponent c : new JComponent[]{download_status_bar, upload_status_bar, force_chunk_reset_button, unfreeze_transferences_button, global_speed_down_label, global_speed_up_label, down_remtime_label, up_remtime_label, close_all_finished_down_button, close_all_finished_up_button, pause_all_down_button, pause_all_up_button}) {
c.setVisible(false);
}
@ -553,6 +565,7 @@ public final class MainPanelView extends javax.swing.JFrame {
down_remtime_label = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
force_chunk_reset_button = new javax.swing.JButton();
download_status_bar = new javax.swing.JProgressBar();
uploads_panel = new javax.swing.JPanel();
global_speed_up_label = new javax.swing.JLabel();
status_up_label = new javax.swing.JLabel();
@ -561,6 +574,7 @@ public final class MainPanelView extends javax.swing.JFrame {
jPanel_scroll_up = new javax.swing.JPanel();
pause_all_up_button = new javax.swing.JButton();
up_remtime_label = new javax.swing.JLabel();
upload_status_bar = new javax.swing.JProgressBar();
unfreeze_transferences_button = new javax.swing.JButton();
main_menubar = new javax.swing.JMenuBar();
file_menu = new javax.swing.JMenu();
@ -673,7 +687,6 @@ public final class MainPanelView extends javax.swing.JFrame {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pause_all_down_button))
.addGroup(downloads_panelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(status_down_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(close_all_finished_down_button)
@ -681,6 +694,7 @@ public final class MainPanelView extends javax.swing.JFrame {
.addComponent(jButton1))
.addComponent(jScrollPane_down)
.addComponent(down_remtime_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(download_status_bar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
downloads_panelLayout.setVerticalGroup(
downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -692,7 +706,9 @@ public final class MainPanelView extends javax.swing.JFrame {
.addComponent(jButton1))
.addComponent(status_down_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane_down, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
.addComponent(download_status_bar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane_down, javax.swing.GroupLayout.DEFAULT_SIZE, 277, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(down_remtime_label)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -744,16 +760,16 @@ public final class MainPanelView extends javax.swing.JFrame {
uploads_panelLayout.setHorizontalGroup(
uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(uploads_panelLayout.createSequentialGroup()
.addComponent(global_speed_up_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(global_speed_up_label, javax.swing.GroupLayout.DEFAULT_SIZE, 839, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pause_all_up_button))
.addGroup(uploads_panelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(status_up_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(close_all_finished_up_button))
.addComponent(jScrollPane_up)
.addComponent(up_remtime_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(upload_status_bar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
uploads_panelLayout.setVerticalGroup(
uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -763,7 +779,9 @@ public final class MainPanelView extends javax.swing.JFrame {
.addComponent(close_all_finished_up_button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(status_up_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane_up, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
.addComponent(upload_status_bar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane_up, javax.swing.GroupLayout.DEFAULT_SIZE, 277, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(up_remtime_label)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -1063,9 +1081,18 @@ public final class MainPanelView extends javax.swing.JFrame {
});
if (!urls.isEmpty()) {
MiscTools.GUIRun(() -> {
download_status_bar.setIndeterminate(true);
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();
if (!folder_file_links.isEmpty()) {
ArrayList<String> nlinks = ma.GENERATE_N_LINKS(folder_file_links);
@ -1074,6 +1101,8 @@ public final class MainPanelView extends javax.swing.JFrame {
urls.addAll(nlinks);
}
getMain_panel().getDownload_manager().getTransference_preprocess_global_queue().removeAll(folder_file_links);
getMain_panel().getDownload_manager().getTransference_preprocess_global_queue().addAll(urls);
getMain_panel().getDownload_manager().secureNotify();
@ -1197,6 +1226,12 @@ public final class MainPanelView extends javax.swing.JFrame {
}
}
if (getMain_panel().getDownload_manager().getTransference_preprocess_global_queue().isEmpty()) {
MiscTools.GUIRun(() -> {
download_status_bar.setVisible(false);
});
}
} else {
MiscTools.GUIRun(() -> {
new_download_menu.setEnabled(true);
@ -1556,6 +1591,7 @@ public final class MainPanelView extends javax.swing.JFrame {
private javax.swing.JButton close_all_finished_down_button;
private javax.swing.JButton close_all_finished_up_button;
private javax.swing.JLabel down_remtime_label;
private javax.swing.JProgressBar download_status_bar;
private javax.swing.JPanel downloads_panel;
private javax.swing.JMenu edit_menu;
private javax.swing.JMenuItem exit_menu;
@ -1591,6 +1627,7 @@ public final class MainPanelView extends javax.swing.JFrame {
private javax.swing.JLabel status_up_label;
private javax.swing.JButton unfreeze_transferences_button;
private javax.swing.JLabel up_remtime_label;
private javax.swing.JProgressBar upload_status_bar;
private javax.swing.JPanel uploads_panel;
// End of variables declaration//GEN-END:variables
private static final Logger LOG = Logger.getLogger(MainPanelView.class.getName());

View File

@ -1200,7 +1200,7 @@ public class MegaAPI implements Serializable {
ArrayList<String> nlinks = new ArrayList<>();
String request = "[{\"a\":\"f\", \"c\":\"1\", \"r\":\"1\"}]";
String request = "[{\"a\":\"f\", \"c\":\"1\", \"r\":\"1\", \"ca\":\"1\"}]";
URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + "&n=" + folder_id);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 KiB

After

Width:  |  Height:  |  Size: 205 KiB