summaryrefslogtreecommitdiffstats
path: root/lib/helpers.js
diff options
context:
space:
mode:
authoremartin <emartin@transperfect.com>2014-07-04 13:43:52 +0100
committeremartin <emartin@transperfect.com>2014-07-04 13:43:52 +0100
commitb04c657aa31f22590fcf7f6d467c559f6c5ca75e (patch)
tree19b0b744bde91145078e6187ea38212b534b3a8e /lib/helpers.js
parent0ea1ccee54e09291d5f521b3e35cda91d96d6cb5 (diff)
downloadpopcorn-api-b04c657aa31f22590fcf7f6d467c559f6c5ca75e.zip
popcorn-api-b04c657aa31f22590fcf7f6d467c559f6c5ca75e.tar.gz
popcorn-api-b04c657aa31f22590fcf7f6d467c559f6c5ca75e.tar.bz2
If a show exists, make sure to get new ratings and status. Right now the ratings never change once the show is in the db
Diffstat (limited to 'lib/helpers.js')
-rwxr-xr-xlib/helpers.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/helpers.js b/lib/helpers.js
index 620e7cf..6af825c 100755
--- a/lib/helpers.js
+++ b/lib/helpers.js
@@ -261,8 +261,16 @@ var helpers = {
console.log("TTL expired, updating info");
show.imdb_id = doc.imdb_id;
//TODO: Change this to just get new rating or something
- helpers.extractShowInfo(show, function(err, show) {
- return callback(err, show);
+ trakt.request('show', 'summary', {title: slug}, function(err, data) {
+ if (!err && data) {
+ Show.update({ _id: doc._id },
+ { $set: { rating: data.ratings, status: data.status}},
+ function(err, doc1) {
+ helpers.extractShowInfo(show, function(err, show) {
+ return callback(err, show);
+ });
+ });
+ }
});
}
else {