Mercurial > MadButterfly
comparison nodejs/examples/mce/epg.js @ 1122:3d438daea48c
Add the handler for the next page
author | wycc |
---|---|
date | Thu, 09 Dec 2010 07:47:14 +0800 |
parents | eb3719020866 |
children | 9f3f20c4a4fb |
comparison
equal
deleted
inserted
replaced
1121:e030c9d4b79b | 1122:3d438daea48c |
---|---|
26 sys.puts("connected"); | 26 sys.puts("connected"); |
27 res.on('data',function (data) { | 27 res.on('data',function (data) { |
28 js = js + data; | 28 js = js + data; |
29 }); | 29 }); |
30 res.on('end', function () { | 30 res.on('end', function () { |
31 res = JSON.parse(js); | 31 try { |
32 res = JSON.parse(js); | |
33 } catch(e) { | |
34 sys.puts(e); | |
35 sys.puts(js); | |
36 } | |
32 sys.puts("parsed"); | 37 sys.puts("parsed"); |
33 self.onLoad(res); | 38 self.onLoad(res); |
34 | 39 |
35 }); | 40 }); |
36 }); | 41 }); |
117 }); | 122 }); |
118 res.on('end',function() { | 123 res.on('end',function() { |
119 fs.close(f); | 124 fs.close(f); |
120 var fields = cachepath.split('.'); | 125 var fields = cachepath.split('.'); |
121 var ext = fields.pop(); | 126 var ext = fields.pop(); |
122 if (ext != "png") { | 127 if (ext != "png" && ext != 'jpg') { |
123 fields.push("png"); | 128 fields.push("png"); |
124 newf = fields.join("."); | 129 newf = fields.join("."); |
125 sys.puts("cachepath="+cachepath+" newf="+newf); | 130 sys.puts("cachepath="+cachepath+" newf="+newf); |
126 os.spawn("convert",[cachepath,newf]); | 131 os.spawn("convert",[cachepath,newf]); |
127 } else { | 132 } else { |