mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-04-29 22:24:32 +02:00
6.90
https://github.com/tonikelope/megabasterd/issues/169 https://github.com/tonikelope/megabasterd/issues/170 -Transfer Manager fix -Option: put new transferences on TOP (Warning: WAIT QUEUE ORDER IS NOT PRESERVED ON MEGABASTERD RESTART).
This commit is contained in:
parent
42bc1b107c
commit
4bf25e44ac
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.tonikelope</groupId>
|
||||
<artifactId>MegaBasterd</artifactId>
|
||||
<version>6.88</version>
|
||||
<version>6.90</version>
|
||||
<packaging>jar</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -100,9 +100,11 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
private volatile boolean _turbo;
|
||||
private volatile boolean _closed;
|
||||
private final Object _progress_watchdog_lock;
|
||||
private final boolean _priority;
|
||||
|
||||
public Download(MainPanel main_panel, MegaAPI ma, String url, String download_path, String file_name, String file_key, Long file_size, String file_pass, String file_noexpire, boolean use_slots, boolean restart, String custom_chunks_dir) {
|
||||
public Download(MainPanel main_panel, MegaAPI ma, String url, String download_path, String file_name, String file_key, Long file_size, String file_pass, String file_noexpire, boolean use_slots, boolean restart, String custom_chunks_dir, boolean priority) {
|
||||
|
||||
_priority = priority;
|
||||
_paused_workers = 0;
|
||||
_ma = ma;
|
||||
_frozen = main_panel.isInit_paused();
|
||||
@ -149,6 +151,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
public Download(Download download) {
|
||||
|
||||
_priority = download.isPriority();
|
||||
_paused_workers = 0;
|
||||
_ma = download.getMa();
|
||||
_last_chunk_id_dispatched = 0L;
|
||||
@ -193,6 +196,10 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
}
|
||||
|
||||
public boolean isPriority() {
|
||||
return _priority;
|
||||
}
|
||||
|
||||
public boolean isCanceled() {
|
||||
return _canceled;
|
||||
}
|
||||
@ -1651,10 +1658,8 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
@Override
|
||||
public void unfreeze() {
|
||||
swingInvoke(() -> {
|
||||
|
||||
getView().printStatusNormal(getView().getStatus_label().getText().replaceFirst("^\\([^)]+\\) ", ""));
|
||||
});
|
||||
getView().printStatusNormal(getView().getStatus_label().getText().replaceFirst("^\\([^)]+\\) ", ""));
|
||||
|
||||
_frozen = false;
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import static com.tonikelope.megabasterd.MainPanel.*;
|
||||
import static com.tonikelope.megabasterd.MiscTools.*;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.logging.Level;
|
||||
import static java.util.logging.Level.SEVERE;
|
||||
import java.util.logging.Logger;
|
||||
@ -103,25 +102,8 @@ public class DownloadManager extends TransferenceManager {
|
||||
|
||||
increment_total_size(download.getFile_size());
|
||||
|
||||
if (download.isRestart()) {
|
||||
getTransference_waitstart_aux_queue().add(download);
|
||||
|
||||
synchronized (getWait_queue_lock()) {
|
||||
|
||||
ConcurrentLinkedQueue<Transference> aux = new ConcurrentLinkedQueue<>();
|
||||
|
||||
aux.addAll(getTransference_waitstart_queue());
|
||||
|
||||
getTransference_waitstart_queue().clear();
|
||||
|
||||
getTransference_waitstart_queue().add(download);
|
||||
|
||||
getTransference_waitstart_queue().addAll(aux);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
getTransference_waitstart_queue().add(download);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
public void hideAllExceptStatus() {
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{speed_label, slots_spinner, slots_label, slot_status_label, slot_status_label, pause_button, stop_button, progress_pbar, keep_temp_checkbox}) {
|
||||
|
||||
c.setVisible(false);
|
||||
@ -463,7 +463,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_download.upWaitQueue();
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
queue_up_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -476,7 +476,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_download.downWaitQueue();
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
queue_down_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -489,7 +489,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_download.topWaitQueue();
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
queue_top_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -502,7 +502,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_download.bottomWaitQueue();
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
queue_bottom_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -513,7 +513,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
printStatusNormal("Pausing download ...");
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{pause_button, speed_label, slots_label, slots_spinner, progress_pbar, file_name_label, file_size_label}) {
|
||||
|
||||
c.setEnabled(false);
|
||||
@ -531,7 +531,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
printStatusNormal("Downloading file from mega ...");
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{pause_button, speed_label, slots_label, slots_spinner, progress_pbar, file_name_label, file_size_label}) {
|
||||
|
||||
c.setEnabled(true);
|
||||
@ -553,7 +553,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
printStatusNormal(status);
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{pause_button, keep_temp_checkbox, stop_button, speed_label, slots_label, slots_spinner, progress_pbar, file_name_label, file_size_label}) {
|
||||
|
||||
c.setEnabled(false);
|
||||
@ -565,7 +565,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
@Override
|
||||
public void updateSpeed(final String speed, final Boolean visible) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
if (speed != null) {
|
||||
speed_label.setText(speed);
|
||||
}
|
||||
@ -579,14 +579,14 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
@Override
|
||||
public void updateProgressBar(final long progress, final double bar_rate) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
progress_pbar.setValue((int) Math.floor(bar_rate * progress));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(final int value) {
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
progress_pbar.setValue(value);
|
||||
});
|
||||
}
|
||||
@ -594,7 +594,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
@Override
|
||||
public void printStatusError(final String message) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
status_label.setForeground(Color.red);
|
||||
status_label.setText(LabelTranslatorSingleton.getInstance().translate(message));
|
||||
});
|
||||
@ -603,7 +603,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
@Override
|
||||
public void printStatusOK(final String message) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
status_label.setForeground(new Color(0, 170, 0));
|
||||
status_label.setText(LabelTranslatorSingleton.getInstance().translate(message));
|
||||
});
|
||||
@ -612,7 +612,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
@Override
|
||||
public void printStatusNormal(final String message) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
status_label.setForeground(new Color(102, 102, 102));
|
||||
status_label.setText(LabelTranslatorSingleton.getInstance().translate(message));
|
||||
});
|
||||
|
@ -86,7 +86,7 @@
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="file_tree_scrollpane" alignment="0" pref="305" max="32767" attributes="0"/>
|
||||
<Component id="file_tree_scrollpane" alignment="0" pref="310" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
@ -132,7 +132,8 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="upload_log_checkbox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="priority_checkbox" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
@ -177,7 +178,10 @@
|
||||
<Component id="add_folder_button" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="upload_log_checkbox" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="upload_log_checkbox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="priority_checkbox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@ -279,13 +283,23 @@
|
||||
<Component class="javax.swing.JCheckBox" name="upload_log_checkbox">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="18" style="1"/>
|
||||
<Font name="Dialog" size="14" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Enable log file"/>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
<Property name="enabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="priority_checkbox">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="14" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Put on TOP of waiting queue"/>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
<Property name="enabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="dance_button">
|
||||
|
@ -46,6 +46,10 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
private int _last_selected_index;
|
||||
private List<File> _drag_drop_files;
|
||||
|
||||
public JCheckBox getPriority_checkbox() {
|
||||
return priority_checkbox;
|
||||
}
|
||||
|
||||
public JCheckBox getUpload_log_checkbox() {
|
||||
return upload_log_checkbox;
|
||||
}
|
||||
@ -227,6 +231,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
add_folder_button = new javax.swing.JButton();
|
||||
add_files_button = new javax.swing.JButton();
|
||||
upload_log_checkbox = new javax.swing.JCheckBox();
|
||||
priority_checkbox = new javax.swing.JCheckBox();
|
||||
dance_button = new javax.swing.JButton();
|
||||
total_file_size_label = new javax.swing.JLabel();
|
||||
warning_label = new javax.swing.JLabel();
|
||||
@ -254,7 +259,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(file_tree_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE)
|
||||
.addComponent(file_tree_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 310, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Upload info"));
|
||||
@ -310,11 +315,16 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
}
|
||||
});
|
||||
|
||||
upload_log_checkbox.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
|
||||
upload_log_checkbox.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
|
||||
upload_log_checkbox.setText("Enable log file");
|
||||
upload_log_checkbox.setDoubleBuffered(true);
|
||||
upload_log_checkbox.setEnabled(false);
|
||||
|
||||
priority_checkbox.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
|
||||
priority_checkbox.setText("Put on TOP of waiting queue");
|
||||
priority_checkbox.setDoubleBuffered(true);
|
||||
priority_checkbox.setEnabled(false);
|
||||
|
||||
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
|
||||
jPanel2.setLayout(jPanel2Layout);
|
||||
jPanel2Layout.setHorizontalGroup(
|
||||
@ -324,7 +334,8 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(upload_log_checkbox)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(priority_checkbox))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(dir_name_label)
|
||||
@ -358,7 +369,9 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
.addComponent(add_files_button)
|
||||
.addComponent(add_folder_button))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(upload_log_checkbox)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(upload_log_checkbox)
|
||||
.addComponent(priority_checkbox))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
@ -461,6 +474,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
dir_name_textfield.setEnabled(false);
|
||||
dir_name_label.setEnabled(false);
|
||||
upload_log_checkbox.setEnabled(false);
|
||||
priority_checkbox.setEnabled(false);
|
||||
|
||||
JFileChooser filechooser = new javax.swing.JFileChooser();
|
||||
|
||||
@ -518,6 +532,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
skip_button.setEnabled(root_childs);
|
||||
skip_rest_button.setEnabled(root_childs);
|
||||
upload_log_checkbox.setEnabled(root_childs);
|
||||
priority_checkbox.setEnabled(root_childs);
|
||||
});
|
||||
});
|
||||
|
||||
@ -543,6 +558,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
dir_name_textfield.setEnabled(root_childs);
|
||||
dir_name_label.setEnabled(root_childs);
|
||||
upload_log_checkbox.setEnabled(root_childs);
|
||||
priority_checkbox.setEnabled(root_childs);
|
||||
|
||||
}
|
||||
}//GEN-LAST:event_add_files_buttonActionPerformed
|
||||
@ -560,6 +576,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
dir_name_textfield.setEnabled(false);
|
||||
dir_name_label.setEnabled(false);
|
||||
upload_log_checkbox.setEnabled(false);
|
||||
priority_checkbox.setEnabled(false);
|
||||
|
||||
JFileChooser filechooser = new javax.swing.JFileChooser();
|
||||
|
||||
@ -609,6 +626,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
skip_button.setEnabled(root_childs);
|
||||
skip_rest_button.setEnabled(root_childs);
|
||||
upload_log_checkbox.setEnabled(root_childs);
|
||||
priority_checkbox.setEnabled(root_childs);
|
||||
});
|
||||
});
|
||||
|
||||
@ -634,6 +652,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
dir_name_textfield.setEnabled(root_childs);
|
||||
dir_name_label.setEnabled(root_childs);
|
||||
upload_log_checkbox.setEnabled(root_childs);
|
||||
priority_checkbox.setEnabled(root_childs);
|
||||
|
||||
}
|
||||
|
||||
@ -705,7 +724,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
|
||||
used_space_label.setForeground(used_space_color);
|
||||
|
||||
for (JComponent c : new JComponent[]{used_space_label, add_files_button, add_folder_button, account_combobox, account_label, upload_log_checkbox}) {
|
||||
for (JComponent c : new JComponent[]{used_space_label, add_files_button, add_folder_button, account_combobox, account_label, upload_log_checkbox, priority_checkbox}) {
|
||||
|
||||
c.setEnabled(true);
|
||||
}
|
||||
@ -733,6 +752,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
add_files_button.setEnabled(false);
|
||||
add_folder_button.setEnabled(false);
|
||||
upload_log_checkbox.setEnabled(false);
|
||||
priority_checkbox.setEnabled(false);
|
||||
dir_name_textfield.setEnabled(false);
|
||||
dir_name_label.setEnabled(false);
|
||||
});
|
||||
@ -756,6 +776,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
add_files_button.setEnabled(false);
|
||||
add_folder_button.setEnabled(false);
|
||||
upload_log_checkbox.setEnabled(false);
|
||||
priority_checkbox.setEnabled(false);
|
||||
dir_name_textfield.setEnabled(false);
|
||||
dir_name_label.setEnabled(false);
|
||||
});
|
||||
@ -898,6 +919,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
private javax.swing.JScrollPane file_tree_scrollpane;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JCheckBox priority_checkbox;
|
||||
private javax.swing.JButton skip_button;
|
||||
private javax.swing.JButton skip_rest_button;
|
||||
private javax.swing.JLabel total_file_size_label;
|
||||
@ -919,6 +941,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
dir_name_textfield.setEnabled(false);
|
||||
dir_name_label.setEnabled(false);
|
||||
upload_log_checkbox.setEnabled(false);
|
||||
priority_checkbox.setEnabled(false);
|
||||
total_file_size_label.setText("[0 B]");
|
||||
});
|
||||
|
||||
@ -964,6 +987,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
dir_name_textfield.setEnabled(true);
|
||||
dir_name_label.setEnabled(true);
|
||||
upload_log_checkbox.setEnabled(true);
|
||||
priority_checkbox.setEnabled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ public class LabelTranslatorSingleton {
|
||||
_addTranslation("Split content in different uploads", "Separar contenido en diferentes subidas");
|
||||
_addTranslation("Merge content in the same upload", "Juntar todo en la misma subida");
|
||||
_addTranslation("How do you want to proceed?", "¿Qué quieres hacer?");
|
||||
_addTranslation("Put on TOP of waiting queue", "Poner en lo alto de la cola de espera");
|
||||
_addTranslation("TOP", "ENCIMA DE TODO");
|
||||
_addTranslation("BOTTOM", "DEBAJO DE TODO");
|
||||
_addTranslation("Freeze transferences before start", "Congelar transferencias antes de empezar");
|
||||
|
@ -28,7 +28,8 @@
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="746" max="32767" attributes="0"/>
|
||||
<Component id="priority_checkbox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="dance_button" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="links_scrollpane" max="32767" attributes="0"/>
|
||||
@ -76,7 +77,10 @@
|
||||
<Component id="use_mega_account_down_combobox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="dance_button" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="dance_button" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="priority_checkbox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@ -202,5 +206,14 @@
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="priority_checkbox">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="14" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Put on TOP of waiting queue"/>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -15,6 +15,7 @@ import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JTextArea;
|
||||
@ -123,6 +124,7 @@ public class LinkGrabberDialog extends javax.swing.JDialog implements ClipboardC
|
||||
dlc_button = new javax.swing.JButton();
|
||||
use_mega_account_down_label = new javax.swing.JLabel();
|
||||
use_mega_account_down_combobox = new javax.swing.JComboBox<>();
|
||||
priority_checkbox = new javax.swing.JCheckBox();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle("Link Grabber");
|
||||
@ -185,6 +187,10 @@ public class LinkGrabberDialog extends javax.swing.JDialog implements ClipboardC
|
||||
}
|
||||
});
|
||||
|
||||
priority_checkbox.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
|
||||
priority_checkbox.setText("Put on TOP of waiting queue");
|
||||
priority_checkbox.setDoubleBuffered(true);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@ -193,7 +199,8 @@ public class LinkGrabberDialog extends javax.swing.JDialog implements ClipboardC
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 746, Short.MAX_VALUE)
|
||||
.addComponent(priority_checkbox)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(dance_button))
|
||||
.addComponent(links_scrollpane)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
@ -231,7 +238,9 @@ public class LinkGrabberDialog extends javax.swing.JDialog implements ClipboardC
|
||||
.addComponent(use_mega_account_down_label)
|
||||
.addComponent(use_mega_account_down_combobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(dance_button)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(dance_button)
|
||||
.addComponent(priority_checkbox))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
@ -428,6 +437,7 @@ public class LinkGrabberDialog extends javax.swing.JDialog implements ClipboardC
|
||||
private javax.swing.JLabel links_label;
|
||||
private javax.swing.JScrollPane links_scrollpane;
|
||||
private javax.swing.JTextArea links_textarea;
|
||||
private javax.swing.JCheckBox priority_checkbox;
|
||||
private javax.swing.JComboBox<String> use_mega_account_down_combobox;
|
||||
private javax.swing.JLabel use_mega_account_down_label;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
@ -441,5 +451,10 @@ public class LinkGrabberDialog extends javax.swing.JDialog implements ClipboardC
|
||||
links_textarea.append((current_text.length() > 0 ? "\n\n" : "") + extractMegaLinksFromString(extractStringFromClipboardContents(_clipboardspy.getContents())));
|
||||
});
|
||||
}
|
||||
|
||||
public JCheckBox getPriority_checkbox() {
|
||||
return priority_checkbox;
|
||||
}
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(LinkGrabberDialog.class.getName());
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ import javax.swing.UIManager;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "6.88";
|
||||
public static final String VERSION = "6.90";
|
||||
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;
|
||||
@ -909,13 +909,15 @@ public final class MainPanel {
|
||||
if (current_dir_version != null && !current_dir_version.equals(VERSION)) {
|
||||
|
||||
old_version_major = findFirstRegex("([0-9]+)\\.[0-9]+$", old_version, 1);
|
||||
old_version_minor = findFirstRegex("[0-9]+\\.([0-9]+)$", old_version, 1);
|
||||
old_version_major = findFirstRegex("[0-9]+\\.([0-9]+)$", old_version, 1);
|
||||
|
||||
String current_dir_major = findFirstRegex("([0-9]+)\\.[0-9]+$", current_dir_version, 1);
|
||||
String current_dir_minor = findFirstRegex("[0-9]+\\.([0-9]+)$", current_dir_version, 1);
|
||||
|
||||
if (Integer.parseInt(current_dir_major) > Integer.parseInt(old_version_major) || (Integer.parseInt(current_dir_major) == Integer.parseInt(old_version_major) && Integer.parseInt(current_dir_minor) > Integer.parseInt(old_version_minor))) {
|
||||
old_version = current_dir_version;
|
||||
old_version_major = current_dir_major;
|
||||
old_version_minor = current_dir_minor;
|
||||
}
|
||||
|
||||
Files.move(Paths.get(file.getAbsolutePath()), Paths.get(old_backups_dir.getAbsolutePath() + "/" + file.getName()), StandardCopyOption.REPLACE_EXISTING);
|
||||
@ -927,6 +929,8 @@ public final class MainPanel {
|
||||
|
||||
}
|
||||
|
||||
System.out.println(old_version_major + " " + old_version_minor);
|
||||
|
||||
if (!old_version.equals("0.0") && (Integer.parseInt(version_major) > Integer.parseInt(old_version_major) || (Integer.parseInt(version_major) == Integer.parseInt(old_version_major) && Integer.parseInt(version_minor) > Integer.parseInt(old_version_minor)))) {
|
||||
Object[] options = {"No",
|
||||
LabelTranslatorSingleton.getInstance().translate("Yes")};
|
||||
@ -939,7 +943,7 @@ public final class MainPanel {
|
||||
options[0]);
|
||||
|
||||
if (n == 1) {
|
||||
Files.move(Paths.get(System.getProperty("user.home") + "/.megabasterd_old_backups/.megabasterd" + old_version + "/" + SqliteSingleton.SQLITE_FILE), Paths.get(System.getProperty("user.home") + "/.megabasterd" + MainPanel.VERSION + "/" + SqliteSingleton.SQLITE_FILE), StandardCopyOption.REPLACE_EXISTING);
|
||||
Files.copy(Paths.get(System.getProperty("user.home") + "/.megabasterd_old_backups/.megabasterd" + old_version + "/" + SqliteSingleton.SQLITE_FILE), Paths.get(System.getProperty("user.home") + "/.megabasterd" + MainPanel.VERSION + "/" + SqliteSingleton.SQLITE_FILE), StandardCopyOption.REPLACE_EXISTING);
|
||||
|
||||
JOptionPane.showMessageDialog(getView(), LabelTranslatorSingleton.getInstance().translate("MegaBasterd will restart"), LabelTranslatorSingleton.getInstance().translate("Restart required"), JOptionPane.WARNING_MESSAGE);
|
||||
|
||||
@ -1130,7 +1134,7 @@ public final class MainPanel {
|
||||
|
||||
if (!tthis.isUse_mega_account_down() || (_mega_accounts.get(email) != null && (ma = checkMegaAccountLoginAndShowMasterPassDialog(tthis, getView(), email)) != null)) {
|
||||
|
||||
Download download = new Download(tthis, ma, (String) o.get("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"));
|
||||
Download download = new Download(tthis, ma, (String) o.get("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);
|
||||
|
||||
getDownload_manager().getTransference_provision_queue().add(download);
|
||||
|
||||
@ -1255,7 +1259,7 @@ public final class MainPanel {
|
||||
|
||||
if ((ma = checkMegaAccountLoginAndShowMasterPassDialog(tthis, getView(), email)) != null) {
|
||||
|
||||
Upload upload = new Upload(tthis, ma, (String) o.get("filename"), (String) o.get("parent_node"), (String) o.get("ul_key") != null ? bin2i32a(BASE642Bin((String) o.get("ul_key"))) : null, (String) o.get("url"), (String) o.get("root_node"), BASE642Bin((String) o.get("share_key")), (String) o.get("folder_link"));
|
||||
Upload upload = new Upload(tthis, ma, (String) o.get("filename"), (String) o.get("parent_node"), (String) o.get("ul_key") != null ? bin2i32a(BASE642Bin((String) o.get("ul_key"))) : null, (String) o.get("url"), (String) o.get("root_node"), BASE642Bin((String) o.get("share_key")), (String) o.get("folder_link"), false);
|
||||
|
||||
getUpload_manager().getTransference_provision_queue().add(upload);
|
||||
|
||||
|
@ -306,7 +306,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
if (!getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().isEmpty()) {
|
||||
|
||||
Upload upload = new Upload(getMain_panel(), ma, f.getAbsolutePath(), file_parent, null, null, parent_node, share_key, folder_link);
|
||||
Upload upload = new Upload(getMain_panel(), ma, f.getAbsolutePath(), file_parent, null, null, parent_node, share_key, folder_link, dialog.getPriority_checkbox().isSelected());
|
||||
|
||||
getMain_panel().getUpload_manager().getTransference_provision_queue().add(upload);
|
||||
|
||||
@ -938,7 +938,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
|
||||
|
||||
Set<String> urls = new HashSet(findAllRegex("(?:https?|mega)://[^/\r\n]+/(#[^\r\n!]*?)?![^\r\n!]+![^\r\n]+", dialog.getLinks_textarea().getText(), 0));
|
||||
Set<String> urls = new HashSet(findAllRegex("(?:https?|mega)://[^\r\n]+(#[^\r\n!]*?)?![^\r\n!]+![^\\?\r\n]+", dialog.getLinks_textarea().getText(), 0));
|
||||
|
||||
Set<String> megadownloader = new HashSet(findAllRegex("mega://enc[^\r\n]+", dialog.getLinks_textarea().getText(), 0));
|
||||
|
||||
@ -967,7 +967,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
Set<String> dlc = new HashSet(findAllRegex("dlc://([^\r\n]+)", dialog.getLinks_textarea().getText(), 1));
|
||||
|
||||
dlc.stream().map((d) -> CryptTools.decryptDLC(d, _main_panel)).forEachOrdered((links) -> {
|
||||
links.stream().filter((link) -> (findFirstRegex("(?:https?|mega)://[^/\r\n]+/(#[^\r\n!]*?)?![^\r\n!]+![^\r\n]+", link, 0) != null)).forEachOrdered((link) -> {
|
||||
links.stream().filter((link) -> (findFirstRegex("(?:https?|mega)://[^\r\n](#[^\r\n!]*?)?![^\r\n!]+![^\\?\r\n]+", link, 0) != null)).forEachOrdered((link) -> {
|
||||
urls.add(link);
|
||||
});
|
||||
});
|
||||
@ -1023,7 +1023,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
if (!getMain_panel().getDownload_manager().getTransference_preprocess_global_queue().isEmpty()) {
|
||||
|
||||
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(), true, getMain_panel().isUse_custom_chunks_dir() ? getMain_panel().getCustom_chunks_dir() : null);
|
||||
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(), true, getMain_panel().isUse_custom_chunks_dir() ? getMain_panel().getCustom_chunks_dir() : null, dialog.getPriority_checkbox().isSelected());
|
||||
|
||||
getMain_panel().getDownload_manager().getTransference_provision_queue().add(download);
|
||||
|
||||
@ -1049,7 +1049,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
if (!getMain_panel().getDownload_manager().getTransference_preprocess_global_queue().isEmpty()) {
|
||||
|
||||
download = new Download(getMain_panel(), ma, url, dl_path, null, null, null, null, null, getMain_panel().isUse_slots_down(), false, getMain_panel().isUse_custom_chunks_dir() ? getMain_panel().getCustom_chunks_dir() : null);
|
||||
download = new Download(getMain_panel(), ma, url, dl_path, null, null, null, null, null, getMain_panel().isUse_slots_down(), false, getMain_panel().isUse_custom_chunks_dir() ? getMain_panel().getCustom_chunks_dir() : null, dialog.getPriority_checkbox().isSelected());
|
||||
|
||||
getMain_panel().getDownload_manager().getTransference_provision_queue().add(download);
|
||||
|
||||
|
@ -796,7 +796,7 @@ public class MiscTools {
|
||||
|
||||
try {
|
||||
|
||||
String decoded = MiscTools.findFirstRegex("(?:https?|mega)://[^/\r\n]+/(#[^\r\n!]*?)?![^\r\n!]+![^\r\n]+", new String(Base64.getDecoder().decode(chunk), "UTF-8"), 0);
|
||||
String decoded = MiscTools.findFirstRegex("(?:https?|mega)://[^\r\n]+(#[^\r\n!]*?)?![^\r\n!]+![^\\?\r\n]+", new String(Base64.getDecoder().decode(chunk), "UTF-8"), 0);
|
||||
|
||||
if (decoded != null) {
|
||||
links.add(decoded);
|
||||
@ -807,7 +807,7 @@ public class MiscTools {
|
||||
}
|
||||
}
|
||||
|
||||
links.addAll(findAllRegex("(?:https?|mega)://[^/\r\n]+/(#[^\r\n!]*?)?![^\r\n!]+![^\r\n]+", URLDecoder.decode(data, "UTF-8"), 0));
|
||||
links.addAll(findAllRegex("(?:https?|mega)://[^\r\n]+(#[^\r\n!]*?)?![^\r\n!]+![^\\?\r\n]+", URLDecoder.decode(data, "UTF-8"), 0));
|
||||
|
||||
links.addAll(findAllRegex("mega://e(n|l)c[^\r\n]+", URLDecoder.decode(data, "UTF-8"), 0));
|
||||
|
||||
@ -827,7 +827,7 @@ public class MiscTools {
|
||||
if (data != null) {
|
||||
|
||||
try {
|
||||
ArrayList<String> links = findAllRegex("(?:https?|mega)://[^/\r\n]+/(#[^\r\n!]*?)?![^\r\n!]+![^\r\n]+", URLDecoder.decode(data, "UTF-8"), 0);
|
||||
ArrayList<String> links = findAllRegex("(?:https?|mega)://[^\r\n]+(#[^\r\n!]*?)?![^\r\n!]+![^\\?\r\n]+", URLDecoder.decode(data, "UTF-8"), 0);
|
||||
|
||||
links.addAll(findAllRegex("mega://e(n|l)c[^\r\n]+", URLDecoder.decode(data, "UTF-8"), 0));
|
||||
|
||||
|
@ -179,81 +179,80 @@ public class StreamerDialog extends javax.swing.JDialog implements ClipboardChan
|
||||
|
||||
final Dialog tthis = this;
|
||||
|
||||
swingInvoke(() -> {
|
||||
try {
|
||||
boolean error = false;
|
||||
try {
|
||||
boolean error = false;
|
||||
|
||||
String stream_link = null;
|
||||
String stream_link = null;
|
||||
|
||||
String link = URLDecoder.decode(original_link_textfield.getText(), "UTF-8").trim();
|
||||
String link = URLDecoder.decode(original_link_textfield.getText(), "UTF-8").trim();
|
||||
|
||||
if (link.length() > 0) {
|
||||
if (link.length() > 0) {
|
||||
|
||||
try {
|
||||
try {
|
||||
|
||||
if (findFirstRegex("://enc", link, 0) != null) {
|
||||
if (findFirstRegex("://enc", link, 0) != null) {
|
||||
|
||||
link = CryptTools.decryptMegaDownloaderLink(link);
|
||||
link = CryptTools.decryptMegaDownloaderLink(link);
|
||||
|
||||
} else if (findFirstRegex("://elc", link, 0) != null) {
|
||||
} else if (findFirstRegex("://elc", link, 0) != null) {
|
||||
|
||||
HashSet links = CryptTools.decryptELC(link, ((MainPanelView) tthis.getParent()).getMain_panel());
|
||||
HashSet links = CryptTools.decryptELC(link, ((MainPanelView) tthis.getParent()).getMain_panel());
|
||||
|
||||
if (links != null) {
|
||||
if (links != null) {
|
||||
|
||||
link = (String) links.iterator().next();
|
||||
}
|
||||
link = (String) links.iterator().next();
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
||||
error = true;
|
||||
|
||||
LOG.log(Level.SEVERE, ex.getMessage());
|
||||
}
|
||||
|
||||
String data;
|
||||
} catch (Exception ex) {
|
||||
|
||||
if (findFirstRegex("://mega(\\.co)?\\.nz/#[^fF]", link, 0) != null || findFirstRegex("https?://[^/]+/![^!]+![0-9a-fA-F]+", link, 0) != null) {
|
||||
error = true;
|
||||
|
||||
String selected_account = (String) use_mega_account_down_combobox.getSelectedItem();
|
||||
LOG.log(Level.SEVERE, ex.getMessage());
|
||||
}
|
||||
|
||||
data = Bin2UrlBASE64(((selected_account != null ? selected_account : "") + "|" + link).getBytes("UTF-8"));
|
||||
String data;
|
||||
|
||||
stream_link = "http://localhost:1337/video/" + data;
|
||||
if (findFirstRegex("://mega(\\.co)?\\.nz/#[^fF]", link, 0) != null || findFirstRegex("https?://[^/]+/![^!]+![0-9a-fA-F]+", link, 0) != null) {
|
||||
|
||||
} else {
|
||||
String selected_account = (String) use_mega_account_down_combobox.getSelectedItem();
|
||||
|
||||
error = true;
|
||||
}
|
||||
data = Bin2UrlBASE64(((selected_account != null ? selected_account : "") + "|" + link).getBytes("UTF-8"));
|
||||
|
||||
stream_link = "http://localhost:1337/video/" + data;
|
||||
|
||||
} else {
|
||||
|
||||
error = true;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
} else {
|
||||
|
||||
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("Please, paste a Mega/MegaCrypter/ELC link!"), "Error", JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
original_link_textfield.setText("");
|
||||
|
||||
dance_button.setEnabled(true);
|
||||
|
||||
original_link_textfield.setEnabled(true);
|
||||
|
||||
} else {
|
||||
|
||||
_mainPanelView.getMain_panel().getClipboardspy().detachObserver((ClipboardChangeObserver) tthis);
|
||||
copyTextToClipboard(stream_link);
|
||||
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("Streaming link was copied to clipboard!\nRemember to keep MegaBasterd running in background while playing content."));
|
||||
dispose();
|
||||
getParent().dispatchEvent(new WindowEvent(tthis, WINDOW_CLOSING));
|
||||
}
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
LOG.log(Level.SEVERE, ex.getMessage());
|
||||
error = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (error) {
|
||||
|
||||
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("Please, paste a Mega/MegaCrypter/ELC link!"), "Error", JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
original_link_textfield.setText("");
|
||||
|
||||
dance_button.setEnabled(true);
|
||||
|
||||
original_link_textfield.setEnabled(true);
|
||||
|
||||
} else {
|
||||
|
||||
_mainPanelView.getMain_panel().getClipboardspy().detachObserver((ClipboardChangeObserver) tthis);
|
||||
copyTextToClipboard(stream_link);
|
||||
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("Streaming link was copied to clipboard!\nRemember to keep MegaBasterd running in background while playing content."));
|
||||
dispose();
|
||||
getParent().dispatchEvent(new WindowEvent(tthis, WINDOW_CLOSING));
|
||||
}
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
LOG.log(Level.SEVERE, ex.getMessage());
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_dance_buttonActionPerformed
|
||||
|
||||
private void use_mega_account_down_comboboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_use_mega_account_down_comboboxItemStateChanged
|
||||
|
@ -30,6 +30,8 @@ public interface Transference {
|
||||
|
||||
void close();
|
||||
|
||||
boolean isPriority();
|
||||
|
||||
boolean isPaused();
|
||||
|
||||
boolean isStopped();
|
||||
|
@ -25,6 +25,7 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
private final ConcurrentLinkedQueue<Runnable> _transference_preprocess_queue;
|
||||
private final ConcurrentLinkedQueue<Transference> _transference_provision_queue;
|
||||
private final ConcurrentLinkedQueue<Transference> _transference_waitstart_queue;
|
||||
private final ConcurrentLinkedQueue<Transference> _transference_waitstart_aux_queue;
|
||||
private final ConcurrentLinkedQueue<Transference> _transference_remove_queue;
|
||||
private final ConcurrentLinkedQueue<Transference> _transference_finished_queue;
|
||||
private final ConcurrentLinkedQueue<Transference> _transference_running_list;
|
||||
@ -77,6 +78,7 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
_wait_queue_lock = new Object();
|
||||
_transference_preprocess_global_queue = new ConcurrentLinkedQueue<>();
|
||||
_transference_waitstart_queue = new ConcurrentLinkedQueue<>();
|
||||
_transference_waitstart_aux_queue = new ConcurrentLinkedQueue<>();
|
||||
_transference_provision_queue = new ConcurrentLinkedQueue<>();
|
||||
_transference_remove_queue = new ConcurrentLinkedQueue<>();
|
||||
_transference_finished_queue = new ConcurrentLinkedQueue<>();
|
||||
@ -167,7 +169,7 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
_starting_transferences = starting;
|
||||
}
|
||||
|
||||
public Object getQueue_sort_lock() {
|
||||
public Object geWaitStartAuxQueue_sort_lock() {
|
||||
return _queue_sort_lock;
|
||||
}
|
||||
|
||||
@ -469,17 +471,21 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
secureNotify();
|
||||
}
|
||||
|
||||
protected void sortTransferenceWaitStartQueue() {
|
||||
public ConcurrentLinkedQueue<Transference> getTransference_waitstart_aux_queue() {
|
||||
return _transference_waitstart_aux_queue;
|
||||
}
|
||||
|
||||
protected void sortTransferenceWaitStartAuxQueue() {
|
||||
|
||||
synchronized (_queue_sort_lock) {
|
||||
|
||||
ArrayList<Transference> trans_list = new ArrayList(getTransference_waitstart_queue());
|
||||
ArrayList<Transference> trans_list = new ArrayList(getTransference_waitstart_aux_queue());
|
||||
|
||||
trans_list.sort((Transference o1, Transference o2) -> o1.getFile_name().compareToIgnoreCase(o2.getFile_name()));
|
||||
|
||||
getTransference_waitstart_queue().clear();
|
||||
getTransference_waitstart_aux_queue().clear();
|
||||
|
||||
getTransference_waitstart_queue().addAll(trans_list);
|
||||
getTransference_waitstart_aux_queue().addAll(trans_list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -625,6 +631,10 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
|
||||
setPreprocessing_transferences(false);
|
||||
|
||||
synchronized (getTransference_preprocess_queue()) {
|
||||
getTransference_preprocess_queue().notifyAll();
|
||||
}
|
||||
|
||||
secureNotify();
|
||||
});
|
||||
}
|
||||
@ -646,21 +656,49 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
provision(transference);
|
||||
|
||||
}
|
||||
|
||||
if (isPreprocessing_transferences()) {
|
||||
|
||||
synchronized (getTransference_preprocess_queue()) {
|
||||
try {
|
||||
getTransference_preprocess_queue().wait(1000);
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(TransferenceManager.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
synchronized (getQueue_sort_lock()) {
|
||||
synchronized (geWaitStartAuxQueue_sort_lock()) {
|
||||
|
||||
sortTransferenceWaitStartQueue();
|
||||
getTransference_waitstart_queue().forEach((up) -> {
|
||||
sortTransferenceWaitStartAuxQueue();
|
||||
|
||||
if (getTransference_waitstart_aux_queue().peek().isPriority()) {
|
||||
|
||||
ArrayList<Transference> trans_list = new ArrayList(getTransference_waitstart_queue());
|
||||
|
||||
trans_list.addAll(0, getTransference_waitstart_aux_queue());
|
||||
|
||||
getTransference_waitstart_queue().clear();
|
||||
|
||||
getTransference_waitstart_queue().addAll(trans_list);
|
||||
|
||||
} else {
|
||||
getTransference_waitstart_queue().addAll(getTransference_waitstart_aux_queue());
|
||||
}
|
||||
|
||||
getTransference_waitstart_aux_queue().clear();
|
||||
|
||||
getTransference_waitstart_queue().forEach((t) -> {
|
||||
swingInvoke(() -> {
|
||||
getScroll_panel().remove((Component) up.getView());
|
||||
getScroll_panel().add((Component) up.getView());
|
||||
getScroll_panel().remove((Component) t.getView());
|
||||
getScroll_panel().add((Component) t.getView());
|
||||
});
|
||||
});
|
||||
getTransference_finished_queue().forEach((up) -> {
|
||||
getTransference_finished_queue().forEach((t) -> {
|
||||
swingInvoke(() -> {
|
||||
getScroll_panel().remove((Component) up.getView());
|
||||
getScroll_panel().add((Component) up.getView());
|
||||
getScroll_panel().remove((Component) t.getView());
|
||||
getScroll_panel().add((Component) t.getView());
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -74,10 +74,12 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
private volatile boolean _closed;
|
||||
private volatile boolean _canceled;
|
||||
private volatile String _temp_mac_data;
|
||||
private final boolean _priority;
|
||||
|
||||
public Upload(MainPanel main_panel, MegaAPI ma, String filename, String parent_node, int[] ul_key, String ul_url, String root_node, byte[] share_key, String folder_link) {
|
||||
public Upload(MainPanel main_panel, MegaAPI ma, String filename, String parent_node, int[] ul_key, String ul_url, String root_node, byte[] share_key, String folder_link, boolean priority) {
|
||||
|
||||
_notified = false;
|
||||
_priority = priority;
|
||||
_frozen = main_panel.isInit_paused();
|
||||
_provision_ok = true;
|
||||
_status_error = null;
|
||||
@ -114,6 +116,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
public Upload(Upload upload) {
|
||||
|
||||
_notified = false;
|
||||
_priority = upload.isPriority();
|
||||
_provision_ok = true;
|
||||
_status_error = null;
|
||||
_auto_retry_on_error = true;
|
||||
@ -146,6 +149,10 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
_temp_mac_data = null;
|
||||
}
|
||||
|
||||
public boolean isPriority() {
|
||||
return _priority;
|
||||
}
|
||||
|
||||
public boolean isCanceled() {
|
||||
return _canceled;
|
||||
}
|
||||
@ -1213,10 +1220,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
@Override
|
||||
public void unfreeze() {
|
||||
|
||||
swingInvoke(() -> {
|
||||
|
||||
getView().printStatusNormal(getView().getStatus_label().getText().replaceFirst("^\\([^)]+\\) ", ""));
|
||||
});
|
||||
getView().printStatusNormal(getView().getStatus_label().getText().replaceFirst("^\\([^)]+\\) ", ""));
|
||||
|
||||
_frozen = false;
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package com.tonikelope.megabasterd;
|
||||
import static com.tonikelope.megabasterd.MiscTools.*;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import static java.util.logging.Level.SEVERE;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -30,9 +29,6 @@ public class UploadManager extends TransferenceManager {
|
||||
|
||||
@Override
|
||||
public void provision(final Transference upload) {
|
||||
swingInvoke(() -> {
|
||||
getScroll_panel().add(((Upload) upload).getView());
|
||||
});
|
||||
|
||||
((Upload) upload).provisionIt();
|
||||
|
||||
@ -40,23 +36,7 @@ public class UploadManager extends TransferenceManager {
|
||||
|
||||
increment_total_size(upload.getFile_size());
|
||||
|
||||
if (upload.isRestart()) {
|
||||
synchronized (getWait_queue_lock()) {
|
||||
|
||||
ConcurrentLinkedQueue<Transference> aux = new ConcurrentLinkedQueue<>();
|
||||
|
||||
aux.addAll(getTransference_waitstart_queue());
|
||||
|
||||
getTransference_waitstart_queue().clear();
|
||||
|
||||
getTransference_waitstart_queue().add(upload);
|
||||
|
||||
getTransference_waitstart_queue().addAll(aux);
|
||||
|
||||
}
|
||||
} else {
|
||||
getTransference_waitstart_queue().add(upload);
|
||||
}
|
||||
getTransference_waitstart_aux_queue().add(upload);
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -417,7 +417,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
public void hideAllExceptStatus() {
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{speed_label, slots_spinner, slots_label, slot_status_label, pause_button, stop_button, progress_pbar, cbc_label}) {
|
||||
|
||||
c.setVisible(false);
|
||||
@ -464,7 +464,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_upload.upWaitQueue();
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
queue_up_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -477,7 +477,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_upload.downWaitQueue();
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
queue_down_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -489,7 +489,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_upload.topWaitQueue();
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
queue_top_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -502,7 +502,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_upload.bottomWaitQueue();
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
queue_bottom_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -510,7 +510,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
public void updateCBC(String status) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
cbc_label.setText(status);
|
||||
});
|
||||
}
|
||||
@ -520,7 +520,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
printStatusNormal("Pausing upload ...");
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{pause_button, speed_label, slots_label, slots_spinner, progress_pbar, file_name_label, file_size_label}) {
|
||||
|
||||
c.setEnabled(false);
|
||||
@ -538,7 +538,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
printStatusNormal(status);
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{pause_button, stop_button, speed_label, slots_label, slots_spinner, progress_pbar, file_name_label, file_size_label}) {
|
||||
|
||||
c.setEnabled(false);
|
||||
@ -551,7 +551,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
printStatusNormal("Uploading file to mega ...");
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{pause_button, speed_label, slots_label, slots_spinner, progress_pbar, file_name_label, file_size_label}) {
|
||||
|
||||
c.setEnabled(true);
|
||||
@ -570,7 +570,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
@Override
|
||||
public void updateSpeed(final String speed, final Boolean visible) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
if (speed != null) {
|
||||
speed_label.setText(speed);
|
||||
}
|
||||
@ -584,14 +584,14 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
@Override
|
||||
public void updateProgressBar(final long progress, final double bar_rate) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
progress_pbar.setValue((int) Math.floor(bar_rate * progress));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(final int value) {
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
progress_pbar.setValue(value);
|
||||
});
|
||||
}
|
||||
@ -599,7 +599,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
@Override
|
||||
public void printStatusError(final String message) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
status_label.setForeground(Color.red);
|
||||
status_label.setText(LabelTranslatorSingleton.getInstance().translate(message));
|
||||
});
|
||||
@ -608,7 +608,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
@Override
|
||||
public void printStatusOK(final String message) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
status_label.setForeground(new Color(0, 170, 0));
|
||||
status_label.setText(LabelTranslatorSingleton.getInstance().translate(message));
|
||||
});
|
||||
@ -617,7 +617,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
@Override
|
||||
public void printStatusNormal(final String message) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
swingInvokeAndWait(() -> {
|
||||
status_label.setForeground(new Color(102, 102, 102));
|
||||
status_label.setText(LabelTranslatorSingleton.getInstance().translate(message));
|
||||
});
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 189 KiB After Width: | Height: | Size: 198 KiB |
Loading…
x
Reference in New Issue
Block a user