[qcineoob] persons in common implemented in movie page
This commit is contained in:
parent
f87a8a685f
commit
74b0b231f1
3 changed files with 94 additions and 2 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>645</width>
|
||||
<height>600</height>
|
||||
<width>655</width>
|
||||
<height>733</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
|
@ -141,6 +141,52 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_15">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="personsInCommonButton">
|
||||
<property name="text">
|
||||
<string>Search persons in common with</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Movie ID :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="personsInCommonEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue