Skip to content

Commit a0522ba

Browse files
author
tonikelope
committed
7.69
Split videos thumbnails fix
1 parent ccca888 commit a0522ba

File tree

7 files changed

+45
-15
lines changed

7 files changed

+45
-15
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.tonikelope</groupId>
55
<artifactId>MegaBasterd</artifactId>
6-
<version>7.68</version>
6+
<version>7.69</version>
77
<packaging>jar</packaging>
88
<repositories>
99
<repository>

src/main/java/com/tonikelope/megabasterd/MainPanel.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
*/
6868
public final class MainPanel {
6969

70-
public static final String VERSION = "7.68";
70+
public static final String VERSION = "7.69";
7171
public static final boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY
7272
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
7373
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;

src/main/java/com/tonikelope/megabasterd/MiscTools.java

+11-4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import java.nio.file.Files;
5252
import java.nio.file.LinkOption;
5353
import java.nio.file.Path;
54+
import java.nio.file.Paths;
5455
import java.security.CodeSource;
5556
import java.security.MessageDigest;
5657
import java.security.NoSuchAlgorithmException;
@@ -130,21 +131,27 @@ public static String getFechaHoraActual() {
130131
return getFechaHoraActual(format);
131132
}
132133

133-
public static boolean isVideoFile(Path path) {
134+
public static boolean isVideoFile(String filename) {
134135

135136
try {
136-
return Files.probeContentType(path).startsWith("video/");
137+
138+
String part_file = MiscTools.findFirstRegex("\\.part[0-9]+-[0-9]+$", filename, 0);
139+
140+
return part_file == null && Files.probeContentType(Paths.get(filename)).startsWith("video/");
137141
} catch (IOException ex) {
138142
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
139143
}
140144

141145
return false;
142146
}
143147

144-
public static boolean isImageFile(Path path) {
148+
public static boolean isImageFile(String filename) {
145149

146150
try {
147-
return Files.probeContentType(path).startsWith("image/");
151+
152+
String part_file = MiscTools.findFirstRegex("\\.part[0-9]+-[0-9]+$", filename, 0);
153+
154+
return part_file == null && Files.probeContentType(Paths.get(filename)).startsWith("image/");
148155
} catch (IOException ex) {
149156
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
150157
}

src/main/java/com/tonikelope/megabasterd/SettingsDialog.java

+24-2
Original file line numberDiff line numberDiff line change
@@ -1769,8 +1769,30 @@ public void mouseClicked(java.awt.event.MouseEvent evt) {
17691769
}// </editor-fold>//GEN-END:initComponents
17701770

17711771
private void cancel_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancel_buttonActionPerformed
1772-
_exit = true;
1773-
setVisible(false);
1772+
1773+
if (!this.save_button.isEnabled()) {
1774+
1775+
Object[] options = {"No",
1776+
LabelTranslatorSingleton.getInstance().translate("Yes")};
1777+
1778+
int n = 1;
1779+
n = showOptionDialog(this,
1780+
LabelTranslatorSingleton.getInstance().translate("SURE?"),
1781+
LabelTranslatorSingleton.getInstance().translate("EXIT"), YES_NO_CANCEL_OPTION, javax.swing.JOptionPane.WARNING_MESSAGE,
1782+
null,
1783+
options,
1784+
options[0]);
1785+
1786+
if (n == 1) {
1787+
_exit = true;
1788+
dispose();
1789+
}
1790+
1791+
} else {
1792+
_exit = true;
1793+
dispose();
1794+
}
1795+
17741796
}//GEN-LAST:event_cancel_buttonActionPerformed
17751797

17761798
private void save_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_save_buttonActionPerformed

src/main/java/com/tonikelope/megabasterd/Thumbnailer.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import java.awt.RenderingHints;
1515
import java.awt.image.BufferedImage;
1616
import java.io.File;
17-
import java.nio.file.Paths;
1817
import java.util.logging.Level;
1918
import java.util.logging.Logger;
2019
import javax.imageio.ImageIO;
@@ -90,15 +89,17 @@ private String processFrame(IVideoPicture picture, BufferedImage image) {
9089
}
9190

9291
public String createThumbnail(String filename) {
92+
try {
93+
if (MiscTools.isVideoFile(filename)) {
9394

94-
if (MiscTools.isVideoFile(Paths.get(filename))) {
95-
96-
return createVideoThumbnail(filename);
95+
return createVideoThumbnail(filename);
9796

98-
} else if (MiscTools.isImageFile(Paths.get(filename))) {
97+
} else if (MiscTools.isImageFile(filename)) {
9998

100-
return createImageThumbnail(filename);
99+
return createImageThumbnail(filename);
101100

101+
}
102+
} catch (Exception ex) {
102103
}
103104

104105
return null;

src/main/java/com/tonikelope/megabasterd/Upload.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ public void run() {
954954

955955
_fid = (String) ((Map<String, Object>) files.get(0)).get("h");
956956

957-
while ("".equals(_thumbnail_file)) {
957+
while (_thumbnail_file != null && "".equals(_thumbnail_file)) {
958958
MiscTools.pausar(1000);
959959
}
960960

-3.26 KB
Loading

0 commit comments

Comments
 (0)