diff --git a/modules/imdb/browser.py b/modules/imdb/browser.py index b29a9dee..0d16fdf6 100644 --- a/modules/imdb/browser.py +++ b/modules/imdb/browser.py @@ -18,6 +18,7 @@ # along with weboob. If not, see . +import HTMLParser from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound from weboob.capabilities.base import NotAvailable, NotLoaded from weboob.capabilities.cinema import Movie, Person @@ -92,6 +93,7 @@ class ImdbBrowser(BaseBrowser): jres = json.loads(res) else: return None + htmlparser = HTMLParser.HTMLParser() title = NotAvailable duration = NotAvailable @@ -106,7 +108,7 @@ class ImdbBrowser(BaseBrowser): if not jres.has_key('title'): return - title = unicode(jres['title'].strip()) + title = htmlparser.unescape(unicode(jres['title'].strip())) if jres.has_key('poster'): thumbnail_url = unicode(jres['poster']) if jres.has_key('directors'): @@ -120,7 +122,7 @@ class ImdbBrowser(BaseBrowser): if jres.has_key('also_known_as'): for other_t in jres['also_known_as']: if other_t.has_key('country') and other_t.has_key('title'): - other_titles.append('%s : %s' % (other_t['country'],other_t['title'])) + other_titles.append('%s : %s' % (other_t['country'],htmlparser.unescape(other_t['title']))) if jres.has_key('release_date'): dstr = str(jres['release_date']) year = int(dstr[:4]) diff --git a/weboob/applications/qcineoob/main_window.py b/weboob/applications/qcineoob/main_window.py index d9a56894..0c971399 100644 --- a/weboob/applications/qcineoob/main_window.py +++ b/weboob/applications/qcineoob/main_window.py @@ -49,6 +49,7 @@ class MainWindow(QtMainWindow): self.ui.backButton.setDisabled(True) self.connect(self.ui.searchEdit, SIGNAL("returnPressed()"), self.search) + self.connect(self.ui.typeCombo, SIGNAL("returnPressed()"), self.search) self.connect(self.ui.actionBackends, SIGNAL("triggered()"), self.backendsConfig) @@ -108,6 +109,21 @@ class MainWindow(QtMainWindow): self.process = QtDo(self.weboob, self.addPerson) self.process.do('iter_movie_persons', id, role, backends=backend_name) + def filmographyAction(self, id, role): + self.ui.stackedWidget.setCurrentWidget(self.ui.movie_list_page) + for minimovie in self.minimovies: + self.ui.movie_list_content.layout().removeWidget(minimovie) + minimovie.hide() + minimovie.deleteLater() + + self.minimovies = [] + self.ui.searchEdit.setEnabled(False) + + 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) + def search(self): tosearch = self.ui.typeCombo.currentText() if tosearch == 'person': diff --git a/weboob/applications/qcineoob/movie.py b/weboob/applications/qcineoob/movie.py index 34c743e6..9bdb4342 100644 --- a/weboob/applications/qcineoob/movie.py +++ b/weboob/applications/qcineoob/movie.py @@ -65,4 +65,3 @@ 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.movie.id,role]) - diff --git a/weboob/applications/qcineoob/person.py b/weboob/applications/qcineoob/person.py index a6b4c36e..c5a632c7 100644 --- a/weboob/applications/qcineoob/person.py +++ b/weboob/applications/qcineoob/person.py @@ -19,7 +19,7 @@ import urllib -from PyQt4.QtCore import QUrl +from PyQt4.QtCore import QUrl,Qt,SIGNAL from PyQt4.QtGui import QFrame, QImage, QPixmap from weboob.applications.qcineoob.ui.person_ui import Ui_Person @@ -32,6 +32,8 @@ class Person(QFrame): self.ui = Ui_Person() self.ui.setupUi(self) + self.connect(self.ui.filmographyButton, SIGNAL("clicked()"), self.filmography) + self.person = person self.gotThumbnail() self.ui.nameLabel.setText(person.name) @@ -50,3 +52,13 @@ class Person(QFrame): data = urllib.urlopen(self.person.thumbnail_url).read() img = QImage.fromData(data) self.ui.imageLabel.setPixmap(QPixmap.fromImage(img)) + + def filmography(self): + role = None + tosearch = self.ui.filmographyCombo.currentText() + role_desc = '' + if tosearch != 'all': + 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]) diff --git a/weboob/applications/qcineoob/ui/main_window.ui b/weboob/applications/qcineoob/ui/main_window.ui index 899b0a3f..701181fb 100644 --- a/weboob/applications/qcineoob/ui/main_window.ui +++ b/weboob/applications/qcineoob/ui/main_window.ui @@ -75,6 +75,12 @@ + + + 75 + true + + diff --git a/weboob/applications/qcineoob/ui/person.ui b/weboob/applications/qcineoob/ui/person.ui index f1661c08..ba57fcb5 100644 --- a/weboob/applications/qcineoob/ui/person.ui +++ b/weboob/applications/qcineoob/ui/person.ui @@ -36,6 +36,52 @@ + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + view +filmography + + + + + + + as + + + + + + + + all + + + + + actor + + + + + director + + + + + + +