mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-04-29 22:24:32 +02:00
-Streamer folder link fix.
-Single instance running sockets -Queues refactoring ...
This commit is contained in:
parent
1953b8edf2
commit
29caf50c28
@ -94,7 +94,7 @@
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="48" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="MegaBasterd 1.8.1"/>
|
||||
<Property name="text" type="java.lang.String" value="MegaBasterd X.X"/>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
|
@ -3,7 +3,7 @@ package megabasterd;
|
||||
import java.awt.Font;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import javax.swing.JOptionPane;
|
||||
import static megabasterd.MainPanel.FONT_DEFAULT;
|
||||
import static megabasterd.MainPanel.THREAD_POOL;
|
||||
@ -58,7 +58,7 @@ public final class AboutDialog extends javax.swing.JDialog {
|
||||
setResizable(false);
|
||||
|
||||
title_label.setFont(new java.awt.Font("Dialog", 1, 48)); // NOI18N
|
||||
title_label.setText("MegaBasterd 1.8.1");
|
||||
title_label.setText("MegaBasterd X.X");
|
||||
title_label.setDoubleBuffered(true);
|
||||
|
||||
made_in_spain_label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/megabasterd/made_in_spain.jpg"))); // NOI18N
|
||||
@ -200,7 +200,7 @@ public final class AboutDialog extends javax.swing.JDialog {
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(AboutDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(AboutDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
swingReflectionInvoke("setEnabled", main.check_version_button, true);
|
||||
|
@ -5,7 +5,7 @@ import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import static megabasterd.MainPanel.THROTTLE_SLICE_SIZE;
|
||||
import static megabasterd.MainPanel.USER_AGENT;
|
||||
import static megabasterd.MiscTools.getWaitTimeExpBackOff;
|
||||
@ -71,7 +71,7 @@ public class ChunkDownloader implements Runnable, SecureNotifiable {
|
||||
try {
|
||||
_secure_notify_lock.wait();
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(ChunkDownloader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(ChunkDownloader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,11 +211,10 @@ public class ChunkDownloader implements Runnable, SecureNotifiable {
|
||||
_download.getProgress_meter().secureNotify();
|
||||
}
|
||||
|
||||
|
||||
Logger.getLogger(ChunkDownloader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(ChunkDownloader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(ChunkDownloader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(ChunkDownloader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} finally {
|
||||
conn.disconnect();
|
||||
}
|
||||
@ -225,7 +224,7 @@ public class ChunkDownloader implements Runnable, SecureNotifiable {
|
||||
|
||||
}catch (IOException ex) {
|
||||
_download.emergencyStopDownloader(ex.getMessage());
|
||||
Logger.getLogger(ChunkDownloader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(ChunkDownloader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
if(!_exit) {
|
||||
|
@ -6,7 +6,7 @@ import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import static megabasterd.MainPanel.THROTTLE_SLICE_SIZE;
|
||||
import static megabasterd.MainPanel.USER_AGENT;
|
||||
import static megabasterd.MiscTools.getWaitTimeExpBackOff;
|
||||
@ -143,10 +143,10 @@ public class ChunkDownloaderMono extends ChunkDownloader {
|
||||
getDownload().getProgress_meter().secureNotify();
|
||||
}
|
||||
|
||||
Logger.getLogger(ChunkDownloaderMono.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(ChunkDownloaderMono.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(ChunkDownloaderMono.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(ChunkDownloaderMono.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -155,11 +155,11 @@ public class ChunkDownloaderMono extends ChunkDownloader {
|
||||
|
||||
}catch (MalformedURLException ex) {
|
||||
|
||||
Logger.getLogger(ChunkDownloaderMono.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(ChunkDownloaderMono.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
} catch (IOException ex) {
|
||||
|
||||
Logger.getLogger(ChunkDownloaderMono.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(ChunkDownloaderMono.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
getDownload().emergencyStopDownloader(ex.getMessage());
|
||||
|
||||
|
@ -11,7 +11,7 @@ import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import javax.crypto.CipherInputStream;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
@ -67,7 +67,7 @@ public final class ChunkUploader implements Runnable, SecureNotifiable {
|
||||
try {
|
||||
_secure_notify_lock.wait();
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(ChunkUploader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(ChunkUploader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -267,10 +267,10 @@ public final class ChunkUploader implements Runnable, SecureNotifiable {
|
||||
_upload.getProgress_meter().secureNotify();
|
||||
}
|
||||
|
||||
Logger.getLogger(ChunkUploader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(ChunkUploader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | InvalidAlgorithmParameterException | InterruptedException ex) {
|
||||
Logger.getLogger(ChunkUploader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(ChunkUploader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
} finally {
|
||||
conn.disconnect();
|
||||
@ -284,7 +284,7 @@ public final class ChunkUploader implements Runnable, SecureNotifiable {
|
||||
|
||||
_upload.emergencyStopUploader(ex.getMessage());
|
||||
|
||||
Logger.getLogger(ChunkUploader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(ChunkUploader.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
if(!_exit) {
|
||||
|
@ -7,7 +7,7 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import javax.crypto.CipherInputStream;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
|
||||
@ -77,7 +77,7 @@ public final class ChunkWriter implements Runnable, SecureNotifiable {
|
||||
try {
|
||||
_secure_notify_lock.wait();
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(ChunkWriter.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(ChunkWriter.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@ import static java.awt.Toolkit.getDefaultToolkit;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.ClipboardOwner;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import static java.lang.System.out;
|
||||
import static java.lang.Thread.sleep;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import static java.util.logging.Level.SEVERE;
|
||||
@ -87,7 +86,7 @@ public final class ClipboardSpy implements Runnable, ClipboardOwner, SecureNotif
|
||||
|
||||
gainOwnership(_contents);
|
||||
|
||||
out.println("Spying clipboard...");
|
||||
System.out.println("Spying clipboard...");
|
||||
|
||||
secureWait();
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -109,7 +109,7 @@ public final class DBTools {
|
||||
value = res.getString(1);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
Logger.getLogger(DBTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(DBTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -11,7 +11,6 @@ import java.io.OutputStream;
|
||||
import static java.lang.Integer.parseInt;
|
||||
import static java.lang.Long.valueOf;
|
||||
import static java.lang.Math.ceil;
|
||||
import static java.lang.System.out;
|
||||
import static java.lang.Thread.sleep;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
@ -60,7 +59,9 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
public static final Object CBC_LOCK=new Object();
|
||||
|
||||
private final MainPanel _main_panel;
|
||||
private DownloadView _view;
|
||||
private DownloadView _view=null; //lazy init
|
||||
private ProgressMeter _progress_meter=null; //lazy init
|
||||
private SpeedMeter _speed_meter=null; //lazy init
|
||||
private final Object _secure_notify_lock;
|
||||
private boolean _notified;
|
||||
private final String _url;
|
||||
@ -80,8 +81,6 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
private final ConcurrentLinkedQueue<Integer> _partialProgressQueue;
|
||||
private volatile long _progress;
|
||||
private ChunkWriter _chunkwriter;
|
||||
private ProgressMeter _progress_meter;
|
||||
private SpeedMeter _speed_meter;
|
||||
private String _last_download_url;
|
||||
private boolean _provision_ok;
|
||||
private boolean _finishing_download;
|
||||
@ -98,10 +97,6 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
|
||||
public Download(MainPanel main_panel, 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) {
|
||||
|
||||
_view = null; //Lazy init (getter!)
|
||||
_speed_meter = null; //Lazy init (getter!)
|
||||
_progress_meter = null; //Lazy init (getter!)
|
||||
|
||||
_paused_workers = 0;
|
||||
_last_chunk_id_dispatched = 0L;
|
||||
_status_error = false;
|
||||
@ -235,15 +230,12 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
public boolean isProvision_ok() {
|
||||
return _provision_ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ProgressMeter getProgress_meter() {
|
||||
return _progress_meter == null?(_progress_meter = new ProgressMeter(this)):_progress_meter;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SpeedMeter getSpeed_meter() {
|
||||
return _speed_meter == null?(_speed_meter = new SpeedMeter(this, getMain_panel().getGlobal_dl_speed())):_speed_meter;
|
||||
@ -486,7 +478,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
|
||||
secureWait();
|
||||
|
||||
out.println("Chunkdownloaders finished!");
|
||||
System.out.println("Chunkdownloaders finished!");
|
||||
|
||||
getSpeed_meter().setExit(true);
|
||||
|
||||
@ -509,7 +501,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
}
|
||||
}
|
||||
|
||||
out.println("Downloader thread pool finished!");
|
||||
System.out.println("Downloader thread pool finished!");
|
||||
|
||||
getMain_panel().getGlobal_dl_speed().detachSpeedMeter(getSpeed_meter());
|
||||
|
||||
@ -706,10 +698,10 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
|
||||
_status_error = true;
|
||||
|
||||
out.println(ex.getMessage());
|
||||
System.out.println(ex.getMessage());
|
||||
|
||||
} catch (Exception ex) {
|
||||
out.println(ex.getMessage());
|
||||
System.out.println(ex.getMessage());
|
||||
}
|
||||
|
||||
if(!_exit) {
|
||||
@ -737,7 +729,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
swingReflectionInvoke("setVisible", getView().getRestart_button(), true);
|
||||
}
|
||||
|
||||
out.println(_file_name+" Downloader: bye bye");
|
||||
System.out.println(_file_name+" Downloader: bye bye");
|
||||
}
|
||||
|
||||
public void provisionIt(boolean retry) throws MegaAPIException, MegaCrypterAPIException {
|
||||
@ -950,7 +942,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
|
||||
_thread_pool.execute(c);
|
||||
|
||||
}catch(java.util.concurrent.RejectedExecutionException e){out.println(e.getMessage());}
|
||||
}catch(java.util.concurrent.RejectedExecutionException e){System.out.println(e.getMessage());}
|
||||
}
|
||||
|
||||
public synchronized void stopLastStartedSlot()
|
||||
|
@ -1,7 +1,6 @@
|
||||
package megabasterd;
|
||||
|
||||
import java.awt.Component;
|
||||
import static java.lang.System.out;
|
||||
import java.sql.SQLException;
|
||||
import static java.util.logging.Level.SEVERE;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
@ -35,15 +34,8 @@ public final class DownloadManager extends TransferenceManager {
|
||||
getLogger(DownloadManager.class.getName()).log(SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
if(!getTransference_remove_queue().isEmpty()) {
|
||||
|
||||
swingReflectionInvoke("setText", getMain_panel().getView().getStatus_down_label(), "Removing "+getTransference_remove_queue().size()+" downloads, please wait...");
|
||||
|
||||
} else {
|
||||
|
||||
swingReflectionInvoke("setText", getMain_panel().getView().getStatus_down_label(), "");
|
||||
}
|
||||
|
||||
secureNotify();
|
||||
}
|
||||
|
||||
public void provision(Download download, boolean retry) throws MegaAPIException, MegaCrypterAPIException
|
||||
@ -53,8 +45,6 @@ public final class DownloadManager extends TransferenceManager {
|
||||
download.provisionIt(retry);
|
||||
|
||||
if(download.isProvision_ok()) {
|
||||
|
||||
out.println("Provision OK!");
|
||||
|
||||
getTransference_start_queue().add(download);
|
||||
|
||||
@ -75,113 +65,131 @@ public final class DownloadManager extends TransferenceManager {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
out.println("Provision error!");
|
||||
|
||||
|
||||
getTransference_finished_queue().add(download);
|
||||
}
|
||||
|
||||
if(getTransference_provision_queue().isEmpty()) {
|
||||
|
||||
swingReflectionInvoke("setText", getMain_panel().getView().getStatus_down_label(), "");
|
||||
|
||||
} else {
|
||||
|
||||
swingReflectionInvoke("setText", getMain_panel().getView().getStatus_down_label(), getTransference_provision_queue().size() + " downloads waiting for provision...");
|
||||
}
|
||||
secureNotify();
|
||||
|
||||
if(retry) {
|
||||
|
||||
secureNotify();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
out.println("Download manager hello!");
|
||||
|
||||
final DownloadManager tthis = this;
|
||||
|
||||
while(true)
|
||||
{
|
||||
if(!getTransference_provision_queue().isEmpty())
|
||||
if(!isProvisioning_transferences() && !getTransference_provision_queue().isEmpty())
|
||||
{
|
||||
swingReflectionInvoke("setEnabled", getMain_panel().getView().getNew_download_menu(), false);
|
||||
setProvisioning_transferences(true);
|
||||
|
||||
swingReflectionInvoke("setText", getMain_panel().getView().getStatus_down_label(), getTransference_provision_queue().size() + " downloads waiting for provision...");
|
||||
|
||||
while(!getTransference_provision_queue().isEmpty())
|
||||
{
|
||||
final Download download = (Download)getTransference_provision_queue().poll();
|
||||
|
||||
if(download != null) {
|
||||
|
||||
try{
|
||||
|
||||
provision(download, false);
|
||||
|
||||
}catch (MegaAPIException | MegaCrypterAPIException ex) {
|
||||
|
||||
out.println("Provision failed! Retrying in separated thread...");
|
||||
|
||||
getScroll_panel().remove(download.getView());
|
||||
|
||||
final DownloadManager main = this;
|
||||
|
||||
THREAD_POOL.execute(new Runnable(){
|
||||
THREAD_POOL.execute(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
|
||||
|
||||
try {
|
||||
|
||||
main.provision(download, true);
|
||||
|
||||
} catch (MegaAPIException | MegaCrypterAPIException ex1) {
|
||||
|
||||
getLogger(DownloadManager.class.getName()).log(SEVERE, null, ex1);
|
||||
while(!getTransference_provision_queue().isEmpty())
|
||||
{
|
||||
final Download download = (Download)getTransference_provision_queue().poll();
|
||||
|
||||
if(download != null) {
|
||||
|
||||
try{
|
||||
|
||||
provision(download, false);
|
||||
|
||||
}catch (MegaAPIException | MegaCrypterAPIException ex) {
|
||||
|
||||
System.out.println("Provision failed! Retrying in separated thread...");
|
||||
|
||||
getScroll_panel().remove(download.getView());
|
||||
|
||||
THREAD_POOL.execute(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
|
||||
try {
|
||||
|
||||
tthis.provision(download, true);
|
||||
|
||||
} catch (MegaAPIException | MegaCrypterAPIException ex1) {
|
||||
|
||||
getLogger(DownloadManager.class.getName()).log(SEVERE, null, ex1);
|
||||
}
|
||||
|
||||
}});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tthis.setProvisioning_transferences(false);
|
||||
|
||||
tthis.secureNotify();
|
||||
|
||||
}});
|
||||
|
||||
}
|
||||
|
||||
if(!isRemoving_transferences() && !getTransference_remove_queue().isEmpty()) {
|
||||
|
||||
setRemoving_transferences(true);
|
||||
|
||||
THREAD_POOL.execute(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
|
||||
|
||||
while(!getTransference_remove_queue().isEmpty()) {
|
||||
|
||||
Download download = (Download)getTransference_remove_queue().poll();
|
||||
|
||||
if(download != null) {
|
||||
remove(download);
|
||||
}
|
||||
}
|
||||
|
||||
tthis.setRemoving_transferences(false);
|
||||
|
||||
tthis.secureNotify();
|
||||
|
||||
}});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!getTransference_remove_queue().isEmpty()) {
|
||||
if(!isStarting_transferences() && !getTransference_start_queue().isEmpty() && getTransference_running_list().size() < getMain_panel().getMax_dl())
|
||||
{
|
||||
setStarting_transferences(true);
|
||||
|
||||
swingReflectionInvoke("setEnabled", getMain_panel().getView().getNew_download_menu(), false);
|
||||
THREAD_POOL.execute(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
|
||||
while(!getTransference_start_queue().isEmpty() && getTransference_running_list().size() < getMain_panel().getMax_dl()) {
|
||||
|
||||
swingReflectionInvoke("setText", getMain_panel().getView().getStatus_down_label(), "Removing "+getTransference_remove_queue().size()+" downloads, please wait...");
|
||||
|
||||
while(!getTransference_remove_queue().isEmpty()) {
|
||||
|
||||
Download download = (Download)getTransference_remove_queue().poll();
|
||||
|
||||
if(download != null) {
|
||||
|
||||
remove(download);
|
||||
|
||||
}
|
||||
}
|
||||
Download download = (Download)getTransference_start_queue().poll();
|
||||
|
||||
if(download != null) {
|
||||
|
||||
start(download);
|
||||
}
|
||||
}
|
||||
|
||||
tthis.setStarting_transferences(false);
|
||||
|
||||
tthis.secureNotify();
|
||||
|
||||
}});
|
||||
}
|
||||
|
||||
while(!getTransference_start_queue().isEmpty() && getTransference_running_list().size() < getMain_panel().getMax_dl()) {
|
||||
|
||||
Download download = (Download)getTransference_start_queue().poll();
|
||||
|
||||
if(download != null) {
|
||||
|
||||
start(download);
|
||||
}
|
||||
}
|
||||
|
||||
checkButtonsAndMenus(getMain_panel().getView().getClose_all_finished_down_button(), getMain_panel().getView().getPause_all_down_button(), getMain_panel().getView().getNew_download_menu(), getMain_panel().getView().getClean_all_down_menu());
|
||||
|
||||
out.println("Download manager wait");
|
||||
|
||||
|
||||
secureWait();
|
||||
|
||||
out.println("Download manager let's go");
|
||||
checkButtonsAndMenus(getMain_panel().getView().getClose_all_finished_down_button(), getMain_panel().getView().getPause_all_down_button(), getMain_panel().getView().getClean_all_down_menu());
|
||||
|
||||
if(!this.getMain_panel().getView().isPre_processing_downloads()) {
|
||||
swingReflectionInvoke("setText", getMain_panel().getView().getStatus_down_label(), getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JTextField;
|
||||
@ -457,7 +457,7 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
||||
Logger.getLogger(FileGrabberDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(FileGrabberDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -2,7 +2,7 @@ package megabasterd;
|
||||
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import javax.swing.JLabel;
|
||||
import static megabasterd.MiscTools.formatBytes;
|
||||
import static megabasterd.MiscTools.swingReflectionInvoke;
|
||||
@ -44,7 +44,7 @@ public final class GlobalSpeedMeter implements Runnable, SecureNotifiable
|
||||
try {
|
||||
_secure_notify_lock.wait();
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(GlobalSpeedMeter.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(GlobalSpeedMeter.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import static megabasterd.MainPanel.STREAMER_PORT;
|
||||
import static megabasterd.MiscTools.findFirstRegex;
|
||||
import static megabasterd.MiscTools.getWaitTimeExpBackOff;
|
||||
import static megabasterd.MiscTools.swingReflectionInvoke;
|
||||
@ -19,7 +20,6 @@ import static megabasterd.MiscTools.swingReflectionInvoke;
|
||||
public final class KissVideoStreamServer {
|
||||
|
||||
public static final int TIMEOUT=30000;
|
||||
public static final int DEFAULT_PORT=1337;
|
||||
public static final int EXP_BACKOFF_BASE=2;
|
||||
public static final int EXP_BACKOFF_SECS_RETRY=1;
|
||||
public static final int EXP_BACKOFF_MAX_WAIT_TIME=128;
|
||||
@ -65,7 +65,7 @@ public final class KissVideoStreamServer {
|
||||
public void start(int port, String context) throws IOException
|
||||
{
|
||||
_httpserver = HttpServer.create(new InetSocketAddress(port), 0);
|
||||
printStatusOK("Kissvideostreamer on localhost:"+DEFAULT_PORT+" (Waiting for request...)");
|
||||
printStatusOK("Kissvideostreamer on localhost:"+STREAMER_PORT+" (Waiting for request...)");
|
||||
_httpserver.createContext(context, (_http_handler = new KissVideoStreamServerHandler(this, _main_panel)));
|
||||
_httpserver.setExecutor(Executors.newCachedThreadPool());
|
||||
_httpserver.start();
|
||||
|
@ -14,10 +14,10 @@ import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import javax.crypto.CipherInputStream;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import static megabasterd.KissVideoStreamServer.DEFAULT_PORT;
|
||||
import static megabasterd.MainPanel.STREAMER_PORT;
|
||||
import static megabasterd.MiscTools.findFirstRegex;
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ public final class KissVideoStreamServerHandler implements HttpHandler {
|
||||
file_info = _httpserver.getMegaFileMetadata(link, _view);
|
||||
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(KissVideoStreamServerHandler.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(KissVideoStreamServerHandler.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
cache_info = new String[6];
|
||||
@ -253,7 +253,7 @@ public final class KissVideoStreamServerHandler implements HttpHandler {
|
||||
cis = new CipherInputStream(is, CryptTools.genDecrypter("AES", "AES/CTR/NoPadding", CryptTools.initMEGALinkKey(_file_key), (header_range!=null && (ranges[0]-sync_bytes)>0)?CryptTools.forwardMEGALinkKeyIV(iv, ranges[0]-sync_bytes):iv));
|
||||
|
||||
} catch ( NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | InvalidAlgorithmParameterException ex) {
|
||||
Logger.getLogger(KissVideoStreamServer.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(KissVideoStreamServerHandler.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
os = xchg.getResponseBody();
|
||||
@ -282,14 +282,14 @@ public final class KissVideoStreamServerHandler implements HttpHandler {
|
||||
|
||||
xchg.close();
|
||||
|
||||
_httpserver.printStatusOK("Kissvideostreamer on localhost:"+DEFAULT_PORT+" (Waiting for request...)");
|
||||
_httpserver.printStatusOK("Kissvideostreamer on localhost:"+STREAMER_PORT+" (Waiting for request...)");
|
||||
|
||||
_httpserver.getStreaming().remove(Thread.currentThread());
|
||||
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(KissVideoStreamServerHandler.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(KissVideoStreamServerHandler.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
if(!_httpserver.isWorking()) {
|
||||
|
@ -4,6 +4,7 @@ import java.awt.AWTException;
|
||||
import static java.awt.EventQueue.invokeLater;
|
||||
import java.awt.Font;
|
||||
import static java.awt.Font.BOLD;
|
||||
import static java.awt.Frame.NORMAL;
|
||||
import java.awt.Image;
|
||||
import java.awt.MenuItem;
|
||||
import java.awt.PopupMenu;
|
||||
@ -16,15 +17,19 @@ import java.awt.TrayIcon;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.File;
|
||||
import static java.awt.event.WindowEvent.WINDOW_CLOSING;
|
||||
import java.io.IOException;
|
||||
import static java.lang.Integer.parseInt;
|
||||
import static java.lang.System.exit;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import static java.util.concurrent.Executors.newCachedThreadPool;
|
||||
import java.util.logging.Level;
|
||||
import static java.util.logging.Level.SEVERE;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
|
||||
@ -36,7 +41,6 @@ import static megabasterd.DBTools.selectMegaAccounts;
|
||||
import static megabasterd.DBTools.selectSettingValueFromDB;
|
||||
import static megabasterd.DBTools.selectUploads;
|
||||
import static megabasterd.DBTools.setupSqliteTables;
|
||||
import static megabasterd.KissVideoStreamServer.DEFAULT_PORT;
|
||||
import static megabasterd.MiscTools.BASE642Bin;
|
||||
import static megabasterd.MiscTools.bin2i32a;
|
||||
import static megabasterd.MiscTools.createAndRegisterFont;
|
||||
@ -54,11 +58,12 @@ import static megabasterd.Transference.MAX_TRANSFERENCE_SPEED_DEFAULT;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION="1.1";
|
||||
public static final String LOCK_FILE="megabasterd.lock";
|
||||
public static final String VERSION="1.2";
|
||||
public static final String USER_AGENT="Mozilla/5.0 (X11; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/48.0";
|
||||
public static final int CONNECTION_TIMEOUT = 30000;
|
||||
public static final int THROTTLE_SLICE_SIZE=16*1024;
|
||||
public static final int STREAMER_PORT = 1337;
|
||||
public static final int WATCHDOG_PORT = 1338;
|
||||
public static final ExecutorService THREAD_POOL = newCachedThreadPool();
|
||||
public static final Font FONT_DEFAULT = createAndRegisterFont("Gochi.ttf");
|
||||
|
||||
@ -76,7 +81,7 @@ public final class MainPanel {
|
||||
});
|
||||
}
|
||||
|
||||
private MainPanelView _view;
|
||||
private MainPanelView _view=null; //lazy init
|
||||
private final GlobalSpeedMeter _global_dl_speed, _global_up_speed;
|
||||
private final DownloadManager _download_manager;
|
||||
private final UploadManager _upload_manager;
|
||||
@ -91,10 +96,11 @@ public final class MainPanel {
|
||||
private KissVideoStreamServer _streamserver;
|
||||
|
||||
public MainPanel() {
|
||||
|
||||
_view = null; //Lazy init (getter!)
|
||||
|
||||
checkAppIsRunning();
|
||||
|
||||
if(checkAppIsRunning()) {
|
||||
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@ -135,7 +141,7 @@ public final class MainPanel {
|
||||
_streamserver = new KissVideoStreamServer(getView());
|
||||
|
||||
try {
|
||||
_streamserver.start(DEFAULT_PORT, "/video");
|
||||
_streamserver.start(STREAMER_PORT, "/video");
|
||||
} catch (IOException ex) {
|
||||
getLogger(MainPanel.class.getName()).log(SEVERE, null, ex);
|
||||
}
|
||||
@ -377,44 +383,60 @@ public final class MainPanel {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAppIsRunning()
|
||||
private boolean checkAppIsRunning()
|
||||
{
|
||||
File lock = new File(LOCK_FILE);
|
||||
|
||||
if(lock.exists()) {
|
||||
|
||||
Object[] options = {"Yes, load it anyway",
|
||||
"No"};
|
||||
|
||||
int n = showOptionDialog(getView(),
|
||||
"It seems MegaBasterd is already running. Do you want to continue?",
|
||||
"Warning!", YES_NO_CANCEL_OPTION, QUESTION_MESSAGE,
|
||||
null,
|
||||
options,
|
||||
options[1]);
|
||||
|
||||
if(n==1) {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
boolean app_is_running = false;
|
||||
|
||||
try {
|
||||
|
||||
lock.createNewFile();
|
||||
|
||||
lock.deleteOnExit();
|
||||
final ServerSocket serverSocket = new ServerSocket(WATCHDOG_PORT, 0, InetAddress.getLoopbackAddress());
|
||||
|
||||
THREAD_POOL.execute(new Runnable(){
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
final ServerSocket socket = serverSocket;
|
||||
|
||||
while(true) {
|
||||
|
||||
try {
|
||||
socket.accept();
|
||||
|
||||
swingReflectionInvoke("setExtendedState", getView(), NORMAL);
|
||||
|
||||
swingReflectionInvoke("setVisible", getView(), true);
|
||||
|
||||
} catch (IOException ex) {
|
||||
getLogger(MainPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
}});
|
||||
|
||||
} catch (IOException ex) {
|
||||
getLogger(MainPanelView.class.getName()).log(SEVERE, null, ex);
|
||||
|
||||
app_is_running = true;
|
||||
|
||||
try {
|
||||
|
||||
Socket clientSocket = new Socket(InetAddress.getLoopbackAddress(), WATCHDOG_PORT);
|
||||
|
||||
clientSocket.close();
|
||||
|
||||
} catch (IOException ex1) {
|
||||
|
||||
getLogger(MainPanel.class.getName()).log(Level.SEVERE, null, ex1);
|
||||
}
|
||||
}
|
||||
|
||||
return app_is_running;
|
||||
}
|
||||
|
||||
private void resumeDownloads() {
|
||||
|
||||
swingReflectionInvoke("setText", getView().getStatus_down_label(), "Resuming previous downloads, please wait...");
|
||||
|
||||
swingReflectionInvoke("setEnabled", getView().getNew_download_menu(), false);
|
||||
|
||||
|
||||
final MainPanel main =this;
|
||||
|
||||
THREAD_POOL.execute(new Runnable(){
|
||||
@ -450,9 +472,6 @@ public final class MainPanel {
|
||||
|
||||
main.getView().getjTabbedPane1().setSelectedIndex(0);
|
||||
|
||||
} else {
|
||||
|
||||
swingReflectionInvoke("setEnabled", main.getView().getNew_download_menu(), true);
|
||||
}
|
||||
|
||||
swingReflectionInvoke("setText", main.getView().getStatus_down_label(), "");
|
||||
@ -487,11 +506,10 @@ public final class MainPanel {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
swingReflectionInvoke("setExtendedState", myframe, javax.swing.JFrame.NORMAL);
|
||||
swingReflectionInvoke("setExtendedState", myframe, NORMAL);
|
||||
|
||||
swingReflectionInvoke("setVisible", myframe, true);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -517,14 +535,13 @@ public final class MainPanel {
|
||||
|
||||
if(!(boolean)swingReflectionInvokeAndWaitForReturn("isVisible", myframe))
|
||||
{
|
||||
swingReflectionInvoke("setExtendedState", myframe, javax.swing.JFrame.NORMAL);
|
||||
swingReflectionInvoke("setExtendedState", myframe, NORMAL);
|
||||
|
||||
swingReflectionInvoke("setVisible", myframe, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
swingReflectionInvoke("dispatchEvent", myframe, new WindowEvent(myframe, WindowEvent.WINDOW_CLOSING));
|
||||
|
||||
swingReflectionInvoke("dispatchEvent", myframe, new WindowEvent(myframe, WINDOW_CLOSING));
|
||||
}
|
||||
|
||||
}
|
||||
@ -548,8 +565,6 @@ public final class MainPanel {
|
||||
|
||||
swingReflectionInvoke("setText", getView().getStatus_up_label(), "Resuming previous uploads, please wait...");
|
||||
|
||||
swingReflectionInvoke("setEnabled", getView().getNew_upload_menu(), false);
|
||||
|
||||
final MainPanel main =this;
|
||||
|
||||
THREAD_POOL.execute(new Runnable(){
|
||||
@ -611,9 +626,7 @@ public final class MainPanel {
|
||||
|
||||
main.getView().getjTabbedPane1().setSelectedIndex(1);
|
||||
|
||||
} else {
|
||||
swingReflectionInvoke("setEnabled", main.getView().getNew_upload_menu(), true);
|
||||
}
|
||||
}
|
||||
|
||||
swingReflectionInvoke("setText", main.getView().getStatus_up_label(), "");
|
||||
|
||||
|
@ -7,7 +7,6 @@ import static java.awt.Font.PLAIN;
|
||||
import java.awt.event.WindowEvent;
|
||||
import static java.awt.event.WindowEvent.WINDOW_CLOSING;
|
||||
import java.io.File;
|
||||
import static java.lang.System.out;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -16,7 +15,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import static java.util.logging.Level.SEVERE;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
@ -40,12 +38,23 @@ import static megabasterd.MiscTools.i32a2bin;
|
||||
import static megabasterd.MiscTools.swingReflectionInvoke;
|
||||
import static megabasterd.MiscTools.swingReflectionInvokeAndWait;
|
||||
import static megabasterd.MiscTools.updateFont;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
|
||||
|
||||
public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
private final MainPanel _main_panel;
|
||||
private volatile boolean _pre_processing_downloads;
|
||||
private volatile boolean _pre_processing_uploads;
|
||||
|
||||
public boolean isPre_processing_downloads() {
|
||||
return _pre_processing_downloads;
|
||||
}
|
||||
|
||||
public boolean isPre_processing_uploads() {
|
||||
return _pre_processing_uploads;
|
||||
}
|
||||
|
||||
public JLabel getKiss_server_status() {
|
||||
return kiss_server_status;
|
||||
}
|
||||
@ -117,13 +126,11 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
|
||||
public MainPanelView(MainPanel main_panel) {
|
||||
|
||||
System.out.println("Main panel view constructor!! ");
|
||||
|
||||
initComponents();
|
||||
|
||||
|
||||
_main_panel = main_panel;
|
||||
|
||||
|
||||
initComponents();
|
||||
|
||||
setTitle("MegaBasterd " + VERSION);
|
||||
|
||||
setIconImage(new ImageIcon(getClass().getResource("pica_roja.png")).getImage());
|
||||
@ -486,7 +493,8 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void new_download_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_new_download_menuActionPerformed
|
||||
|
||||
|
||||
_pre_processing_downloads = true;
|
||||
|
||||
swingReflectionInvoke("setEnabled", new_download_menu, false);
|
||||
|
||||
@ -511,7 +519,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
THREAD_POOL.execute(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
|
||||
swingReflectionInvoke("setText", main.status_down_label, "Pre-processing downloads, please wait...");
|
||||
|
||||
Set<String> urls = new HashSet(findAllRegex("(?:https?|mega)://[^/]*/(#.*?)?!.+![^\r\n]+", dialog.getLinks_textarea().getText(), 0));
|
||||
@ -586,25 +594,19 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
main.getMain_panel().getDownload_manager().secureNotify();
|
||||
|
||||
} else {
|
||||
|
||||
swingReflectionInvoke("setEnabled", main.new_download_menu, true);
|
||||
}
|
||||
|
||||
} else {
|
||||
}
|
||||
|
||||
swingReflectionInvoke("setEnabled", main.new_download_menu, true);
|
||||
}
|
||||
|
||||
swingReflectionInvoke("setText", main.status_down_label, "");
|
||||
|
||||
}});
|
||||
} else {
|
||||
}
|
||||
|
||||
swingReflectionInvoke("setEnabled", new_download_menu, true);
|
||||
}
|
||||
|
||||
swingReflectionInvoke("setEnabled", new_download_menu, true);
|
||||
|
||||
dialog.dispose();
|
||||
|
||||
_pre_processing_downloads = false;
|
||||
|
||||
}//GEN-LAST:event_new_download_menuActionPerformed
|
||||
|
||||
@ -714,6 +716,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
private void new_upload_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_new_upload_menuActionPerformed
|
||||
|
||||
_pre_processing_uploads = true;
|
||||
|
||||
swingReflectionInvoke("setEnabled", new_upload_menu, false);
|
||||
|
||||
@ -767,7 +770,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
String parent_node = (String)((Map)((List)res.get("f")).get(0)).get("h");
|
||||
|
||||
out.println("Dir "+ parent_node+" created");
|
||||
System.out.println("Dir "+ parent_node+" created");
|
||||
|
||||
ma.shareFolder(parent_node, parent_key, share_key);
|
||||
|
||||
@ -785,7 +788,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
String[] dirs = file_path.split("/");
|
||||
|
||||
out.println(file_path);
|
||||
System.out.println(file_path);
|
||||
|
||||
MegaDirNode current_node = file_paths;
|
||||
|
||||
@ -825,7 +828,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
main.getMain_panel().getUpload_manager().secureNotify();
|
||||
|
||||
} catch (Exception ex) {
|
||||
swingReflectionInvoke("setEnabled", main.new_upload_menu, true);
|
||||
|
||||
getLogger(MainPanelView.class.getName()).log(SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
@ -835,11 +838,13 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
} catch (Exception ex) {
|
||||
getLogger(MainPanelView.class.getName()).log(SEVERE, null, ex);
|
||||
}
|
||||
} else {
|
||||
swingReflectionInvoke("setEnabled", new_upload_menu, true);
|
||||
}
|
||||
}
|
||||
|
||||
swingReflectionInvoke("setEnabled", new_upload_menu, true);
|
||||
|
||||
dialog.dispose();
|
||||
|
||||
_pre_processing_uploads = false;
|
||||
}//GEN-LAST:event_new_upload_menuActionPerformed
|
||||
|
||||
private void close_all_finished_up_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_close_all_finished_up_buttonActionPerformed
|
||||
|
@ -13,7 +13,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import javax.crypto.Cipher;
|
||||
import static megabasterd.MiscTools.Bin2UrlBASE64;
|
||||
@ -244,7 +244,7 @@ public final class MegaAPI {
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return quota;
|
||||
@ -291,7 +291,7 @@ public final class MegaAPI {
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
}
|
||||
@ -331,7 +331,7 @@ public final class MegaAPI {
|
||||
try {
|
||||
Thread.sleep( getWaitTimeExpBackOff(conta_error));
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -366,7 +366,7 @@ public final class MegaAPI {
|
||||
try {
|
||||
Thread.sleep(getWaitTimeExpBackOff(conta_error));
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -489,7 +489,7 @@ public final class MegaAPI {
|
||||
ret = CryptTools.aes_cbc_encrypt(new_attr_byte, key, CryptTools.AES_ZERO_IV);
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -515,7 +515,7 @@ public final class MegaAPI {
|
||||
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
}
|
||||
|
||||
@ -543,7 +543,7 @@ public final class MegaAPI {
|
||||
ul_url = (String)res_map[0].get("p");
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return ul_url;
|
||||
@ -568,7 +568,7 @@ public final class MegaAPI {
|
||||
res_map = objectMapper.readValue(res, HashMap[].class);
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return res_map[0];
|
||||
@ -623,7 +623,7 @@ public final class MegaAPI {
|
||||
res_map = objectMapper.readValue(res, HashMap[].class);
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return res_map[0];
|
||||
@ -656,7 +656,7 @@ public final class MegaAPI {
|
||||
res_map = objectMapper.readValue(res, HashMap[].class);
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return res_map[0];
|
||||
@ -691,7 +691,7 @@ public final class MegaAPI {
|
||||
public_link = "https://mega.nz/#!"+file_id+"!"+Bin2UrlBASE64(node_key);
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return public_link;
|
||||
@ -724,7 +724,7 @@ public final class MegaAPI {
|
||||
public_link = "https://mega.nz/#F!"+folder_id+"!"+Bin2UrlBASE64(node_key);
|
||||
|
||||
}catch (Exception ex) {
|
||||
Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return public_link;
|
||||
@ -767,7 +767,7 @@ public final class MegaAPI {
|
||||
System.out.println(res);
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -781,7 +781,7 @@ public final class MegaAPI {
|
||||
ch = Bin2UrlBASE64(encryptKey((h+h).getBytes(), i32a2bin(getMaster_key())));
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return ch;
|
||||
@ -869,7 +869,7 @@ public final class MegaAPI {
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -11,7 +11,7 @@ import java.security.spec.KeySpec;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
@ -112,7 +112,7 @@ public final class MegaCrypterAPI {
|
||||
dl_url = new String(decrypted_url);
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(MegaCrypterAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaCrypterAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,7 +280,7 @@ public final class MegaCrypterAPI {
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(MegaCrypterAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MegaCrypterAPI.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package megabasterd;
|
||||
|
||||
import java.util.HashMap;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import static megabasterd.MiscTools.formatBytes;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -24,7 +25,7 @@ public final class MegaMutableTreeNode extends DefaultMutableTreeNode {
|
||||
|
||||
HashMap<String,Object> user_object = (HashMap<String,Object>)userObject;
|
||||
|
||||
return user_object.get("name") + ((isLeaf() && user_object.get("size")!=null)?" ["+MiscTools.formatBytes((long)user_object.get("size"))+"]":"");
|
||||
return user_object.get("name") + ((isLeaf() && user_object.get("size")!=null)?" ["+formatBytes((long)user_object.get("size"))+"]":"");
|
||||
|
||||
} else if(userObject instanceof Object) {
|
||||
|
||||
|
@ -38,7 +38,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
@ -87,7 +87,7 @@ public final class MiscTools {
|
||||
ge.registerFont(font);
|
||||
|
||||
} catch (FontFormatException | IOException ex) {
|
||||
Logger.getLogger(DownloadView.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return font;
|
||||
@ -103,7 +103,7 @@ public final class MiscTools {
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(MainPanelView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
java.util.logging.Logger.getLogger(MiscTools.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ public final class MiscTools {
|
||||
|
||||
} catch (SecurityException | IllegalArgumentException | NoSuchMethodException ex) {
|
||||
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
System.out.println("REFLECTION METHOD NOT FOUND -> "+method_name+"#"+obj.getClass().toString()+"#"+String.valueOf(params.length));
|
||||
}
|
||||
@ -435,7 +435,7 @@ public final class MiscTools {
|
||||
}
|
||||
|
||||
} catch (SecurityException | IllegalArgumentException | NoSuchMethodException ex) {
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -461,7 +461,7 @@ public final class MiscTools {
|
||||
SwingUtilities.invokeAndWait(r);
|
||||
|
||||
} catch (InterruptedException | InvocationTargetException ex) {
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -480,7 +480,7 @@ public final class MiscTools {
|
||||
try {
|
||||
ret = c.call();
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -492,7 +492,7 @@ public final class MiscTools {
|
||||
try {
|
||||
ret = futureTask.get();
|
||||
} catch (InterruptedException | ExecutionException ex) {
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -545,7 +545,7 @@ public final class MiscTools {
|
||||
|
||||
String response = new String(byte_res.toByteArray()).trim();
|
||||
|
||||
return MiscTools.findFirstRegex("http", response, 0)!=null?response:link;
|
||||
return findFirstRegex("http", response, 0)!=null?response:link;
|
||||
}
|
||||
|
||||
public static String formatBytes(Long bytes) {
|
||||
@ -661,7 +661,7 @@ public final class MiscTools {
|
||||
((MutableTreeNode)new_root).setUserObject( ((DefaultMutableTreeNode)tree.getModel().getRoot()).getUserObject() );
|
||||
|
||||
} catch (InstantiationException | IllegalAccessException ex) {
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
for (TreePath path : paths) {
|
||||
@ -689,7 +689,7 @@ public final class MiscTools {
|
||||
((MutableTreeNode)node).setUserObject( ((DefaultMutableTreeNode)path_element).getUserObject() );
|
||||
|
||||
} catch (InstantiationException | IllegalAccessException ex) {
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -710,7 +710,7 @@ public final class MiscTools {
|
||||
}
|
||||
}
|
||||
|
||||
tree.setModel(new DefaultTreeModel(MiscTools.sortTree((DefaultMutableTreeNode)new_root)));
|
||||
tree.setModel(new DefaultTreeModel(sortTree((DefaultMutableTreeNode)new_root)));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -781,9 +781,9 @@ public final class MiscTools {
|
||||
|
||||
if(data != null) {
|
||||
|
||||
ArrayList<String> links = MiscTools.findAllRegex("(?:https?|mega)://[^/]*/(#.*?)?!.+![^\r\n]+", data, 0);
|
||||
ArrayList<String> links = findAllRegex("(?:https?|mega)://[^/]*/(#.*?)?!.+![^\r\n]+", data, 0);
|
||||
|
||||
links.addAll(MiscTools.findAllRegex("mega://enc.*?[^\r\n]+", data, 0));
|
||||
links.addAll(findAllRegex("mega://enc.*?[^\r\n]+", data, 0));
|
||||
|
||||
for(String s:links) {
|
||||
|
||||
@ -800,9 +800,9 @@ public final class MiscTools {
|
||||
|
||||
if(data != null) {
|
||||
|
||||
ArrayList<String> links = MiscTools.findAllRegex("(?:https?|mega)://[^/]*/(#.*?)?!.+![^\r\n]+", data, 0);
|
||||
ArrayList<String> links = findAllRegex("(?:https?|mega)://[^/]*/(#.*?)?!.+![^\r\n]+", data, 0);
|
||||
|
||||
links.addAll(MiscTools.findAllRegex("mega://enc.*?[^\r\n]+", data, 0));
|
||||
links.addAll(findAllRegex("mega://enc.*?[^\r\n]+", data, 0));
|
||||
|
||||
if(links.size()>0) {
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package megabasterd;
|
||||
|
||||
import static java.lang.System.out;
|
||||
import static java.util.logging.Level.SEVERE;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
|
||||
@ -67,7 +66,7 @@ public final class ProgressMeter implements Runnable, SecureNotifiable
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
out.println("ProgressMeter hello!");
|
||||
System.out.println("ProgressMeter hello!");
|
||||
|
||||
while(!_exit || !_transference.getPartialProgress().isEmpty())
|
||||
{
|
||||
|
@ -259,7 +259,7 @@
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="20" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Use multi slot download mode (NOT recommended. Download restart needed.)"/>
|
||||
<Property name="text" type="java.lang.String" value="Use multi slot download mode (NOT recommended; download restart needed)"/>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
@ -493,7 +493,7 @@
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="20" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Use multi slot upload mode (Recommended. Upload restart needed.)"/>
|
||||
<Property name="text" type="java.lang.String" value="Use multi slot upload mode (RECOMMENDED; Upload restart needed)"/>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
|
@ -8,7 +8,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JSpinner;
|
||||
@ -373,7 +373,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
default_slots_down_label.setDoubleBuffered(true);
|
||||
|
||||
multi_slot_down_checkbox.setFont(new java.awt.Font("Dialog", 1, 20)); // NOI18N
|
||||
multi_slot_down_checkbox.setText("Use multi slot download mode (NOT recommended. Download restart needed.)");
|
||||
multi_slot_down_checkbox.setText("Use multi slot download mode (NOT recommended; download restart needed)");
|
||||
multi_slot_down_checkbox.setDoubleBuffered(true);
|
||||
multi_slot_down_checkbox.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
@ -514,7 +514,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
max_uploads_spinner.setDoubleBuffered(true);
|
||||
|
||||
multi_slot_up_checkbox.setFont(new java.awt.Font("Dialog", 1, 20)); // NOI18N
|
||||
multi_slot_up_checkbox.setText("Use multi slot upload mode (Recommended. Upload restart needed.)");
|
||||
multi_slot_up_checkbox.setText("Use multi slot upload mode (RECOMMENDED; Upload restart needed)");
|
||||
multi_slot_up_checkbox.setDoubleBuffered(true);
|
||||
multi_slot_up_checkbox.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
@ -734,7 +734,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
} catch(Exception ex) {
|
||||
|
||||
email_error.add(email);
|
||||
Logger.getLogger(SettingsDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(SettingsDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -755,7 +755,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
} catch (Exception ex) {
|
||||
|
||||
email_error.add(email);
|
||||
Logger.getLogger(SettingsDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(SettingsDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
}
|
||||
}
|
||||
@ -793,7 +793,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
}
|
||||
});
|
||||
} catch (SQLException ex) {
|
||||
Logger.getLogger(SettingsDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(SettingsDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}//GEN-LAST:event_ok_buttonActionPerformed
|
||||
|
||||
|
@ -2,7 +2,7 @@ package megabasterd;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import static megabasterd.MiscTools.formatBytes;
|
||||
|
||||
public final class SpeedMeter implements Runnable, SecureNotifiable
|
||||
@ -49,7 +49,7 @@ public final class SpeedMeter implements Runnable, SecureNotifiable
|
||||
try {
|
||||
_secure_notify_lock.wait();
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(UploadMACGenerator.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(SpeedMeter.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -30,7 +30,7 @@ public final class SqliteSingleton {
|
||||
conn = DriverManager.getConnection("jdbc:sqlite:"+SQLITE_FILE);
|
||||
|
||||
}catch(ClassNotFoundException | SQLException ex) {
|
||||
Logger.getLogger(SqliteSingleton.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(SqliteSingleton.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return conn;
|
||||
|
@ -2,7 +2,7 @@ package megabasterd;
|
||||
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -86,7 +86,7 @@ public final class StreamThrottlerSupervisor implements Runnable, SecureNotifiab
|
||||
try {
|
||||
_secure_notify_lock.wait();
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(UploadMACGenerator.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(StreamThrottlerSupervisor.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ public final class StreamThrottlerSupervisor implements Runnable, SecureNotifiab
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(StreamThrottlerSupervisor.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(StreamThrottlerSupervisor.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,17 @@ import java.awt.Font;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import javax.swing.JOptionPane;
|
||||
import static megabasterd.MainPanel.FONT_DEFAULT;
|
||||
import static megabasterd.MiscTools.copyTextToClipboard;
|
||||
import static megabasterd.MiscTools.deflateURL;
|
||||
import static megabasterd.MiscTools.extractFirstMegaLinkFromString;
|
||||
import static megabasterd.MiscTools.extractStringFromClipboardContents;
|
||||
import static megabasterd.MiscTools.findFirstRegex;
|
||||
import static megabasterd.MiscTools.swingReflectionInvoke;
|
||||
import static megabasterd.MiscTools.swingReflectionInvokeAndWaitForReturn;
|
||||
import static megabasterd.MiscTools.updateFont;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -25,10 +33,10 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
|
||||
_clipboardspy = clipboardspy;
|
||||
|
||||
MiscTools.updateFont(put_label, FONT_DEFAULT, Font.PLAIN);
|
||||
MiscTools.updateFont(dance_button, FONT_DEFAULT, Font.PLAIN);
|
||||
updateFont(put_label, FONT_DEFAULT, Font.PLAIN);
|
||||
updateFont(dance_button, FONT_DEFAULT, Font.PLAIN);
|
||||
|
||||
MiscTools.swingReflectionInvoke("setText", original_link_textfield, MiscTools.extractFirstMegaLinkFromString(MiscTools.extractStringFromClipboardContents(clipboardspy.getContents())));
|
||||
swingReflectionInvoke("setText", original_link_textfield, extractFirstMegaLinkFromString(extractStringFromClipboardContents(clipboardspy.getContents())));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -102,13 +110,13 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
private void dance_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dance_buttonActionPerformed
|
||||
|
||||
|
||||
String link=((String)MiscTools.swingReflectionInvokeAndWaitForReturn("getText", original_link_textfield)).trim();
|
||||
String link=((String)swingReflectionInvokeAndWaitForReturn("getText", original_link_textfield)).trim();
|
||||
|
||||
if(link.length() == 0) {
|
||||
|
||||
JOptionPane.showMessageDialog(this, "Please, paste a mega/megacrypter link!");
|
||||
|
||||
MiscTools.swingReflectionInvoke("setText", original_link_textfield, "");
|
||||
swingReflectionInvoke("setText", original_link_textfield, "");
|
||||
|
||||
} else {
|
||||
|
||||
@ -117,20 +125,20 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
link = CryptTools.decryptMegaDownloaderLink(link);
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(StreamerDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(StreamerDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
String data;
|
||||
|
||||
link=link.replace("/#!N?", "/#N!");
|
||||
|
||||
if( MiscTools.findFirstRegex("://mega(\\.co)?\\.nz/#[^fF]", link, 0) != null)
|
||||
if( findFirstRegex("://mega(\\.co)?\\.nz/#[^fF]", link, 0) != null)
|
||||
{
|
||||
data=MiscTools.findFirstRegex("/#(N?!.+)", link, 1);
|
||||
data=findFirstRegex("/#(N?!.+)", link, 1);
|
||||
|
||||
_cookLink("http://localhost:1337/video/mega/"+data);
|
||||
|
||||
} else if( (data=MiscTools.findFirstRegex("https?://([^/]+/![^!]+![0-9a-fA-F]+)", link, 1)) != null) {
|
||||
} else if( (data=findFirstRegex("https?://([^/]+/![^!]+![0-9a-fA-F]+)", link, 1)) != null) {
|
||||
|
||||
_cookLink("http://localhost:1337/video/"+data);
|
||||
|
||||
@ -138,15 +146,15 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
|
||||
JOptionPane.showMessageDialog(this, "Please, paste a mega/megacrypter link!");
|
||||
|
||||
MiscTools.swingReflectionInvoke("setText", original_link_textfield, "");
|
||||
swingReflectionInvoke("setText", original_link_textfield, "");
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_dance_buttonActionPerformed
|
||||
|
||||
private void _cookLink(final String streamlink)
|
||||
{
|
||||
MiscTools.swingReflectionInvoke("setEnabled", dance_button, false);
|
||||
MiscTools.swingReflectionInvoke("setEnabled", original_link_textfield, false);
|
||||
swingReflectionInvoke("setEnabled", dance_button, false);
|
||||
swingReflectionInvoke("setEnabled", original_link_textfield, false);
|
||||
|
||||
final StreamerDialog streamer_run = this;
|
||||
|
||||
@ -155,9 +163,9 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
public void run() {
|
||||
|
||||
try {
|
||||
MiscTools.copyTextToClipboard(MiscTools.deflateURL(streamlink));
|
||||
copyTextToClipboard(deflateURL(streamlink));
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(StreamerDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(StreamerDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
JOptionPane.showMessageDialog(streamer_run, "Streaming link was copied to clipboard!\n(Remember to keep MegaBasterd running in background while playing)");
|
||||
@ -180,5 +188,12 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
@Override
|
||||
public void notifyClipboardChange() {
|
||||
|
||||
MiscTools.swingReflectionInvoke("setText", original_link_textfield, MiscTools.extractFirstMegaLinkFromString(MiscTools.extractStringFromClipboardContents(_clipboardspy.getContents()))); }
|
||||
String link = extractFirstMegaLinkFromString(extractStringFromClipboardContents(_clipboardspy.getContents()));
|
||||
|
||||
if(!link.contains("/#F!")) {
|
||||
|
||||
swingReflectionInvoke("setText", original_link_textfield, link);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,8 +5,9 @@ import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JPanel;
|
||||
import static megabasterd.MiscTools.swingReflectionInvoke;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -23,9 +24,39 @@ abstract public class TransferenceManager implements Runnable, SecureNotifiable
|
||||
private final MainPanel _main_panel;
|
||||
private final Object _secure_notify_lock;
|
||||
private boolean _notified;
|
||||
private volatile boolean _removing_transferences;
|
||||
private volatile boolean _provisioning_transferences;
|
||||
private volatile boolean _starting_transferences;
|
||||
|
||||
public boolean isRemoving_transferences() {
|
||||
return _removing_transferences;
|
||||
}
|
||||
|
||||
public void setRemoving_transferences(boolean removing) {
|
||||
_removing_transferences = removing;
|
||||
}
|
||||
|
||||
public boolean isProvisioning_transferences() {
|
||||
return _provisioning_transferences;
|
||||
}
|
||||
|
||||
public void setProvisioning_transferences(boolean provisioning) {
|
||||
_provisioning_transferences = provisioning;
|
||||
}
|
||||
|
||||
public boolean isStarting_transferences() {
|
||||
return _starting_transferences;
|
||||
}
|
||||
|
||||
public void setStarting_transferences(boolean starting_transferences) {
|
||||
_starting_transferences = starting_transferences;
|
||||
}
|
||||
|
||||
public TransferenceManager(MainPanel main_panel, javax.swing.JPanel scroll_panel) {
|
||||
_notified = false;
|
||||
_removing_transferences = false;
|
||||
_provisioning_transferences = false;
|
||||
_starting_transferences=false;
|
||||
_main_panel = main_panel;
|
||||
_scroll_panel = scroll_panel;
|
||||
_secure_notify_lock = new Object();
|
||||
@ -34,7 +65,6 @@ abstract public class TransferenceManager implements Runnable, SecureNotifiable
|
||||
_transference_remove_queue = new ConcurrentLinkedQueue();
|
||||
_transference_finished_queue = new ConcurrentLinkedQueue();
|
||||
_transference_running_list = new ConcurrentLinkedQueue();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,9 +73,7 @@ abstract public class TransferenceManager implements Runnable, SecureNotifiable
|
||||
synchronized(_secure_notify_lock) {
|
||||
|
||||
_notified = true;
|
||||
|
||||
|
||||
|
||||
|
||||
_secure_notify_lock.notify();
|
||||
}
|
||||
}
|
||||
@ -60,7 +88,7 @@ abstract public class TransferenceManager implements Runnable, SecureNotifiable
|
||||
try {
|
||||
_secure_notify_lock.wait();
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(TransferenceManager.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(TransferenceManager.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,7 +194,7 @@ abstract public class TransferenceManager implements Runnable, SecureNotifiable
|
||||
}
|
||||
|
||||
public void checkButtonsAndMenus(javax.swing.JButton close_all_finished_button, javax.swing.JButton pause_all_button,
|
||||
javax.swing.MenuElement new_trans_menu, javax.swing.MenuElement clean_all_waiting_trans_menu) {
|
||||
javax.swing.MenuElement clean_all_waiting_trans_menu) {
|
||||
|
||||
if(!_transference_running_list.isEmpty()) {
|
||||
|
||||
@ -180,27 +208,31 @@ abstract public class TransferenceManager implements Runnable, SecureNotifiable
|
||||
}
|
||||
}
|
||||
|
||||
MiscTools.swingReflectionInvoke("setVisible", pause_all_button, show_pause_all);
|
||||
swingReflectionInvoke("setVisible", pause_all_button, show_pause_all);
|
||||
|
||||
} else {
|
||||
|
||||
MiscTools.swingReflectionInvoke("setVisible", pause_all_button, false);
|
||||
swingReflectionInvoke("setVisible", pause_all_button, false);
|
||||
}
|
||||
|
||||
MiscTools.swingReflectionInvoke("setEnabled", new_trans_menu, _transference_provision_queue.isEmpty());
|
||||
|
||||
MiscTools.swingReflectionInvoke("setEnabled", clean_all_waiting_trans_menu, !_transference_start_queue.isEmpty());
|
||||
swingReflectionInvoke("setEnabled", clean_all_waiting_trans_menu, !_transference_start_queue.isEmpty());
|
||||
|
||||
if(!_transference_finished_queue.isEmpty()) {
|
||||
|
||||
MiscTools.swingReflectionInvoke("setText", close_all_finished_button, "Close all finished ("+_transference_finished_queue.size()+")" );
|
||||
swingReflectionInvoke("setText", close_all_finished_button, "Close all finished ("+_transference_finished_queue.size()+")" );
|
||||
|
||||
MiscTools.swingReflectionInvoke("setVisible", close_all_finished_button, true);
|
||||
swingReflectionInvoke("setVisible", close_all_finished_button, true);
|
||||
|
||||
} else {
|
||||
|
||||
MiscTools.swingReflectionInvoke("setVisible", close_all_finished_button, false);
|
||||
swingReflectionInvoke("setVisible", close_all_finished_button, false);
|
||||
}
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
|
||||
return "Prov("+_transference_provision_queue.size()+") / Rem("+_transference_remove_queue.size()+") / Wait("+_transference_start_queue.size()+") / Run("+_transference_running_list.size()+") / Finish("+_transference_finished_queue.size()+")";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import static megabasterd.MainPanel.THREAD_POOL;
|
||||
import static megabasterd.MiscTools.BASE642Bin;
|
||||
import static megabasterd.MiscTools.Bin2BASE64;
|
||||
@ -38,7 +38,9 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
public static final int WORKERS_DEFAULT = 2;
|
||||
|
||||
private final MainPanel _main_panel;
|
||||
private UploadView _view;
|
||||
private UploadView _view=null; //lazy init
|
||||
private SpeedMeter _speed_meter=null; //lazy init
|
||||
private ProgressMeter _progress_meter=null; //lazy init
|
||||
private String _exit_message;
|
||||
private String _dir_name;
|
||||
private volatile boolean _exit;
|
||||
@ -55,8 +57,6 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
private volatile int[] _file_meta_mac;
|
||||
private boolean _finishing_upload;
|
||||
private String _fid;
|
||||
private SpeedMeter _speed_meter;
|
||||
private ProgressMeter _progress_meter;
|
||||
private boolean _notified;
|
||||
private String _completion_handle;
|
||||
private int _paused_workers;
|
||||
@ -83,10 +83,6 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
|
||||
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 use_slots, int slots, boolean restart) {
|
||||
|
||||
_view = null; //Lazy init (getter!)
|
||||
_speed_meter = null; //Lazy init (getter!)
|
||||
_progress_meter = null; //Lazy init (getter!)
|
||||
|
||||
_saved_file_mac = new int[]{0, 0, 0, 0};
|
||||
_notified = false;
|
||||
_provision_ok = true;
|
||||
@ -318,7 +314,7 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
try {
|
||||
_secure_notify_lock.wait();
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -399,7 +395,7 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -607,7 +603,7 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
DBTools.updateUploadUrl(_file_name, _ma.getEmail(), _ul_url);
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
Logger.getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -704,7 +700,7 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
_thread_pool.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
|
||||
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -754,7 +750,7 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
swingReflectionInvoke("setEnabled", getView().getFile_link_button(), true);
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
printStatusOK(_exit_message);
|
||||
@ -839,7 +835,7 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
try {
|
||||
DBTools.deleteUpload(_file_name, _ma.getEmail());
|
||||
} catch (SQLException ex) {
|
||||
Logger.getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
getMain_panel().getUpload_manager().getTransference_running_list().remove(this);
|
||||
@ -927,7 +923,7 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
try {
|
||||
DBTools.deleteUpload(_file_name, _ma.getEmail());
|
||||
} catch (SQLException ex) {
|
||||
Logger.getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
getMain_panel().getUpload_manager().getTransference_running_list().remove(this);
|
||||
|
@ -9,7 +9,7 @@ import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
@ -63,7 +63,7 @@ public final class UploadMACGenerator implements Runnable, SecureNotifiable {
|
||||
try {
|
||||
_secure_notify_lock.wait();
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(UploadMACGenerator.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(UploadMACGenerator.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ public final class UploadMACGenerator implements Runnable, SecureNotifiable {
|
||||
_bytes_read+=chunk.getSize();
|
||||
|
||||
} catch (IOException | NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | InvalidAlgorithmParameterException | IllegalBlockSizeException | BadPaddingException ex) {
|
||||
Logger.getLogger(UploadMACGenerator.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(UploadMACGenerator.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
_chunk_queue.remove(chunk.getId());
|
||||
@ -208,7 +208,7 @@ public final class UploadMACGenerator implements Runnable, SecureNotifiable {
|
||||
System.out.println("MAC GENERATOR BYE BYE...");
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(UploadMACGenerator.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger(UploadMACGenerator.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import java.sql.SQLException;
|
||||
import static java.util.logging.Level.SEVERE;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import static megabasterd.DBTools.deleteUpload;
|
||||
import static megabasterd.MainPanel.THREAD_POOL;
|
||||
import static megabasterd.MiscTools.HashString;
|
||||
import static megabasterd.MiscTools.swingReflectionInvoke;
|
||||
|
||||
@ -52,16 +53,8 @@ public final class UploadManager extends TransferenceManager {
|
||||
|
||||
getTransference_finished_queue().add(upload);
|
||||
}
|
||||
|
||||
if(getTransference_provision_queue().isEmpty()) {
|
||||
|
||||
swingReflectionInvoke("setText", getMain_panel().getView().getStatus_up_label(), "");
|
||||
|
||||
} else {
|
||||
|
||||
swingReflectionInvoke("setText", getMain_panel().getView().getStatus_up_label(), getTransference_provision_queue().size() + " uploads waiting for provision...");
|
||||
}
|
||||
|
||||
secureNotify();
|
||||
}
|
||||
|
||||
|
||||
@ -97,69 +90,108 @@ public final class UploadManager extends TransferenceManager {
|
||||
}
|
||||
}
|
||||
|
||||
if(!getTransference_remove_queue().isEmpty()) {
|
||||
|
||||
swingReflectionInvoke("setText", upload.getMain_panel().getView().getStatus_up_label(), "Removing "+getTransference_remove_queue().size()+" uploads, please wait...");
|
||||
|
||||
} else {
|
||||
|
||||
swingReflectionInvoke("setText", upload.getMain_panel().getView().getStatus_up_label(), "");
|
||||
}
|
||||
secureNotify();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
final UploadManager tthis = this;
|
||||
|
||||
while(true)
|
||||
{
|
||||
if(!getTransference_provision_queue().isEmpty())
|
||||
if(!isProvisioning_transferences() && !getTransference_provision_queue().isEmpty())
|
||||
{
|
||||
swingReflectionInvoke("setEnabled", getMain_panel().getView().getNew_upload_menu(), false);
|
||||
setProvisioning_transferences(true);
|
||||
|
||||
swingReflectionInvoke("setText", getMain_panel().getView().getStatus_up_label(), getTransference_provision_queue().size() + " uploads waiting for provision...");
|
||||
|
||||
while(!getTransference_provision_queue().isEmpty())
|
||||
{
|
||||
Upload upload = (Upload)getTransference_provision_queue().poll();
|
||||
|
||||
if(upload != null) {
|
||||
|
||||
provision(upload);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!getTransference_remove_queue().isEmpty()){
|
||||
|
||||
swingReflectionInvoke("setEnabled", getMain_panel().getView().getNew_upload_menu(), false);
|
||||
|
||||
swingReflectionInvoke("setText", getMain_panel().getView().getStatus_up_label(), "Removing "+getTransference_remove_queue().size()+" uploads, please wait...");
|
||||
|
||||
while(!getTransference_remove_queue().isEmpty()) {
|
||||
|
||||
Upload upload = (Upload)getTransference_remove_queue().poll();
|
||||
|
||||
if(upload != null) {
|
||||
|
||||
remove(upload);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while(!getTransference_start_queue().isEmpty() && getTransference_running_list().size() < getMain_panel().getMax_ul()) {
|
||||
|
||||
Upload upload = (Upload)getTransference_start_queue().poll();
|
||||
|
||||
if(upload != null) {
|
||||
|
||||
start(upload);
|
||||
}
|
||||
}
|
||||
|
||||
checkButtonsAndMenus(getMain_panel().getView().getClose_all_finished_up_button(), getMain_panel().getView().getPause_all_up(), getMain_panel().getView().getNew_upload_menu(), getMain_panel().getView().getClean_all_up_menu());
|
||||
THREAD_POOL.execute(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
|
||||
while(!getTransference_provision_queue().isEmpty())
|
||||
{
|
||||
Upload upload = (Upload)getTransference_provision_queue().poll();
|
||||
|
||||
if(upload != null) {
|
||||
|
||||
provision(upload);
|
||||
}
|
||||
}
|
||||
|
||||
tthis.setProvisioning_transferences(false);
|
||||
|
||||
tthis.secureNotify();
|
||||
|
||||
|
||||
}});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(!isRemoving_transferences() && !getTransference_remove_queue().isEmpty()){
|
||||
|
||||
setRemoving_transferences(true);
|
||||
|
||||
THREAD_POOL.execute(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
|
||||
while(!getTransference_remove_queue().isEmpty()) {
|
||||
|
||||
Upload upload = (Upload)getTransference_remove_queue().poll();
|
||||
|
||||
if(upload != null) {
|
||||
|
||||
remove(upload);
|
||||
}
|
||||
}
|
||||
|
||||
tthis.setRemoving_transferences(false);
|
||||
|
||||
tthis.secureNotify();
|
||||
|
||||
}});
|
||||
}
|
||||
|
||||
|
||||
if(!isStarting_transferences() && !getTransference_start_queue().isEmpty() && getTransference_running_list().size() < getMain_panel().getMax_ul())
|
||||
{
|
||||
setStarting_transferences(true);
|
||||
|
||||
THREAD_POOL.execute(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
|
||||
while(!getTransference_start_queue().isEmpty() && getTransference_running_list().size() < getMain_panel().getMax_ul()) {
|
||||
|
||||
Upload upload = (Upload)getTransference_start_queue().poll();
|
||||
|
||||
if(upload != null) {
|
||||
|
||||
start(upload);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tthis.setStarting_transferences(false);
|
||||
|
||||
tthis.secureNotify();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
secureWait();
|
||||
|
||||
checkButtonsAndMenus(getMain_panel().getView().getClose_all_finished_up_button(), getMain_panel().getView().getPause_all_up(), getMain_panel().getView().getClean_all_up_menu());
|
||||
|
||||
if(!this.getMain_panel().getView().isPre_processing_uploads()) {
|
||||
swingReflectionInvoke("setText", getMain_panel().getView().getStatus_up_label(), getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user