Skip to content

Commit

Permalink
2.92
Browse files Browse the repository at this point in the history
  • Loading branch information
tonikelope committed Feb 2, 2018
1 parent 5889043 commit 41b86e5
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 15 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>2.91</version>
<version>2.92</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/com/tonikelope/megabasterd/ChunkDownloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ public void run() {
conta_error = 0;

error = false;

error509 = false;

while (!_exit && !_download.isStopped() && (conta_error < MAX_SLOT_ERROR || _download.getMain_panel().isUse_smart_proxy())) {
while (!_exit && !_download.isStopped() && (error509 || conta_error < MAX_SLOT_ERROR || _download.getMain_panel().isUse_smart_proxy())) {

if (httpclient == null || error || _download.getMain_panel().isUse_smart_proxy()) {

Expand Down Expand Up @@ -164,6 +165,10 @@ public void run() {

error = false;

if (error509) {
getDownload().getView().set509Error(false);
}

error509 = false;

try (CloseableHttpResponse httpresponse = httpclient.execute(httpget)) {
Expand All @@ -180,7 +185,10 @@ public void run() {
error = true;

if (http_status == 509) {

error509 = true;

getDownload().getView().set509Error(true);
}

} else {
Expand Down
22 changes: 20 additions & 2 deletions src/main/java/com/tonikelope/megabasterd/ChunkDownloaderMono.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void run() {
String worker_url = null;
Chunk chunk;
int reads, conta_error, http_status = 200;
boolean error;
boolean error, error509;
HttpGet httpget = null;
CloseableHttpResponse httpresponse = null;

Expand All @@ -40,9 +40,13 @@ public void run() {

error = false;

error509 = false;

getDownload().getView().set509Error(false);

InputStream is = null;

while (!isExit() && !getDownload().isStopped()) {
while (!isExit() && !getDownload().isStopped() && (error509 || conta_error < MAX_SLOT_ERROR)) {

if (worker_url == null || error) {

Expand Down Expand Up @@ -71,12 +75,26 @@ public void run() {

error = false;

if (error509) {

getDownload().getView().set509Error(false);
}

error509 = false;

if (http_status != HttpStatus.SC_OK) {

Logger.getLogger(getClass().getName()).log(Level.INFO, "{0} Failed : HTTP error code : {1}", new Object[]{Thread.currentThread().getName(), http_status});

error = true;

if (http_status == 509) {

error509 = true;

getDownload().getView().set509Error(true);
}

getDownload().rejectChunkId(chunk.getId());

conta_error++;
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/tonikelope/megabasterd/Download.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
private long _last_chunk_id_dispatched;
private final MegaAPI _ma;
private volatile boolean _canceled;
private volatile boolean _error509;

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, int slots, boolean restart) {

Expand Down Expand Up @@ -116,6 +117,7 @@ public Download(MainPanel main_panel, MegaAPI ma, String url, String download_pa
_file_noexpire = file_noexpire;
_use_slots = use_slots;
_slots = slots;
_error509 = false;
_restart = restart;
_secure_notify_lock = new Object();
_workers_lock = new Object();
Expand Down Expand Up @@ -170,6 +172,14 @@ public Download(Download download) {

}

public boolean isError509() {
return _error509;
}

public void setError509(boolean error509) {
_error509 = error509;
}

public Object getWorkers_lock() {
return _workers_lock;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/tonikelope/megabasterd/DownloadView.form
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<Component id="copy_link_button" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="speed_label" min="-2" pref="340" max="-2" attributes="0"/>
<Component id="speed_label" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="pause_button" min="-2" max="-2" attributes="0"/>
</Group>
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/com/tonikelope/megabasterd/DownloadView.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(copy_link_button))
.addGroup(layout.createSequentialGroup()
.addComponent(speed_label, javax.swing.GroupLayout.PREFERRED_SIZE, 340, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(speed_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(pause_button))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
Expand Down Expand Up @@ -612,6 +612,13 @@ public Object call() throws Exception {
});
}

public void set509Error(boolean error) {

_download.setError509(error);

speed_label.setIcon(error ? new javax.swing.ImageIcon(getClass().getResource("/images/icons8-error-40.png")) : null);
}

// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton close_button;
private javax.swing.JButton copy_link_button;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private void cancel_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN
private void ok_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ok_buttonActionPerformed

status_label.setText("Verifying your password, please wait...");

pack();

final Dialog tthis = this;
Expand All @@ -215,7 +215,7 @@ public void run() {
JOptionPane.showMessageDialog(tthis, "BAD PASSWORD!", "Error", JOptionPane.ERROR_MESSAGE);

status_label.setText("");

pack();

current_pass_textfield.setText("");
Expand All @@ -236,7 +236,7 @@ public void run() {
} catch (HeadlessException | NoSuchAlgorithmException | InvalidKeySpecException ex) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
}

}
});

Expand Down
10 changes: 9 additions & 1 deletion src/main/java/com/tonikelope/megabasterd/GlobalSpeedMeter.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,17 @@ private long calcTransferenceSpeed(Transference transference, HashMap properties

no_data_count = 0;

} else if (transference instanceof Download && ((Download) transference).isError509()) {

transference.getView().updateSpeed("BANDWIDTH LIMIT ERROR!", true);

sp = 0L;

no_data_count++;

} else {

transference.getView().updateSpeed("------ *", true);
transference.getView().updateSpeed("------", true);

sp = 0L;

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 @@ -48,7 +48,7 @@
*/
public final class MainPanel {

public static final String VERSION = "2.91";
public static final String VERSION = "2.92";
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="14" style="2"/>
</Property>
<Property name="text" type="java.lang.String" value="Note: if you want to download without using a MEGA account (or using a FREE one) you SHOULD enable MULTI SLOT. "/>
<Property name="text" type="java.lang.String" value="Note: if you want to download without using a MEGA account (or using a FREE one) you MUST enable MULTI SLOT. "/>
</Properties>
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
megacrypter_reverse_warning_label.setText("Note: you MUST \"OPEN\" this port in your router/firewall.");

rec_download_slots_label.setFont(new java.awt.Font("Dialog", 2, 14)); // NOI18N
rec_download_slots_label.setText("Note: if you want to download without using a MEGA account (or using a FREE one) you SHOULD enable MULTI SLOT. ");
rec_download_slots_label.setText("Note: if you want to download without using a MEGA account (or using a FREE one) you MUST enable MULTI SLOT. ");

megacrypter_reverse_checkbox.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
megacrypter_reverse_checkbox.setText("Use Megacrypter reverse mode");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/tonikelope/megabasterd/UploadView.form
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<Component id="slots_spinner" min="-2" pref="70" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="speed_label" min="-2" pref="340" max="-2" attributes="0"/>
<Component id="speed_label" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="pause_button" min="-2" max="-2" attributes="0"/>
</Group>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/tonikelope/megabasterd/UploadView.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(slots_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(speed_label, javax.swing.GroupLayout.PREFERRED_SIZE, 340, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(speed_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(pause_button))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
Expand Down
Binary file added src/main/resources/images/icons8-error-40.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 41b86e5

Please sign in to comment.