diff --git a/couchpotato/core/plugins/status/main.py b/couchpotato/core/plugins/status/main.py index 338749d6f1821445a89730048e5a4847f3cef0d1..c01caef59778cade6a827b4854504ada24fc91ee 100644 --- a/couchpotato/core/plugins/status/main.py +++ b/couchpotato/core/plugins/status/main.py @@ -23,6 +23,7 @@ class StatusPlugin(Plugin): 'deleted': 'Deleted', 'ignored': 'Ignored', 'available': 'Available', + 'suggest': 'Suggest', } def __init__(self): diff --git a/couchpotato/core/plugins/suggestion/main.py b/couchpotato/core/plugins/suggestion/main.py index 7a65a0156081c4f3dd8a69d59f5a3f02c044ad19..2c31ca32ad2047cbfc4be5fcb4abd3c52cc148fc 100644 --- a/couchpotato/core/plugins/suggestion/main.py +++ b/couchpotato/core/plugins/suggestion/main.py @@ -1,6 +1,22 @@ +from couchpotato.api import addApiView +from couchpotato.core.event import fireEvent +from couchpotato.core.helpers.request import jsonified, getParam from couchpotato.core.plugins.base import Plugin class Suggestion(Plugin): - pass + def __init__(self): + addApiView('suggestion.view', self.getView) + + def getView(self): + + limit_offset = getParam('limit_offset', None) + total_movies, movies = fireEvent('movie.list', status = 'suggest', limit_offset = limit_offset, single = True) + + return jsonified({ + 'success': True, + 'empty': len(movies) == 0, + 'total': total_movies, + 'movies': movies, + }) diff --git a/couchpotato/core/providers/movie/couchpotatoapi/main.py b/couchpotato/core/providers/movie/couchpotatoapi/main.py index 87586847e0364f56a8a6d5efa6151d16e02cd7fd..fc16e8abbbb32525cae1c68d53226bee80db9dc4 100644 --- a/couchpotato/core/providers/movie/couchpotatoapi/main.py +++ b/couchpotato/core/providers/movie/couchpotatoapi/main.py @@ -17,7 +17,7 @@ class CouchPotatoApi(MovieProvider): 'info': 'https://couchpota.to/api/info/%s/', 'is_movie': 'https://couchpota.to/api/ismovie/%s/', 'eta': 'https://couchpota.to/api/eta/%s/', - 'suggest': 'https://couchpota.to/api/suggest/%s/%s/', + 'suggest': 'https://couchpota.to/api/suggest/', } http_time_between_calls = 0 api_version = 1 @@ -28,6 +28,7 @@ class CouchPotatoApi(MovieProvider): addEvent('movie.info', self.getInfo, priority = 1) addEvent('movie.search', self.search, priority = 1) addEvent('movie.release_date', self.getReleaseDate) + addEvent('movie.suggest', self.suggest) addEvent('movie.is_movie', self.isMovie) def search(self, q, limit = 12): @@ -63,8 +64,10 @@ class CouchPotatoApi(MovieProvider): return dates def suggest(self, movies = [], ignore = []): - - suggestions = self.getJsonData(self.urls['suggest'] % (','.join(movies), ','.join(ignore))) + suggestions = self.getJsonData(self.urls['suggest'], params = { + 'movies': ','.join(movies), + #'ignore': ','.join(ignore), + }) log.info('Found Suggestions for %s', (suggestions)) return suggestions diff --git a/couchpotato/static/scripts/page/soon.js b/couchpotato/static/scripts/page/soon.js deleted file mode 100644 index eeef446c8202757bd46bff10c4c8677af2fba344..0000000000000000000000000000000000000000 --- a/couchpotato/static/scripts/page/soon.js +++ /dev/null @@ -1,8 +0,0 @@ -Page.Soon = new Class({ - - Extends: PageBase, - - name: 'soon', - title: 'Which wanted movies are released soon?' - -}) \ No newline at end of file