Commit e0a73270 authored by CallisteHanriat's avatar CallisteHanriat

wav files are saved by their current date, into the original folder. New...

wav files are saved by their current date, into the original folder. New Recording constructor which is the same as the previous (before used in some activities) bit with respeakingID in add + new RecordingLig constructor.  Adding some comments on a RecordingLig constructor
parent c144d073
......@@ -44,6 +44,62 @@ public class Recording extends FileModel {
/** sample file duration in sec */
public static final long SAMPLE_SEC = 15;
/**
* The constructor used when we create a translation or respeaking
*
* @param recordingUUID the temporary UUID of the recording in question.
* (recording can be wav or movie(mp4))
* @param name The recording's name.
* @param date The date of creation.
* @param versionName The recording's version(v0x)
* @param ownerId The recording owner's ID(Google account)
* @param languages The languages associated with the recording
* @param speakersIds The IDs of the speakers associated with the
* recording
* @param deviceName The model name of the device
* @param androidID The android ID of the device that created the
* recording
* @param groupId The ID of the group of recordings this recording
* belongs in (Some source recording and respeakings/commentaries)
* @param sourceVerId The version-ID of the source recording of this recording
* @param respeakingId the original name of recording file
* @param sampleRate The sample rate of the recording.
* @param durationMsec The duration of the recording in milliseconds.
* @param format The mime type
* @param bitsPerSample The bits per sample of the audio
* @param numChannels The number of channels of the audio
* @param latitude The location data
* @param longitude The location data
*/
public Recording(UUID recordingUUID, String name, Date date,
String versionName, String ownerId,
List<Language> languages, List<String> speakersIds,
String deviceName, String androidID, String groupId, String sourceVerId,
String respeakingId, long sampleRate, int durationMsec, String format, int numChannels,
int bitsPerSample, Double latitude, Double longitude) {
super(versionName, ownerId, null, null, format);
this.recordingUUID = recordingUUID;
setName(name);
setDate(date);
setLanguages(languages);
setSpeakersIds(speakersIds);
setDeviceName(deviceName);
setAndroidID(androidID);
setRespeakingId(respeakingId);
setSampleRate(sampleRate);
setDurationMsec(durationMsec);
setGroupId(groupId);
this.sourceVerId = sourceVerId;
this.numChannels = numChannels;
this.bitsPerSample = bitsPerSample;
this.latitude = latitude;
this.longitude = longitude;
setId(determineId());
setFileType(sourceVerId, languages);
}
/**
* The constructor used when first creating a Recording.
......@@ -146,6 +202,8 @@ public class Recording extends FileModel {
this.sourceVerId = sourceVerId;
this.fileType = fileType;
}
private String determineId() {
// Build up the filename prefix
......
......@@ -31,6 +31,57 @@ public class RecordingLig extends Recording {
private int speakerBirthYear = 0;
private String speakerGender;
/**
* The constructor used when we create a translation or respeaking
* @param recordingUUID The temporary UUID of the recording in question.
* (recording can be wav or movie(mp4))
* @param name The recording's name
* @param date The date of creation
* @param versionName The recording's version (v0x)
* @param ownerId The recording owner's ID(Google account)
* @param recordLang The recording record language
* @param motherTong The recording mother language
* @param languages The languages associated with the recording
* @param speakersIds The Ids of the speakers associated with the recording
* @param deviceName The model name of the device
* @param androidID The android ID of the device that created the recording
* (androidId is unique for one device)
* @param groupId The ID of the group of recordings this recording
* @param sourceVerId The version-ID of the source recording of this recording
* @param respeakingId The original name of the file (without extension)
* @param sampleRate The sample rate of the recording
* @param durationMsec The duration of the recording in milliseconds
* @param format The mime type
* @param numChannels The number of channels of the audio
* @param bitsPerSample The bits per sample of the audio
* @param latitude The location data
* @param longitude The location data
* @param region The region where the recording has been done
* @param spkrName The name of the speaker who did the recording
* @param spkrAge The age of the speaker who did the recording
* @param spkrGndr The gender of the speaker who did the recording
*/
public RecordingLig(UUID recordingUUID, String name, Date date,
String versionName, String ownerId, Language recordLang, Language motherTong,
List<Language> languages, List<String> speakersIds,
String deviceName, String androidID, String groupId, String sourceVerId, String respeakingId,
long sampleRate, int durationMsec, String format, int numChannels,
int bitsPerSample, Double latitude, Double longitude,
String region, String spkrName, int spkrAge, String spkrGndr) {
super(recordingUUID, name, date, versionName, ownerId,
languages, speakersIds, deviceName, androidID, groupId,
sourceVerId, respeakingId, sampleRate, durationMsec, format, numChannels,
bitsPerSample, latitude, longitude);
this.regionOrigin = region;
this.speakerName = spkrName;
this.speakerBirthYear = spkrAge;
this.speakerGender = spkrGndr;
this.recordLang = recordLang != null ? new Language(recordLang.getName(),recordLang.getCode())
: new Language("", "");
this.motherTong = motherTong != null ? new Language(motherTong.getName(),motherTong.getCode())
: new Language("", "");
}
public RecordingLig(UUID recordingUUID, String name, Date date,
String versionName, String ownerId, Language recordLang, Language motherTong,
List<Language> languages, List<String> speakersIds,
......@@ -220,7 +271,8 @@ public class RecordingLig extends Recording {
public File getIndividualRecordingPath() {
File path;
if (this.name.contains("rspk") || this.name.contains("trsl")) {
String[] dir = this.name.split("_");
String[] dir = this.getRespeakingId().split("_");
Log.d("path -> ", this.getRespeakingId());
path = new File(getRecordingsPath(),
dir[0] + "_" + dir[1] + "_" + dir[2] + "/");
} else { path = new File(getRecordingsPath(), this.name + "/"); }
......
......@@ -149,10 +149,11 @@ public class ThumbRespeakActivityLig extends AikumaActivity {
String regionOrigin = respeakingBundle.getString(RecordingMetadataLig.metaOrigin);
String speakerName = respeakingBundle.getString(RecordingMetadataLig.metaSpkrName);
int speakerAge = respeakingBundle.getInt(RecordingMetadataLig.metaSpkrBirthYr);
String originalName = getIntent().getStringExtra("dirname");
Log.d("name original file", originalName);
String mode = translateMode ? "_trsl" : "_rspk";
String name = metadataIntent.getStringExtra("dirname")
+ mode;
String name = new SimpleDateFormat("yyMMdd-HHmmss").format(date) + "_" + recordLang.getCode()
+ "_" + Aikuma.getDeviceId() + mode;
Log.d("name of file ", name);
// + "_respeak_" + new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(date)
......@@ -169,7 +170,7 @@ public class ThumbRespeakActivityLig extends AikumaActivity {
AikumaSettings.getLatestVersion(),
AikumaSettings.getCurrentUserId(), recordLang, motherTong,
rspkLanguages, new ArrayList<String>(), deviceName, androidID,
groupId, sourceVerId, sampleRate, duration,
groupId, sourceVerId,originalName, sampleRate, duration,
recorder.getFormat(), recorder.getNumChannels(),
recorder.getBitsPerSample(), latitude, longitude,
regionOrigin, speakerName, speakerAge, gender);
......
......@@ -191,7 +191,6 @@ public class ThumbRespeakSummaryLig extends AikumaActivity implements OnClickLis
@Override
public void onClick(View v) {
Toast.makeText(this, "Record Button activates", Toast.LENGTH_SHORT).show();
Log.i(TAG, "id: " + v.getId());
if (v.getId() == okButtonId) {
try {
......
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