diff --git a/couchpotato/core/plugins/movie/main.py b/couchpotato/core/plugins/movie/main.py index fbad4713..314f7702 100644 --- a/couchpotato/core/plugins/movie/main.py +++ b/couchpotato/core/plugins/movie/main.py @@ -60,7 +60,7 @@ class MoviePlugin(Plugin): addApiView('movie.refresh', self.refresh, docs = { 'desc': 'Refresh a movie by id', 'params': { - 'id': {'desc': 'The id of the movie that needs to be refreshed'}, + 'id': {'desc': 'Movie ID(s) you want to refresh.', 'type': 'int (comma separated)'}, } }) addApiView('movie.available_chars', self.charView) @@ -232,19 +232,19 @@ class MoviePlugin(Plugin): def refresh(self): - params = getParams() db = get_session() - movie = db.query(Movie).filter_by(id = params.get('id')).first() + for id in getParam('id').split(','): + movie = db.query(Movie).filter_by(id = id).first() - # Get current selected title - default_title = '' - for title in movie.library.titles: - if title.default: default_title = title.title + # Get current selected title + default_title = '' + for title in movie.library.titles: + if title.default: default_title = title.title - if movie: - fireEventAsync('library.update', identifier = movie.library.identifier, default_title = default_title, force = True) - fireEventAsync('searcher.single', movie.to_dict(self.default_dict)) + if movie: + fireEventAsync('library.update', identifier = movie.library.identifier, default_title = default_title, force = True) + fireEventAsync('searcher.single', movie.to_dict(self.default_dict)) return jsonified({ 'success': True, diff --git a/couchpotato/core/plugins/movie/static/list.js b/couchpotato/core/plugins/movie/static/list.js index becdc141..12d931a3 100644 --- a/couchpotato/core/plugins/movie/static/list.js +++ b/couchpotato/core/plugins/movie/static/list.js @@ -144,6 +144,15 @@ var MovieList = new Class({ 'click': self.deleteSelected.bind(self) } }) + ), + new Element('div.refresh').adopt( + new Element('span[text=or]'), + new Element('a.button.green', { + 'text': 'Refresh', + 'events': { + 'click': self.refreshSelected.bind(self) + } + }) ) ) ).inject(self.el, 'top'); @@ -292,6 +301,17 @@ var MovieList = new Class({ }); }, + refreshSelected: function(){ + var self = this; + var ids = self.getSelectedMovies() + + Api.request('movie.refresh', { + 'data': { + 'id': ids.join(','), + } + }); + }, + getSelectedMovies: function(){ var self = this; diff --git a/couchpotato/core/plugins/movie/static/movie.css b/couchpotato/core/plugins/movie/static/movie.css index a6f7e4cd..6365f798 100644 --- a/couchpotato/core/plugins/movie/static/movie.css +++ b/couchpotato/core/plugins/movie/static/movie.css @@ -456,11 +456,13 @@ padding: 3px 7px; } + .movies .alph_nav .mass_edit_form .refresh, .movies .alph_nav .mass_edit_form .delete { float: left; padding: 8px 0 0 8px; } + .movies .alph_nav .mass_edit_form .refresh span, .movies .alph_nav .mass_edit_form .delete span { margin: 0 10px 0 0; } diff --git a/couchpotato/core/plugins/searcher/main.py b/couchpotato/core/plugins/searcher/main.py index e2642dcb..f610dfde 100644 --- a/couchpotato/core/plugins/searcher/main.py +++ b/couchpotato/core/plugins/searcher/main.py @@ -65,6 +65,10 @@ class Searcher(Plugin): def single(self, movie): + if not movie['profile']: + log.debug('Movie does\'nt have a profile, assuming in manage tab.') + return + db = get_session() pre_releases = fireEvent('quality.pre_releases', single = True)