Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Commit

Permalink
Fix casting multi-lang support
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnault committed May 21, 2015
1 parent c2c983c commit a172c42
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions lib/projection.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,17 @@ Projection.prototype.findMovie = function(near, movie, options, callback) {

var content = m.find('.desc .info').not('.info.links').html().split('<br>');

var persons = $(content[1]).text();
//console.log(persons);
var categories = persons.split(' - ');
var director = categories[0].replace('Director: ', ''); // TODO must be multi-lang
var cast = categories[1].replace('Cast: ', '').split(', ');

var infos = formatInfos(content[0].split(' - '));

var persons = $('<div>' + content[1] + '</div>');//.text();

var director = persons.find('span[itemprop="director"]').text().trim();

var cast = [];
persons.find('span[itemprop="actors"]').each(function(gg, a) {
cast.push($(a).text().trim());
});

var trailer = null;
if (m.find('.info a').attr('href') && (m.find('.info a').attr('href').match(/(youtube|vimeo|daily)/))) {
trailer = m.find('.info a').attr('href').replace('/url?q=', '').trim();
Expand Down Expand Up @@ -184,12 +187,12 @@ var formatShowtimes = function(showtimes) {
});
};

// var p = new Projection();
var p = new Projection();
// p.findTheaters('Sherbrooke', {}, function(err, theaters) {
// console.log(theaters[2].movies[0]);
// });
// p.findMovie('Sherbrooke', 'Mad Max', { hl:'fr'}, function(err, movie) {
// console.log(movie);
// });
p.findMovie('Sherbrooke', 'Mad Max', { hl:'fr'}, function(err, movie) {
console.log(movie);
});

module.exports = Projection;

0 comments on commit a172c42

Please sign in to comment.