[qcineoob] role selection improved in filmography and casting
This commit is contained in:
parent
63c769305d
commit
251f863c0b
4 changed files with 33 additions and 38 deletions
|
|
@ -231,7 +231,7 @@ class AllocineBrowser(BaseBrowser):
|
|||
person.thumbnail_url = thumbnail_url
|
||||
return person
|
||||
|
||||
def iter_movie_persons(self, movie_id, role):
|
||||
def iter_movie_persons(self, movie_id, role_filter):
|
||||
res = self.readurl(
|
||||
'http://api.allocine.fr/rest/v3/movie?partner=YW5kcm9pZC12M3M&code=%s&profile=large&mediafmt=mp4-lc&format=json&filter=movie&striptags=synopsis,synopsisshort' % movie_id)
|
||||
if res is not None:
|
||||
|
|
@ -240,26 +240,27 @@ class AllocineBrowser(BaseBrowser):
|
|||
return
|
||||
if 'castMember' in jres:
|
||||
for cast in jres['castMember']:
|
||||
id = cast['person']['code']
|
||||
name = unicode(cast['person']['name'])
|
||||
short_description = unicode(cast['activity']['$'])
|
||||
if 'role' in cast:
|
||||
short_description += ', %s' % cast['role']
|
||||
thumbnail_url = NotAvailable
|
||||
if 'picture' in cast:
|
||||
thumbnail_url = unicode(cast['picture']['href'])
|
||||
person = Person(id, name)
|
||||
person.short_description = short_description
|
||||
person.real_name = NotLoaded
|
||||
person.birth_place = NotLoaded
|
||||
person.birth_date = NotLoaded
|
||||
person.death_date = NotLoaded
|
||||
person.gender = NotLoaded
|
||||
person.nationality = NotLoaded
|
||||
person.short_biography = NotLoaded
|
||||
person.roles = NotLoaded
|
||||
person.thumbnail_url = thumbnail_url
|
||||
yield person
|
||||
if (role_filter is None or (role_filter is not None and cast['activity']['$'].lower().strip() == role_filter.lower().strip())):
|
||||
id = cast['person']['code']
|
||||
name = unicode(cast['person']['name'])
|
||||
short_description = unicode(cast['activity']['$'])
|
||||
if 'role' in cast:
|
||||
short_description += ', %s' % cast['role']
|
||||
thumbnail_url = NotAvailable
|
||||
if 'picture' in cast:
|
||||
thumbnail_url = unicode(cast['picture']['href'])
|
||||
person = Person(id, name)
|
||||
person.short_description = short_description
|
||||
person.real_name = NotLoaded
|
||||
person.birth_place = NotLoaded
|
||||
person.birth_date = NotLoaded
|
||||
person.death_date = NotLoaded
|
||||
person.gender = NotLoaded
|
||||
person.nationality = NotLoaded
|
||||
person.short_biography = NotLoaded
|
||||
person.roles = NotLoaded
|
||||
person.thumbnail_url = thumbnail_url
|
||||
yield person
|
||||
|
||||
def iter_person_movies(self, person_id, role_filter):
|
||||
res = self.readurl(
|
||||
|
|
@ -269,7 +270,7 @@ class AllocineBrowser(BaseBrowser):
|
|||
else:
|
||||
return
|
||||
for m in jres['participation']:
|
||||
if (role_filter is None or (role_filter is not None and m['activity']['$'].lower().strip() == role_filter)):
|
||||
if (role_filter is None or (role_filter is not None and m['activity']['$'].lower().strip() == role_filter.lower().strip())):
|
||||
prod_year = '????'
|
||||
if 'productionYear' in m['movie']:
|
||||
prod_year = m['movie']['productionYear']
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ class MainWindow(QtMainWindow):
|
|||
self.ui.backButton.setToolTip(self.action_history['action_list'][-1]['description'])
|
||||
return todo['function'](*todo['args'])
|
||||
|
||||
def castingAction(self, id, role):
|
||||
def castingAction(self, backend_name, id, role):
|
||||
self.ui.stackedWidget.setCurrentWidget(self.ui.list_page)
|
||||
for mini in self.minis:
|
||||
self.ui.list_content.layout().removeWidget(mini)
|
||||
|
|
@ -186,13 +186,11 @@ class MainWindow(QtMainWindow):
|
|||
self.ui.searchEdit.setEnabled(False)
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
|
||||
backend_name = str(self.ui.backendEdit.itemData(self.ui.backendEdit.currentIndex()).toString())
|
||||
|
||||
self.process = QtDo(self.weboob, self.addPerson)
|
||||
self.process.do('iter_movie_persons', id, role, backends=backend_name, caps=ICapCinema)
|
||||
self.ui.stopButton.show()
|
||||
|
||||
def filmographyAction(self, id, role):
|
||||
def filmographyAction(self, backend_name, id, role):
|
||||
self.ui.stackedWidget.setCurrentWidget(self.ui.list_page)
|
||||
for mini in self.minis:
|
||||
self.ui.list_content.layout().removeWidget(mini)
|
||||
|
|
@ -203,8 +201,6 @@ class MainWindow(QtMainWindow):
|
|||
self.ui.searchEdit.setEnabled(False)
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
|
||||
backend_name = str(self.ui.backendEdit.itemData(self.ui.backendEdit.currentIndex()).toString())
|
||||
|
||||
self.process = QtDo(self.weboob, self.addMovie)
|
||||
self.process.do('iter_person_movies', id, role, backends=backend_name, caps=ICapCinema)
|
||||
self.ui.stopButton.show()
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ from PyQt4.QtGui import QFrame, QImage, QPixmap
|
|||
from weboob.applications.qcineoob.ui.movie_ui import Ui_Movie
|
||||
from weboob.capabilities.base import empty
|
||||
from weboob.applications.suboob.suboob import LANGUAGE_CONV
|
||||
from weboob.applications.cineoob.cineoob import ROLE_LIST
|
||||
|
||||
|
||||
class Movie(QFrame):
|
||||
|
|
@ -83,8 +82,8 @@ class Movie(QFrame):
|
|||
self.ui.noteLabel.setText('%s' % movie.note)
|
||||
else:
|
||||
self.ui.noteLabel.parent().hide()
|
||||
for role in ROLE_LIST:
|
||||
self.ui.castingCombo.addItem('%ss' % role)
|
||||
for role in movie.roles.keys():
|
||||
self.ui.castingCombo.addItem('%s' % role)
|
||||
|
||||
self.ui.verticalLayout.setAlignment(Qt.AlignTop)
|
||||
self.ui.verticalLayout_2.setAlignment(Qt.AlignTop)
|
||||
|
|
@ -117,10 +116,10 @@ class Movie(QFrame):
|
|||
|
||||
def casting(self):
|
||||
role = None
|
||||
tosearch = self.ui.castingCombo.currentText()
|
||||
tosearch = unicode(self.ui.castingCombo.currentText())
|
||||
role_desc = ''
|
||||
if tosearch != 'all':
|
||||
role = tosearch[:-1]
|
||||
role = tosearch
|
||||
role_desc = ' as %s' % role
|
||||
self.parent.doAction('Casting%s of movie "%s"' % (role_desc, self.movie.original_title),
|
||||
self.parent.castingAction, [self.movie.id, role])
|
||||
self.parent.castingAction, [self.backend.name, self.movie.id, role])
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ from PyQt4.QtGui import QFrame, QImage, QPixmap, QApplication
|
|||
|
||||
from weboob.applications.qcineoob.ui.person_ui import Ui_Person
|
||||
from weboob.capabilities.base import empty
|
||||
from weboob.applications.cineoob.cineoob import ROLE_LIST
|
||||
|
||||
|
||||
class Person(QFrame):
|
||||
|
|
@ -60,7 +59,7 @@ class Person(QFrame):
|
|||
else:
|
||||
self.ui.deathDateLabel.parent().hide()
|
||||
self.ui.shortBioPlain.setPlainText('%s' % person.short_biography)
|
||||
for role in ROLE_LIST:
|
||||
for role in person.roles.keys():
|
||||
self.ui.filmographyCombo.addItem(role)
|
||||
self.ui.verticalLayout_2.setAlignment(Qt.AlignTop)
|
||||
|
||||
|
|
@ -78,13 +77,13 @@ class Person(QFrame):
|
|||
role = tosearch
|
||||
role_desc = ' as %s' % role
|
||||
self.parent.doAction('Filmography of "%s"%s' % (self.person.name, role_desc),
|
||||
self.parent.filmographyAction, [self.person.id, role])
|
||||
self.parent.filmographyAction, [self.backend.name, self.person.id, role])
|
||||
|
||||
def biography(self):
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
self.backend.fill_person(self.person, 'biography')
|
||||
bio = self.person.biography
|
||||
self.ui.shortBioPlain.setPlainText(bio)
|
||||
self.ui.shortBioPlain.setPlainText(u'%s' % bio)
|
||||
self.ui.biographyLabel.setText('Full biography:')
|
||||
self.ui.biographyButton.hide()
|
||||
QApplication.restoreOverrideCursor()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue