session.add(movie) # delete old image if old_poster_md5 and old_poster_md5 != new_poster_md5: import delete old_poster = session.query( db.Poster).filter_by(md5sum=old_poster_md5).first() if old_poster and len( old_poster.movies ) == 1: # other movies are not using the same poster session.delete(old_poster) delete.delete_poster_from_cache(old_poster_md5, self.locations['posters']) if commit(session): main_treeview.setmovie(self, movie, self.selected_iter_edit[0], self.treemodel) # close add window self.widgets['add']['window'].hide() # refresh self.treeview_clicked() self.update_statusbar(_('Movie information has been updated')) def change_rating_from_slider(self): rating = int(self.widgets['add']['rating_slider'].get_value()) self.widgets['add']['image_rating'].show() try: rimage = int(str(self.config.get('rating_image'))) except: rimage = 0
# delete old image import delete old_poster = session.query(db.Poster).filter_by(md5sum=old_poster_md5).first() if old_poster and len(old_poster.movies) == 1: # other movies are not using the same poster session.delete(old_poster) delete.delete_poster_from_cache(old_poster_md5, self.locations['posters']) else: details['poster_md5'] = new_poster_md5 update_movie_instance(movie, details, session) session.add(movie) if commit(session): treeselection = self.widgets['treeview'].get_selection() (tmp_model, tmp_iter) = treeselection.get_selected() main_treeview.setmovie(self, movie, tmp_iter, tmp_model) # close add window self.widgets['add']['window'].hide() # refresh self.treeview_clicked() self.update_statusbar(_('Movie information has been updated')) def change_rating_from_slider(self): rating = int(self.widgets['add']['rating_slider'].get_value()) self.widgets['add']['image_rating'].show() try: rimage = int(str(self.config.get('rating_image'))) except: rimage = 0
else: details['poster_md5'] = None update_movie_instance(movie, details, session) session.add(movie) # delete old image if old_poster_md5 and old_poster_md5 != new_poster_md5: import delete old_poster = session.query(db.Poster).filter_by(md5sum=old_poster_md5).first() if old_poster and len(old_poster.movies) == 1: # other movies are not using the same poster session.delete(old_poster) delete.delete_poster_from_cache(old_poster_md5, self.locations['posters']) if commit(session): main_treeview.setmovie(self, movie, self.selected_iter_edit[0], self.treemodel) # close add window self.widgets['add']['window'].hide() # refresh self.treeview_clicked() self.update_statusbar(_('Movie information has been updated')) def change_rating_from_slider(self): rating = int(self.widgets['add']['rating_slider'].get_value()) self.widgets['add']['image_rating'].show() try: rimage = int(str(self.config.get('rating_image'))) except: rimage = 0