Cleanup
This commit is contained in:
@@ -137,10 +137,6 @@ public class GalleryCtl {
|
|||||||
// Set the image aspect ratio to be preserved
|
// Set the image aspect ratio to be preserved
|
||||||
imageView.setPreserveRatio(true);
|
imageView.setPreserveRatio(true);
|
||||||
|
|
||||||
// Set the image to the image View
|
|
||||||
// TODO ist this ever used?
|
|
||||||
imageView.setImage(SOMLayout.LOGO_IMAGE);
|
|
||||||
|
|
||||||
// make it fit the height of the Screen
|
// make it fit the height of the Screen
|
||||||
imageView.setFitHeight(SOMLayout.screenHeight / 3);
|
imageView.setFitHeight(SOMLayout.screenHeight / 3);
|
||||||
imageView.setFitWidth(SOMLayout.screenWidth / 4);
|
imageView.setFitWidth(SOMLayout.screenWidth / 4);
|
||||||
|
|||||||
@@ -275,8 +275,8 @@ public class PictureCtl {
|
|||||||
SOMImage somImage = somImageList.get(numberOfImages - 1);
|
SOMImage somImage = somImageList.get(numberOfImages - 1);
|
||||||
|
|
||||||
// update the Image State
|
// update the Image State
|
||||||
// TODO Probably not necessary
|
// TODO Probably not necessary -- commented out to test it
|
||||||
somImage.updateImageState();
|
// somImage.updateImageState();
|
||||||
|
|
||||||
// Scale the Image if needed
|
// Scale the Image if needed
|
||||||
ScaleWorker.scale(somImage, ScaleWorker.PREVIEW);
|
ScaleWorker.scale(somImage, ScaleWorker.PREVIEW);
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ public class SOMConfig {
|
|||||||
@XmlElement(name = "UPLOAD_PATH")
|
@XmlElement(name = "UPLOAD_PATH")
|
||||||
public static final String UPLOAD_PATH = getEventPicDir();
|
public static final String UPLOAD_PATH = getEventPicDir();
|
||||||
// The Box's ID
|
// The Box's ID
|
||||||
// Todo Throw out!! or by MAC Adress
|
|
||||||
@XmlElement(name = "BOX_ID")
|
@XmlElement(name = "BOX_ID")
|
||||||
public static final String BOX_ID = MachineWorker.getHostName();
|
public static final String BOX_ID = MachineWorker.getHostName();
|
||||||
// Number of pictures in series mode
|
// Number of pictures in series mode
|
||||||
@@ -41,12 +40,12 @@ public class SOMConfig {
|
|||||||
public static final String CLOUD_CREDENTIALS = "upload:geheim";
|
public static final String CLOUD_CREDENTIALS = "upload:geheim";
|
||||||
// Make the Scaling Algorithm switchable
|
// Make the Scaling Algorithm switchable
|
||||||
public static final int SCALING_GRAPHICS_2D = 0;
|
public static final int SCALING_GRAPHICS_2D = 0;
|
||||||
public static final int SCALING_IMAGE_ICON = 1;
|
public static final int SCALING_JAVAFX = 1;
|
||||||
public static final int SCALING_JAVAFX = 2;
|
|
||||||
public static final int SCALING_ALGORITHM = SCALING_GRAPHICS_2D;
|
public static final int SCALING_ALGORITHM = SCALING_GRAPHICS_2D;
|
||||||
|
public static final String CLOUD_ADDRESS = "https://cloud.selfomat.de/remote.php/webdav/";
|
||||||
// Path to configfile
|
// Path to configfile
|
||||||
//TODO Resource??
|
private static final File configfile = new File(("config/config.xml"));
|
||||||
private static final File configfile = new File(SOMLayout.class.getResource("/config/config.xml").getFile());
|
|
||||||
// Instance
|
// Instance
|
||||||
private static SOMConfig config = null;
|
private static SOMConfig config = null;
|
||||||
|
|
||||||
@@ -82,11 +81,6 @@ public class SOMConfig {
|
|||||||
|
|
||||||
File picturesPath = SOMConfig.PICTURES_PATH;
|
File picturesPath = SOMConfig.PICTURES_PATH;
|
||||||
|
|
||||||
// File eventPicDir = new File(picturesPath.toString() + "/" + timeString
|
|
||||||
// + "/" + MachineWorker.getHostName());
|
|
||||||
// TODO catch possible fail
|
|
||||||
// eventPicDir.mkdirs();
|
|
||||||
|
|
||||||
String eventPicDir = picturesPath.toString() + "/" + timeString
|
String eventPicDir = picturesPath.toString() + "/" + timeString
|
||||||
+ "/" + MachineWorker.getHostName();
|
+ "/" + MachineWorker.getHostName();
|
||||||
|
|
||||||
@@ -96,8 +90,6 @@ public class SOMConfig {
|
|||||||
// Write Config
|
// Write Config
|
||||||
private void writeConfig() {
|
private void writeConfig() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// TODO catch possible fail
|
|
||||||
configfile.getParentFile().mkdirs();
|
configfile.getParentFile().mkdirs();
|
||||||
|
|
||||||
JAXBContext jaxbContext = JAXBContext.newInstance(SOMConfig.class);
|
JAXBContext jaxbContext = JAXBContext.newInstance(SOMConfig.class);
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ public class SOMLayout {
|
|||||||
public static final javafx.scene.image.Image SERIES_PHOTO_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_CaptureSeries.png").toString());
|
public static final javafx.scene.image.Image SERIES_PHOTO_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_CaptureSeries.png").toString());
|
||||||
public static final javafx.scene.image.Image PRINT_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Print.png").toString());
|
public static final javafx.scene.image.Image PRINT_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Print.png").toString());
|
||||||
public static final javafx.scene.image.Image PICTURE_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Picture.png").toString());
|
public static final javafx.scene.image.Image PICTURE_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Picture.png").toString());
|
||||||
public static final javafx.scene.image.Image SMILE_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Smiley.png").toString()); //TODO LINK right image
|
public static final javafx.scene.image.Image SMILE_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Smiley.png").toString());
|
||||||
public static final javafx.scene.image.Image BACK_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Back.png").toString()); //TODO LINK right image
|
public static final javafx.scene.image.Image BACK_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Back.png").toString());
|
||||||
public static final javafx.scene.image.Image FORTH_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Forth.png").toString()); //TODO LINK right image
|
public static final javafx.scene.image.Image FORTH_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMIcons_Forth.png").toString());
|
||||||
//CI
|
//CI
|
||||||
public static final javafx.scene.image.Image LOGO_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMLogo.png").toString());
|
public static final javafx.scene.image.Image LOGO_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMLogo.png").toString());
|
||||||
// public static final javafx.scene.image.Image SPLASH_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMSplash.jpg").toString());
|
// public static final javafx.scene.image.Image SPLASH_IMAGE = new javafx.scene.image.Image(ClassLoader.class.getResource("/img/SOMSplash.jpg").toString());
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ public class FilesWorker {
|
|||||||
public static File getSourcePath() {
|
public static File getSourcePath() {
|
||||||
File src = new File(SOMConfig.PICTURES_PATH.toString() + "/src");
|
File src = new File(SOMConfig.PICTURES_PATH.toString() + "/src");
|
||||||
|
|
||||||
// TODO catch possible fail
|
|
||||||
src.mkdirs();
|
src.mkdirs();
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
@@ -65,7 +64,6 @@ public class FilesWorker {
|
|||||||
public static File getPreviewPath() {
|
public static File getPreviewPath() {
|
||||||
File prv = new File(SOMConfig.PICTURES_PATH.toString() + "/prv");
|
File prv = new File(SOMConfig.PICTURES_PATH.toString() + "/prv");
|
||||||
|
|
||||||
// TODO catch possible fail
|
|
||||||
prv.mkdirs();
|
prv.mkdirs();
|
||||||
return prv;
|
return prv;
|
||||||
}
|
}
|
||||||
@@ -79,7 +77,6 @@ public class FilesWorker {
|
|||||||
public static File getThumbPath() {
|
public static File getThumbPath() {
|
||||||
File tmb = new File(SOMConfig.PICTURES_PATH.toString() + "/tmb");
|
File tmb = new File(SOMConfig.PICTURES_PATH.toString() + "/tmb");
|
||||||
|
|
||||||
// TODO catch possible fail
|
|
||||||
tmb.mkdirs();
|
tmb.mkdirs();
|
||||||
return tmb;
|
return tmb;
|
||||||
}
|
}
|
||||||
@@ -93,7 +90,6 @@ public class FilesWorker {
|
|||||||
public static File getFinalPath() {
|
public static File getFinalPath() {
|
||||||
File fnl = new File(SOMConfig.PICTURES_PATH.toString() + "/fnl");
|
File fnl = new File(SOMConfig.PICTURES_PATH.toString() + "/fnl");
|
||||||
|
|
||||||
// TODO catch possible fail
|
|
||||||
fnl.mkdirs();
|
fnl.mkdirs();
|
||||||
return fnl;
|
return fnl;
|
||||||
}
|
}
|
||||||
@@ -107,7 +103,6 @@ public class FilesWorker {
|
|||||||
public static File getTempPath() {
|
public static File getTempPath() {
|
||||||
File tmp = new File(SOMConfig.PICTURES_PATH.toString() + "/tmp");
|
File tmp = new File(SOMConfig.PICTURES_PATH.toString() + "/tmp");
|
||||||
|
|
||||||
// TODO catch possible fail
|
|
||||||
tmp.mkdirs();
|
tmp.mkdirs();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
@@ -136,6 +131,9 @@ public class FilesWorker {
|
|||||||
public static void upload() {
|
public static void upload() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
// Backup the Backup
|
||||||
|
|
||||||
|
|
||||||
// Get all Files in the image Folder
|
// Get all Files in the image Folder
|
||||||
List<File> images = allFilesForUpload();
|
List<File> images = allFilesForUpload();
|
||||||
// Lists for either dirs or pictures
|
// Lists for either dirs or pictures
|
||||||
@@ -231,7 +229,6 @@ public class FilesWorker {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -246,12 +243,10 @@ public class FilesWorker {
|
|||||||
System.out.println("LAUNCH Upload Process: " + i);
|
System.out.println("LAUNCH Upload Process: " + i);
|
||||||
|
|
||||||
final File file = files.get(i);
|
final File file = files.get(i);
|
||||||
final String target = "https://cloud.selfomat.de/remote.php/webdav/" + SOMConfig.getEventPicDir() + "/" + file.getName();
|
final String target = SOMConfig.CLOUD_ADDRESS + SOMConfig.getEventPicDir() + "/" + file.getName();
|
||||||
|
|
||||||
System.out.println(file.toString());
|
|
||||||
System.out.println("----------->");
|
|
||||||
System.out.println(target);
|
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
|
System.out.println(file.toString() + "----------->" + target);
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
|
|
||||||
final int pictureCounter = i + 1;
|
final int pictureCounter = i + 1;
|
||||||
@@ -261,6 +256,7 @@ public class FilesWorker {
|
|||||||
protected Boolean call() throws Exception {
|
protected Boolean call() throws Exception {
|
||||||
// build the upload process
|
// build the upload process
|
||||||
// TODO remove -k option (this option skips certificate verification)
|
// TODO remove -k option (this option skips certificate verification)
|
||||||
|
// TODO Make Software run in SELFOMAT Directory
|
||||||
ProcessBuilder builder = new ProcessBuilder(
|
ProcessBuilder builder = new ProcessBuilder(
|
||||||
"bash",
|
"bash",
|
||||||
"SELFOMAT/sh/upload.sh",
|
"SELFOMAT/sh/upload.sh",
|
||||||
@@ -288,6 +284,7 @@ public class FilesWorker {
|
|||||||
} else {
|
} else {
|
||||||
// process ended failing
|
// process ended failing
|
||||||
// TODO Catch failed uploads
|
// TODO Catch failed uploads
|
||||||
|
|
||||||
System.out.println("process ended failing " + file);
|
System.out.println("process ended failing " + file);
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
return false;
|
return false;
|
||||||
@@ -306,7 +303,6 @@ public class FilesWorker {
|
|||||||
threads[i].join();
|
threads[i].join();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
//TODO Catch fails
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void uploadDir(final List<File> dirs) throws Exception {
|
private static void uploadDir(final List<File> dirs) throws Exception {
|
||||||
@@ -326,10 +322,10 @@ public class FilesWorker {
|
|||||||
// TODO remove -k option (this option skips certificate verification)
|
// TODO remove -k option (this option skips certificate verification)
|
||||||
ProcessBuilder builder = new ProcessBuilder("curl",
|
ProcessBuilder builder = new ProcessBuilder("curl",
|
||||||
"-u",
|
"-u",
|
||||||
"upload:geheim",
|
SOMConfig.CLOUD_CREDENTIALS,
|
||||||
"-X",
|
"-X",
|
||||||
"MKCOL",
|
"MKCOL",
|
||||||
"https://cloud.selfom.at/remote.php/webdav/" + SOMConfig.getEventPicDir(),
|
SOMConfig.CLOUD_ADDRESS + SOMConfig.getEventPicDir(),
|
||||||
// dir.toString().replace("/src", ""),
|
// dir.toString().replace("/src", ""),
|
||||||
"-k");
|
"-k");
|
||||||
|
|
||||||
@@ -385,7 +381,6 @@ public class FilesWorker {
|
|||||||
return new ArrayList<File>(filesAndDirs);
|
return new ArrayList<File>(filesAndDirs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO static??
|
|
||||||
public static SOMImage waitForImageAndCapture() {
|
public static SOMImage waitForImageAndCapture() {
|
||||||
//Behandelt
|
//Behandelt
|
||||||
try {
|
try {
|
||||||
@@ -456,7 +451,7 @@ public class FilesWorker {
|
|||||||
// Check that filename is the same as expected image
|
// Check that filename is the same as expected image
|
||||||
&& !fileName.toString().equals(
|
&& !fileName.toString().equals(
|
||||||
newImage.getSrc().getName())) {
|
newImage.getSrc().getName())) {
|
||||||
// TODO Catch wrong pictures, only for testing
|
// TODO Catch wrong pictures, only for testing, make only available for Developer (Hostname??)
|
||||||
// Hide the Progress Indicator
|
// Hide the Progress Indicator
|
||||||
SOMGUI.captureCtl.pictureLoadIndicator.setVisible(false);
|
SOMGUI.captureCtl.pictureLoadIndicator.setVisible(false);
|
||||||
// Set back the Progress Indicator
|
// Set back the Progress Indicator
|
||||||
|
|||||||
@@ -209,18 +209,12 @@ public class ScaleWorker extends Thread {
|
|||||||
// Print the File Path
|
// Print the File Path
|
||||||
System.out.println(sourceFile.toString());
|
System.out.println(sourceFile.toString());
|
||||||
|
|
||||||
// Print the Sizes
|
|
||||||
System.out.println("Size now: " + sourceWidth + "px X " + sourceHeight + "px");
|
|
||||||
System.out.println("Size between: " + scaledSourceWidth + "px X " + scaledSourceHeight + "px");
|
|
||||||
System.out.println("Size after: " + targetWidth + "px X " + targetHeight + "px");
|
|
||||||
|
|
||||||
// SCALE -----------------------------------------------------------
|
// SCALE -----------------------------------------------------------
|
||||||
// THE -------------------------------------------------------------
|
// THE -------------------------------------------------------------
|
||||||
// SOURCE ----------------------------------------------------------
|
// SOURCE ----------------------------------------------------------
|
||||||
|
|
||||||
// Get the ImageIcon
|
// Get the ImageIcon
|
||||||
Image sourceImageIconImage = sourceImageIcon.getImage();
|
Image sourceImageIconImage = sourceImageIcon.getImage();
|
||||||
System.out.println("Got the ImageIcon");
|
|
||||||
|
|
||||||
// Open a buffered Image in the specified size
|
// Open a buffered Image in the specified size
|
||||||
// (with no data at this point --> black image)
|
// (with no data at this point --> black image)
|
||||||
@@ -229,29 +223,21 @@ public class ScaleWorker extends Thread {
|
|||||||
scaledSourceHeight,
|
scaledSourceHeight,
|
||||||
BufferedImage.TYPE_INT_RGB
|
BufferedImage.TYPE_INT_RGB
|
||||||
);
|
);
|
||||||
System.out.println("Got the BufferedImage");
|
|
||||||
|
|
||||||
// Get the Graphics2D
|
// Get the Graphics2D
|
||||||
scaledSourceGraphics = scaledSourceBufferedImage.createGraphics();
|
scaledSourceGraphics = scaledSourceBufferedImage.createGraphics();
|
||||||
System.out.println("Got the Graphics2D");
|
|
||||||
|
|
||||||
// Set the Rendering hints
|
// Set the Rendering hints
|
||||||
scaledSourceGraphics.setRenderingHint(
|
scaledSourceGraphics.setRenderingHint(
|
||||||
RenderingHints.KEY_INTERPOLATION,
|
RenderingHints.KEY_INTERPOLATION,
|
||||||
RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR
|
RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR
|
||||||
);
|
);
|
||||||
System.out.println("Rendering Hints Set");
|
|
||||||
|
|
||||||
// Actually Scale the Image
|
// Actually Scale the Image
|
||||||
scaledSourceGraphics.drawImage(sourceImageIconImage, 0, 0, scaledSourceWidth, scaledSourceHeight, null);
|
scaledSourceGraphics.drawImage(sourceImageIconImage, 0, 0, scaledSourceWidth, scaledSourceHeight, null);
|
||||||
System.out.println("IMAGE SCALED");
|
|
||||||
|
|
||||||
scaledSourceGraphics.dispose();
|
scaledSourceGraphics.dispose();
|
||||||
// System Resources Released
|
// System Resources Released
|
||||||
// TODO Can we use this for perormance??
|
|
||||||
|
|
||||||
System.out.println("Got the target Image Icon");
|
|
||||||
|
|
||||||
|
|
||||||
// Calculate the Offsets
|
// Calculate the Offsets
|
||||||
int wOffset;
|
int wOffset;
|
||||||
@@ -269,10 +255,6 @@ public class ScaleWorker extends Thread {
|
|||||||
wOffset = 0;
|
wOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Got the Offset for cropping");
|
|
||||||
|
|
||||||
System.out.println("Get the Crop Image Filter");
|
|
||||||
|
|
||||||
CropImageFilter cropimgf = new CropImageFilter(
|
CropImageFilter cropimgf = new CropImageFilter(
|
||||||
// Crop by moving the image half the way
|
// Crop by moving the image half the way
|
||||||
// it is wider to the left
|
// it is wider to the left
|
||||||
@@ -285,30 +267,18 @@ public class ScaleWorker extends Thread {
|
|||||||
targetHeight
|
targetHeight
|
||||||
);
|
);
|
||||||
|
|
||||||
System.out.println("Ready");
|
|
||||||
|
|
||||||
System.out.println("Get the Filtered image Source");
|
|
||||||
|
|
||||||
FilteredImageSource producer = new FilteredImageSource(
|
FilteredImageSource producer = new FilteredImageSource(
|
||||||
scaledSourceBufferedImage.getSource(),
|
scaledSourceBufferedImage.getSource(),
|
||||||
cropimgf
|
cropimgf
|
||||||
);
|
);
|
||||||
|
|
||||||
System.out.println("Ready");
|
|
||||||
|
|
||||||
System.out.println("Get the target Image");
|
|
||||||
Image image = Toolkit.getDefaultToolkit().createImage(
|
Image image = Toolkit.getDefaultToolkit().createImage(
|
||||||
producer
|
producer
|
||||||
);
|
);
|
||||||
System.out.println("Ready");
|
|
||||||
|
|
||||||
System.out.println("Get the target image Icon");
|
targetImageIcon = new ImageIcon(
|
||||||
targetImageIcon = new ImageIcon( // TODO Veeeery slow on raspberry
|
|
||||||
image
|
image
|
||||||
);
|
);
|
||||||
System.out.println("Ready");
|
|
||||||
// TODO Check if there is something in the Image Icon on RPi
|
|
||||||
System.out.println("IMAGE CROPPED");
|
|
||||||
|
|
||||||
// save the smaller image
|
// save the smaller image
|
||||||
croppedBufferedImage = new BufferedImage(
|
croppedBufferedImage = new BufferedImage(
|
||||||
@@ -317,38 +287,23 @@ public class ScaleWorker extends Thread {
|
|||||||
BufferedImage.TYPE_INT_RGB
|
BufferedImage.TYPE_INT_RGB
|
||||||
);
|
);
|
||||||
|
|
||||||
System.out.println("Got the BufferedImage after CROPPING");
|
|
||||||
croppedGraphics = croppedBufferedImage.getGraphics();
|
croppedGraphics = croppedBufferedImage.getGraphics();
|
||||||
System.out.println("Got the Graphics");
|
|
||||||
|
|
||||||
croppedGraphics.drawImage(targetImageIcon.getImage(), 0, 0, null);
|
croppedGraphics.drawImage(targetImageIcon.getImage(), 0, 0, null);
|
||||||
|
|
||||||
System.out.println("Graphics drawn");
|
|
||||||
|
|
||||||
// WRITE ---------------------------------------------------------------
|
// WRITE ---------------------------------------------------------------
|
||||||
// THE -----------------------------------------------------------------
|
// THE -----------------------------------------------------------------
|
||||||
// IMAGE ---------------------------------------------------------------
|
// IMAGE ---------------------------------------------------------------
|
||||||
|
|
||||||
System.out.println("Writing Thumb");
|
|
||||||
|
|
||||||
System.out.println("Trying to write image to " + targetFile.toString());
|
|
||||||
System.out.println(croppedBufferedImage.toString());
|
|
||||||
// TODO Breaking up at this point on the RPi --> Look at older ScaleWorker
|
|
||||||
|
|
||||||
writeJPEG(targetFile, croppedBufferedImage);
|
writeJPEG(targetFile, croppedBufferedImage);
|
||||||
|
|
||||||
System.out.println("Image Writer returned: "
|
|
||||||
// + iw
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// UPDATE ---------------------------------------------------------------
|
// UPDATE ---------------------------------------------------------------
|
||||||
// IMAGE ----------------------------------------------------------------
|
// IMAGE ----------------------------------------------------------------
|
||||||
// STATE ----------------------------------------------------------------
|
// STATE ----------------------------------------------------------------
|
||||||
|
|
||||||
somImage.updateImageState();
|
somImage.updateImageState();
|
||||||
|
|
||||||
System.out.println("Image State Updated");
|
System.out.println("Image State Updated: Scaled");
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
croppedGraphics.dispose();
|
croppedGraphics.dispose();
|
||||||
@@ -361,127 +316,6 @@ public class ScaleWorker extends Thread {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SOMConfig.SCALING_IMAGE_ICON: {
|
|
||||||
// // IMAGE ICON ----------------------------------------------------------
|
|
||||||
// // Generate an ImageIcon from the Source File
|
|
||||||
// sourceImage = new javafx.scene.image.Image(sourceFile.toString());
|
|
||||||
// // the sources original width and height
|
|
||||||
// sourceWidth = sourceImage.getWidth();
|
|
||||||
// sourceHeight = sourceImage.getHeight();
|
|
||||||
//
|
|
||||||
// // Calculate the aspect ratio before cropping
|
|
||||||
// sourceAspect = (sourceWidth) / (sourceHeight);
|
|
||||||
// // Calculate the ImageViews' cropped aspect ratio
|
|
||||||
// targetAspect = ((double) targetWidth) / ((double) targetHeight);
|
|
||||||
//
|
|
||||||
// // if picture is higher than frame
|
|
||||||
// if (sourceAspect < targetAspect) {
|
|
||||||
// scaledSourceHeight = (int) Math.ceil(targetWidth / sourceAspect);
|
|
||||||
// scaledSourceWidth = targetWidth;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // if Picture is narrower (or equal)
|
|
||||||
// else {
|
|
||||||
// scaledSourceWidth = (int) Math.ceil(targetHeight * sourceAspect);
|
|
||||||
// scaledSourceHeight = targetHeight;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //Way too slow for the RPi
|
|
||||||
// System.out.println("Scale with ImageIcon");
|
|
||||||
//
|
|
||||||
// // Scale to right size,
|
|
||||||
// // no cropping
|
|
||||||
// targetImageIcon = new ImageIcon(
|
|
||||||
// sourceImageIcon.getImage().getScaledInstance(
|
|
||||||
// scaledSourceWidth, scaledSourceHeight,
|
|
||||||
// Image.SCALE_FAST
|
|
||||||
// ));
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// // Calculate the Offsets
|
|
||||||
// int wOffset;
|
|
||||||
// int hOffset;
|
|
||||||
//
|
|
||||||
// // ----------
|
|
||||||
// // Crop Image
|
|
||||||
// if (sourceAspect > targetAspect) {
|
|
||||||
// hOffset = 0;
|
|
||||||
// wOffset = (scaledSourceWidth - targetWidth) / 2;
|
|
||||||
// } else {
|
|
||||||
// hOffset = (scaledSourceHeight - targetHeight) / 2;
|
|
||||||
// wOffset = 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// System.out.println("Got the Offset for cropping");
|
|
||||||
//
|
|
||||||
// System.out.println("Get the Crop Image Filter");
|
|
||||||
// CropImageFilter cropimgf = new CropImageFilter(
|
|
||||||
// // Crop by moving the image half the way
|
|
||||||
// // it is wider to the left
|
|
||||||
// wOffset,
|
|
||||||
// // Crop by moving the image half the way
|
|
||||||
// // it is higher to the top
|
|
||||||
// hOffset,
|
|
||||||
//
|
|
||||||
// targetWidth,
|
|
||||||
// targetHeight
|
|
||||||
// );
|
|
||||||
// System.out.println("Ready");
|
|
||||||
//
|
|
||||||
// System.out.println("Get the Filtered image Source");
|
|
||||||
// FilteredImageSource producer = new FilteredImageSource(
|
|
||||||
// sourceImageIcon.getImage().getSource(),
|
|
||||||
// cropimgf
|
|
||||||
// );
|
|
||||||
// System.out.println("Ready");
|
|
||||||
//
|
|
||||||
// System.out.println("Get the target Image");
|
|
||||||
// Image image = Toolkit.getDefaultToolkit().createImage(
|
|
||||||
// producer
|
|
||||||
// );
|
|
||||||
// System.out.println("Ready");
|
|
||||||
//
|
|
||||||
// System.out.println("Get the target image Icon");
|
|
||||||
// targetImageIcon = new ImageIcon( // TODO Veeeery slow on raspberry
|
|
||||||
// image
|
|
||||||
// );
|
|
||||||
// System.out.println("Ready");
|
|
||||||
// // TODO Check if there is something in the Image Icon on RPi
|
|
||||||
// System.out.println("IMAGE CROPPED");
|
|
||||||
//
|
|
||||||
// // save the smaller image
|
|
||||||
// BufferedImage bufferedImage = new BufferedImage(
|
|
||||||
// targetWidth,
|
|
||||||
// targetHeight,
|
|
||||||
// BufferedImage.TYPE_INT_RGB
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// System.out.println("Got the BufferedImage after CROPPING");
|
|
||||||
// croppedGraphics = bufferedImage.getGraphics();
|
|
||||||
// System.out.println("Got the Graphics");
|
|
||||||
//
|
|
||||||
// croppedGraphics.drawImage(targetImageIcon.getImage(), 0, 0, null);
|
|
||||||
//
|
|
||||||
// System.out.println("Graphics drawn");
|
|
||||||
//
|
|
||||||
// System.out.println("Writing Thumb");
|
|
||||||
//
|
|
||||||
// System.out.println("Trying to write image to " + targetFile.toString());
|
|
||||||
// System.out.println(bufferedImage.toString());
|
|
||||||
// // TODO Breaking up at this point on the RPi --> Look at older ScaleWorker
|
|
||||||
//
|
|
||||||
// writeJPEG(targetFile, bufferedImage);
|
|
||||||
//
|
|
||||||
// System.out.println("Image Writer returned: "
|
|
||||||
//// + iw
|
|
||||||
// );
|
|
||||||
// somImage.updateImageState();
|
|
||||||
//
|
|
||||||
// System.out.println("Image State Updated");
|
|
||||||
//
|
|
||||||
// somImage.updateImageState();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// JAVAFX ----------------------------------------------------------
|
// JAVAFX ----------------------------------------------------------
|
||||||
case SOMConfig.SCALING_JAVAFX: {
|
case SOMConfig.SCALING_JAVAFX: {
|
||||||
// Scale with javafx
|
// Scale with javafx
|
||||||
@@ -493,7 +327,7 @@ public class ScaleWorker extends Thread {
|
|||||||
|
|
||||||
somImage.updateImageState();
|
somImage.updateImageState();
|
||||||
|
|
||||||
System.out.println("Image State Updated");
|
System.out.println("Image State Updated: Scaled");
|
||||||
|
|
||||||
somImage.updateImageState();
|
somImage.updateImageState();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -0,0 +1,271 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Gphoto2 compiler and installer script
|
||||||
|
#
|
||||||
|
# This script is specifically created for Raspbian http://www.raspbian.org
|
||||||
|
# and Raspberry Pi http://www.raspberrypi.org but should work over any
|
||||||
|
# Debian-based distribution
|
||||||
|
|
||||||
|
# Created and mantained by Gonzalo Cao Cabeza de Vaca
|
||||||
|
# Please send any feedback or comments to gonzalo.cao(at)gmail.com
|
||||||
|
# Updated for gPhoto2 2.5.1.1 by Peter Hinson
|
||||||
|
# Updated for gPhoto2 2.5.2 by Dmitri Popov
|
||||||
|
# Updated for gphoto2 2.5.5 by Mihai Doarna
|
||||||
|
# Updated for gphoto2 2.5.6 by Mathias Peter
|
||||||
|
# Updated for gphoto2 2.5.7 by Sijawusz Pur Rahnama
|
||||||
|
# Updated for gphoto2 2.5.8 by scribblemaniac
|
||||||
|
# Updated for gphoto2 2.5.9 at GitHub by Gonzalo Cao
|
||||||
|
# Updated for last development release at GitHub by Gonzalo Cao
|
||||||
|
# Updated for gphoto2 2.5.10 by Gonzalo Cao
|
||||||
|
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
latest_stable_version=2_5_10
|
||||||
|
display_version=$(echo ${latest_stable_version} | tr '_' '.')
|
||||||
|
branch_libgphoto=''
|
||||||
|
branch_gphoto=''
|
||||||
|
|
||||||
|
if [ "$(whoami)" != "root" ]; then
|
||||||
|
echo "Sorry, this script must be executed with sudo or as root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
cat << EOF
|
||||||
|
usage: sudo $0 [-h|--help|-s|--stable|-d|--development]
|
||||||
|
|
||||||
|
-h|--help: this help message
|
||||||
|
-s|--stable: select the stable version: ${display_version}
|
||||||
|
-d|--development: select the latest develoment version
|
||||||
|
|
||||||
|
Note: An interactive menu is displayed if no parameter is given.
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_options()
|
||||||
|
{
|
||||||
|
if ! all_options=$(getopt -o hds -l help,development,stable -- "$@")
|
||||||
|
then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
eval set -- "$all_options"
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help) usage;;
|
||||||
|
-d|--development) shift 1;;
|
||||||
|
-s|--stable) branch_libgphoto="--branch libgphoto2-${latest_stable_version}-release"
|
||||||
|
branch_gphoto="--branch gphoto2-${latest_stable_version}-release"
|
||||||
|
shift 1;;
|
||||||
|
--) break ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
menu()
|
||||||
|
{
|
||||||
|
PS3='Please enter your choice: '
|
||||||
|
options=("Install last development version"
|
||||||
|
"Install last stable release (${display_version})"
|
||||||
|
"Quit")
|
||||||
|
|
||||||
|
select opt in "${options[@]}"
|
||||||
|
do
|
||||||
|
case $opt in
|
||||||
|
"Install last development version")
|
||||||
|
echo
|
||||||
|
echo "\"Install last development version\" selected"
|
||||||
|
echo
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"Install last stable release (${display_version})")
|
||||||
|
echo
|
||||||
|
echo "\"Install last stable release (${display_version})\" selected"
|
||||||
|
echo
|
||||||
|
branch_libgphoto="--branch libgphoto2-${latest_stable_version}-release"
|
||||||
|
branch_gphoto="--branch gphoto2-${latest_stable_version}-release"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"Quit")
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*) echo invalid option;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Display the menu if the script was called without any parameters
|
||||||
|
# else try to parse the options
|
||||||
|
if [ $# -eq 0 ]
|
||||||
|
then
|
||||||
|
menu
|
||||||
|
else
|
||||||
|
parse_options "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "----------------"
|
||||||
|
echo "Updating sources"
|
||||||
|
echo "----------------"
|
||||||
|
echo
|
||||||
|
|
||||||
|
apt-get update -qq
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "-----------------------------------------"
|
||||||
|
echo "Removing gphoto2 and libgphoto2 if exists"
|
||||||
|
echo "-----------------------------------------"
|
||||||
|
echo
|
||||||
|
|
||||||
|
apt-get remove -y gphoto2 libgphoto2-port10
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "-----------------------"
|
||||||
|
echo "Installing dependencies"
|
||||||
|
echo "-----------------------"
|
||||||
|
echo
|
||||||
|
|
||||||
|
apt-get install -y build-essential libltdl-dev libusb-dev libexif-dev libpopt-dev libudev-dev pkg-config git automake autoconf autopoint gettext libtool wget
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "-------------------------"
|
||||||
|
echo "Creating temporary folder"
|
||||||
|
echo "-------------------------"
|
||||||
|
echo
|
||||||
|
|
||||||
|
mkdir gphoto2-temp-folder
|
||||||
|
cd gphoto2-temp-folder
|
||||||
|
|
||||||
|
echo "gphoto2-temp-folder created"
|
||||||
|
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "----------------------"
|
||||||
|
echo "Downloading libgphoto2"
|
||||||
|
echo "----------------------"
|
||||||
|
echo
|
||||||
|
|
||||||
|
if (git clone $branch_libgphoto https://github.com/gphoto/libgphoto2.git)
|
||||||
|
then
|
||||||
|
cd libgphoto2/
|
||||||
|
else
|
||||||
|
echo "Unable to get libgphoto2"
|
||||||
|
echo "Exiting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "-----------------------------------"
|
||||||
|
echo "Compiling and installing libgphoto2"
|
||||||
|
echo "-----------------------------------"
|
||||||
|
echo
|
||||||
|
|
||||||
|
autoreconf --install --symlink
|
||||||
|
./configure
|
||||||
|
make -j "$cores"
|
||||||
|
make install
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "-------------------"
|
||||||
|
echo "Downloading gphoto2"
|
||||||
|
echo "-------------------"
|
||||||
|
echo
|
||||||
|
|
||||||
|
if (git clone $branch_gphoto https://github.com/gphoto/gphoto2.git)
|
||||||
|
then
|
||||||
|
cd gphoto2
|
||||||
|
else
|
||||||
|
echo "Unable to get gphoto2"
|
||||||
|
echo "Exiting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "--------------------------------"
|
||||||
|
echo "Compiling and installing gphoto2"
|
||||||
|
echo "--------------------------------"
|
||||||
|
echo
|
||||||
|
|
||||||
|
autoreconf --install --symlink
|
||||||
|
./configure
|
||||||
|
make -j "$cores"
|
||||||
|
make install
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "-----------------"
|
||||||
|
echo "Linking libraries"
|
||||||
|
echo "-----------------"
|
||||||
|
echo
|
||||||
|
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "---------------------------------------------------------------------------------"
|
||||||
|
echo "Generating udev rules, see http://www.gphoto.org/doc/manual/permissions-usb.html"
|
||||||
|
echo "---------------------------------------------------------------------------------"
|
||||||
|
echo
|
||||||
|
|
||||||
|
udev_version=$(udevd --version)
|
||||||
|
|
||||||
|
if [ "$udev_version" -ge "201" ]
|
||||||
|
then
|
||||||
|
udev_rules=201
|
||||||
|
elif [ "$udev_version" -ge "175" ]
|
||||||
|
then
|
||||||
|
udev_rules=175
|
||||||
|
elif [ "$udev_version" -ge "136" ]
|
||||||
|
then
|
||||||
|
udev_rules=136
|
||||||
|
else
|
||||||
|
udev_rules=0.98
|
||||||
|
fi
|
||||||
|
|
||||||
|
/usr/local/lib/libgphoto2/print-camera-list udev-rules version $udev_rules group plugdev mode 0660 > /etc/udev/rules.d/90-libgphoto2.rules
|
||||||
|
|
||||||
|
if [ "$udev_rules" = "201" ]
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "------------------------------------------------------------------------"
|
||||||
|
echo "Generating hwdb file in /etc/udev/hwdb.d/20-gphoto.hwdb. Ignore the NOTE"
|
||||||
|
echo "------------------------------------------------------------------------"
|
||||||
|
echo
|
||||||
|
/usr/local/lib/libgphoto2/print-camera-list hwdb > /etc/udev/hwdb.d/20-gphoto.hwdb
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "-------------------"
|
||||||
|
echo "Removing temp files"
|
||||||
|
echo "-------------------"
|
||||||
|
echo
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
rm -r gphoto2-temp-folder
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "--------------------"
|
||||||
|
echo "Finished!! Enjoy it!"
|
||||||
|
echo "--------------------"
|
||||||
|
echo
|
||||||
|
|
||||||
|
gphoto2 --version
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
lp -d Canon_CP910 $1
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
gvfs-mount -s gphoto2
|
||||||
|
|
||||||
|
cd ~/
|
||||||
|
#java -jar /home/pi/SELFOMAT/selfomat-single-user-0.3.0.7-SNAPSHOT-jar-with-dependencies.jar
|
||||||
|
#java -Dcom.sun.javafx.touch=true -Dcom.sun.javafx.isEmbedded=true -Dcom.sun.javafx.vk.adjustwindow=true -jar /home/pi/SELFOMAT/selfomat-single-user-0.3.0.11-SNAPSHOT-jar-with-dependencies.jar
|
||||||
|
#sudo java -jar /home/pi/SELFOMAT/selfomat-single-user-0.3.0.19-SNAPSHOT-jar-with-dependencies.jar
|
||||||
|
sudo java -Dmonocle.input.3/eef/1/100.flipXY=false -Dmonocle.inpu100.minX=89 -Dmonocle.input.3/eef/1/100.maxX=1945 -Dmonocle.input.3/eef/1/100.maxY=178 -Dmonocle.input.3/eef/1/100.minY=1816 -jar SELFOMAT/selfomat-single-user-0.4.0.11-SNAPSHOT-jar-with-dependencies.jar
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# Upload files to a webdav storage,
|
# Upload files to a webdav storage,
|
||||||
# check them by an MD5 Hash
|
# check them by an MD5 Hash
|
||||||
# and remove the local copy afterwards.
|
# and remove the local copy afterwards.
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" == "-h" ];
|
if [ "$1" == "-h" ];
|
||||||
then
|
then
|
||||||
echo "Syntax:"
|
echo "Syntax:"
|
||||||
@@ -14,11 +15,49 @@ then
|
|||||||
echo "Source and Target are the same"
|
echo "Source and Target are the same"
|
||||||
echo "No Arguments provided!"
|
echo "No Arguments provided!"
|
||||||
|
|
||||||
else
|
|
||||||
#upload the image
|
|
||||||
curl -T $1 -u $3 $2 -k
|
|
||||||
|
|
||||||
# get the online images' MD5up
|
|
||||||
|
else
|
||||||
|
|
||||||
|
STAMP=$(date "+%Y%m%d-%H%M%S")
|
||||||
|
|
||||||
|
echo $STAMP
|
||||||
|
|
||||||
|
# get the online images' MD5
|
||||||
|
pre_online_md5=$(curl $2 -k -u $3 | md5sum | awk '{print $1}')
|
||||||
|
|
||||||
|
# get the local images' MD5
|
||||||
|
pre_local_md5=$(md5sum "$1" | awk '{print $1}')
|
||||||
|
|
||||||
|
# compare both MD5s
|
||||||
|
echo "$pre_online_md5"
|
||||||
|
echo "$pre_local_md5"
|
||||||
|
|
||||||
|
#check if the file already exists
|
||||||
|
if curl --head -u $3 --fail $2 -k;
|
||||||
|
then
|
||||||
|
## it exists
|
||||||
|
|
||||||
|
echo "FILE ALREADY EXISTS"
|
||||||
|
|
||||||
|
# Check if it is the same already
|
||||||
|
if [ "$pre_online_md5" != "$pre_local_md5" ];
|
||||||
|
then
|
||||||
|
# FILES DIFFER FROM EACH OTHER
|
||||||
|
# if not move the online file
|
||||||
|
|
||||||
|
echo "RANAMING FILE TO $2.$STAMP"
|
||||||
|
|
||||||
|
curl -u $3 -k -X MOVE --header "Destination:$2.$STAMP" $2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# IF THERE WAS ANOTHER IMAGE, NOW IT SHOULD BE RENAMED
|
||||||
|
|
||||||
|
echo "UPLOAD FILE"
|
||||||
|
curl -u $3 -T $1 $2 -k
|
||||||
|
|
||||||
|
# get the online images' MD5
|
||||||
online_md5=$(curl $2 -k -u $3 | md5sum | awk '{print $1}')
|
online_md5=$(curl $2 -k -u $3 | md5sum | awk '{print $1}')
|
||||||
|
|
||||||
# get the local images' MD5
|
# get the local images' MD5
|
||||||
|
|||||||
Reference in New Issue
Block a user