Mercurial > pumpbridge
comparison src/google.coffee @ 27:f27ddfa42e94
try/catch; From/To/-ESN changes; google probs
author | Mathias Gebbe <mgebbe@intevation.de> |
---|---|
date | Sat, 28 Jun 2014 13:08:40 +0200 |
parents | cdbc77880565 |
children | faeb3b96bdeb |
comparison
equal
deleted
inserted
replaced
26:cdbc77880565 | 27:f27ddfa42e94 |
---|---|
50 (stream, callback) -> | 50 (stream, callback) -> |
51 return if not stream? or not stream.items? or stream.items.length is 0 | 51 return if not stream? or not stream.items? or stream.items.length is 0 |
52 async.eachLimit stream.items, 10, ((post, cb) -> | 52 async.eachLimit stream.items, 10, ((post, cb) -> |
53 async.waterfall [ | 53 async.waterfall [ |
54 (callback) -> | 54 (callback) -> |
55 console.log "check googlepost "+ post.id | 55 console.log "check googlepost " + post.id + " to " + me |
56 FromESN.search {uid: post.id + "@google_to_" + me}, callback | 56 FromESN.search {uid: post.id + "@google_to_" + me}, callback |
57 (result, callback) -> | 57 (result, callback) -> |
58 return if result.length isnt 0 | 58 if result.length isnt 0 |
59 ti = new Date().getTime() - interval | 59 return |
60 ts = Date.parse(post.published) | 60 else |
61 if (ts >= ti) | |
62 Sync.postParser post, null, 'google', callback | 61 Sync.postParser post, null, 'google', callback |
63 else | 62 #ti = new Date().getTime() - interval |
64 return | 63 #ts = Date.parse(post.published) |
64 #if (ts >= ti) | |
65 #else | |
66 # return | |
65 (parsed, callback) -> | 67 (parsed, callback) -> |
66 console.log "post googlepost "+ post.id | 68 console.log "post googlepost "+ post.id |
67 Pump.postUser bridgeid, me, parsed, callback | 69 Pump.postUser bridgeid, me, parsed, callback |
68 (pumppost, callback) -> | 70 (pumppost, callback) -> |
69 pumppost = JSON.parse(pumppost) | 71 pumppost = JSON.parse(pumppost) |