refs #299,#36,#40,#37,#33 closed

This commit is contained in:
2017-01-16 18:44:02 +01:00
parent c3db9d0166
commit f5e50d1164
18 changed files with 174 additions and 88 deletions
+1
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="Encoding"> <component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/resources/sh/upload.sh" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" /> <file url="PROJECT" charset="UTF-8" />
</component> </component>
</project> </project>
+30
View File
@@ -0,0 +1,30 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Release" type="MavenRunConfiguration" factoryName="Maven" singleton="true">
<MavenSettings>
<option name="myGeneralSettings" />
<option name="myRunnerSettings" />
<option name="myRunnerParameters">
<MavenRunnerParameters>
<option name="profiles">
<set />
</option>
<option name="goals">
<list>
<option value="clean" />
<option value="assembly:assembly" />
<option value="release:prepare" />
<option value="release:perform" />
<option value="-B" />
</list>
</option>
<option name="profilesMap">
<map />
</option>
<option name="resolveToWorkspace" value="false" />
<option name="workingDirPath" value="$PROJECT_DIR$" />
</MavenRunnerParameters>
</option>
</MavenSettings>
<method />
</configuration>
</component>
+1 -1
View File
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.selfomat</groupId> <groupId>de.selfomat</groupId>
<artifactId>selfomat-single-user</artifactId> <artifactId>selfomat-single-user</artifactId>
<version>0.4.0.5-SNAPSHOT</version> <version>0.4.0.11-SNAPSHOT</version>
<scm> <scm>
<url>scm:svn:svn://simongehrig:L4ut5pr3ch3r!@svn.picture.tools/selfomat/trunk/selfomat-java-single-user</url> <url>scm:svn:svn://simongehrig:L4ut5pr3ch3r!@svn.picture.tools/selfomat/trunk/selfomat-java-single-user</url>
+1 -1
View File
@@ -85,7 +85,7 @@ public class CaptureCtl {
image.setImage(SOMLayout.LOGO_IMAGE); image.setImage(SOMLayout.LOGO_IMAGE);
// make it fit the height of the Screen // make it fit the height of the Screen
image.setFitWidth(SOMLayout.screenHeight / 2); // image.setFitWidth(SOMLayout.screenHeight / 2);
// Calculate the offset to center it horizontally if the image is wider than the screen (or narrower) // Calculate the offset to center it horizontally if the image is wider than the screen (or narrower)
double aspect = image.getImage().getWidth() / image.getImage().getHeight(); double aspect = image.getImage().getWidth() / image.getImage().getHeight();
+1 -1
View File
@@ -257,7 +257,7 @@ public class PictureCtl {
image.setImage(SOMLayout.LOGO_IMAGE); image.setImage(SOMLayout.LOGO_IMAGE);
// make it fit the height of the Screen // make it fit the height of the Screen
image.setFitWidth(SOMLayout.screenHeight / 2); // image.setFitWidth(SOMLayout.screenHeight);
// Calculate the offset to center it horizontally if the image is wider than the screen (or narrower) // Calculate the offset to center it horizontally if the image is wider than the screen (or narrower)
double aspect = image.getImage().getWidth() / image.getImage().getHeight(); double aspect = image.getImage().getWidth() / image.getImage().getHeight();
+5 -1
View File
@@ -35,6 +35,10 @@ public class SOMConfig {
public static final int COUNTDOWN_COUNTER = 3; public static final int COUNTDOWN_COUNTER = 3;
// Images per Page in the Gallery // Images per Page in the Gallery
public static final int IMAGES_PER_PAGE = 9; public static final int IMAGES_PER_PAGE = 9;
// Limot of Parallel Uploads
public static final int PARALLEL_UPLOADS = 10;
// Cloud Credentials
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_IMAGE_ICON = 1;
@@ -70,7 +74,7 @@ public class SOMConfig {
* *
* @return * @return
*/ */
private static String getEventPicDir() { public static String getEventPicDir() {
// get current Date in String for Upload-dir // get current Date in String for Upload-dir
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
DateFormat df = new SimpleDateFormat("yyyy/MM/dd"); DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
-16
View File
@@ -1,16 +0,0 @@
package model;
public class SOMLanguage {
// for Testing
public static final String pre = "";
// for Use
// public static String pre = "/resources";
/**
* Languagestring of the Button that switches back one Panel
*/
// public static final String UIBtnBack = "Zurück";
/**
* Tells People to SMILE!
*/
public static final String UIBtnSmile = "SMILE";
}
+57 -54
View File
@@ -2,7 +2,6 @@ package workers;
import GUI.SOMGUI; import GUI.SOMGUI;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import javafx.fxml.FXMLLoader;
import model.SOMConfig; import model.SOMConfig;
import model.SOMEvent; import model.SOMEvent;
import model.SOMImage; import model.SOMImage;
@@ -143,14 +142,23 @@ public class FilesWorker {
List<File> dirs = new ArrayList<File>(); List<File> dirs = new ArrayList<File>();
List<File> pics = new ArrayList<File>(); List<File> pics = new ArrayList<File>();
//relative ones
// int directoriesUploaded = 0;
// int picturesUploaded = 0;
// Check for internet connection // Check for internet connection
if (internet()) { if (internet()) {
// Count Files and Dirs // Count Files and Dirs
// DIRS
String[] splits = SOMConfig.getEventPicDir().split("/");
String currentdir = "";
for (String split : splits) {
currentdir = currentdir + "/" + split;
dirs.add(new File(currentdir));
System.out.println("DIR added:" + currentdir);
}
// FILES
for (int i = 0; i < images.size(); i++) { for (int i = 0; i < images.size(); i++) {
// get the current file // get the current file
@@ -158,18 +166,9 @@ public class FilesWorker {
System.out.println(file); System.out.println(file);
// get dirs
if (file.isDirectory()
&& !file.toString().contains("prv")
&& !file.toString().contains("tmb")
&& !file.toString().contains("tmp")
&& !file.toString().contains("fnl")) {
dirs.add(file);
}
// get pics // get pics
else if (file.isFile() if (file.isFile()
&& file.toPath().toString().contains("src")) { && file.toString().contains("src")) {
pics.add(file); pics.add(file);
} }
} }
@@ -177,31 +176,25 @@ public class FilesWorker {
// REPORT TO CONSOLE // REPORT TO CONSOLE
System.out.println(dirs.size() + " Directories"); System.out.println(dirs.size() + " Directories");
System.out.println(pics.size() + " Pics"); System.out.println(pics.size() + " Pics");
int uploadeddirs = 0;
int uploadedfiles = 0;
// GET THE UI // GET THE UI
SOMGUI.changetoupload();
// UPLOAD DIRECTORIES
FXMLLoader fxmlLoader = new FXMLLoader();
try {
fxmlLoader.setLocation(
FilesWorker.class.getClassLoader().getResource("fxml/upload.fxml")
);
fxmlLoader.load();
} catch (IOException e) {
e.printStackTrace();
}
int i = 0;
List<File> limitdirs = new ArrayList<File>(); List<File> limitdirs = new ArrayList<File>();
// TODO Limit Uploads
for (File dir : dirs
) {
i++; for (File dir : dirs) {
System.out.println("Queueing Dir " + dir.toString()); uploadeddirs++;
System.out.println("Queueing Directories " + dir.toString());
limitdirs.add(dir); limitdirs.add(dir);
if (limitdirs.size() >= 3 || limitdirs.size() == i) { if (limitdirs.size() >= SOMConfig.PARALLEL_UPLOADS
// Upload even if limit is not reached
|| (dirs.size() - uploadeddirs) < SOMConfig.PARALLEL_UPLOADS) {
System.out.println("Launch Dir upload"); System.out.println("Launch Dir upload");
uploadDir(limitdirs); uploadDir(limitdirs);
@@ -210,23 +203,28 @@ public class FilesWorker {
limitdirs.clear(); limitdirs.clear();
} }
} }
// uploadDir(dirs);
// UPLOAD FILES
List<File> limitpics = new ArrayList<File>(); List<File> limitpics = new ArrayList<File>();
for (File pic : pics for (File pic : pics
) { ) {
i++;
System.out.println("Queueing Dir " + pic.toString());
limitpics.add(pic);
if (limitpics.size() >= 3 || limitdirs.size() == i) {
System.out.println("Launch Pic upload"); uploadedfiles++;
System.out.println("Queueing File " + pic.toString());
limitpics.add(pic);
if (limitpics.size() >= SOMConfig.PARALLEL_UPLOADS
// Upload even if limit is not reached
|| (pics.size() - uploadedfiles) < SOMConfig.PARALLEL_UPLOADS) {
System.out.println("Launch File upload");
uploadFile(limitpics); uploadFile(limitpics);
System.out.println("Clear Queue"); System.out.println("Clear File Queue");
limitpics.clear(); limitpics.clear();
} }
} }
// uploadFile(pics);
SOMGUI.changetopicture(); SOMGUI.changetopicture();
} }
@@ -245,9 +243,16 @@ public class FilesWorker {
for (int i = 0; i < threads.length; i++) { for (int i = 0; i < threads.length; i++) {
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();
System.out.println(file.toString());
System.out.println("----------->");
System.out.println(target);
System.out.println("");
System.out.println("");
final int pictureCounter = i + 1; final int pictureCounter = i + 1;
Task<Boolean> task = new Task<Boolean>() { Task<Boolean> task = new Task<Boolean>() {
@@ -257,20 +262,17 @@ public class FilesWorker {
// 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)
ProcessBuilder builder = new ProcessBuilder( ProcessBuilder builder = new ProcessBuilder(
"curl", "bash",
"-T", "SELFOMAT/sh/upload.sh",
file.toString(), file.toString(),
"-u", target,
"upload:geheim", SOMConfig.CLOUD_CREDENTIALS
"https://cloud.selfom.at/remote.php/webdav/" + file.toString().replace("/src", ""), );
"-k");
// make the process traceable // make the process traceable
builder.redirectErrorStream(true); builder.redirectErrorStream(true);
Process process = builder.start();
// launch upload process // launch upload process
Process process = builder.start();
// wait for the process to end // wait for the process to end
if (process.waitFor() == 0) { if (process.waitFor() == 0) {
@@ -327,7 +329,8 @@ public class FilesWorker {
"upload:geheim", "upload:geheim",
"-X", "-X",
"MKCOL", "MKCOL",
"https://cloud.selfom.at/remote.php/webdav/" + dir.toString().replace("/src", ""), "https://cloud.selfom.at/remote.php/webdav/" + SOMConfig.getEventPicDir(),
// dir.toString().replace("/src", ""),
"-k"); "-k");
// make the process traceable // make the process traceable
+27 -17
View File
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.image.*?> <?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
@@ -20,63 +21,72 @@
<RowConstraints percentHeight="33.3"/> <RowConstraints percentHeight="33.3"/>
</rowConstraints> </rowConstraints>
<children> <children>
<!-- NAVIGATION -->
<Button fx:id="forthButton" mnemonicParsing="false" GridPane.columnIndex="3"/> <Button fx:id="forthButton" mnemonicParsing="false" GridPane.columnIndex="3"/>
<Button fx:id="pictureButton" mnemonicParsing="false" GridPane.columnIndex="3" GridPane.rowIndex="1"/> <Button fx:id="pictureButton" mnemonicParsing="false" GridPane.columnIndex="3" GridPane.rowIndex="1"/>
<Button fx:id="backButton" mnemonicParsing="false" GridPane.columnIndex="3" GridPane.rowIndex="2"/> <Button fx:id="backButton" mnemonicParsing="false" GridPane.columnIndex="3" GridPane.rowIndex="2"/>
<Button fx:id="galleryButton1" mnemonicParsing="false" text="1">
<graphic>
<!--ROW 1--> <!--ROW 1-->
<Button fx:id="galleryButton1" mnemonicParsing="false" text="1">
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
<graphic>
<ImageView fx:id="galleryImageView1" preserveRatio="true"/> <ImageView fx:id="galleryImageView1" preserveRatio="true"/>
</graphic> </graphic>
</Button> </Button>
<Button fx:id="galleryButton2" mnemonicParsing="false" text="2" GridPane.columnIndex="1"> <Button fx:id="galleryButton2" mnemonicParsing="false" text="2" GridPane.columnIndex="1">
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
<graphic> <graphic>
<ImageView fx:id="galleryImageView2" preserveRatio="true"/> <ImageView fx:id="galleryImageView2" preserveRatio="true"/>
</graphic> </graphic>
</Button> </Button>
<Button fx:id="galleryButton3" mnemonicParsing="false" text="3" GridPane.columnIndex="2"> <Button fx:id="galleryButton3" mnemonicParsing="false" text="3" GridPane.columnIndex="2">
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
<graphic> <graphic>
<ImageView fx:id="galleryImageView3" preserveRatio="true"/> <ImageView fx:id="galleryImageView3" preserveRatio="true"/>
</graphic> </graphic>
</Button> </Button>
<Button fx:id="galleryButton6" mnemonicParsing="false" text="6" GridPane.columnIndex="2"
GridPane.rowIndex="1">
<graphic>
<ImageView fx:id="galleryImageView6" preserveRatio="true"/>
</graphic>
</Button>
<Button fx:id="galleryButton4" mnemonicParsing="false" text="4" GridPane.rowIndex="1">
<graphic>
<!--ROW 2--> <!--ROW 2-->
<Button fx:id="galleryButton4" mnemonicParsing="false" text="4" GridPane.rowIndex="1">
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
<graphic>
<ImageView fx:id="galleryImageView4" preserveRatio="true"/> <ImageView fx:id="galleryImageView4" preserveRatio="true"/>
</graphic> </graphic>
</Button> </Button>
<Button fx:id="galleryButton5" mnemonicParsing="false" text="5" GridPane.columnIndex="1" <Button fx:id="galleryButton5" mnemonicParsing="false" text="5" GridPane.columnIndex="1"
GridPane.rowIndex="1"> GridPane.rowIndex="1">
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
<graphic> <graphic>
<ImageView fx:id="galleryImageView5" preserveRatio="true"/> <ImageView fx:id="galleryImageView5" preserveRatio="true"/>
</graphic> </graphic>
</Button> </Button>
<Button fx:id="galleryButton9" mnemonicParsing="false" text="9" GridPane.columnIndex="2" <Button fx:id="galleryButton6" mnemonicParsing="false" text="6" GridPane.columnIndex="2"
GridPane.rowIndex="2"> GridPane.rowIndex="1">
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
<graphic> <graphic>
<ImageView fx:id="galleryImageView9" preserveRatio="true"/> <ImageView fx:id="galleryImageView6" preserveRatio="true"/>
</graphic> </graphic>
</Button> </Button>
<Button fx:id="galleryButton7" mnemonicParsing="false" text="7" GridPane.rowIndex="2">
<graphic>
<!--ROW 3--> <!--ROW 3-->
<Button fx:id="galleryButton7" mnemonicParsing="false" text="7" GridPane.rowIndex="2">
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
<graphic>
<ImageView fx:id="galleryImageView7" preserveRatio="true"/> <ImageView fx:id="galleryImageView7" preserveRatio="true"/>
</graphic> </graphic>
</Button> </Button>
<Button fx:id="galleryButton8" mnemonicParsing="false" text="8" GridPane.columnIndex="1" <Button fx:id="galleryButton8" mnemonicParsing="false" text="8" GridPane.columnIndex="1"
GridPane.rowIndex="2"> GridPane.rowIndex="2">
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
<graphic> <graphic>
<ImageView fx:id="galleryImageView8" preserveRatio="true"/> <ImageView fx:id="galleryImageView8" preserveRatio="true"/>
</graphic> </graphic>
</Button> </Button>
<Button fx:id="galleryButton9" mnemonicParsing="false" text="9" GridPane.columnIndex="2"
GridPane.rowIndex="2">
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
<graphic>
<ImageView fx:id="galleryImageView9" preserveRatio="true"/>
</graphic>
</Button>
</children> </children>
</GridPane> </GridPane>
</children> </children>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

+11
View File
@@ -1,5 +1,16 @@
#!/usr/bin/env bash
# NOT USED AT THE TIME!!
# go to images dir
cd images cd images
# capture
gphoto2 --capture-image gphoto2 --capture-image
# download
gphoto2 --get-all-images gphoto2 --get-all-images
# delete on camera
gphoto2 --delete-all-images gphoto2 --delete-all-images
# change back to home dir
cd cd
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
# Upload files to a webdav storage,
# check them by an MD5 Hash
# and remove the local copy afterwards.
if [ "$1" == "-h" ];
then
echo "Syntax:"
echo "upload.sh [Local File Location] [Remote File Location] [username:password]"
elif [ $1 = $2 ];
then
echo "Source and Target are the same"
echo "No Arguments provided!"
else
#upload the image
curl -T $1 -u $3 $2 -k
# get the online images' MD5up
online_md5=$(curl $2 -k -u $3 | md5sum | awk '{print $1}')
# get the local images' MD5
local_md5=$(md5sum "$1" | awk '{print $1}')
# compare both MD5s
echo "$online_md5"
echo "$local_md5"
if [ "$online_md5" == "$local_md5" ];
# Remove the original Image if successful
then
echo "Uploaded successfully!"
# Remove Original
rm $1
# Fallback routine if not successful
else
echo "Upload failed!!"
fi
fi