mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-29 04:50:14 +02:00
7.65
https://github.com/tonikelope/megabasterd/issues/437 (EXPERIMENTAL FOR IMAGES AND VIDEOS) Thumbnails optional in Settings>Uploads (default=true)
This commit is contained in:
parent
18a715f533
commit
a849975141
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.tonikelope</groupId>
|
<groupId>com.tonikelope</groupId>
|
||||||
<artifactId>MegaBasterd</artifactId>
|
<artifactId>MegaBasterd</artifactId>
|
||||||
<version>7.64</version>
|
<version>7.65</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
|
@ -108,6 +108,10 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
|||||||
MiscTools.GUIRunAndWait(() -> {
|
MiscTools.GUIRunAndWait(() -> {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
|
String upload_log_string = DBTools.selectSettingValue("upload_log");
|
||||||
|
|
||||||
|
upload_log_checkbox.setSelected("yes".equals(upload_log_string));
|
||||||
|
|
||||||
updateFonts(this, GUI_FONT, _main_panel.getZoom_factor());
|
updateFonts(this, GUI_FONT, _main_panel.getZoom_factor());
|
||||||
|
|
||||||
updateTitledBorderFont(((javax.swing.border.TitledBorder) jPanel1.getBorder()), GUI_FONT, _main_panel.getZoom_factor());
|
updateTitledBorderFont(((javax.swing.border.TitledBorder) jPanel1.getBorder()), GUI_FONT, _main_panel.getZoom_factor());
|
||||||
|
@ -67,7 +67,7 @@ import javax.swing.UIManager;
|
|||||||
*/
|
*/
|
||||||
public final class MainPanel {
|
public final class MainPanel {
|
||||||
|
|
||||||
public static final String VERSION = "7.64";
|
public static final String VERSION = "7.65";
|
||||||
public static final boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY
|
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 THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||||
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
||||||
|
@ -567,23 +567,30 @@
|
|||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="rec_upload_slots_label" alignment="0" pref="1185" max="32767" attributes="0"/>
|
<Component id="rec_upload_slots_label" alignment="0" pref="1185" max="32767" attributes="0"/>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
|
|
||||||
<Component id="max_up_speed_label" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="max_up_speed_spinner" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="limit_upload_speed_checkbox" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
|
||||||
<Component id="default_slots_up_label" max="32767" attributes="0"/>
|
|
||||||
<Component id="max_uploads_label" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="default_slots_up_spinner" min="-2" max="-2" attributes="0"/>
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<Component id="max_uploads_spinner" alignment="0" min="-2" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
|
||||||
|
<Component id="max_up_speed_label" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="max_up_speed_spinner" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Component id="limit_upload_speed_checkbox" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||||
|
<Component id="default_slots_up_label" max="32767" attributes="0"/>
|
||||||
|
<Component id="max_uploads_label" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="default_slots_up_spinner" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="max_uploads_spinner" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
<Component id="thumbnail_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="upload_log_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
@ -612,6 +619,10 @@
|
|||||||
<Component id="max_up_speed_label" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="max_up_speed_label" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="max_up_speed_spinner" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="max_up_speed_spinner" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||||
|
<Component id="thumbnail_checkbox" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||||
|
<Component id="upload_log_checkbox" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
@ -689,6 +700,24 @@
|
|||||||
<Property name="text" type="java.lang.String" value="Note: slots consume RAM, so use them moderately."/>
|
<Property name="text" type="java.lang.String" value="Note: slots consume RAM, so use them moderately."/>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
|
<Component class="javax.swing.JCheckBox" name="thumbnail_checkbox">
|
||||||
|
<Properties>
|
||||||
|
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||||
|
<Font name="Dialog" size="18" style="1"/>
|
||||||
|
</Property>
|
||||||
|
<Property name="text" type="java.lang.String" value="Create and upload image/video thumbnails"/>
|
||||||
|
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JCheckBox" name="upload_log_checkbox">
|
||||||
|
<Properties>
|
||||||
|
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||||
|
<Font name="Dialog" size="18" style="1"/>
|
||||||
|
</Property>
|
||||||
|
<Property name="text" type="java.lang.String" value="Create upload logs"/>
|
||||||
|
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
|
@ -194,6 +194,26 @@ public class SettingsDialog extends javax.swing.JDialog {
|
|||||||
monitor_clipboard = monitor_clipboard_string.equals("yes");
|
monitor_clipboard = monitor_clipboard_string.equals("yes");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean thumbnails = Upload.DEFAULT_THUMBNAILS;
|
||||||
|
|
||||||
|
String thumbnails_string = DBTools.selectSettingValue("thumbnails");
|
||||||
|
|
||||||
|
if (thumbnails_string != null) {
|
||||||
|
thumbnails = thumbnails_string.equals("yes");
|
||||||
|
}
|
||||||
|
|
||||||
|
thumbnail_checkbox.setSelected(thumbnails);
|
||||||
|
|
||||||
|
boolean upload_log = Upload.UPLOAD_LOG;
|
||||||
|
|
||||||
|
String upload_log_string = DBTools.selectSettingValue("upload_log");
|
||||||
|
|
||||||
|
if (upload_log_string != null) {
|
||||||
|
upload_log = upload_log_string.equals("yes");
|
||||||
|
}
|
||||||
|
|
||||||
|
upload_log_checkbox.setSelected(upload_log);
|
||||||
|
|
||||||
clipboardspy_checkbox.setSelected(monitor_clipboard);
|
clipboardspy_checkbox.setSelected(monitor_clipboard);
|
||||||
|
|
||||||
String default_download_dir = DBTools.selectSettingValue("default_down_dir");
|
String default_download_dir = DBTools.selectSettingValue("default_down_dir");
|
||||||
@ -703,6 +723,8 @@ public class SettingsDialog extends javax.swing.JDialog {
|
|||||||
max_up_speed_spinner = new javax.swing.JSpinner();
|
max_up_speed_spinner = new javax.swing.JSpinner();
|
||||||
limit_upload_speed_checkbox = new javax.swing.JCheckBox();
|
limit_upload_speed_checkbox = new javax.swing.JCheckBox();
|
||||||
rec_upload_slots_label = new javax.swing.JLabel();
|
rec_upload_slots_label = new javax.swing.JLabel();
|
||||||
|
thumbnail_checkbox = new javax.swing.JCheckBox();
|
||||||
|
upload_log_checkbox = new javax.swing.JCheckBox();
|
||||||
accounts_panel = new javax.swing.JPanel();
|
accounts_panel = new javax.swing.JPanel();
|
||||||
mega_accounts_scrollpane = new javax.swing.JScrollPane();
|
mega_accounts_scrollpane = new javax.swing.JScrollPane();
|
||||||
mega_accounts_table = new javax.swing.JTable();
|
mega_accounts_table = new javax.swing.JTable();
|
||||||
@ -1066,6 +1088,14 @@ public class SettingsDialog extends javax.swing.JDialog {
|
|||||||
rec_upload_slots_label.setFont(new java.awt.Font("Dialog", 0, 14)); // NOI18N
|
rec_upload_slots_label.setFont(new java.awt.Font("Dialog", 0, 14)); // NOI18N
|
||||||
rec_upload_slots_label.setText("Note: slots consume RAM, so use them moderately.");
|
rec_upload_slots_label.setText("Note: slots consume RAM, so use them moderately.");
|
||||||
|
|
||||||
|
thumbnail_checkbox.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
|
||||||
|
thumbnail_checkbox.setText("Create and upload image/video thumbnails");
|
||||||
|
thumbnail_checkbox.setDoubleBuffered(true);
|
||||||
|
|
||||||
|
upload_log_checkbox.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
|
||||||
|
upload_log_checkbox.setText("Create upload logs");
|
||||||
|
upload_log_checkbox.setDoubleBuffered(true);
|
||||||
|
|
||||||
javax.swing.GroupLayout uploads_panelLayout = new javax.swing.GroupLayout(uploads_panel);
|
javax.swing.GroupLayout uploads_panelLayout = new javax.swing.GroupLayout(uploads_panel);
|
||||||
uploads_panel.setLayout(uploads_panelLayout);
|
uploads_panel.setLayout(uploads_panelLayout);
|
||||||
uploads_panelLayout.setHorizontalGroup(
|
uploads_panelLayout.setHorizontalGroup(
|
||||||
@ -1075,19 +1105,24 @@ public class SettingsDialog extends javax.swing.JDialog {
|
|||||||
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(rec_upload_slots_label, javax.swing.GroupLayout.DEFAULT_SIZE, 1185, Short.MAX_VALUE)
|
.addComponent(rec_upload_slots_label, javax.swing.GroupLayout.DEFAULT_SIZE, 1185, Short.MAX_VALUE)
|
||||||
.addGroup(uploads_panelLayout.createSequentialGroup()
|
.addGroup(uploads_panelLayout.createSequentialGroup()
|
||||||
.addGap(20, 20, 20)
|
|
||||||
.addComponent(max_up_speed_label)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(max_up_speed_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addComponent(limit_upload_speed_checkbox)
|
|
||||||
.addGroup(uploads_panelLayout.createSequentialGroup()
|
|
||||||
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
|
||||||
.addComponent(default_slots_up_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(max_uploads_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(default_slots_up_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addGroup(uploads_panelLayout.createSequentialGroup()
|
||||||
.addComponent(max_uploads_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
.addGap(20, 20, 20)
|
||||||
|
.addComponent(max_up_speed_label)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(max_up_speed_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addComponent(limit_upload_speed_checkbox)
|
||||||
|
.addGroup(uploads_panelLayout.createSequentialGroup()
|
||||||
|
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||||
|
.addComponent(default_slots_up_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addComponent(max_uploads_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(default_slots_up_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(max_uploads_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||||
|
.addComponent(thumbnail_checkbox)
|
||||||
|
.addComponent(upload_log_checkbox))
|
||||||
|
.addGap(0, 0, Short.MAX_VALUE)))
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
uploads_panelLayout.setVerticalGroup(
|
uploads_panelLayout.setVerticalGroup(
|
||||||
@ -1109,6 +1144,10 @@ public class SettingsDialog extends javax.swing.JDialog {
|
|||||||
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(max_up_speed_label)
|
.addComponent(max_up_speed_label)
|
||||||
.addComponent(max_up_speed_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(max_up_speed_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addGap(18, 18, 18)
|
||||||
|
.addComponent(thumbnail_checkbox)
|
||||||
|
.addGap(18, 18, 18)
|
||||||
|
.addComponent(upload_log_checkbox)
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1770,6 +1809,8 @@ public class SettingsDialog extends javax.swing.JDialog {
|
|||||||
settings.put("run_command_path", run_command_textbox.getText());
|
settings.put("run_command_path", run_command_textbox.getText());
|
||||||
settings.put("mega_api_key", mega_api_key.getText().trim());
|
settings.put("mega_api_key", mega_api_key.getText().trim());
|
||||||
settings.put("clipboardspy", clipboardspy_checkbox.isSelected() ? "yes" : "no");
|
settings.put("clipboardspy", clipboardspy_checkbox.isSelected() ? "yes" : "no");
|
||||||
|
settings.put("thumbnails", thumbnail_checkbox.isSelected() ? "yes" : "no");
|
||||||
|
settings.put("upload_log", upload_log_checkbox.isSelected() ? "yes" : "no");
|
||||||
|
|
||||||
if (custom_proxy_textarea.getText().trim().length() == 0) {
|
if (custom_proxy_textarea.getText().trim().length() == 0) {
|
||||||
smart_proxy_checkbox.setSelected(false);
|
smart_proxy_checkbox.setSelected(false);
|
||||||
@ -3133,7 +3174,9 @@ public class SettingsDialog extends javax.swing.JDialog {
|
|||||||
private javax.swing.JCheckBox smart_proxy_checkbox;
|
private javax.swing.JCheckBox smart_proxy_checkbox;
|
||||||
private javax.swing.JCheckBox start_frozen_checkbox;
|
private javax.swing.JCheckBox start_frozen_checkbox;
|
||||||
private javax.swing.JLabel status;
|
private javax.swing.JLabel status;
|
||||||
|
private javax.swing.JCheckBox thumbnail_checkbox;
|
||||||
private javax.swing.JButton unlock_accounts_button;
|
private javax.swing.JButton unlock_accounts_button;
|
||||||
|
private javax.swing.JCheckBox upload_log_checkbox;
|
||||||
private javax.swing.JPanel uploads_panel;
|
private javax.swing.JPanel uploads_panel;
|
||||||
private javax.swing.JScrollPane uploads_scrollpane;
|
private javax.swing.JScrollPane uploads_scrollpane;
|
||||||
private javax.swing.JCheckBox use_mega_account_down_checkbox;
|
private javax.swing.JCheckBox use_mega_account_down_checkbox;
|
||||||
|
@ -14,6 +14,7 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.RenderingHints;
|
import java.awt.RenderingHints;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@ -25,17 +26,12 @@ public class Thumbnailer {
|
|||||||
|
|
||||||
public static final int IMAGE_THUMB_SIZE = 250;
|
public static final int IMAGE_THUMB_SIZE = 250;
|
||||||
|
|
||||||
/**
|
public static final float SECONDS_BETWEEN_FRAMES_PERC = 0.03f; //Take frame video at 3% position
|
||||||
* The number of seconds between frames.
|
|
||||||
*/
|
|
||||||
public static final double SECONDS_BETWEEN_FRAMES = 10;
|
|
||||||
|
|
||||||
public static final float SECONDS_BETWEEN_FRAMES_PERC = 0.03f; //0f para usar SECONDS_BETWEEN_FRAMES directamente
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of nano-seconds between frames.
|
* The number of nano-seconds between frames.
|
||||||
*/
|
*/
|
||||||
private long nano_seconds_between_frames = (long) (Global.DEFAULT_PTS_PER_SECOND * SECONDS_BETWEEN_FRAMES);
|
private long nano_seconds_between_frames;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time of last frame write.
|
* Time of last frame write.
|
||||||
@ -93,7 +89,22 @@ public class Thumbnailer {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String createImageThumbnail(String filename) {
|
public String createThumbnail(String filename) {
|
||||||
|
|
||||||
|
if (MiscTools.isVideoFile(Paths.get(filename))) {
|
||||||
|
|
||||||
|
return createVideoThumbnail(filename);
|
||||||
|
|
||||||
|
} else if (MiscTools.isImageFile(Paths.get(filename))) {
|
||||||
|
|
||||||
|
return createImageThumbnail(filename);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String createImageThumbnail(String filename) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@ -139,7 +150,7 @@ public class Thumbnailer {
|
|||||||
* @param args must contain one string which represents a filename
|
* @param args must contain one string which represents a filename
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public String createVideoThumbnail(String filename) {
|
private String createVideoThumbnail(String filename) {
|
||||||
|
|
||||||
// make sure that we can actually convert video pixel formats
|
// make sure that we can actually convert video pixel formats
|
||||||
if (!IVideoResampler.isSupported(
|
if (!IVideoResampler.isSupported(
|
||||||
@ -157,9 +168,7 @@ public class Thumbnailer {
|
|||||||
throw new IllegalArgumentException("could not open file: " + filename);
|
throw new IllegalArgumentException("could not open file: " + filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SECONDS_BETWEEN_FRAMES_PERC > 0) {
|
nano_seconds_between_frames = (long) (Global.DEFAULT_PTS_PER_SECOND * Math.round((float) SECONDS_BETWEEN_FRAMES_PERC * container.getDuration() / 1000000));
|
||||||
nano_seconds_between_frames = (long) (Global.DEFAULT_PTS_PER_SECOND * Math.round((float) SECONDS_BETWEEN_FRAMES_PERC * container.getDuration() / 1000000));
|
|
||||||
}
|
|
||||||
|
|
||||||
// query how many streams the call to open found
|
// query how many streams the call to open found
|
||||||
int numStreams = container.getNumStreams();
|
int numStreams = container.getNumStreams();
|
||||||
|
@ -40,6 +40,8 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
|||||||
|
|
||||||
public static final int WORKERS_DEFAULT = 6;
|
public static final int WORKERS_DEFAULT = 6;
|
||||||
public static final int CHUNK_SIZE_MULTI = 1; //Otra cosa da errores al reanudar una subida (investigar)
|
public static final int CHUNK_SIZE_MULTI = 1; //Otra cosa da errores al reanudar una subida (investigar)
|
||||||
|
public static final boolean DEFAULT_THUMBNAILS = true;
|
||||||
|
public static final boolean UPLOAD_LOG = false;
|
||||||
private static final Logger LOG = Logger.getLogger(Upload.class.getName());
|
private static final Logger LOG = Logger.getLogger(Upload.class.getName());
|
||||||
private final MainPanel _main_panel;
|
private final MainPanel _main_panel;
|
||||||
private volatile UploadView _view;
|
private volatile UploadView _view;
|
||||||
@ -461,24 +463,6 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
_thread_pool.execute(() -> {
|
|
||||||
|
|
||||||
if (MiscTools.isVideoFile(Paths.get(_file_name))) {
|
|
||||||
|
|
||||||
Thumbnailer thumbnailer = new Thumbnailer();
|
|
||||||
|
|
||||||
_thumbnail_file = thumbnailer.createVideoThumbnail(_file_name);
|
|
||||||
|
|
||||||
} else if (MiscTools.isImageFile(Paths.get(_file_name))) {
|
|
||||||
|
|
||||||
Thumbnailer thumbnailer = new Thumbnailer();
|
|
||||||
|
|
||||||
_thumbnail_file = thumbnailer.createImageThumbnail(_file_name);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
getView().printStatusNormal(LabelTranslatorSingleton.getInstance().translate(_frozen ? "(FROZEN) Waiting to start (" : "Waiting to start (") + _ma.getFull_email() + ") ...");
|
getView().printStatusNormal(LabelTranslatorSingleton.getInstance().translate(_frozen ? "(FROZEN) Waiting to start (" : "Waiting to start (") + _ma.getFull_email() + ") ...");
|
||||||
|
|
||||||
MiscTools.GUIRun(() -> {
|
MiscTools.GUIRun(() -> {
|
||||||
@ -717,6 +701,21 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
|||||||
|
|
||||||
if (!_exit) {
|
if (!_exit) {
|
||||||
|
|
||||||
|
_thread_pool.execute(() -> {
|
||||||
|
|
||||||
|
String thumbnails_string = DBTools.selectSettingValue("thumbnails");
|
||||||
|
|
||||||
|
if ("yes".equals(thumbnails_string)) {
|
||||||
|
|
||||||
|
Thumbnailer thumbnailer = new Thumbnailer();
|
||||||
|
|
||||||
|
_thumbnail_file = thumbnailer.createThumbnail(_file_name);
|
||||||
|
} else {
|
||||||
|
_thumbnail_file = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
if (_ul_url == null) {
|
if (_ul_url == null) {
|
||||||
|
|
||||||
int conta_error = 0;
|
int conta_error = 0;
|
||||||
@ -955,39 +954,25 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
|||||||
|
|
||||||
_fid = (String) ((Map<String, Object>) files.get(0)).get("h");
|
_fid = (String) ((Map<String, Object>) files.get(0)).get("h");
|
||||||
|
|
||||||
if (MiscTools.isVideoFile(Paths.get(_file_name))) {
|
while ("".equals(_thumbnail_file)) {
|
||||||
|
MiscTools.pausar(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_thumbnail_file != null) {
|
||||||
|
|
||||||
getView().printStatusNormal("Creating thumbnail ... ***DO NOT EXIT MEGABASTERD NOW***");
|
getView().printStatusNormal("Creating thumbnail ... ***DO NOT EXIT MEGABASTERD NOW***");
|
||||||
|
|
||||||
if (_thumbnail_file != null) {
|
if (!Files.isReadable(Paths.get(_thumbnail_file))) {
|
||||||
|
Thumbnailer thumbnailer = new Thumbnailer();
|
||||||
|
|
||||||
while ("".equals(_thumbnail_file)) {
|
_thumbnail_file = thumbnailer.createThumbnail(_file_name);
|
||||||
MiscTools.pausar(1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
getView().printStatusNormal("Uploading thumbnail ... ***DO NOT EXIT MEGABASTERD NOW***");
|
|
||||||
|
|
||||||
_ma.uploadThumbnails(this, _fid, _thumbnail_file, _thumbnail_file);
|
|
||||||
|
|
||||||
Files.deleteIfExists(Paths.get(_thumbnail_file));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (MiscTools.isImageFile(Paths.get(_file_name))) {
|
getView().printStatusNormal("Uploading thumbnail ... ***DO NOT EXIT MEGABASTERD NOW***");
|
||||||
|
|
||||||
getView().printStatusNormal("Creating thumbnail ... ***DO NOT EXIT MEGABASTERD NOW***");
|
_ma.uploadThumbnails(this, _fid, _thumbnail_file, _thumbnail_file);
|
||||||
|
|
||||||
if (_thumbnail_file != null) {
|
Files.deleteIfExists(Paths.get(_thumbnail_file));
|
||||||
|
|
||||||
while ("".equals(_thumbnail_file)) {
|
|
||||||
MiscTools.pausar(1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
getView().printStatusNormal("Uploading thumbnail ... ***DO NOT EXIT MEGABASTERD NOW***");
|
|
||||||
|
|
||||||
_ma.uploadThumbnails(this, _fid, _thumbnail_file, _thumbnail_file);
|
|
||||||
|
|
||||||
Files.deleteIfExists(Paths.get(_thumbnail_file));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 180 KiB |
Loading…
x
Reference in New Issue
Block a user