*** MAYBE NOT WORKING ***

Added Hostname for Booth identification while Upload

Removed Date Structure inside Images Folder
--> CHECK IN BACKUP IF FILES GET OVERWRITTEN

Changed Event date structure with upload Date structure in upload
--> ALSO TESTING NECCESSARY

Changed Splash Screen JPG for Logo PNG in Capture and Picture Panels
--> Testing
This commit is contained in:
2016-12-12 21:07:55 +01:00
parent c459938a9a
commit c3db9d0166
15 changed files with 98 additions and 46 deletions
+31 -2
View File
@@ -1,5 +1,7 @@
package model;
import workers.MachineWorker;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
@@ -8,6 +10,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.File;
import java.nio.file.Files;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@XmlRootElement(name = "Config")
@@ -17,10 +21,12 @@ public class SOMConfig {
// important Paths
@XmlElement(name = "PICTURES_PATH")
public static final File PICTURES_PATH = new File("images");
@XmlElement(name = "UPLOAD_PATH")
public static final String UPLOAD_PATH = getEventPicDir();
// The Box's ID
// Todo Throw out!! or by MAC Adress
@XmlElement(name = "BOX_ID")
public static final String BOX_ID = "selfomat-42";
public static final String BOX_ID = MachineWorker.getHostName();
// Number of pictures in series mode
@XmlElement(name = "SERIES_COUNTER")
public static final int SERIES_COUNTER = 4;
@@ -59,6 +65,30 @@ public class SOMConfig {
return config;
}
/**
* Gets the Directory for the Event and Creates the Folders
*
* @return
*/
private static String getEventPicDir() {
// get current Date in String for Upload-dir
Calendar cal = Calendar.getInstance();
DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
String timeString = df.format(cal.getTime());
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
+ "/" + MachineWorker.getHostName();
return eventPicDir;
}
// Write Config
private void writeConfig() {
try {
@@ -116,5 +146,4 @@ public class SOMConfig {
java.sql.Timestamp c = new java.sql.Timestamp(now.getTime());
return c.getTime();
}
}