[qcineoob] filmography
[imdb] html characters converted
This commit is contained in:
parent
33981a8fdb
commit
6fe917417c
6 changed files with 85 additions and 4 deletions
|
|
@ -18,6 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
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])
|
||||
|
|
|
|||
|
|
@ -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':
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
|
|
|
|||
|
|
@ -75,6 +75,12 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="currentActionLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
|
|
|
|||
|
|
@ -36,6 +36,52 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_12">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="filmographyButton">
|
||||
<property name="text">
|
||||
<string>view
|
||||
filmography</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>as</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="filmographyCombo">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>all</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>actor</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>director</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue