Commit f2ab2fc8 authored by Elodie Gauthier's avatar Elodie Gauthier

Fix minor issues before delivery to partners.

Precise message log in RecordElicitation.java.
Add "_elicit" to the recording filename of an elicitation.

We still cannot do a respeaking/translation of an elicitation.
parent bc5ad9e4
...@@ -1147,7 +1147,7 @@ public class Recording extends FileModel { ...@@ -1147,7 +1147,7 @@ public class Recording extends FileModel {
/** /**
* Name mutator. * Name mutator.
*/ */
private void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
......
...@@ -148,7 +148,13 @@ public class RecordingLig extends Recording { ...@@ -148,7 +148,13 @@ public class RecordingLig extends Recording {
throws IOException { throws IOException {
File wavFile = new File(getNoSyncRecordingsPath(), wavUUIDExt); File wavFile = new File(getNoSyncRecordingsPath(), wavUUIDExt);
Log.i(TAG, "importwav: " + wavFile.length()); Log.i(TAG, "importwav: " + wavFile.length());
File destFile = new File(getIndividualRecordingPath(), this.name + ext); Log.i(TAG, "Elicitation mode? " + isElicit());
File destFile;
if (isElicit()) {
destFile = new File(getIndividualRecordingPath(), this.respeakingId + ext);
} else {
destFile = new File(getIndividualRecordingPath(), this.name + ext);
}
FileUtils.moveFile(wavFile, destFile); FileUtils.moveFile(wavFile, destFile);
// FileUtils.moveFile(wavFile, this.getFile(idExt)); // FileUtils.moveFile(wavFile, this.getFile(idExt));
Log.i(TAG, "src file " + wavFile.getAbsolutePath() + " moves to " + destFile.getAbsolutePath()); Log.i(TAG, "src file " + wavFile.getAbsolutePath() + " moves to " + destFile.getAbsolutePath());
...@@ -185,14 +191,12 @@ public class RecordingLig extends Recording { ...@@ -185,14 +191,12 @@ public class RecordingLig extends Recording {
// if the recording is original // if the recording is original
if (isOriginal()) { if (isOriginal() || isElicit()) {
// Import the sample wave file into the new recording directory // Import the sample wave file into the new recording directory
File wavFile = new File(getNoSyncRecordingsPath(), recordingUUID + SAMPLE_SUFFIX); File wavFile = new File(getNoSyncRecordingsPath(), recordingUUID + SAMPLE_SUFFIX);
FileIO.delete(wavFile); FileIO.delete(wavFile);
Log.d("file deleted", wavFile.getName()); Log.d("file deleted", wavFile.getName());
}else { } else {
// Try and import the mapping file // Try and import the mapping file
importMapping(recordingUUID, getId()); importMapping(recordingUUID, getId());
...@@ -204,8 +208,12 @@ public class RecordingLig extends Recording { ...@@ -204,8 +208,12 @@ public class RecordingLig extends Recording {
// Write the json metadata. // Write the json metadata.
File metadataFile = new File(getIndividualRecordingPath(), File metadataFile;
this.name + METADATA_SUFFIX); if (isElicit()) {
metadataFile = new File(getIndividualRecordingPath(), this.respeakingId + METADATA_SUFFIX);
} else {
metadataFile = new File(getIndividualRecordingPath(), this.name + METADATA_SUFFIX);
}
FileIO.writeJSONObject(metadataFile,encodedRecording); FileIO.writeJSONObject(metadataFile,encodedRecording);
Log.i(TAG, "Saved metadata file to " + metadataFile.getAbsolutePath()); Log.i(TAG, "Saved metadata file to " + metadataFile.getAbsolutePath());
} }
...@@ -266,9 +274,30 @@ public class RecordingLig extends Recording { ...@@ -266,9 +274,30 @@ public class RecordingLig extends Recording {
public File getFile() { public File getFile() {
String extension = (this.isMovie())? ".mp4" : ".wav"; String extension = (this.isMovie())? ".mp4" : ".wav";
return new File(getIndividualRecordingPath(), this.name + extension); return new File(getIndividualRecordingPath(), this.name + extension);
// return getFile(id + extension); // return getFile(id + extension);
}
public File getElicitFile() {
String extension = (this.isMovie())? ".mp4" : ".wav";
if (isElicit()) {
return new File(getIndividualRecordingPath(), this.getRespeakingId() + extension);
} else {
return new File(getIndividualRecordingPath(), this.name + extension);
// return getFile(id + extension);
}
} }
/**
* Returns true if the Recording is an elicitation;
*
* @return True if the recording is an elicitation.
*/
public boolean isElicit() {
return this.name.contains("elicit") && !this.name.contains("_rspk") || !this.name.contains("_trsl");
}
public File getRecordingsPath() { public File getRecordingsPath() {
File path = new File( File path = new File(
FileIO.getOwnerPath(), RECORDINGS); FileIO.getOwnerPath(), RECORDINGS);
...@@ -283,14 +312,21 @@ public class RecordingLig extends Recording { ...@@ -283,14 +312,21 @@ public class RecordingLig extends Recording {
*/ */
public File getIndividualRecordingPath() { public File getIndividualRecordingPath() {
File path; File path;
String[] dir = this.getRespeakingId().split("_");
if (this.name.contains("rspk") || this.name.contains("trsl")) { if (this.name.contains("rspk") || this.name.contains("trsl")) {
String[] dir = this.getRespeakingId().split("_");
Log.d("path -> ", "path -> "+this.getRespeakingId()); Log.d("path -> ", "path -> "+this.getRespeakingId());
path = new File(getRecordingsPath(), path = new File(getRecordingsPath(),
dir[0] + "_" + dir[1] + "_" + dir[2] + "/"); dir[0] + "_" + dir[1] + "_" + dir[2] + "/");
} else { path = new File(getRecordingsPath(), this.name + "/"); } } else if (isElicit()) {
Log.d("elicitation path -> ", "elicitation path -> "+this.getRespeakingId());
path = new File(getRecordingsPath(),
dir[0] + "_" + dir[1] + "_" + dir[2] + "_" + dir[3] + "/");
} else {
path = new File(getRecordingsPath(), this.name + "/");
}
path.mkdirs(); path.mkdirs();
Log.d("destPath", path.toString()); Log.d("destPath", path.toString());
return path; return path;
} }
} }
...@@ -189,7 +189,7 @@ public class ThumbRespeakActivityLig extends AikumaActivity { ...@@ -189,7 +189,7 @@ public class ThumbRespeakActivityLig extends AikumaActivity {
*/ */
private void saveCurrentState() { private void saveCurrentState() {
Log.d("saveCurrentSession", "true"); Log.d("saveCurrentSession", "true");
Toast.makeText(this, "save current not finished session", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "The session has been saved.", Toast.LENGTH_SHORT).show();
duration = respeaker.getSimplePlayer().getCurrentMsec(); duration = respeaker.getSimplePlayer().getCurrentMsec();
Date date = new Date(); Date date = new Date();
DateFormat dateformat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); DateFormat dateformat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment