refs #299,#36,#40,#37,#33 closed
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources/sh/upload.sh" charset="UTF-8" />
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -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>
|
||||
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.selfomat</groupId>
|
||||
<artifactId>selfomat-single-user</artifactId>
|
||||
<version>0.4.0.5-SNAPSHOT</version>
|
||||
<version>0.4.0.11-SNAPSHOT</version>
|
||||
|
||||
<scm>
|
||||
<url>scm:svn:svn://simongehrig:L4ut5pr3ch3r!@svn.picture.tools/selfomat/trunk/selfomat-java-single-user</url>
|
||||
|
||||
@@ -85,7 +85,7 @@ public class CaptureCtl {
|
||||
image.setImage(SOMLayout.LOGO_IMAGE);
|
||||
|
||||
// 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)
|
||||
double aspect = image.getImage().getWidth() / image.getImage().getHeight();
|
||||
|
||||
@@ -257,7 +257,7 @@ public class PictureCtl {
|
||||
image.setImage(SOMLayout.LOGO_IMAGE);
|
||||
|
||||
// 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)
|
||||
double aspect = image.getImage().getWidth() / image.getImage().getHeight();
|
||||
|
||||
@@ -35,6 +35,10 @@ public class SOMConfig {
|
||||
public static final int COUNTDOWN_COUNTER = 3;
|
||||
// Images per Page in the Gallery
|
||||
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
|
||||
public static final int SCALING_GRAPHICS_2D = 0;
|
||||
public static final int SCALING_IMAGE_ICON = 1;
|
||||
@@ -70,7 +74,7 @@ public class SOMConfig {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static String getEventPicDir() {
|
||||
public static String getEventPicDir() {
|
||||
// get current Date in String for Upload-dir
|
||||
Calendar cal = Calendar.getInstance();
|
||||
DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package workers;
|
||||
|
||||
import GUI.SOMGUI;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import model.SOMConfig;
|
||||
import model.SOMEvent;
|
||||
import model.SOMImage;
|
||||
@@ -143,14 +142,23 @@ public class FilesWorker {
|
||||
List<File> dirs = new ArrayList<File>();
|
||||
List<File> pics = new ArrayList<File>();
|
||||
|
||||
//relative ones
|
||||
// int directoriesUploaded = 0;
|
||||
// int picturesUploaded = 0;
|
||||
|
||||
// Check for internet connection
|
||||
if (internet()) {
|
||||
|
||||
// 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++) {
|
||||
|
||||
// get the current file
|
||||
@@ -158,18 +166,9 @@ public class FilesWorker {
|
||||
|
||||
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
|
||||
else if (file.isFile()
|
||||
&& file.toPath().toString().contains("src")) {
|
||||
if (file.isFile()
|
||||
&& file.toString().contains("src")) {
|
||||
pics.add(file);
|
||||
}
|
||||
}
|
||||
@@ -177,31 +176,25 @@ public class FilesWorker {
|
||||
// REPORT TO CONSOLE
|
||||
System.out.println(dirs.size() + " Directories");
|
||||
System.out.println(pics.size() + " Pics");
|
||||
|
||||
int uploadeddirs = 0;
|
||||
int uploadedfiles = 0;
|
||||
|
||||
// GET THE UI
|
||||
SOMGUI.changetoupload();
|
||||
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader();
|
||||
try {
|
||||
fxmlLoader.setLocation(
|
||||
FilesWorker.class.getClassLoader().getResource("fxml/upload.fxml")
|
||||
);
|
||||
|
||||
fxmlLoader.load();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
// UPLOAD DIRECTORIES
|
||||
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);
|
||||
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");
|
||||
uploadDir(limitdirs);
|
||||
@@ -210,23 +203,28 @@ public class FilesWorker {
|
||||
limitdirs.clear();
|
||||
}
|
||||
}
|
||||
// uploadDir(dirs);
|
||||
|
||||
// UPLOAD FILES
|
||||
List<File> limitpics = new ArrayList<File>();
|
||||
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);
|
||||
|
||||
System.out.println("Clear Queue");
|
||||
System.out.println("Clear File Queue");
|
||||
limitpics.clear();
|
||||
}
|
||||
}
|
||||
// uploadFile(pics);
|
||||
|
||||
SOMGUI.changetopicture();
|
||||
}
|
||||
@@ -245,9 +243,16 @@ public class FilesWorker {
|
||||
|
||||
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 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;
|
||||
Task<Boolean> task = new Task<Boolean>() {
|
||||
@@ -257,20 +262,17 @@ public class FilesWorker {
|
||||
// build the upload process
|
||||
// TODO remove -k option (this option skips certificate verification)
|
||||
ProcessBuilder builder = new ProcessBuilder(
|
||||
"curl",
|
||||
"-T",
|
||||
"bash",
|
||||
"SELFOMAT/sh/upload.sh",
|
||||
file.toString(),
|
||||
"-u",
|
||||
"upload:geheim",
|
||||
"https://cloud.selfom.at/remote.php/webdav/" + file.toString().replace("/src", ""),
|
||||
"-k");
|
||||
target,
|
||||
SOMConfig.CLOUD_CREDENTIALS
|
||||
);
|
||||
|
||||
// make the process traceable
|
||||
builder.redirectErrorStream(true);
|
||||
|
||||
|
||||
Process process = builder.start();
|
||||
// launch upload process
|
||||
Process process = builder.start();
|
||||
|
||||
// wait for the process to end
|
||||
if (process.waitFor() == 0) {
|
||||
@@ -327,7 +329,8 @@ public class FilesWorker {
|
||||
"upload:geheim",
|
||||
"-X",
|
||||
"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");
|
||||
|
||||
// make the process traceable
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
@@ -20,63 +21,72 @@
|
||||
<RowConstraints percentHeight="33.3"/>
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<!-- NAVIGATION -->
|
||||
<Button fx:id="forthButton" mnemonicParsing="false" GridPane.columnIndex="3"/>
|
||||
<Button fx:id="pictureButton" mnemonicParsing="false" GridPane.columnIndex="3" GridPane.rowIndex="1"/>
|
||||
<Button fx:id="backButton" mnemonicParsing="false" GridPane.columnIndex="3" GridPane.rowIndex="2"/>
|
||||
|
||||
<!--ROW 1-->
|
||||
<Button fx:id="galleryButton1" mnemonicParsing="false" text="1">
|
||||
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
|
||||
<graphic>
|
||||
<!--ROW 1-->
|
||||
<ImageView fx:id="galleryImageView1" preserveRatio="true"/>
|
||||
</graphic>
|
||||
</Button>
|
||||
<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>
|
||||
<ImageView fx:id="galleryImageView2" preserveRatio="true"/>
|
||||
</graphic>
|
||||
</Button>
|
||||
<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>
|
||||
<ImageView fx:id="galleryImageView3" preserveRatio="true"/>
|
||||
</graphic>
|
||||
</Button>
|
||||
<Button fx:id="galleryButton6" mnemonicParsing="false" text="6" GridPane.columnIndex="2"
|
||||
GridPane.rowIndex="1">
|
||||
<graphic>
|
||||
<ImageView fx:id="galleryImageView6" preserveRatio="true"/>
|
||||
</graphic>
|
||||
</Button>
|
||||
<!--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>
|
||||
<!--ROW 2-->
|
||||
|
||||
<ImageView fx:id="galleryImageView4" preserveRatio="true"/>
|
||||
</graphic>
|
||||
</Button>
|
||||
<Button fx:id="galleryButton5" mnemonicParsing="false" text="5" GridPane.columnIndex="1"
|
||||
GridPane.rowIndex="1">
|
||||
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
|
||||
<graphic>
|
||||
<ImageView fx:id="galleryImageView5" preserveRatio="true"/>
|
||||
</graphic>
|
||||
</Button>
|
||||
<Button fx:id="galleryButton9" mnemonicParsing="false" text="9" GridPane.columnIndex="2"
|
||||
GridPane.rowIndex="2">
|
||||
<Button fx:id="galleryButton6" mnemonicParsing="false" text="6" GridPane.columnIndex="2"
|
||||
GridPane.rowIndex="1">
|
||||
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
|
||||
<graphic>
|
||||
<ImageView fx:id="galleryImageView9" preserveRatio="true"/>
|
||||
<ImageView fx:id="galleryImageView6" preserveRatio="true"/>
|
||||
</graphic>
|
||||
</Button>
|
||||
<!--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>
|
||||
<!--ROW 3-->
|
||||
|
||||
<ImageView fx:id="galleryImageView7" preserveRatio="true"/>
|
||||
</graphic>
|
||||
</Button>
|
||||
<Button fx:id="galleryButton8" mnemonicParsing="false" text="8" GridPane.columnIndex="1"
|
||||
GridPane.rowIndex="2">
|
||||
<Insets bottom="25.0" top="25.0" left="25.0" right="25.0"/>
|
||||
<graphic>
|
||||
<ImageView fx:id="galleryImageView8" preserveRatio="true"/>
|
||||
</graphic>
|
||||
</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>
|
||||
</GridPane>
|
||||
</children>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 4.3 KiB |
@@ -1,5 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# NOT USED AT THE TIME!!
|
||||
|
||||
# go to images dir
|
||||
cd images
|
||||
|
||||
# capture
|
||||
gphoto2 --capture-image
|
||||
# download
|
||||
gphoto2 --get-all-images
|
||||
# delete on camera
|
||||
gphoto2 --delete-all-images
|
||||
|
||||
# change back to home dir
|
||||
cd
|
||||
|
||||
@@ -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
|
||||