Browse Source

Suggestion & Charts cleanup

pull/5287/head
Ruud 10 years ago
parent
commit
dee84c0493
  1. 9
      couchpotato/core/media/movie/charts/__init__.py
  2. 34
      couchpotato/core/media/movie/charts/static/charts.js
  3. 2
      couchpotato/core/media/movie/providers/automation/bluray.py
  4. 2
      couchpotato/core/media/movie/providers/automation/imdb.py
  5. 24
      couchpotato/core/media/movie/suggestion.py
  6. 28
      couchpotato/static/scripts/combined.plugins.min.js

9
couchpotato/core/media/movie/charts/__init__.py

@ -14,14 +14,7 @@ config = [{
'type': 'list',
'name': 'charts_providers',
'tab': 'display',
'options': [
{
'name': 'max_items',
'default': 5,
'type': 'int',
'description': 'Maximum number of items displayed from each chart.',
},
],
'options': [],
},
],
}]

34
couchpotato/core/media/movie/charts/static/charts.js

@ -14,28 +14,8 @@ var Charts = new Class({
create: function(){
var self = this;
self.el = new Element('div.charts').adopt(
self.el_no_charts_enabled = new Element('p.no_charts_enabled', {
'html': 'Hey, it looks like you have no charts enabled at the moment. If you\'d like some great movie suggestions you can go to <a href="' + App.createUrl('settings/display') + '">settings</a> and turn on some charts of your choice.'
}),
self.el_refresh_container = new Element('div.refresh').adopt(
self.el_refresh_link = new Element('a.refresh.icon2', {
'href': '#',
'events': {
'click': function(e) {
e.preventDefault();
self.el.getElements('.chart').destroy();
self.el_refreshing_text.show();
self.el_refresh_link.hide();
self.api_request = Api.request('charts.view', {
'data': { 'force_update': 1 },
'onComplete': self.fill.bind(self)
});
}
}
}),
self.el = new Element('div.charts').grab(
self.el_refresh_container = new Element('div.refresh').grab(
self.el_refreshing_text = new Element('span.refreshing', {
'text': 'Refreshing charts...'
})
@ -52,16 +32,8 @@ var Charts = new Class({
var self = this;
self.el_refreshing_text.hide();
self.el_refresh_link.show();
if(!json || json.count === 0){
self.el_no_charts_enabled.show();
self.el_refresh_link.show();
self.el_refreshing_text.hide();
}
else {
self.el_no_charts_enabled.hide();
if(json && json.count > 0){
json.charts.sort(function(a, b) {
return a.order - b.order;
});

2
couchpotato/core/media/movie/providers/automation/bluray.py

@ -116,7 +116,7 @@ class Bluray(Automation, RSS):
if not movie_list['list']:
movie_ids = []
max_items = int(self.conf('max_items', section='charts', default=5))
max_items = 10
rss_movies = self.getRSSData(self.rss_url)
for movie in rss_movies:

2
couchpotato/core/media/movie/providers/automation/imdb.py

@ -181,7 +181,7 @@ class IMDBCharts(IMDBBase):
def getChartList(self):
# Nearly identical to 'getIMDBids', but we don't care about minimalMovie and return all movie data (not just id)
movie_lists = []
max_items = int(self.conf('max_items', section = 'charts', default=5))
max_items = 10
for name in self.charts:
chart = self.charts[name].copy()

24
couchpotato/core/media/movie/suggestion.py

@ -23,6 +23,11 @@ class Suggestion(Plugin):
addEvent('app.load', test)
def suggestView(self, limit = 6, **kwargs):
if self.isDisabled():
return {
'success': True,
'movies': []
}
movies = splitString(kwargs.get('movies', ''))
ignored = splitString(kwargs.get('ignored', ''))
@ -139,3 +144,22 @@ class Suggestion(Plugin):
self.setCache('suggestion_cached', new_suggestions, timeout = 3024000)
return new_suggestions
config = [{
'name': 'suggestion',
'groups': [
{
'label': 'Suggestions',
'description': 'Displays suggestions on the home page',
'name': 'suggestions',
'tab': 'display',
'options': [
{
'name': 'enabled',
'default': True,
'type': 'enabler',
},
],
},
],
}]

28
couchpotato/static/scripts/combined.plugins.min.js

@ -2351,25 +2351,7 @@ var Charts = new Class({
},
create: function() {
var self = this;
self.el = new Element("div.charts").adopt(self.el_no_charts_enabled = new Element("p.no_charts_enabled", {
html: "Hey, it looks like you have no charts enabled at the moment. If you'd like some great movie suggestions you can go to <a href=\"" + App.createUrl("settings/display") + '">settings</a> and turn on some charts of your choice.'
}), self.el_refresh_container = new Element("div.refresh").adopt(self.el_refresh_link = new Element("a.refresh.icon2", {
href: "#",
events: {
click: function(e) {
e.preventDefault();
self.el.getElements(".chart").destroy();
self.el_refreshing_text.show();
self.el_refresh_link.hide();
self.api_request = Api.request("charts.view", {
data: {
force_update: 1
},
onComplete: self.fill.bind(self)
});
}
}
}), self.el_refreshing_text = new Element("span.refreshing", {
self.el = new Element("div.charts").grab(self.el_refresh_container = new Element("div.refresh").grab(self.el_refreshing_text = new Element("span.refreshing", {
text: "Refreshing charts..."
})));
self.show();
@ -2378,13 +2360,7 @@ var Charts = new Class({
fill: function(json) {
var self = this;
self.el_refreshing_text.hide();
self.el_refresh_link.show();
if (!json || json.count === 0) {
self.el_no_charts_enabled.show();
self.el_refresh_link.show();
self.el_refreshing_text.hide();
} else {
self.el_no_charts_enabled.hide();
if (json && json.count > 0) {
json.charts.sort(function(a, b) {
return a.order - b.order;
});

Loading…
Cancel
Save