2011-05-24 20:04:48 +00:00
|
|
|
var startTime = new Date();
|
|
|
|
|
2011-05-23 20:35:35 +00:00
|
|
|
$(function() {
|
|
|
|
var savePath = '';
|
|
|
|
$('#saveLocationBtn').click(function() {
|
2011-05-24 20:04:48 +00:00
|
|
|
savePath = mozillaSelectFolder().file.path;
|
|
|
|
// alert(savePath.file.path);
|
2011-05-23 20:35:35 +00:00
|
|
|
});
|
|
|
|
$('#selectAudioFile').click(function() {
|
2011-05-24 20:04:48 +00:00
|
|
|
if (savePath === '') { alert("Please select a save location first."); return false; }
|
2011-05-23 20:35:35 +00:00
|
|
|
fil = selectFile();
|
2011-05-24 20:04:48 +00:00
|
|
|
// alert(savePath);
|
|
|
|
var destName = getDateString(startTime) + ".mp3";
|
|
|
|
mozillaCopyFile(fil.file.path, savePath, destName);
|
|
|
|
});
|
|
|
|
$('#saveFormData').click(function() {
|
|
|
|
if (savePath === '') { alert("Please select a save location first."); return false; }
|
|
|
|
var arr = $('#metadataForm').serializeArray();
|
|
|
|
var s = JSON.stringify(arr);
|
|
|
|
// alert(s);
|
|
|
|
var destFilePath = savePath + "/" + getDateString(startTime) + ".json";
|
|
|
|
// alert(destFilePath);
|
|
|
|
mozillaSaveFile(destFilePath, s);
|
|
|
|
alert("saved " + destFilePath);
|
2011-05-23 20:35:35 +00:00
|
|
|
});
|
|
|
|
});
|
2011-05-24 20:04:48 +00:00
|
|
|
|
|
|
|
function getDateString(dateObj) {
|
|
|
|
return dateObj.toUTCString().replace(",", "").replace(":", ".");
|
|
|
|
}
|