mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-04-29 22:24:32 +02:00
Cleaning...
This commit is contained in:
parent
96af814804
commit
3d3b97117a
@ -70,7 +70,7 @@ public final class Chunk {
|
||||
|
||||
private long calculateSize(long file_size)
|
||||
{
|
||||
long chunk_size = (_id>=1 && _id<=7)?_id*128*1024:1024*1024;
|
||||
long chunk_size = (_id>=1 && _id<=7)?_id*128*1_024:1_024*1_024;
|
||||
|
||||
if(_offset + chunk_size > file_size) {
|
||||
chunk_size = file_size - _offset;
|
||||
@ -81,9 +81,9 @@ public final class Chunk {
|
||||
|
||||
private long calculateOffset()
|
||||
{
|
||||
long[] offs = {0, 128, 384, 768, 1280, 1920, 2688};
|
||||
long[] offs = {0, 128, 384, 768, 1_280, 1_920, 2_688};
|
||||
|
||||
return (_id<=7?offs[(int)_id-1]:(3584 + (_id-8)*1024))*1024;
|
||||
return (_id<=7?offs[(int)_id-1]:(3_584 + (_id-8)*1_024))*1_024;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ public class ChunkDownloader implements Runnable, SecureNotifiable {
|
||||
|
||||
conta_error++;
|
||||
|
||||
Thread.sleep(getWaitTimeExpBackOff(conta_error)*1000);
|
||||
Thread.sleep(getWaitTimeExpBackOff(conta_error)*1_000);
|
||||
|
||||
} else if(!error) {
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class ChunkDownloaderMono extends ChunkDownloader {
|
||||
|
||||
conta_error++;
|
||||
|
||||
Thread.sleep(getWaitTimeExpBackOff(conta_error)*1000);
|
||||
Thread.sleep(getWaitTimeExpBackOff(conta_error)*1_000);
|
||||
|
||||
} else if(!error) {
|
||||
|
||||
|
@ -235,7 +235,7 @@ public final class ChunkUploader implements Runnable, SecureNotifiable {
|
||||
|
||||
if(!_exit) {
|
||||
|
||||
Thread.sleep(getWaitTimeExpBackOff(conta_error)*1000);
|
||||
Thread.sleep(getWaitTimeExpBackOff(conta_error)*1_000);
|
||||
}
|
||||
|
||||
} else if(!error) {
|
||||
|
@ -128,7 +128,7 @@ public final class ChunkWriter implements Runnable, SecureNotifiable {
|
||||
{
|
||||
Chunk current_chunk;
|
||||
CipherInputStream cis;
|
||||
byte[] buffer = new byte[16*1024];
|
||||
byte[] buffer = new byte[16*1_024];
|
||||
int reads;
|
||||
|
||||
try {
|
||||
@ -186,9 +186,9 @@ public final class ChunkWriter implements Runnable, SecureNotifiable {
|
||||
|
||||
private long calculateLastWrittenChunk(long temp_file_size)
|
||||
{
|
||||
if(temp_file_size > 3584*1024)
|
||||
if(temp_file_size > 3_584*1_024)
|
||||
{
|
||||
return 7 + (long)Math.ceil((temp_file_size - 3584*1024)/(1024*1024));
|
||||
return 7 + (long)Math.ceil((temp_file_size - 3_584*1_024)/(1_024*1_024));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -197,7 +197,7 @@ public final class ChunkWriter implements Runnable, SecureNotifiable {
|
||||
while(tot < temp_file_size)
|
||||
{
|
||||
i++;
|
||||
tot+=i*128*1024;
|
||||
tot+=i*128*1_024;
|
||||
}
|
||||
|
||||
return i;
|
||||
|
@ -4,6 +4,7 @@ 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;
|
||||
@ -86,7 +87,7 @@ public final class ClipboardSpy implements Runnable, ClipboardOwner, SecureNotif
|
||||
|
||||
gainOwnership(_contents);
|
||||
|
||||
System.out.println("Spying clipboard...");
|
||||
out.println("Spying clipboard...");
|
||||
|
||||
secureWait();
|
||||
}
|
||||
|
@ -286,11 +286,11 @@ public final class CryptTools {
|
||||
|
||||
public static int[] MEGAPrepareMasterKey(int[] key) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException {
|
||||
|
||||
int[] pkey = {0x93C467E3, 0x7DB0C7A4, 0xD1BE3F81, 0x0152CB56};
|
||||
int[] pkey = {0x93C4_67E3, 0x7DB0_C7A4, 0xD1BE_3F81, 0x0152_CB56};
|
||||
|
||||
int[] iv = {0,0,0,0};
|
||||
|
||||
for(int r=0; r<0x10000; r++) {
|
||||
for(int r=0; r<0x1_0000; r++) {
|
||||
|
||||
for(int j=0; j<key.length; j+=4) {
|
||||
|
||||
|
@ -8,9 +8,11 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import static java.lang.Integer.MAX_VALUE;
|
||||
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;
|
||||
@ -397,10 +399,10 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
_retrying_request = false;
|
||||
|
||||
swingReflectionInvoke("setMinimum", getView().getProgress_pbar(), 0);
|
||||
swingReflectionInvoke("setMaximum", getView().getProgress_pbar(), Integer.MAX_VALUE);
|
||||
swingReflectionInvoke("setMaximum", getView().getProgress_pbar(), MAX_VALUE);
|
||||
swingReflectionInvoke("setStringPainted", getView().getProgress_pbar(), true);
|
||||
|
||||
_progress_bar_rate = Integer.MAX_VALUE/(double)_file_size;
|
||||
_progress_bar_rate = MAX_VALUE/(double)_file_size;
|
||||
|
||||
filename = _download_path+"/"+_file_name;
|
||||
|
||||
@ -478,7 +480,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
|
||||
secureWait();
|
||||
|
||||
System.out.println("Chunkdownloaders finished!");
|
||||
out.println("Chunkdownloaders finished!");
|
||||
|
||||
getSpeed_meter().setExit(true);
|
||||
|
||||
@ -494,14 +496,14 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
{
|
||||
try {
|
||||
|
||||
_thread_pool.awaitTermination(Integer.MAX_VALUE, DAYS);
|
||||
_thread_pool.awaitTermination(MAX_VALUE, DAYS);
|
||||
|
||||
} catch (InterruptedException ex) {
|
||||
getLogger(Download.class.getName()).log(SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Downloader thread pool finished!");
|
||||
out.println("Downloader thread pool finished!");
|
||||
|
||||
getMain_panel().getGlobal_dl_speed().detachSpeedMeter(getSpeed_meter());
|
||||
|
||||
@ -525,7 +527,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
throw new IOException("El tamaño del fichero es incorrecto!");
|
||||
}
|
||||
|
||||
swingReflectionInvoke("setValue", getView().getProgress_pbar(), Integer.MAX_VALUE);
|
||||
swingReflectionInvoke("setValue", getView().getProgress_pbar(), MAX_VALUE);
|
||||
|
||||
_file.renameTo(new File(filename));
|
||||
|
||||
@ -579,7 +581,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
|
||||
swingReflectionInvoke("setVisible", getView().getStop_button(), false);
|
||||
|
||||
swingReflectionInvoke("setValue", getView().getProgress_pbar(), Integer.MAX_VALUE);
|
||||
swingReflectionInvoke("setValue", getView().getProgress_pbar(), MAX_VALUE);
|
||||
|
||||
}
|
||||
}
|
||||
@ -698,10 +700,10 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
|
||||
_status_error = true;
|
||||
|
||||
System.out.println(ex.getMessage());
|
||||
out.println(ex.getMessage());
|
||||
|
||||
} catch (Exception ex) {
|
||||
System.out.println(ex.getMessage());
|
||||
out.println(ex.getMessage());
|
||||
}
|
||||
|
||||
if(!_exit) {
|
||||
@ -729,7 +731,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
swingReflectionInvoke("setVisible", getView().getRestart_button(), true);
|
||||
}
|
||||
|
||||
System.out.println(_file_name+" Downloader: bye bye");
|
||||
out.println(_file_name+" Downloader: bye bye");
|
||||
}
|
||||
|
||||
public void provisionIt(boolean retry) throws MegaAPIException, MegaCrypterAPIException {
|
||||
@ -919,7 +921,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
for(long i=getWaitTimeExpBackOff(api_error_retry++); i>0 && !_exit; i--)
|
||||
{
|
||||
try {
|
||||
sleep(1000);
|
||||
sleep(1_000);
|
||||
} catch (InterruptedException ex) {}
|
||||
}
|
||||
}
|
||||
@ -942,7 +944,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
|
||||
_thread_pool.execute(c);
|
||||
|
||||
}catch(java.util.concurrent.RejectedExecutionException e){System.out.println(e.getMessage());}
|
||||
}catch(java.util.concurrent.RejectedExecutionException e){out.println(e.getMessage());}
|
||||
}
|
||||
|
||||
public synchronized void stopLastStartedSlot()
|
||||
@ -1011,7 +1013,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
|
||||
long chunk_id=1;
|
||||
long tot=0L;
|
||||
byte[] chunk_buffer = new byte[16*1024];
|
||||
byte[] chunk_buffer = new byte[16*1_024];
|
||||
byte[] byte_block = new byte[16];
|
||||
int[] int_block;
|
||||
int re, reads, to_read;
|
||||
@ -1133,9 +1135,9 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
|
||||
public long calculateMaxTempFileSize(long size)
|
||||
{
|
||||
if(size > 3584*1024)
|
||||
if(size > 3_584*1_024)
|
||||
{
|
||||
long reminder = (size - 3584*1024)%(1024*1024);
|
||||
long reminder = (size - 3_584*1_024)%(1_024*1_024);
|
||||
|
||||
return reminder==0?size:(size - reminder);
|
||||
}
|
||||
@ -1146,10 +1148,10 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
while(tot < size)
|
||||
{
|
||||
i++;
|
||||
tot+=i*128*1024;
|
||||
tot+=i*128*1_024;
|
||||
}
|
||||
|
||||
return tot==size?size:(tot-i*128*1024);
|
||||
return tot==size?size:(tot-i*128*1_024);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1236,7 +1238,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
}
|
||||
|
||||
try {
|
||||
sleep(1000);
|
||||
sleep(1_000);
|
||||
} catch (InterruptedException ex2) {}
|
||||
}
|
||||
}
|
||||
@ -1323,7 +1325,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
}
|
||||
|
||||
try {
|
||||
sleep(1000);
|
||||
sleep(1_000);
|
||||
} catch (InterruptedException ex2) {}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
import javax.swing.tree.TreeNode;
|
||||
import static megabasterd.MainPanel.FONT_DEFAULT;
|
||||
import static megabasterd.MainPanel.THREAD_POOL;
|
||||
import static megabasterd.MiscTools.deleteAllExceptSelectedTreeItems;
|
||||
import static megabasterd.MiscTools.deleteSelectedTreeItems;
|
||||
import static megabasterd.MiscTools.formatBytes;
|
||||
@ -433,7 +434,7 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
|
||||
swingReflectionInvoke("setEnabled", skip_rest_button, false);
|
||||
swingReflectionInvoke("setEnabled", warning_label, false);
|
||||
|
||||
MainPanel.THREAD_POOL.execute(new Runnable(){
|
||||
THREAD_POOL.execute(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
|
@ -19,7 +19,7 @@ import static megabasterd.MiscTools.swingReflectionInvoke;
|
||||
|
||||
public final class KissVideoStreamServer {
|
||||
|
||||
public static final int TIMEOUT=30000;
|
||||
public static final int TIMEOUT=30_000;
|
||||
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;
|
||||
@ -168,7 +168,7 @@ public final class KissVideoStreamServer {
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(1_000);
|
||||
} catch (InterruptedException ex) {}
|
||||
}
|
||||
}
|
||||
@ -230,7 +230,7 @@ public final class KissVideoStreamServer {
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(1_000);
|
||||
} catch (InterruptedException ex) {}
|
||||
}
|
||||
}
|
||||
@ -264,7 +264,7 @@ public final class KissVideoStreamServer {
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(1_000);
|
||||
} catch (InterruptedException ex) {}
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ public final class KissVideoStreamServerHandler implements HttpHandler {
|
||||
|
||||
resheaders.add("Connection", "close");
|
||||
|
||||
byte[] buffer = new byte[16*1024];
|
||||
byte[] buffer = new byte[16*1_024];
|
||||
|
||||
int reads;
|
||||
|
||||
@ -287,7 +287,7 @@ public final class KissVideoStreamServerHandler implements HttpHandler {
|
||||
_httpserver.getStreaming().remove(Thread.currentThread());
|
||||
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(1_000);
|
||||
} catch (InterruptedException ex) {
|
||||
getLogger(KissVideoStreamServerHandler.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
@ -60,10 +60,10 @@ public final class MainPanel {
|
||||
|
||||
public static final String VERSION="1.3";
|
||||
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 int CONNECTION_TIMEOUT = 30_000;
|
||||
public static final int THROTTLE_SLICE_SIZE=16*1_024;
|
||||
public static final int STREAMER_PORT = 1_337;
|
||||
public static final int WATCHDOG_PORT = 1_338;
|
||||
public static final ExecutorService THREAD_POOL = newCachedThreadPool();
|
||||
public static final Font FONT_DEFAULT = createAndRegisterFont("Gochi.ttf");
|
||||
|
||||
@ -130,7 +130,7 @@ public final class MainPanel {
|
||||
|
||||
THREAD_POOL.execute((_upload_manager = new UploadManager(this)));
|
||||
|
||||
THREAD_POOL.execute((_stream_supervisor = new StreamThrottlerSupervisor(_limit_download_speed?_max_dl_speed*1024:0, _limit_upload_speed?_max_up_speed*1024:0, THROTTLE_SLICE_SIZE)));
|
||||
THREAD_POOL.execute((_stream_supervisor = new StreamThrottlerSupervisor(_limit_download_speed?_max_dl_speed*1_024:0, _limit_upload_speed?_max_up_speed*1_024:0, THROTTLE_SLICE_SIZE)));
|
||||
|
||||
THREAD_POOL.execute((_clipboardspy = new ClipboardSpy()));
|
||||
|
||||
|
@ -177,10 +177,10 @@
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="jTabbedPane1" max="32767" attributes="0"/>
|
||||
<Component id="jTabbedPane1" pref="796" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="kiss_server_status" min="-2" pref="440" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="kiss_server_status" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="logo_label" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@ -244,7 +244,7 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="global_speed_down_label" min="-2" pref="404" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="338" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="258" max="32767" attributes="0"/>
|
||||
<Component id="pause_all_down_button" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
@ -352,7 +352,7 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="global_speed_up_label" min="-2" pref="404" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="338" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="258" max="32767" attributes="0"/>
|
||||
<Component id="pause_all_up_button" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
|
@ -15,6 +15,7 @@ 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;
|
||||
@ -38,7 +39,6 @@ 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 {
|
||||
@ -267,7 +267,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(downloads_panelLayout.createSequentialGroup()
|
||||
.addComponent(global_speed_down_label, javax.swing.GroupLayout.PREFERRED_SIZE, 404, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 338, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 258, Short.MAX_VALUE)
|
||||
.addComponent(pause_all_down_button))
|
||||
.addGroup(downloads_panelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
@ -329,7 +329,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(uploads_panelLayout.createSequentialGroup()
|
||||
.addComponent(global_speed_up_label, javax.swing.GroupLayout.PREFERRED_SIZE, 404, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 338, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 258, Short.MAX_VALUE)
|
||||
.addComponent(pause_all_up_button))
|
||||
.addGroup(uploads_panelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
@ -470,10 +470,10 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jTabbedPane1)
|
||||
.addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 796, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(kiss_server_status, javax.swing.GroupLayout.PREFERRED_SIZE, 440, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(kiss_server_status, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(logo_label)))
|
||||
.addContainerGap())
|
||||
);
|
||||
@ -636,9 +636,9 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
_main_panel.loadUserSettings();
|
||||
|
||||
_main_panel.getStream_supervisor().setMaxBytesPerSecInput(_main_panel.isLimit_download_speed()?_main_panel.getMax_dl_speed()*1024:0);
|
||||
_main_panel.getStream_supervisor().setMaxBytesPerSecInput(_main_panel.isLimit_download_speed()?_main_panel.getMax_dl_speed()*1_024:0);
|
||||
|
||||
_main_panel.getStream_supervisor().setMaxBytesPerSecOutput( _main_panel.isLimit_upload_speed()?_main_panel.getMax_up_speed()*1024:0);
|
||||
_main_panel.getStream_supervisor().setMaxBytesPerSecOutput( _main_panel.isLimit_upload_speed()?_main_panel.getMax_up_speed()*1_024:0);
|
||||
|
||||
swingReflectionInvoke("setForeground", global_speed_down_label, _main_panel.isLimit_download_speed()?new Color(255,0,0):new Color(0,128,255));
|
||||
|
||||
|
@ -342,7 +342,7 @@ public final class MegaAPI {
|
||||
|
||||
ByteArrayOutputStream byte_res = new ByteArrayOutputStream();
|
||||
|
||||
byte[] buffer = new byte[16*1024];
|
||||
byte[] buffer = new byte[16*1_024];
|
||||
|
||||
int reads;
|
||||
|
||||
|
@ -60,7 +60,7 @@ public final class MegaCrypterAPI {
|
||||
|
||||
ByteArrayOutputStream byte_res = new ByteArrayOutputStream();
|
||||
|
||||
byte[] buffer = new byte[16*1024];
|
||||
byte[] buffer = new byte[16*1_024];
|
||||
|
||||
int reads;
|
||||
|
||||
|
@ -534,7 +534,7 @@ public final class MiscTools {
|
||||
|
||||
ByteArrayOutputStream byte_res = new ByteArrayOutputStream();
|
||||
|
||||
byte[] buffer = new byte[16*1024];
|
||||
byte[] buffer = new byte[16*1_024];
|
||||
|
||||
int reads;
|
||||
|
||||
@ -554,7 +554,7 @@ public final class MiscTools {
|
||||
|
||||
bytes = Math.max(bytes, 0L);
|
||||
|
||||
int pow = Math.min((int)((bytes>0L?Math.log(bytes):0) / Math.log(1024)), units.length - 1);
|
||||
int pow = Math.min((int)((bytes>0L?Math.log(bytes):0) / Math.log(1_024)), units.length - 1);
|
||||
|
||||
Double bytes_double = (double)bytes/(1 << (10 * pow));
|
||||
|
||||
|
@ -16,6 +16,7 @@ import javax.swing.SpinnerNumberModel;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import static megabasterd.DBTools.insertSettingValueInDB;
|
||||
import static megabasterd.MainPanel.FONT_DEFAULT;
|
||||
import static megabasterd.MainPanel.THREAD_POOL;
|
||||
import static megabasterd.MiscTools.Bin2BASE64;
|
||||
import static megabasterd.MiscTools.i32a2bin;
|
||||
import static megabasterd.MiscTools.swingReflectionInvoke;
|
||||
@ -704,7 +705,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
final SettingsDialog dialog = this;
|
||||
|
||||
MainPanel.THREAD_POOL.execute(new Runnable(){
|
||||
THREAD_POOL.execute(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
|
@ -7,7 +7,7 @@ import static megabasterd.MiscTools.formatBytes;
|
||||
|
||||
public final class SpeedMeter implements Runnable, SecureNotifiable
|
||||
{
|
||||
public static final int SLEEP = 3000;
|
||||
public static final int SLEEP = 3_000;
|
||||
private long _progress;
|
||||
private final Transference _transference;
|
||||
private final GlobalSpeedMeter _gspeed;
|
||||
@ -120,7 +120,7 @@ public final class SpeedMeter implements Runnable, SecureNotifiable
|
||||
|
||||
} else if( p > _progress) {
|
||||
|
||||
double sleep_time = ((double)SpeedMeter.SLEEP*(no_data_count+1))/1000 ;
|
||||
double sleep_time = ((double)SpeedMeter.SLEEP*(no_data_count+1))/1_000 ;
|
||||
|
||||
double current_speed = (p - _progress) / sleep_time;
|
||||
|
||||
|
@ -147,7 +147,7 @@ public final class StreamThrottlerSupervisor implements Runnable, SecureNotifiab
|
||||
secureNotifyAll();
|
||||
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(1_000);
|
||||
} catch (InterruptedException ex) {
|
||||
getLogger(StreamThrottlerSupervisor.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
@ -2,11 +2,14 @@ package megabasterd;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.awt.event.WindowEvent;
|
||||
import static java.awt.event.WindowEvent.WINDOW_CLOSING;
|
||||
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.MainPanel.THREAD_POOL;
|
||||
import static megabasterd.MiscTools.copyTextToClipboard;
|
||||
import static megabasterd.MiscTools.deflateURL;
|
||||
import static megabasterd.MiscTools.extractFirstMegaLinkFromString;
|
||||
@ -109,81 +112,84 @@ 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)swingReflectionInvokeAndWaitForReturn("getText", original_link_textfield)).trim();
|
||||
|
||||
if(link.length() == 0) {
|
||||
|
||||
JOptionPane.showMessageDialog(this, "Please, paste a mega/megacrypter link!");
|
||||
|
||||
swingReflectionInvoke("setText", original_link_textfield, "");
|
||||
|
||||
} else {
|
||||
|
||||
try {
|
||||
|
||||
link = CryptTools.decryptMegaDownloaderLink(link);
|
||||
|
||||
} catch (Exception ex) {
|
||||
getLogger(StreamerDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
String data;
|
||||
|
||||
link=link.replace("/#!N?", "/#N!");
|
||||
|
||||
if( findFirstRegex("://mega(\\.co)?\\.nz/#[^fF]", link, 0) != null)
|
||||
{
|
||||
data=findFirstRegex("/#(N?!.+)", link, 1);
|
||||
|
||||
_cookLink("http://localhost:1337/video/mega/"+data);
|
||||
|
||||
} else if( (data=findFirstRegex("https?://([^/]+/![^!]+![0-9a-fA-F]+)", link, 1)) != null) {
|
||||
|
||||
_cookLink("http://localhost:1337/video/"+data);
|
||||
|
||||
} else {
|
||||
|
||||
JOptionPane.showMessageDialog(this, "Please, paste a mega/megacrypter link!");
|
||||
|
||||
swingReflectionInvoke("setText", original_link_textfield, "");
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_dance_buttonActionPerformed
|
||||
|
||||
private void _cookLink(final String streamlink)
|
||||
{
|
||||
swingReflectionInvoke("setEnabled", dance_button, false);
|
||||
swingReflectionInvoke("setEnabled", original_link_textfield, false);
|
||||
|
||||
final StreamerDialog streamer_run = this;
|
||||
final StreamerDialog tthis = this;
|
||||
|
||||
MainPanel.THREAD_POOL.execute(new Runnable(){
|
||||
THREAD_POOL.execute(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
try {
|
||||
copyTextToClipboard(deflateURL(streamlink));
|
||||
} catch (IOException 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)");
|
||||
|
||||
streamer_run.dispose();
|
||||
|
||||
streamer_run.getParent().dispatchEvent(new WindowEvent(streamer_run, WindowEvent.WINDOW_CLOSING));
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
boolean error=false;
|
||||
|
||||
String stream_link=null;
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton dance_button;
|
||||
private javax.swing.JTextField original_link_textfield;
|
||||
private javax.swing.JLabel put_label;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
String link=((String)swingReflectionInvokeAndWaitForReturn("getText", original_link_textfield)).trim();
|
||||
|
||||
if(link.length() > 0) {
|
||||
|
||||
try {
|
||||
|
||||
link = CryptTools.decryptMegaDownloaderLink(link);
|
||||
|
||||
} catch (Exception ex) {
|
||||
getLogger(StreamerDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
String data;
|
||||
|
||||
link=link.replace("/#!N?", "/#N!");
|
||||
|
||||
if( findFirstRegex("://mega(\\.co)?\\.nz/#[^fF]", link, 0) != null)
|
||||
{
|
||||
data=findFirstRegex("/#(N?!.+)", link, 1);
|
||||
|
||||
stream_link = "http://localhost:1337/video/mega/"+data;
|
||||
|
||||
} else if( (data=findFirstRegex("https?://([^/]+/![^!]+![0-9a-fA-F]+)", link, 1)) != null) {
|
||||
|
||||
stream_link = "http://localhost:1337/video/"+data;
|
||||
|
||||
} else {
|
||||
|
||||
error = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
error = true;
|
||||
}
|
||||
|
||||
if(error) {
|
||||
|
||||
JOptionPane.showMessageDialog(tthis, "Please, paste a mega/megacrypter link!");
|
||||
|
||||
swingReflectionInvoke("setText", original_link_textfield, "");
|
||||
|
||||
swingReflectionInvoke("setEnabled", dance_button, true);
|
||||
|
||||
swingReflectionInvoke("setEnabled", original_link_textfield, true);
|
||||
|
||||
} else {
|
||||
|
||||
try {
|
||||
|
||||
copyTextToClipboard(deflateURL(stream_link));
|
||||
|
||||
JOptionPane.showMessageDialog(tthis, "Streaming link was copied to clipboard!\n(Remember to keep MegaBasterd running in background while playing)");
|
||||
|
||||
tthis.dispose();
|
||||
|
||||
tthis.getParent().dispatchEvent(new WindowEvent(tthis, WINDOW_CLOSING));
|
||||
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(StreamerDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
}});
|
||||
}//GEN-LAST:event_dance_buttonActionPerformed
|
||||
|
||||
@Override
|
||||
public void notifyClipboardChange() {
|
||||
@ -195,5 +201,12 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
||||
swingReflectionInvoke("setText", original_link_textfield, link);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton dance_button;
|
||||
private javax.swing.JTextField original_link_textfield;
|
||||
private javax.swing.JLabel put_label;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
|
@ -5,9 +5,9 @@ import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.logging.Level;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import javax.swing.JPanel;
|
||||
import static megabasterd.MiscTools.swingReflectionInvoke;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user