导入evernote <en-media问题

This commit is contained in:
life
2015-04-06 20:12:56 +08:00
parent b0601eeb53
commit 9e57a77281
2 changed files with 14 additions and 4 deletions

9
src/node_modules/file.js generated vendored
View File

@@ -37,6 +37,7 @@ var File = {
var filename = Common.uuid() + '.' + type; var filename = Common.uuid() + '.' + type;
if(isImage) { if(isImage) {
var basePath = User.getCurUserImagesPath(); var basePath = User.getCurUserImagesPath();
} else { } else {
var basePath = User.getCurUserAttachsPath(); var basePath = User.getCurUserAttachsPath();
} }
@@ -86,10 +87,11 @@ var File = {
} }
}); });
*/ */
// console.log(txtPath);
// console.log(filePath);
Common.cmd([txtPath, filePath], function(code) { Common.cmd([txtPath, filePath], function(code) {
console.log('子进程已关闭,代码:' + code); // console.log('子进程已关闭,代码:' + code);
fs.unlink(txtPath); // fs.unlink(txtPath);
if(!code) { if(!code) {
try { try {
if(isImage) { if(isImage) {
@@ -101,6 +103,7 @@ var File = {
me._addAttach(filePath, fileTitle, callback) me._addAttach(filePath, fileTitle, callback)
} }
} catch(e) { } catch(e) {
console.log(e);
callback(false); callback(false);
} }
} else { } else {

9
src/node_modules/import.js generated vendored
View File

@@ -36,7 +36,7 @@ var Import = {
if(!content) { if(!content) {
return ''; return '';
} }
var reg = new RegExp("<en\-media(.*?)\/>", "g"); var reg = new RegExp("<en\-media(.*?)\/*>", "g"); // <en-media /> <en-media></en-media>
var i = 0; var i = 0;
// console.log(content); // console.log(content);
while(ret = reg.exec(content)) { while(ret = reg.exec(content)) {
@@ -59,6 +59,10 @@ var Import = {
}; };
}; };
// 如果是<en-media></en-media>, </en-media>匹配不到
content = content.replace(/<\/en-media>/g, '');
return content; return content;
}, },
@@ -83,6 +87,9 @@ var Import = {
var resources = note['resource'] || []; var resources = note['resource'] || [];
var parsedRes = []; var parsedRes = [];
var attachs = []; var attachs = [];
console.log("-----------")
console.log(note);
console.log(resources);
async.eachSeries(resources, function(res, cb) { async.eachSeries(resources, function(res, cb) {
// console.log(res['data'][0]['$']); // console.log(res['data'][0]['$']);
/* /*