diff --git a/index.html b/index.html
index e1cfe47c..d9e1a0a8 100644
--- a/index.html
+++ b/index.html
@@ -5,7 +5,7 @@
-
+
@@ -20,7 +20,7 @@
Popcorn Time
-
+
@@ -31,7 +31,7 @@
Popcorn Time
Movies
@@ -85,8 +85,14 @@ <%= title %>
<%= runtime %> <%= i18n.__('durationUnit') %>
<% } %>
+
+ <% if (this.model.get('ageRating')) { %>
+
+ <%= ageRating %>
+
+ <% } %>
-
+
<% var p_rating = this.model.get('voteAverage') ? this.model.get('voteAverage').toFixed(1) : 0.0 %>
@@ -143,7 +149,7 @@ <%= i18n.__('subtitledIn') %>
-
+
@@ -153,7 +159,7 @@
<%= i18n.__('subtitledIn') %>
-
+
diff --git a/js/frontend/models/movie.js b/js/frontend/models/movie.js
index 3483d571..ce1cd43b 100644
--- a/js/frontend/models/movie.js
+++ b/js/frontend/models/movie.js
@@ -1,7 +1,7 @@
App.Model.Movie = Backbone.Model.extend({
buildBasicView: function () {
-
+
var model = this;
// This is mostly used for reporting
@@ -11,7 +11,7 @@ App.Model.Movie = Backbone.Model.extend({
model.view = new App.View.MovieListItem({
model: model
});
-
+
model.trigger('rottenloaded');
},
@@ -20,7 +20,7 @@ App.Model.Movie = Backbone.Model.extend({
var model = this;
App.findMovieInfo(model.get('imdb'), function (data) {
-
+
model.set('infoLoaded', true);
model.set('image', data.image);
model.set('bigImage', data.image);
@@ -57,9 +57,26 @@ App.Model.Movie = Backbone.Model.extend({
this.buildBasicView();
//this.setRottenInfo();
//this.setSubtitles();
+ this.getAgeRating();
this.calculateTorrentHealth();
},
+ getAgeRating: function() {
+ // Requests the MPAA rating of the movie
+
+ var model = this;
+ var rating_url = 'http://www.omdbapi.com/?i=' + model.get('imdb');
+ var request = require("request");
+
+ request(rating_url, function(error, response, body) {
+ if (!error) {
+ model.set('ageRating', JSON.parse(body).Rated);
+ } else {
+ console.log(error);
+ }
+ });
+ },
+
calculateTorrentHealth: function () {
// Calculates the "health" of the torrent (how easy it is to stream)
var seeders = this.get('seeders');
@@ -91,4 +108,4 @@ App.Model.Movie = Backbone.Model.extend({
}
}
-});
\ No newline at end of file
+});