closed #304,#33,#302,#307,#301,#305
This commit is contained in:
Generated
+9
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectCodeStyleSettingsManager">
|
||||||
|
<option name="PER_PROJECT_SETTINGS">
|
||||||
|
<value />
|
||||||
|
</option>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -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.11-SNAPSHOT</version>
|
<version>0.4.0.13-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>
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ public class CaptureCtl {
|
|||||||
Platform.runLater(new Runnable() {
|
Platform.runLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
// Set Countdown Text
|
// Set Countdown Text
|
||||||
countdownText.setText(String.valueOf(counter + 1));
|
countdownText.setText(String.valueOf(counter + 2));
|
||||||
// Set the Counter Visible
|
// Set the Counter Visible
|
||||||
countdownText.setVisible(true);
|
countdownText.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,8 +119,8 @@ public class SOMGUI extends Application {
|
|||||||
|
|
||||||
// Set the Upload scene
|
// Set the Upload scene
|
||||||
changetoupload();
|
changetoupload();
|
||||||
// Start Upload Process
|
|
||||||
|
// Start Upload Process (switches over to Picture afterwards)
|
||||||
FilesWorker.upload();
|
FilesWorker.upload();
|
||||||
// Set the Picture scene
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ public class SOMConfig {
|
|||||||
public static final int SERIES_COUNTER = 4;
|
public static final int SERIES_COUNTER = 4;
|
||||||
// Seconds before image is taken
|
// Seconds before image is taken
|
||||||
@XmlElement(name = "COUNTDOWN_COUNTER")
|
@XmlElement(name = "COUNTDOWN_COUNTER")
|
||||||
public static final int COUNTDOWN_COUNTER = 3;
|
public static final int COUNTDOWN_COUNTER = 4;
|
||||||
// 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
|
// Limot of Parallel Uploads
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class SOMEvent {
|
|||||||
*/
|
*/
|
||||||
public void getEventImages() {
|
public void getEventImages() {
|
||||||
// Behandelt
|
// Behandelt
|
||||||
if (!imagesread) {
|
// if (!imagesread) {
|
||||||
|
|
||||||
File[] files = FilesWorker.getSourcePath().listFiles();
|
File[] files = FilesWorker.getSourcePath().listFiles();
|
||||||
|
|
||||||
@@ -74,8 +74,8 @@ public class SOMEvent {
|
|||||||
this.addImage(img);
|
this.addImage(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
imagesread = true;
|
// imagesread = true;
|
||||||
}
|
// }
|
||||||
// return;
|
// return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,15 @@ package model;
|
|||||||
|
|
||||||
import workers.FilesWorker;
|
import workers.FilesWorker;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
|
||||||
public class SOMImage {
|
public class SOMImage {
|
||||||
|
|
||||||
private static String name; // the filename
|
private static String name; // the filename
|
||||||
|
|
||||||
private final SOMConfig config = SOMConfig.getInstance();
|
private final SOMConfig config = SOMConfig.getInstance();
|
||||||
|
|
||||||
private final File tmb; // thumbnail
|
private final File tmb; // thumbnail
|
||||||
private final File prv; // preview
|
private final File prv; // preview
|
||||||
private final File src; // source
|
private final File src; // source
|
||||||
@@ -25,8 +26,7 @@ public class SOMImage {
|
|||||||
|
|
||||||
File src = new File(FilesWorker.getSourcePath().toString() + "/" + name);
|
File src = new File(FilesWorker.getSourcePath().toString() + "/" + name);
|
||||||
|
|
||||||
File prv = new File(FilesWorker.getPreviewPath().toString() + "/"
|
File prv = new File(FilesWorker.getPreviewPath().toString() + "/" + name);
|
||||||
+ name);
|
|
||||||
|
|
||||||
File tmb = new File(FilesWorker.getThumbPath().toString() + "/" + name);
|
File tmb = new File(FilesWorker.getThumbPath().toString() + "/" + name);
|
||||||
|
|
||||||
@@ -153,23 +153,23 @@ public class SOMImage {
|
|||||||
* @param type 0 = thumb, 1 = preview, 2 = full Size
|
* @param type 0 = thumb, 1 = preview, 2 = full Size
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ImageIcon toImageIcon(int type) {
|
// public ImageIcon toImageIcon(int type) {
|
||||||
File imagepath;
|
// File imagepath;
|
||||||
switch (type) {
|
// switch (type) {
|
||||||
case 0:
|
// case 0:
|
||||||
imagepath = getTmb();
|
// imagepath = getTmb();
|
||||||
break;
|
// break;
|
||||||
case 1:
|
// case 1:
|
||||||
imagepath = getPrv();
|
// imagepath = getPrv();
|
||||||
break;
|
// break;
|
||||||
case 2:
|
// case 2:
|
||||||
imagepath = getSrc();
|
// imagepath = getSrc();
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
imagepath = null;
|
// imagepath = null;
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return new ImageIcon(imagepath.getPath());
|
// return new ImageIcon(imagepath.getPath());
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,14 +131,13 @@ 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
|
||||||
List<File> dirs = new ArrayList<File>();
|
List<File> dirs = new ArrayList<File>();
|
||||||
List<File> pics = new ArrayList<File>();
|
List<File> pics = new ArrayList<File>();
|
||||||
|
List<File> remv = new ArrayList<File>();
|
||||||
|
|
||||||
// Check for internet connection
|
// Check for internet connection
|
||||||
if (internet()) {
|
if (internet()) {
|
||||||
@@ -150,6 +149,7 @@ public class FilesWorker {
|
|||||||
String currentdir = "";
|
String currentdir = "";
|
||||||
|
|
||||||
for (String split : splits) {
|
for (String split : splits) {
|
||||||
|
|
||||||
currentdir = currentdir + "/" + split;
|
currentdir = currentdir + "/" + split;
|
||||||
dirs.add(new File(currentdir));
|
dirs.add(new File(currentdir));
|
||||||
|
|
||||||
@@ -168,6 +168,8 @@ public class FilesWorker {
|
|||||||
if (file.isFile()
|
if (file.isFile()
|
||||||
&& file.toString().contains("src")) {
|
&& file.toString().contains("src")) {
|
||||||
pics.add(file);
|
pics.add(file);
|
||||||
|
} else {
|
||||||
|
remv.add(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,9 +180,6 @@ public class FilesWorker {
|
|||||||
int queueddirs = 0;
|
int queueddirs = 0;
|
||||||
int queuedfiles = 0;
|
int queuedfiles = 0;
|
||||||
|
|
||||||
// GET THE UI
|
|
||||||
SOMGUI.changetoupload();
|
|
||||||
|
|
||||||
// UPLOAD DIRECTORIES
|
// UPLOAD DIRECTORIES
|
||||||
List<File> limitdirs = new ArrayList<File>();
|
List<File> limitdirs = new ArrayList<File>();
|
||||||
|
|
||||||
@@ -221,9 +220,25 @@ public class FilesWorker {
|
|||||||
|
|
||||||
System.out.println("Clear File Queue");
|
System.out.println("Clear File Queue");
|
||||||
limitpics.clear();
|
limitpics.clear();
|
||||||
|
} else if (queuedfiles == pics.size() && pics.size() != 0) {
|
||||||
|
// reboot
|
||||||
|
new ProcessBuilder("reboot").start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove the rest of the files (thumbs, previews)
|
||||||
|
for (File rem : remv) {
|
||||||
|
if (rem.isFile()) {
|
||||||
|
rem.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Archive the Backup
|
||||||
|
archiveBackup();
|
||||||
|
|
||||||
|
// Update the State fot previews and thumbs
|
||||||
|
SOMEvent.getInstance().getImages();
|
||||||
|
|
||||||
SOMGUI.changetopicture();
|
SOMGUI.changetopicture();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -235,6 +250,42 @@ public class FilesWorker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void archiveBackup() {
|
||||||
|
Task<Boolean> task = new Task<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Boolean call() throws Exception {
|
||||||
|
// build the archive process
|
||||||
|
// TODO remove -k option (this option skips certificate verification)
|
||||||
|
// TODO Make Software run in SELFOMAT Directory
|
||||||
|
ProcessBuilder builder = new ProcessBuilder(
|
||||||
|
"bash",
|
||||||
|
"SELFOMAT/sh/move-backup.sh"
|
||||||
|
);
|
||||||
|
|
||||||
|
// make the process traceable
|
||||||
|
builder.redirectErrorStream(true);
|
||||||
|
// launch archive process
|
||||||
|
Process process = builder.start();
|
||||||
|
|
||||||
|
// wait for the process to end
|
||||||
|
if (process.waitFor() == 0) {
|
||||||
|
// process ended successful
|
||||||
|
System.out.println("archiving Backup");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// process ended failing
|
||||||
|
// TODO Catch failed uploads
|
||||||
|
|
||||||
|
System.out.println("Backup archiving failed!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private static void uploadFile(final List<File> files) throws Exception {
|
private static void uploadFile(final List<File> files) throws Exception {
|
||||||
final Thread[] threads = new Thread[files.size()];
|
final Thread[] threads = new Thread[files.size()];
|
||||||
|
|
||||||
@@ -325,8 +376,7 @@ public class FilesWorker {
|
|||||||
SOMConfig.CLOUD_CREDENTIALS,
|
SOMConfig.CLOUD_CREDENTIALS,
|
||||||
"-X",
|
"-X",
|
||||||
"MKCOL",
|
"MKCOL",
|
||||||
SOMConfig.CLOUD_ADDRESS + SOMConfig.getEventPicDir(),
|
SOMConfig.CLOUD_ADDRESS + dir.toString().replace("/src", ""),
|
||||||
// dir.toString().replace("/src", ""),
|
|
||||||
"-k");
|
"-k");
|
||||||
|
|
||||||
// make the process traceable
|
// make the process traceable
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# get the current Time
|
||||||
|
STAMP=$(date "+%Y%m%d-%H%M%S")
|
||||||
|
# make the dir to move to
|
||||||
|
mkdir img.backup/${STAMP}/
|
||||||
|
# move the files
|
||||||
|
mv img.backup/images/src/* img.backup/${STAMP}/
|
||||||
@@ -29,7 +29,7 @@ if [ "$1" == "-h" ];
|
|||||||
# get the local images' MD5
|
# get the local images' MD5
|
||||||
pre_local_md5=$(md5sum "$1" | awk '{print $1}')
|
pre_local_md5=$(md5sum "$1" | awk '{print $1}')
|
||||||
|
|
||||||
# compare both MD5s
|
# compare both MD5s manually (for development)
|
||||||
echo "$pre_online_md5"
|
echo "$pre_online_md5"
|
||||||
echo "$pre_local_md5"
|
echo "$pre_local_md5"
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ if [ "$1" == "-h" ];
|
|||||||
# get the local images' MD5
|
# get the local images' MD5
|
||||||
local_md5=$(md5sum "$1" | awk '{print $1}')
|
local_md5=$(md5sum "$1" | awk '{print $1}')
|
||||||
|
|
||||||
# compare both MD5s
|
# compare both MD5s manually (for development)
|
||||||
echo "$online_md5"
|
echo "$online_md5"
|
||||||
echo "$local_md5"
|
echo "$local_md5"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user