diff --git a/pom.xml b/pom.xml index 5fdecc8cd..fa9c92b9d 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.tonikelope MegaBasterd - 8.15 + 8.16 jar diff --git a/src/main/java/com/tonikelope/megabasterd/ChunkDownloader.java b/src/main/java/com/tonikelope/megabasterd/ChunkDownloader.java index 47ddab93e..eb1d8725b 100644 --- a/src/main/java/com/tonikelope/megabasterd/ChunkDownloader.java +++ b/src/main/java/com/tonikelope/megabasterd/ChunkDownloader.java @@ -194,7 +194,15 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable { if (_current_smart_proxy != null && chunk_error) { - proxy_manager.blockProxy(_current_smart_proxy, timeout ? "TIMEOUT!" : "HTTP " + String.valueOf(http_error)); + if (!timeout && http_error != 429) { + proxy_manager.blockProxy(_current_smart_proxy, timeout ? "TIMEOUT!" : "HTTP " + String.valueOf(http_error)); + } else if (timeout) { + _excluded_proxy_list.add(_current_smart_proxy); + LOG.log(Level.WARNING, "{0} Worker [{1}] PROXY {2} TIMEOUT", new Object[]{Thread.currentThread().getName(), _id, _current_smart_proxy}); + } else { + _excluded_proxy_list.add(_current_smart_proxy); + LOG.log(Level.WARNING, "{0} Worker [{1}] PROXY {2} TOO MANY CONNECTIONS", new Object[]{Thread.currentThread().getName(), _id, _current_smart_proxy}); + } String[] smart_proxy = proxy_manager.getProxy(_excluded_proxy_list); @@ -274,6 +282,8 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable { timeout = false; + http_error = 0; + File tmp_chunk_file = null, chunk_file = null; LOG.log(Level.INFO, "{0} Worker [{1}] is downloading chunk [{2}]! {3}", new Object[]{Thread.currentThread().getName(), _id, chunk_id, _download.getFile_name()}); diff --git a/src/main/java/com/tonikelope/megabasterd/MainPanel.java b/src/main/java/com/tonikelope/megabasterd/MainPanel.java index 02f43e374..91056116f 100644 --- a/src/main/java/com/tonikelope/megabasterd/MainPanel.java +++ b/src/main/java/com/tonikelope/megabasterd/MainPanel.java @@ -70,7 +70,7 @@ import javax.swing.UIManager; */ public final class MainPanel { - public static final String VERSION = "8.15"; + public static final String VERSION = "8.16"; public static final boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY public static final int THROTTLE_SLICE_SIZE = 16 * 1024; public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024; @@ -256,6 +256,8 @@ public final class MainPanel { _resume_downloads = false; + MiscTools.createUploadLogDir(); + try { setupSqliteTables(); diff --git a/src/main/java/com/tonikelope/megabasterd/MainPanelView.java b/src/main/java/com/tonikelope/megabasterd/MainPanelView.java index 1f7cbdb42..6f1da3c6d 100644 --- a/src/main/java/com/tonikelope/megabasterd/MainPanelView.java +++ b/src/main/java/com/tonikelope/megabasterd/MainPanelView.java @@ -276,7 +276,7 @@ public final class MainPanelView extends javax.swing.JFrame { if (dialog.getUpload_log_checkbox().isSelected()) { - File upload_log = new File(MainPanel.MEGABASTERD_HOME_DIR + "/megabasterd_upload_" + parent_node + ".log"); + File upload_log = new File(MiscTools.UPLOAD_LOGS_DIR + "/megabasterd_upload_" + parent_node + ".log"); upload_log.createNewFile(); FileWriter fr; diff --git a/src/main/java/com/tonikelope/megabasterd/MiscTools.java b/src/main/java/com/tonikelope/megabasterd/MiscTools.java index 4a0410276..a07af2cf5 100644 --- a/src/main/java/com/tonikelope/megabasterd/MiscTools.java +++ b/src/main/java/com/tonikelope/megabasterd/MiscTools.java @@ -119,6 +119,8 @@ public class MiscTools { public static final int EXP_BACKOFF_MAX_WAIT_TIME = 8; public static final Object PASS_LOCK = new Object(); public static final int HTTP_TIMEOUT = 30; + public static final String UPLOAD_LOGS_DIR = System.getProperty("user.home") + File.separator + "MEGABASTERD_UPLOAD_LOGS"; + private static final Comparator TREE_NODE_COMPARATOR = (DefaultMutableTreeNode a, DefaultMutableTreeNode b) -> { if (a.isLeaf() && !b.isLeaf()) { return 1; @@ -160,6 +162,27 @@ public class MiscTools { return null; } + public static void createUploadLogDir() { + + if (!Files.exists(Paths.get(UPLOAD_LOGS_DIR))) { + try { + Files.createDirectory(Paths.get(UPLOAD_LOGS_DIR)); + + File dir = new File(System.getProperty("user.home")); + + for (File file : dir.listFiles()) { + if (!file.isDirectory() && file.getName().startsWith("megabasterd_upload_")) { + Files.move(file.toPath(), Paths.get(UPLOAD_LOGS_DIR + File.separator + file.getName())); + } + } + + } catch (IOException ex) { + Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex); + } + + } + } + public static void purgeFolderCache() { File directory = new File(System.getProperty("java.io.tmpdir")); diff --git a/src/main/java/com/tonikelope/megabasterd/Upload.java b/src/main/java/com/tonikelope/megabasterd/Upload.java index b3d17a224..39858a9f2 100644 --- a/src/main/java/com/tonikelope/megabasterd/Upload.java +++ b/src/main/java/com/tonikelope/megabasterd/Upload.java @@ -992,7 +992,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia synchronized (this.getMain_panel().getUpload_manager().getLog_file_lock()) { - File upload_log = new File(MainPanel.MEGABASTERD_HOME_DIR + "/megabasterd_upload_" + _root_node + ".log"); + File upload_log = new File(MiscTools.UPLOAD_LOGS_DIR + "/megabasterd_upload_" + _root_node + ".log"); if (upload_log.exists()) { diff --git a/src/main/resources/images/mbasterd_screen.png b/src/main/resources/images/mbasterd_screen.png index c5d78739f..6533554be 100644 Binary files a/src/main/resources/images/mbasterd_screen.png and b/src/main/resources/images/mbasterd_screen.png differ