diff --git a/weboob/applications/qcineoob/main_window.py b/weboob/applications/qcineoob/main_window.py index 0e1748a7..d0faab77 100644 --- a/weboob/applications/qcineoob/main_window.py +++ b/weboob/applications/qcineoob/main_window.py @@ -102,6 +102,42 @@ class Result(QFrame): self.process.do('iter_movie_persons', id, role, backends=backend_name, caps=CapCinema) self.parent.ui.stopButton.show() + def personsInCommonAction(self, backend_name, id1, id2): + self.ui.stackedWidget.setCurrentWidget(self.ui.list_page) + for mini in self.minis: + self.ui.list_content.layout().removeWidget(mini) + mini.hide() + mini.deleteLater() + + self.minis = [] + self.parent.ui.searchEdit.setEnabled(False) + QApplication.setOverrideCursor(Qt.WaitCursor) + + for a_backend in self.weboob.iter_backends(): + if (backend_name and a_backend.name == backend_name): + backend = a_backend + movie1 = backend.get_movie(id1) + movie2 = backend.get_movie(id2) + + lid1 = [] + for p in backend.iter_movie_persons_ids(id1): + lid1.append(p) + lid2 = [] + for p in backend.iter_movie_persons_ids(id2): + lid2.append(p) + + inter = list(set(lid1) & set(lid2)) + + for common in inter: + person = backend.get_person(common) + person.backend = backend_name + role1 = movie1.get_role_by_person_id(person.id) + role2 = movie2.get_role_by_person_id(person.id) + person.short_description = '%s in %s ; %s in %s'%(role1, movie1.original_title, role2, movie2.original_title) + self.addPerson(person) + + self.processFinished() + def filmographyAction(self, backend_name, id, role): self.ui.stackedWidget.setCurrentWidget(self.ui.list_page) for mini in self.minis: diff --git a/weboob/applications/qcineoob/movie.py b/weboob/applications/qcineoob/movie.py index 71f61e7e..e4176689 100644 --- a/weboob/applications/qcineoob/movie.py +++ b/weboob/applications/qcineoob/movie.py @@ -40,6 +40,7 @@ class Movie(QFrame): self.connect(self.ui.castingButton, SIGNAL("clicked()"), self.casting) self.connect(self.ui.torrentButton, SIGNAL("clicked()"), self.searchTorrent) self.connect(self.ui.subtitleButton, SIGNAL("clicked()"), self.searchSubtitle) + self.connect(self.ui.personsInCommonButton, SIGNAL("clicked()"), self.personsInCommon) self.movie = movie self.backend = backend @@ -122,3 +123,12 @@ class Movie(QFrame): role_desc = ' as %s' % role self.parent.doAction('Casting%s of movie "%s"' % (role_desc, self.movie.original_title), self.parent.castingAction, [self.backend.name, self.movie.id, role]) + + def personsInCommon(self): + my_id = self.movie.id + my_title = self.movie.original_title + other_id = unicode(self.ui.personsInCommonEdit.text()).split('@')[0] + other_movie = self.backend.get_movie(other_id) + other_title = other_movie.original_title + desc = 'Persons in common %s, %s'%(my_title, other_title) + self.parent.doAction(desc, self.parent.personsInCommonAction, [self.backend.name, my_id, other_id]) diff --git a/weboob/applications/qcineoob/ui/movie.ui b/weboob/applications/qcineoob/ui/movie.ui index 765a7d6a..ca7f0cc0 100644 --- a/weboob/applications/qcineoob/ui/movie.ui +++ b/weboob/applications/qcineoob/ui/movie.ui @@ -6,8 +6,8 @@ 0 0 - 645 - 600 + 655 + 733 @@ -141,6 +141,52 @@ + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Search persons in common with + + + + + + + + + + 0 + 0 + + + + Movie ID : + + + + + + + + 0 + 0 + + + + + + + + +