Skip to content

Commit

Permalink
7.69
Browse files Browse the repository at this point in the history
Split videos thumbnails fix
  • Loading branch information
tonikelope committed Jan 7, 2023
1 parent ccca888 commit a0522ba
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.tonikelope</groupId>
<artifactId>MegaBasterd</artifactId>
<version>7.68</version>
<version>7.69</version>
<packaging>jar</packaging>
<repositories>
<repository>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/tonikelope/megabasterd/MainPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
*/
public final class MainPanel {

public static final String VERSION = "7.68";
public static final String VERSION = "7.69";
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;
Expand Down
15 changes: 11 additions & 4 deletions src/main/java/com/tonikelope/megabasterd/MiscTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.CodeSource;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
Expand Down Expand Up @@ -130,21 +131,27 @@ public static String getFechaHoraActual() {
return getFechaHoraActual(format);
}

public static boolean isVideoFile(Path path) {
public static boolean isVideoFile(String filename) {

try {
return Files.probeContentType(path).startsWith("video/");

String part_file = MiscTools.findFirstRegex("\\.part[0-9]+-[0-9]+$", filename, 0);

return part_file == null && Files.probeContentType(Paths.get(filename)).startsWith("video/");
} catch (IOException ex) {
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
}

return false;
}

public static boolean isImageFile(Path path) {
public static boolean isImageFile(String filename) {

try {
return Files.probeContentType(path).startsWith("image/");

String part_file = MiscTools.findFirstRegex("\\.part[0-9]+-[0-9]+$", filename, 0);

return part_file == null && Files.probeContentType(Paths.get(filename)).startsWith("image/");
} catch (IOException ex) {
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
}
Expand Down
26 changes: 24 additions & 2 deletions src/main/java/com/tonikelope/megabasterd/SettingsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -1769,8 +1769,30 @@ public void mouseClicked(java.awt.event.MouseEvent evt) {
}// </editor-fold>//GEN-END:initComponents

private void cancel_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancel_buttonActionPerformed
_exit = true;
setVisible(false);

if (!this.save_button.isEnabled()) {

Object[] options = {"No",
LabelTranslatorSingleton.getInstance().translate("Yes")};

int n = 1;
n = showOptionDialog(this,
LabelTranslatorSingleton.getInstance().translate("SURE?"),
LabelTranslatorSingleton.getInstance().translate("EXIT"), YES_NO_CANCEL_OPTION, javax.swing.JOptionPane.WARNING_MESSAGE,
null,
options,
options[0]);

if (n == 1) {
_exit = true;
dispose();
}

} else {
_exit = true;
dispose();
}

}//GEN-LAST:event_cancel_buttonActionPerformed

private void save_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_save_buttonActionPerformed
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/com/tonikelope/megabasterd/Thumbnailer.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.File;
import java.nio.file.Paths;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
Expand Down Expand Up @@ -90,15 +89,17 @@ private String processFrame(IVideoPicture picture, BufferedImage image) {
}

public String createThumbnail(String filename) {
try {
if (MiscTools.isVideoFile(filename)) {

if (MiscTools.isVideoFile(Paths.get(filename))) {

return createVideoThumbnail(filename);
return createVideoThumbnail(filename);

} else if (MiscTools.isImageFile(Paths.get(filename))) {
} else if (MiscTools.isImageFile(filename)) {

return createImageThumbnail(filename);
return createImageThumbnail(filename);

}
} catch (Exception ex) {
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/tonikelope/megabasterd/Upload.java
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ public void run() {

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

while ("".equals(_thumbnail_file)) {
while (_thumbnail_file != null && "".equals(_thumbnail_file)) {
MiscTools.pausar(1000);
}

Expand Down
Binary file modified src/main/resources/images/mbasterd_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a0522ba

Please sign in to comment.