mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-21 22:52:22 +00:00
Reprocessing
Ironed out a few bugs in restarting processing.
This commit is contained in:
parent
f910d80517
commit
5f9d29e131
@ -558,7 +558,10 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe
|
||||
// if (fileInputParameters.recentFiles == null) return false;
|
||||
// if (fileInputParameters.recentFiles.size() < 1) return false;
|
||||
// String fileName = fileInputParameters.recentFiles.get(0);
|
||||
return runFileAnalysis();
|
||||
if (runFileAnalysis() == false) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public File getCurrentFile() {
|
||||
@ -737,6 +740,8 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe
|
||||
@Override
|
||||
public boolean startSystem(AcquisitionControl daqControl) {
|
||||
|
||||
|
||||
|
||||
if (audioStream == null) return false;
|
||||
|
||||
dontStop = true;
|
||||
|
@ -141,6 +141,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D
|
||||
String[] selList = {globalFolder};
|
||||
folderInputParameters.setSelectedFiles(selList);
|
||||
// need to immediately make the allfiles list since it's about to get used by the reprocess manager
|
||||
// need to worry about how to wait for this since it's starting in a different thread.
|
||||
makeSelFileList();
|
||||
}
|
||||
|
||||
@ -868,6 +869,8 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D
|
||||
long fileStart = getFileStartTime(allFiles.get(i).getAbsoluteFile());
|
||||
if (fileStart >= startTime) {
|
||||
currentFile = i;
|
||||
PamCalendar.setSoundFile(true);
|
||||
PamCalendar.setSessionStartTime(startTime);
|
||||
System.out.printf("Sound Acquisition start processing at file %s time %s\n", allFiles.get(i).getName(),
|
||||
PamCalendar.formatDBDateTime(fileStart));
|
||||
return true;
|
||||
|
@ -1212,6 +1212,8 @@ public class PamController implements PamControllerInterface, PamSettings {
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* This needs to be called after prepareproces.
|
||||
* Now we do some extra checks on the stores to see if we want to overwite data,
|
||||
* carry on from where we left off, etc.
|
||||
*/
|
||||
@ -1221,14 +1223,15 @@ public class PamController implements PamControllerInterface, PamSettings {
|
||||
if (goonthen == false) {
|
||||
System.out.println("Data processing will not start since you've chosen not to overwrite existing output data");
|
||||
pamStop();
|
||||
setPamStatus(PAM_IDLE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (saveSettings) {
|
||||
saveSettings(PamCalendar.getSessionStartTime());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (saveSettings) {
|
||||
saveSettings(PamCalendar.getSessionStartTime());
|
||||
}
|
||||
|
||||
StorageOptions.getInstance().setBlockOptions();
|
||||
|
||||
t1 = System.currentTimeMillis();
|
||||
|
@ -48,6 +48,10 @@ public class ReprocessManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (choiceSummary.getInputStoreInfo() == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// need to decide what to do based on the list of possible choices.
|
||||
ReprocessStoreChoice choice = chosePartStoreAction(choiceSummary);
|
||||
|
||||
|
@ -177,6 +177,7 @@ public class RWEProcess extends PamProcess {
|
||||
minSoundType = rweControl.rweParameters.minSoundType;
|
||||
classifier.setSoundData(getSampleRate(), sourceDataBlock.getFftLength(),
|
||||
sourceDataBlock.getFftHop());
|
||||
System.out.println("Create right whale channel process " + iChannel);
|
||||
}
|
||||
|
||||
|
||||
|
@ -117,6 +117,8 @@ public class BinaryOutputStream {
|
||||
File outputFile = new File(mainFileName);
|
||||
|
||||
boolean open = openPGDFFile(outputFile);
|
||||
|
||||
// System.out.println("Open outout file " + outputFile.getAbsolutePath());
|
||||
|
||||
if (open) {
|
||||
addToDataMap(outputFile);
|
||||
@ -260,6 +262,7 @@ public class BinaryOutputStream {
|
||||
|
||||
public synchronized boolean closeFile() {
|
||||
boolean ok = true;
|
||||
// System.out.println("Close output file " + mainFileName);
|
||||
if (dataOutputStream != null) {
|
||||
if (currentDataMapPoint != null) {
|
||||
currentDataMapPoint.setBinaryFooter(footer);
|
||||
|
@ -2404,6 +2404,7 @@ PamSettingsSource, DataOutputStore {
|
||||
}
|
||||
else {
|
||||
reportError("No valid header in file " + file.getAbsolutePath());
|
||||
inputStream.closeFile();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -142,9 +142,10 @@ public class BinaryStoreDeleter {
|
||||
boolean headOk = false;
|
||||
BinaryHeader binaryHead = new BinaryHeader();
|
||||
try {
|
||||
DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(indexFile)));
|
||||
FileInputStream fis = new FileInputStream(indexFile);
|
||||
DataInputStream dis = new DataInputStream(new BufferedInputStream(fis));
|
||||
headOk = binaryHead.readHeader(dis);
|
||||
dis.close();
|
||||
fis.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
headOk = false;
|
||||
@ -188,6 +189,7 @@ public class BinaryStoreDeleter {
|
||||
}
|
||||
|
||||
private boolean partialCopyFile(PamDataBlock aBlock, File dataFile, long timeMillis) {
|
||||
System.out.printf("Partial delete of file %s from %s\n", dataFile.getAbsoluteFile(), PamCalendar.formatDBDateTime(timeMillis));
|
||||
try {
|
||||
BinaryInputStream inputStream = new BinaryInputStream(binaryStore, aBlock);
|
||||
if (inputStream.openFile(dataFile) == false) {
|
||||
@ -303,10 +305,11 @@ public class BinaryStoreDeleter {
|
||||
* @return
|
||||
*/
|
||||
private boolean deleteFileSet(File dataFile) {
|
||||
System.out.printf("Deleting full file set for %s\n", dataFile.getAbsoluteFile());
|
||||
boolean deleteOk = true;
|
||||
try {
|
||||
File indexFile = binaryStore.findIndexFile(dataFile, true);
|
||||
File noiseFile = binaryStore.findNoiseFile(dataFile, true);
|
||||
boolean deleteOk = true;
|
||||
deleteOk &= dataFile.delete();
|
||||
if (indexFile != null) {
|
||||
deleteOk &= indexFile.delete();
|
||||
@ -314,11 +317,14 @@ public class BinaryStoreDeleter {
|
||||
if (noiseFile != null) {
|
||||
deleteOk &= noiseFile.delete();
|
||||
}
|
||||
return deleteOk;
|
||||
}
|
||||
catch (Exception e) {
|
||||
return false;
|
||||
deleteOk = false;
|
||||
}
|
||||
|
||||
System.out.printf("Deleting full file set %s for %s\n", deleteOk?"OK":"Error", dataFile.getAbsoluteFile());
|
||||
|
||||
return deleteOk;
|
||||
|
||||
}
|
||||
|
||||
|
@ -136,15 +136,16 @@ public class BinaryStoreStatusFuncs {
|
||||
* get the UID and time of the last item in the file. Can return these in the form of
|
||||
* a BinaryFooter since it's pretty much the same information needed.
|
||||
*/
|
||||
BinaryInputStream inputStream = new BinaryInputStream(binaryStore, null);
|
||||
try {
|
||||
// need to work through the file now.
|
||||
BinaryInputStream inputStream = new BinaryInputStream(binaryStore, null);
|
||||
if (inputStream.openFile(aFile) == false) {
|
||||
return null;
|
||||
};
|
||||
BinaryObjectData binaryObjectData;
|
||||
BinaryHeader bh = inputStream.readHeader();
|
||||
if (bh==null) {
|
||||
inputStream.closeFile();
|
||||
return null;
|
||||
}
|
||||
int inputFormat = bh.getHeaderFormat();
|
||||
@ -159,6 +160,7 @@ public class BinaryStoreStatusFuncs {
|
||||
bf = new BinaryFooter();
|
||||
if (bf.readFooterData(binaryObjectData.getDataInputStream(), inputFormat)) {
|
||||
if (bf.getDataDate() != 0) {
|
||||
inputStream.closeFile();
|
||||
return bf;
|
||||
}
|
||||
}
|
||||
@ -184,11 +186,18 @@ public class BinaryStoreStatusFuncs {
|
||||
}
|
||||
}
|
||||
}
|
||||
inputStream.closeFile();
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.out.printf("Corrupt data file %s: %s\n", aFile, e.getMessage());
|
||||
// return null;
|
||||
}
|
||||
try {
|
||||
if (inputStream != null) {
|
||||
inputStream.closeFile();
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
}
|
||||
if (lastTime != null && lastUID != null) {
|
||||
BinaryFooter bf = new BinaryFooter();
|
||||
@ -211,18 +220,23 @@ public class BinaryStoreStatusFuncs {
|
||||
*/
|
||||
private BinaryHeader findFirstHeader(List<File> binFiles) {
|
||||
BinaryHeader binaryHead = new BinaryHeader();
|
||||
DataInputStream dis = null;
|
||||
for (File aFile : binFiles) {
|
||||
try {
|
||||
DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(aFile)));
|
||||
if (binaryHead.readHeader(dis)) {
|
||||
return binaryHead;
|
||||
}
|
||||
dis = new DataInputStream(new BufferedInputStream(new FileInputStream(aFile)));
|
||||
}
|
||||
catch (IOException e) {
|
||||
binaryHead = null;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
dis.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return binaryHead;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user