mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-29 13:00:15 +02:00
2.21
This commit is contained in:
parent
f9051b1aaa
commit
2074f8b85f
@ -101,7 +101,7 @@ public final class ChunkWriter implements Runnable, SecureSingleThreadNotifiable
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Chunk current_chunk;
|
Chunk current_chunk;
|
||||||
byte[] buffer = new byte[16 * 1024];
|
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||||
int reads;
|
int reads;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -340,7 +340,7 @@ public final class CryptTools {
|
|||||||
|
|
||||||
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||||
|
|
||||||
byte[] buffer = new byte[16 * 1024];
|
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||||
|
|
||||||
int reads;
|
int reads;
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ public final class CryptTools {
|
|||||||
|
|
||||||
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||||
|
|
||||||
byte[] buffer = new byte[16 * 1024];
|
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||||
|
|
||||||
int reads;
|
int reads;
|
||||||
|
|
||||||
@ -569,7 +569,7 @@ public final class CryptTools {
|
|||||||
String enc_dlc_key;
|
String enc_dlc_key;
|
||||||
|
|
||||||
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||||
byte[] buffer = new byte[16 * 1024];
|
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||||
int reads;
|
int reads;
|
||||||
while ((reads = is.read(buffer)) != -1) {
|
while ((reads = is.read(buffer)) != -1) {
|
||||||
|
|
||||||
|
@ -1042,7 +1042,7 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
|
|||||||
|
|
||||||
long chunk_id = 1;
|
long chunk_id = 1;
|
||||||
long tot = 0L;
|
long tot = 0L;
|
||||||
byte[] chunk_buffer = new byte[16 * 1024];
|
byte[] chunk_buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||||
byte[] byte_block = new byte[16];
|
byte[] byte_block = new byte[16];
|
||||||
int[] int_block;
|
int[] int_block;
|
||||||
int re, reads, to_read;
|
int re, reads, to_read;
|
||||||
|
@ -20,6 +20,7 @@ import java.util.List;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import static java.util.logging.Level.SEVERE;
|
import static java.util.logging.Level.SEVERE;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import static java.util.logging.Logger.getLogger;
|
import static java.util.logging.Logger.getLogger;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -41,10 +42,9 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
|||||||
public final class KissVideoStreamServer implements HttpHandler, SecureSingleThreadNotifiable {
|
public final class KissVideoStreamServer implements HttpHandler, SecureSingleThreadNotifiable {
|
||||||
|
|
||||||
public static final int WORKER_STATUS_FILE_INFO = 0x01;
|
public static final int WORKER_STATUS_FILE_INFO = 0x01;
|
||||||
public static final int WORKER_STATUS_CONNECT = 0x02;
|
public static final int WORKER_STATUS_STREAM = 0x02;
|
||||||
public static final int WORKER_STATUS_STREAM = 0x03;
|
public static final int WORKER_STATUS_RETRY = 0x03;
|
||||||
public static final int WORKER_STATUS_RETRY = 0x04;
|
public static final int WORKER_STATUS_EXIT = 0x04;
|
||||||
public static final int WORKER_STATUS_EXIT = 0x05;
|
|
||||||
public static final int WORKERS = 4;
|
public static final int WORKERS = 4;
|
||||||
|
|
||||||
private final MainPanel _main_panel;
|
private final MainPanel _main_panel;
|
||||||
@ -109,7 +109,7 @@ public final class KissVideoStreamServer implements HttpHandler, SecureSingleThr
|
|||||||
public void start(int port, String context) throws IOException {
|
public void start(int port, String context) throws IOException {
|
||||||
swingReflectionInvoke("setForeground", _main_panel.getView().getKiss_server_status(), new Color(0, 128, 0));
|
swingReflectionInvoke("setForeground", _main_panel.getView().getKiss_server_status(), new Color(0, 128, 0));
|
||||||
|
|
||||||
swingReflectionInvoke("setText", _main_panel.getView().getKiss_server_status(), "Kissvideostreamer on localhost:" + STREAMER_PORT + " (Waiting for request...)");
|
swingReflectionInvoke("setText", _main_panel.getView().getKiss_server_status(), "Stream server running on localhost:" + STREAMER_PORT + " (Waiting for request...)");
|
||||||
|
|
||||||
HttpServer httpserver = HttpServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), port), 0);
|
HttpServer httpserver = HttpServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), port), 0);
|
||||||
|
|
||||||
@ -141,10 +141,6 @@ public final class KissVideoStreamServer implements HttpHandler, SecureSingleThr
|
|||||||
conta_info++;
|
conta_info++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WORKER_STATUS_CONNECT:
|
|
||||||
conta_connect++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WORKER_STATUS_STREAM:
|
case WORKER_STATUS_STREAM:
|
||||||
conta_stream++;
|
conta_stream++;
|
||||||
break;
|
break;
|
||||||
@ -159,11 +155,11 @@ public final class KissVideoStreamServer implements HttpHandler, SecureSingleThr
|
|||||||
|
|
||||||
if (conta_info > 0 || conta_connect > 0 || conta_stream > 0 || conta_retry > 0) {
|
if (conta_info > 0 || conta_connect > 0 || conta_stream > 0 || conta_retry > 0) {
|
||||||
|
|
||||||
status = "Kissvideostreamer on localhost:" + STREAMER_PORT + " Info: " + conta_info + " / Conn: " + conta_connect + " / Stream: " + conta_stream + " / Retry: " + conta_retry;
|
status = "Stream server running on localhost:" + STREAMER_PORT + " Info: " + conta_info + " / Stream: " + conta_stream + " / Retry: " + conta_retry;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
status = "Kissvideostreamer on localhost:" + STREAMER_PORT + " (Waiting for request...)";
|
status = "Stream server running on localhost:" + STREAMER_PORT + " (Waiting for request...)";
|
||||||
}
|
}
|
||||||
|
|
||||||
swingReflectionInvoke("setText", _main_panel.getView().getKiss_server_status(), status);
|
swingReflectionInvoke("setText", _main_panel.getView().getKiss_server_status(), status);
|
||||||
@ -419,7 +415,9 @@ public final class KissVideoStreamServer implements HttpHandler, SecureSingleThr
|
|||||||
|
|
||||||
String link;
|
String link;
|
||||||
|
|
||||||
String[] url_parts = url_path.substring(url_path.indexOf("/video/") + 7).split("#");
|
System.out.println(url_path.substring(url_path.indexOf("/video/") + 7));
|
||||||
|
|
||||||
|
String[] url_parts = new String(MiscTools.UrlBASE642Bin(url_path.substring(url_path.indexOf("/video/") + 7))).split("#");
|
||||||
|
|
||||||
mega_account = url_parts[0];
|
mega_account = url_parts[0];
|
||||||
|
|
||||||
@ -427,7 +425,7 @@ public final class KissVideoStreamServer implements HttpHandler, SecureSingleThr
|
|||||||
mega_account = null;
|
mega_account = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
link = new String(MiscTools.UrlBASE642Bin(url_parts[1]));
|
link = new String(url_parts[1]);
|
||||||
|
|
||||||
HashMap cache_info, file_info;
|
HashMap cache_info, file_info;
|
||||||
|
|
||||||
@ -496,7 +494,7 @@ public final class KissVideoStreamServer implements HttpHandler, SecureSingleThr
|
|||||||
|
|
||||||
resheaders.add("Connection", "close");
|
resheaders.add("Connection", "close");
|
||||||
|
|
||||||
byte[] buffer = new byte[16 * 1024];
|
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||||
|
|
||||||
int reads;
|
int reads;
|
||||||
|
|
||||||
@ -571,8 +569,6 @@ public final class KissVideoStreamServer implements HttpHandler, SecureSingleThr
|
|||||||
chunkwriter = new StreamChunkWriter(this, link, file_info, mega_account, pipeout, temp_url, 0, file_size - 1);
|
chunkwriter = new StreamChunkWriter(this, link, file_info, mega_account, pipeout, temp_url, 0, file_size - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateStatus(WORKER_STATUS_CONNECT);
|
|
||||||
|
|
||||||
THREAD_POOL.execute(chunkwriter);
|
THREAD_POOL.execute(chunkwriter);
|
||||||
|
|
||||||
for (int i = 0; i < WORKERS; i++) {
|
for (int i = 0; i < WORKERS; i++) {
|
||||||
@ -602,7 +598,11 @@ public final class KissVideoStreamServer implements HttpHandler, SecureSingleThr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
//Logger.getLogger(KissVideoStreamServer.class.getName()).log(Level.SEVERE, null, ex);
|
|
||||||
|
if (!(ex instanceof IOException)) {
|
||||||
|
Logger.getLogger(KissVideoStreamServer.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
System.out.println("KissVideoStreamerHandle: bye bye");
|
System.out.println("KissVideoStreamerHandle: bye bye");
|
||||||
|
|
||||||
|
@ -85,6 +85,9 @@ public final class LinkGrabberDialog extends javax.swing.JDialog implements Clip
|
|||||||
|
|
||||||
swingReflectionInvoke("addItem", use_mega_account_down_combobox, o);
|
swingReflectionInvoke("addItem", use_mega_account_down_combobox, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
swingReflectionInvoke("addItem", use_mega_account_down_combobox, "");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
swingReflectionInvoke("setEnabled", use_mega_account_down_combobox, false);
|
swingReflectionInvoke("setEnabled", use_mega_account_down_combobox, false);
|
||||||
swingReflectionInvoke("setEnabled", use_mega_account_down_label, false);
|
swingReflectionInvoke("setEnabled", use_mega_account_down_label, false);
|
||||||
@ -282,7 +285,7 @@ public final class LinkGrabberDialog extends javax.swing.JDialog implements Clip
|
|||||||
|
|
||||||
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||||
|
|
||||||
byte[] buffer = new byte[16 * 1024];
|
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||||
|
|
||||||
int reads;
|
int reads;
|
||||||
|
|
||||||
@ -352,7 +355,7 @@ public final class LinkGrabberDialog extends javax.swing.JDialog implements Clip
|
|||||||
private void use_mega_account_down_comboboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_use_mega_account_down_comboboxItemStateChanged
|
private void use_mega_account_down_comboboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_use_mega_account_down_comboboxItemStateChanged
|
||||||
String selected_item = (String) use_mega_account_down_combobox.getSelectedItem();
|
String selected_item = (String) use_mega_account_down_combobox.getSelectedItem();
|
||||||
|
|
||||||
if (_main_panel.isUse_mega_account_down() && selected_item != null && !selected_item.equals(_last_selected_account)) {
|
if (_main_panel.isUse_mega_account_down() && !"".equals(selected_item) && selected_item != null && !selected_item.equals(_last_selected_account)) {
|
||||||
|
|
||||||
use_mega_account_down_combobox.setEnabled(false);
|
use_mega_account_down_combobox.setEnabled(false);
|
||||||
|
|
||||||
@ -444,6 +447,8 @@ public final class LinkGrabberDialog extends javax.swing.JDialog implements Clip
|
|||||||
swingReflectionInvokeAndWait("setEnabled", ((LinkGrabberDialog) tthis).getDance_button(), true);
|
swingReflectionInvokeAndWait("setEnabled", ((LinkGrabberDialog) tthis).getDance_button(), true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if(!selected_item.equals(_last_selected_account)) {
|
||||||
|
_last_selected_account=null;
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_use_mega_account_down_comboboxItemStateChanged
|
}//GEN-LAST:event_use_mega_account_down_comboboxItemStateChanged
|
||||||
|
|
||||||
|
@ -59,8 +59,9 @@ import org.apache.http.auth.UsernamePasswordCredentials;
|
|||||||
*/
|
*/
|
||||||
public final class MainPanel {
|
public final class MainPanel {
|
||||||
|
|
||||||
public static final String VERSION = "2.20";
|
public static final String VERSION = "2.21";
|
||||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||||
|
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
||||||
public static final int STREAMER_PORT = 1337;
|
public static final int STREAMER_PORT = 1337;
|
||||||
public static final int WATCHDOG_PORT = 1338;
|
public static final int WATCHDOG_PORT = 1338;
|
||||||
public static final int DEFAULT_MEGA_PROXY_PORT = 9999;
|
public static final int DEFAULT_MEGA_PROXY_PORT = 9999;
|
||||||
|
@ -310,7 +310,7 @@ public final class MegaAPI {
|
|||||||
|
|
||||||
try (ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
try (ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||||
|
|
||||||
byte[] buffer = new byte[16 * 1024];
|
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||||
|
|
||||||
int reads;
|
int reads;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public final class MegaCrypterAPI {
|
|||||||
|
|
||||||
try (ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
try (ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||||
|
|
||||||
byte[] buffer = new byte[16 * 1024];
|
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||||
|
|
||||||
int reads;
|
int reads;
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ public final class MiscTools {
|
|||||||
|
|
||||||
try (ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
try (ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||||
|
|
||||||
byte[] buffer = new byte[16 * 1024];
|
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||||
|
|
||||||
int reads;
|
int reads;
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
package megabasterd;
|
package megabasterd;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
@ -41,19 +41,13 @@ public class StreamChunkDownloader implements Runnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
StreamChunk chunk_stream;
|
|
||||||
int reads, http_status;
|
|
||||||
byte[] buffer = new byte[THROTTLE_SLICE_SIZE];
|
|
||||||
InputStream is;
|
|
||||||
boolean error;
|
|
||||||
|
|
||||||
System.out.println(Thread.currentThread().getName() + " Worker [" + _id + "]: let's do some work!");
|
System.out.println(Thread.currentThread().getName() + " Worker [" + _id + "]: let's do some work!");
|
||||||
|
|
||||||
try (CloseableHttpClient httpclient = MiscTools.getApacheKissHttpClient()) {
|
try (CloseableHttpClient httpclient = MiscTools.getApacheKissHttpClient()) {
|
||||||
|
|
||||||
String url=_chunkwriter.getUrl();
|
|
||||||
|
|
||||||
error = false;
|
String url = _chunkwriter.getUrl();
|
||||||
|
|
||||||
|
boolean error = false;
|
||||||
|
|
||||||
long offset = -1;
|
long offset = -1;
|
||||||
|
|
||||||
@ -69,15 +63,19 @@ public class StreamChunkDownloader implements Runnable {
|
|||||||
if (!error) {
|
if (!error) {
|
||||||
|
|
||||||
offset = _chunkwriter.nextOffset();
|
offset = _chunkwriter.nextOffset();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
url=_chunkwriter.getUrl();
|
url = _chunkwriter.getUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset >= 0) {
|
if (offset >= 0) {
|
||||||
|
|
||||||
chunk_stream = new StreamChunk(offset, _chunkwriter.calculateChunkSize(offset), url);
|
int reads, http_status;
|
||||||
|
|
||||||
|
byte[] buffer = new byte[THROTTLE_SLICE_SIZE];
|
||||||
|
|
||||||
|
StreamChunk chunk_stream = new StreamChunk(offset, _chunkwriter.calculateChunkSize(offset), url);
|
||||||
|
|
||||||
System.out.println(Thread.currentThread().getName() + " Worker [" + _id + "]: offset: " + offset + " size: " + chunk_stream.getSize());
|
System.out.println(Thread.currentThread().getName() + " Worker [" + _id + "]: offset: " + offset + " size: " + chunk_stream.getSize());
|
||||||
|
|
||||||
@ -89,7 +87,7 @@ public class StreamChunkDownloader implements Runnable {
|
|||||||
|
|
||||||
if (!_exit) {
|
if (!_exit) {
|
||||||
|
|
||||||
is = httpresponse.getEntity().getContent();
|
InputStream is = httpresponse.getEntity().getContent();
|
||||||
|
|
||||||
http_status = httpresponse.getStatusLine().getStatusCode();
|
http_status = httpresponse.getStatusLine().getStatusCode();
|
||||||
|
|
||||||
@ -152,7 +150,7 @@ public class StreamChunkDownloader implements Runnable {
|
|||||||
|
|
||||||
_chunkwriter.secureNotifyAll();
|
_chunkwriter.secureNotifyAll();
|
||||||
|
|
||||||
System.out.println("Worker [" + _id + "]: bye bye");
|
System.out.println(Thread.currentThread().getName() + " Worker [" + _id + "]: bye bye");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package megabasterd;
|
package megabasterd;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -37,13 +32,13 @@ public class StreamChunkWriter implements Runnable, SecureMultiThreadNotifiable
|
|||||||
private final Object _secure_notify_lock;
|
private final Object _secure_notify_lock;
|
||||||
private final Object _chunk_offset_lock;
|
private final Object _chunk_offset_lock;
|
||||||
private final KissVideoStreamServer _server;
|
private final KissVideoStreamServer _server;
|
||||||
private volatile boolean _exit;
|
private volatile boolean _exit;
|
||||||
|
|
||||||
public StreamChunkWriter(KissVideoStreamServer server, String link, HashMap file_info, String mega_account, PipedOutputStream pipeos, String url, long start_offset, long end_offset) {
|
public StreamChunkWriter(KissVideoStreamServer server, String link, HashMap file_info, String mega_account, PipedOutputStream pipeos, String url, long start_offset, long end_offset) {
|
||||||
_server=server;
|
_server = server;
|
||||||
_link=link;
|
_link = link;
|
||||||
_mega_account=mega_account;
|
_mega_account = mega_account;
|
||||||
_file_info=file_info;
|
_file_info = file_info;
|
||||||
_bytes_written = start_offset;
|
_bytes_written = start_offset;
|
||||||
_pipeos = pipeos;
|
_pipeos = pipeos;
|
||||||
_start_offset = start_offset;
|
_start_offset = start_offset;
|
||||||
@ -53,22 +48,22 @@ public class StreamChunkWriter implements Runnable, SecureMultiThreadNotifiable
|
|||||||
_notified_threads = new ConcurrentHashMap<>();
|
_notified_threads = new ConcurrentHashMap<>();
|
||||||
_secure_notify_lock = new Object();
|
_secure_notify_lock = new Object();
|
||||||
_chunk_offset_lock = new Object();
|
_chunk_offset_lock = new Object();
|
||||||
_url=url;
|
_url = url;
|
||||||
_exit = false;
|
_exit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUrl() throws IOException, InterruptedException {
|
public String getUrl() throws IOException, InterruptedException {
|
||||||
|
|
||||||
if(!MiscTools.checkMegaDownloadUrl(_url)) {
|
if (!MiscTools.checkMegaDownloadUrl(_url)) {
|
||||||
|
|
||||||
_url = _server.getMegaFileDownloadUrl(_link, (String)_file_info.get("pass_hash"), (String)_file_info.get("noexpiretoken"), _mega_account);
|
_url = _server.getMegaFileDownloadUrl(_link, (String) _file_info.get("pass_hash"), (String) _file_info.get("noexpiretoken"), _mega_account);
|
||||||
_file_info.put("url", _url);
|
_file_info.put("url", _url);
|
||||||
_server.getLink_cache().put(_link, _file_info);
|
_server.getLink_cache().put(_link, _file_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _url;
|
return _url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExit() {
|
public boolean isExit() {
|
||||||
return _exit;
|
return _exit;
|
||||||
}
|
}
|
||||||
@ -80,10 +75,6 @@ public class StreamChunkWriter implements Runnable, SecureMultiThreadNotifiable
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
StreamChunk current_chunk;
|
|
||||||
byte[] buffer = new byte[16 * 1024];
|
|
||||||
int reads;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
System.out.println("StreamChunkWriter: let's do some work! Start: " + _start_offset + " End: " + _end_offset);
|
System.out.println("StreamChunkWriter: let's do some work! Start: " + _start_offset + " End: " + _end_offset);
|
||||||
@ -92,10 +83,14 @@ public class StreamChunkWriter implements Runnable, SecureMultiThreadNotifiable
|
|||||||
|
|
||||||
while (!_exit && _bytes_written < _end_offset && _chunk_queue.containsKey(_bytes_written)) {
|
while (!_exit && _bytes_written < _end_offset && _chunk_queue.containsKey(_bytes_written)) {
|
||||||
|
|
||||||
current_chunk = _chunk_queue.get(_bytes_written);
|
StreamChunk current_chunk = _chunk_queue.get(_bytes_written);
|
||||||
|
|
||||||
InputStream is = current_chunk.getInputStream();
|
InputStream is = current_chunk.getInputStream();
|
||||||
|
|
||||||
|
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||||
|
|
||||||
|
int reads;
|
||||||
|
|
||||||
while (!_exit && (reads = is.read(buffer)) != -1) {
|
while (!_exit && (reads = is.read(buffer)) != -1) {
|
||||||
|
|
||||||
_pipeos.write(buffer, 0, reads);
|
_pipeos.write(buffer, 0, reads);
|
||||||
@ -132,7 +127,9 @@ public class StreamChunkWriter implements Runnable, SecureMultiThreadNotifiable
|
|||||||
|
|
||||||
_exit = true;
|
_exit = true;
|
||||||
|
|
||||||
System.out.println("StreamChunkWriter: bye bye");
|
secureNotifyAll();
|
||||||
|
|
||||||
|
System.out.println(Thread.currentThread().getName() + " StreamChunkWriter: bye bye");
|
||||||
}
|
}
|
||||||
|
|
||||||
public long nextOffset() {
|
public long nextOffset() {
|
||||||
|
@ -68,6 +68,8 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
|||||||
|
|
||||||
swingReflectionInvoke("addItem", use_mega_account_down_combobox, o);
|
swingReflectionInvoke("addItem", use_mega_account_down_combobox, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
swingReflectionInvoke("addItem", use_mega_account_down_combobox, "");
|
||||||
} else {
|
} else {
|
||||||
swingReflectionInvoke("setEnabled", use_mega_account_down_combobox, false);
|
swingReflectionInvoke("setEnabled", use_mega_account_down_combobox, false);
|
||||||
swingReflectionInvoke("setEnabled", use_mega_account_down_label, false);
|
swingReflectionInvoke("setEnabled", use_mega_account_down_label, false);
|
||||||
@ -207,7 +209,9 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
|||||||
|
|
||||||
if (findFirstRegex("://mega(\\.co)?\\.nz/#[^fF]", link, 0) != null || findFirstRegex("https?://[^/]+/![^!]+![0-9a-fA-F]+", link, 0) != null) {
|
if (findFirstRegex("://mega(\\.co)?\\.nz/#[^fF]", link, 0) != null || findFirstRegex("https?://[^/]+/![^!]+![0-9a-fA-F]+", link, 0) != null) {
|
||||||
|
|
||||||
stream_link = "http://localhost:1337/video/" + (_last_selected_account != null ? _last_selected_account : "") + "#" + MiscTools.Bin2UrlBASE64(link.getBytes());
|
data = MiscTools.Bin2UrlBASE64(((_last_selected_account != null ? _last_selected_account : "") + "#" + link).getBytes());
|
||||||
|
|
||||||
|
stream_link = "http://localhost:1337/video/" + data;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -245,7 +249,7 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
|||||||
private void use_mega_account_down_comboboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_use_mega_account_down_comboboxItemStateChanged
|
private void use_mega_account_down_comboboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_use_mega_account_down_comboboxItemStateChanged
|
||||||
String selected_item = (String) use_mega_account_down_combobox.getSelectedItem();
|
String selected_item = (String) use_mega_account_down_combobox.getSelectedItem();
|
||||||
|
|
||||||
if (_main_panel.isUse_mega_account_down() && selected_item != null && !selected_item.equals(_last_selected_account)) {
|
if (_main_panel.isUse_mega_account_down() && !"".equals(selected_item) && selected_item != null && !selected_item.equals(_last_selected_account)) {
|
||||||
|
|
||||||
use_mega_account_down_combobox.setEnabled(false);
|
use_mega_account_down_combobox.setEnabled(false);
|
||||||
|
|
||||||
@ -337,6 +341,8 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
|
|||||||
swingReflectionInvokeAndWait("setEnabled", ((StreamerDialog) tthis).getDance_button(), true);
|
swingReflectionInvokeAndWait("setEnabled", ((StreamerDialog) tthis).getDance_button(), true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if(!selected_item.equals(_last_selected_account)) {
|
||||||
|
_last_selected_account=null;
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_use_mega_account_down_comboboxItemStateChanged
|
}//GEN-LAST:event_use_mega_account_down_comboboxItemStateChanged
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user