Skip to content
This repository was archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #904 from duckduckgo/jag/movie-fix
Browse files Browse the repository at this point in the history
Movie: Similar fix to #903
  • Loading branch information
Jag Talon committed Jun 24, 2014
2 parents 844dcd6 + d8cfb61 commit f34f388
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions share/spice/movie/movie.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
(function(env) {
"use strict";

// A change in the Rotten Tomatoes API returns images that end in _tmb.
// This changes this to _det.
function toDetail(img) {
return img.replace(/tmb\.jpg$/, "det.jpg");
}

env.ddg_spice_movie = function(api_result) {

Expand Down Expand Up @@ -30,15 +35,16 @@
position = "-272px -144px";
}

var image = toDetail(item.posters.detailed);
return {
rating: Math.max(item.ratings.critics_score / 20, 0),
image: item.posters.detailed,
image: image,
icon_url: DDG.get_asset_path('movie','icons-v2.png'),
icon_image: position,
icon_class: position ? 'tomato--icon' : "",
abstract: Handlebars.helpers.ellipsis(item.synopsis || item.critics_consensus, 200),
heading: item.title,
img_m: item.posters.detailed,
img_m: image,
url: item.links.alternate
};
},
Expand All @@ -65,7 +71,7 @@
],
primary: [
{ key: 'title' },
{ key: 'posters.detailed', match: /_det\.jpg$/, strict: false }
{ key: 'posters.detailed', match: /\.jpg$/, strict: false }
]
}
});
Expand Down

0 comments on commit f34f388

Please sign in to comment.