Mass refresh movies

This commit is contained in:
Ruud
2012-05-05 02:11:03 +02:00
parent efe554d723
commit bc3d00c206
4 changed files with 36 additions and 10 deletions
+10 -10
View File
@@ -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,
@@ -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;
@@ -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;
}
@@ -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)