[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
|
person.thumbnail_url = thumbnail_url
|
||||||
return person
|
return person
|
||||||
|
|
||||||
def iter_movie_persons(self, movie_id, role):
|
def iter_movie_persons(self, movie_id, role_filter):
|
||||||
res = self.readurl(
|
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)
|
'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:
|
if res is not None:
|
||||||
|
|
@ -240,26 +240,27 @@ class AllocineBrowser(BaseBrowser):
|
||||||
return
|
return
|
||||||
if 'castMember' in jres:
|
if 'castMember' in jres:
|
||||||
for cast in jres['castMember']:
|
for cast in jres['castMember']:
|
||||||
id = cast['person']['code']
|
if (role_filter is None or (role_filter is not None and cast['activity']['$'].lower().strip() == role_filter.lower().strip())):
|
||||||
name = unicode(cast['person']['name'])
|
id = cast['person']['code']
|
||||||
short_description = unicode(cast['activity']['$'])
|
name = unicode(cast['person']['name'])
|
||||||
if 'role' in cast:
|
short_description = unicode(cast['activity']['$'])
|
||||||
short_description += ', %s' % cast['role']
|
if 'role' in cast:
|
||||||
thumbnail_url = NotAvailable
|
short_description += ', %s' % cast['role']
|
||||||
if 'picture' in cast:
|
thumbnail_url = NotAvailable
|
||||||
thumbnail_url = unicode(cast['picture']['href'])
|
if 'picture' in cast:
|
||||||
person = Person(id, name)
|
thumbnail_url = unicode(cast['picture']['href'])
|
||||||
person.short_description = short_description
|
person = Person(id, name)
|
||||||
person.real_name = NotLoaded
|
person.short_description = short_description
|
||||||
person.birth_place = NotLoaded
|
person.real_name = NotLoaded
|
||||||
person.birth_date = NotLoaded
|
person.birth_place = NotLoaded
|
||||||
person.death_date = NotLoaded
|
person.birth_date = NotLoaded
|
||||||
person.gender = NotLoaded
|
person.death_date = NotLoaded
|
||||||
person.nationality = NotLoaded
|
person.gender = NotLoaded
|
||||||
person.short_biography = NotLoaded
|
person.nationality = NotLoaded
|
||||||
person.roles = NotLoaded
|
person.short_biography = NotLoaded
|
||||||
person.thumbnail_url = thumbnail_url
|
person.roles = NotLoaded
|
||||||
yield person
|
person.thumbnail_url = thumbnail_url
|
||||||
|
yield person
|
||||||
|
|
||||||
def iter_person_movies(self, person_id, role_filter):
|
def iter_person_movies(self, person_id, role_filter):
|
||||||
res = self.readurl(
|
res = self.readurl(
|
||||||
|
|
@ -269,7 +270,7 @@ class AllocineBrowser(BaseBrowser):
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
for m in jres['participation']:
|
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 = '????'
|
prod_year = '????'
|
||||||
if 'productionYear' in m['movie']:
|
if 'productionYear' in m['movie']:
|
||||||
prod_year = m['movie']['productionYear']
|
prod_year = m['movie']['productionYear']
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ class MainWindow(QtMainWindow):
|
||||||
self.ui.backButton.setToolTip(self.action_history['action_list'][-1]['description'])
|
self.ui.backButton.setToolTip(self.action_history['action_list'][-1]['description'])
|
||||||
return todo['function'](*todo['args'])
|
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)
|
self.ui.stackedWidget.setCurrentWidget(self.ui.list_page)
|
||||||
for mini in self.minis:
|
for mini in self.minis:
|
||||||
self.ui.list_content.layout().removeWidget(mini)
|
self.ui.list_content.layout().removeWidget(mini)
|
||||||
|
|
@ -186,13 +186,11 @@ class MainWindow(QtMainWindow):
|
||||||
self.ui.searchEdit.setEnabled(False)
|
self.ui.searchEdit.setEnabled(False)
|
||||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
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 = QtDo(self.weboob, self.addPerson)
|
||||||
self.process.do('iter_movie_persons', id, role, backends=backend_name, caps=ICapCinema)
|
self.process.do('iter_movie_persons', id, role, backends=backend_name, caps=ICapCinema)
|
||||||
self.ui.stopButton.show()
|
self.ui.stopButton.show()
|
||||||
|
|
||||||
def filmographyAction(self, id, role):
|
def filmographyAction(self, backend_name, id, role):
|
||||||
self.ui.stackedWidget.setCurrentWidget(self.ui.list_page)
|
self.ui.stackedWidget.setCurrentWidget(self.ui.list_page)
|
||||||
for mini in self.minis:
|
for mini in self.minis:
|
||||||
self.ui.list_content.layout().removeWidget(mini)
|
self.ui.list_content.layout().removeWidget(mini)
|
||||||
|
|
@ -203,8 +201,6 @@ class MainWindow(QtMainWindow):
|
||||||
self.ui.searchEdit.setEnabled(False)
|
self.ui.searchEdit.setEnabled(False)
|
||||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
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 = QtDo(self.weboob, self.addMovie)
|
||||||
self.process.do('iter_person_movies', id, role, backends=backend_name, caps=ICapCinema)
|
self.process.do('iter_person_movies', id, role, backends=backend_name, caps=ICapCinema)
|
||||||
self.ui.stopButton.show()
|
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.applications.qcineoob.ui.movie_ui import Ui_Movie
|
||||||
from weboob.capabilities.base import empty
|
from weboob.capabilities.base import empty
|
||||||
from weboob.applications.suboob.suboob import LANGUAGE_CONV
|
from weboob.applications.suboob.suboob import LANGUAGE_CONV
|
||||||
from weboob.applications.cineoob.cineoob import ROLE_LIST
|
|
||||||
|
|
||||||
|
|
||||||
class Movie(QFrame):
|
class Movie(QFrame):
|
||||||
|
|
@ -83,8 +82,8 @@ class Movie(QFrame):
|
||||||
self.ui.noteLabel.setText('%s' % movie.note)
|
self.ui.noteLabel.setText('%s' % movie.note)
|
||||||
else:
|
else:
|
||||||
self.ui.noteLabel.parent().hide()
|
self.ui.noteLabel.parent().hide()
|
||||||
for role in ROLE_LIST:
|
for role in movie.roles.keys():
|
||||||
self.ui.castingCombo.addItem('%ss' % role)
|
self.ui.castingCombo.addItem('%s' % role)
|
||||||
|
|
||||||
self.ui.verticalLayout.setAlignment(Qt.AlignTop)
|
self.ui.verticalLayout.setAlignment(Qt.AlignTop)
|
||||||
self.ui.verticalLayout_2.setAlignment(Qt.AlignTop)
|
self.ui.verticalLayout_2.setAlignment(Qt.AlignTop)
|
||||||
|
|
@ -117,10 +116,10 @@ class Movie(QFrame):
|
||||||
|
|
||||||
def casting(self):
|
def casting(self):
|
||||||
role = None
|
role = None
|
||||||
tosearch = self.ui.castingCombo.currentText()
|
tosearch = unicode(self.ui.castingCombo.currentText())
|
||||||
role_desc = ''
|
role_desc = ''
|
||||||
if tosearch != 'all':
|
if tosearch != 'all':
|
||||||
role = tosearch[:-1]
|
role = tosearch
|
||||||
role_desc = ' as %s' % role
|
role_desc = ' as %s' % role
|
||||||
self.parent.doAction('Casting%s of movie "%s"' % (role_desc, self.movie.original_title),
|
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.applications.qcineoob.ui.person_ui import Ui_Person
|
||||||
from weboob.capabilities.base import empty
|
from weboob.capabilities.base import empty
|
||||||
from weboob.applications.cineoob.cineoob import ROLE_LIST
|
|
||||||
|
|
||||||
|
|
||||||
class Person(QFrame):
|
class Person(QFrame):
|
||||||
|
|
@ -60,7 +59,7 @@ class Person(QFrame):
|
||||||
else:
|
else:
|
||||||
self.ui.deathDateLabel.parent().hide()
|
self.ui.deathDateLabel.parent().hide()
|
||||||
self.ui.shortBioPlain.setPlainText('%s' % person.short_biography)
|
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.filmographyCombo.addItem(role)
|
||||||
self.ui.verticalLayout_2.setAlignment(Qt.AlignTop)
|
self.ui.verticalLayout_2.setAlignment(Qt.AlignTop)
|
||||||
|
|
||||||
|
|
@ -78,13 +77,13 @@ class Person(QFrame):
|
||||||
role = tosearch
|
role = tosearch
|
||||||
role_desc = ' as %s' % role
|
role_desc = ' as %s' % role
|
||||||
self.parent.doAction('Filmography of "%s"%s' % (self.person.name, role_desc),
|
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):
|
def biography(self):
|
||||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||||
self.backend.fill_person(self.person, 'biography')
|
self.backend.fill_person(self.person, 'biography')
|
||||||
bio = 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.biographyLabel.setText('Full biography:')
|
||||||
self.ui.biographyButton.hide()
|
self.ui.biographyButton.hide()
|
||||||
QApplication.restoreOverrideCursor()
|
QApplication.restoreOverrideCursor()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue