diff --git a/modules/imdb/backend.py b/modules/imdb/backend.py
index ed344e9f..c695f3bc 100644
--- a/modules/imdb/backend.py
+++ b/modules/imdb/backend.py
@@ -73,7 +73,7 @@ class ImdbBackend(BaseBackend, ICapCinema):
if 'real_name' in fields or 'birth_place' in fields\
or 'death_date' in fields or 'nationality' in fields\
or 'short_biography' in fields or 'roles' in fields\
- or 'birth_date' in fields\
+ or 'birth_date' in fields or 'thumbnail_url' in fields\
or 'gender' in fields or fields == None:
per = self.get_person(person.id)
person.real_name = per.real_name
@@ -85,6 +85,7 @@ class ImdbBackend(BaseBackend, ICapCinema):
person.short_biography = per.short_biography
person.short_description = per.short_description
person.roles = per.roles
+ person.thumbnail_url = per.thumbnail_url
if 'biography' in fields:
person.biography = self.get_person_biography(person.id)
@@ -94,7 +95,8 @@ class ImdbBackend(BaseBackend, ICapCinema):
def fill_movie(self, movie, fields):
if 'other_titles' in fields or 'release_date' in fields\
or 'duration' in fields or 'country' in fields\
- or 'roles' in fields or 'note' in fields:
+ or 'roles' in fields or 'note' in fields\
+ or 'thumbnail_url' in fields:
mov = self.get_movie(movie.id)
movie.other_titles = mov.other_titles
movie.release_date = mov.release_date
@@ -104,6 +106,7 @@ class ImdbBackend(BaseBackend, ICapCinema):
movie.note = mov.note
movie.roles = mov.roles
movie.short_description= mov.short_description
+ movie.thumbnail_url = mov.thumbnail_url
if 'all_release_dates' in fields:
movie.all_release_dates = self.get_movie_releases(movie.id)
diff --git a/modules/imdb/browser.py b/modules/imdb/browser.py
index bb9816e3..b29a9dee 100644
--- a/modules/imdb/browser.py
+++ b/modules/imdb/browser.py
@@ -64,6 +64,7 @@ class ImdbBrowser(BaseBrowser):
movie.note = NotLoaded
movie.roles = NotLoaded
movie.all_release_dates= NotLoaded
+ movie.thumbnail_url = NotLoaded
yield movie
def iter_persons(self, pattern):
@@ -82,6 +83,7 @@ class ImdbBrowser(BaseBrowser):
person.short_biography= NotLoaded
person.short_description= latin2unicode(p['description'])
person.roles = NotLoaded
+ person.thumbnail_url = NotLoaded
yield person
def get_movie(self, id):
@@ -209,6 +211,9 @@ dict_hex = {'á': u'á',
'ü': u'ü',
'&': u'&',
''': u"'",
+ 'à': u'à',
+ 'À': u'À',
+ 'â': u'â',
'ç': u'ç'
}
def latin2unicode(word):
diff --git a/modules/imdb/pages.py b/modules/imdb/pages.py
index 9121420f..dbaccd96 100644
--- a/modules/imdb/pages.py
+++ b/modules/imdb/pages.py
@@ -92,6 +92,7 @@ class MovieCrewPage(BasePage):
person.nationality = NotLoaded
person.short_biography= NotLoaded
person.roles = NotLoaded
+ person.thumbnail_url = NotLoaded
yield person
for gloss_link in self.parser.select(self.document.getroot(),'table[cellspacing=1] h5 a'):
@@ -135,6 +136,7 @@ class PersonPage(BasePage):
death_date = NotAvailable
real_name = NotAvailable
gender = NotAvailable
+ thumbnail_url = NotAvailable
roles = {}
nationality = NotAvailable
td_overview = self.parser.select(self.document.getroot(),'td#overview-top',1)
@@ -171,6 +173,10 @@ class PersonPage(BasePage):
dtime.append('1')
dtime.append('1')
death_date = datetime(int(dtime[0]),int(dtime[1]),int(dtime[2]))
+ img_thumbnail = self.parser.select(self.document.getroot(),'td#img_primary img')
+ if len(img_thumbnail) > 0:
+ thumbnail_url = unicode(img_thumbnail[0].attrib.get('src',''))
+
# go to the filmography page
self.browser.location('http://www.imdb.com/name/%s/filmotype'%id)
assert self.browser.is_on_page(FilmographyPage)
@@ -186,6 +192,7 @@ class PersonPage(BasePage):
person.short_biography = short_biography
person.short_description = short_description
person.roles = roles
+ person.thumbnail_url = thumbnail_url
return person
class FilmographyPage(BasePage):
diff --git a/weboob/applications/qcineoob/minimovie.py b/weboob/applications/qcineoob/minimovie.py
index 57d7f441..cbc00c29 100644
--- a/weboob/applications/qcineoob/minimovie.py
+++ b/weboob/applications/qcineoob/minimovie.py
@@ -17,11 +17,13 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
+import urllib
from PyQt4.QtGui import QFrame, QImage, QPixmap
from weboob.tools.application.qt import QtDo
from weboob.applications.qcineoob.ui.minimovie_ui import Ui_MiniMovie
+from weboob.capabilities.base import NotAvailable, NotLoaded
class MiniMovie(QFrame):
def __init__(self, weboob, backend, movie, parent=None):
@@ -34,17 +36,16 @@ class MiniMovie(QFrame):
self.backend = backend
self.movie = movie
self.ui.titleLabel.setText(movie.original_title)
+ self.ui.shortDescLabel.setText(movie.short_description)
self.ui.backendLabel.setText(backend.name)
- #self.process_thumbnail = QtDo(self.weboob, self.gotThumbnail)
- #self.process_thumbnail.do('fillobj', self.movie, ['thumbnail_url'], backends=backend)
+ self.process_thumbnail = QtDo(self.weboob, self.gotThumbnail)
+ self.process_thumbnail.do('fillobj', self.movie, ['thumbnail_url'], backends=backend)
def gotThumbnail(self, backend, movie):
- if not backend:
- return
-
- if movie.thumbnail_url:
- img = QImage.fromData(movie.thumbnail.data)
+ if self.movie.thumbnail_url != NotAvailable:
+ data = urllib.urlopen(self.movie.thumbnail_url).read()
+ img = QImage.fromData(data)
self.ui.imageLabel.setPixmap(QPixmap.fromImage(img))
def enterEvent(self, event):
diff --git a/weboob/applications/qcineoob/miniperson.py b/weboob/applications/qcineoob/miniperson.py
index f268dda0..a4dbe318 100644
--- a/weboob/applications/qcineoob/miniperson.py
+++ b/weboob/applications/qcineoob/miniperson.py
@@ -17,11 +17,13 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
+import urllib
from PyQt4.QtGui import QFrame, QImage, QPixmap
from weboob.tools.application.qt import QtDo
from weboob.applications.qcineoob.ui.miniperson_ui import Ui_MiniPerson
+from weboob.capabilities.base import NotAvailable, NotLoaded
class MiniPerson(QFrame):
def __init__(self, weboob, backend, person, parent=None):
@@ -34,18 +36,16 @@ class MiniPerson(QFrame):
self.backend = backend
self.person = person
self.ui.nameLabel.setText(person.name)
- #self.ui.birthdateLabel.setText(person.birth_date)
+ self.ui.shortDescLabel.setText(person.short_description)
self.ui.backendLabel.setText(backend.name)
- #self.process_thumbnail = QtDo(self.weboob, self.gotThumbnail)
- #self.process_thumbnail.do('fillobj', self.person, ['thumbnail_url'], backends=backend)
+ self.process_thumbnail = QtDo(self.weboob, self.gotThumbnail)
+ self.process_thumbnail.do('fillobj', self.person, ['thumbnail_url'], backends=backend)
def gotThumbnail(self, backend, person):
- if not backend:
- return
-
- if person.thumbnail_url:
- img = QImage.fromData(person.thumbnail.data)
+ if self.person.thumbnail_url != NotAvailable:
+ data = urllib.urlopen(self.person.thumbnail_url).read()
+ img = QImage.fromData(data)
self.ui.imageLabel.setPixmap(QPixmap.fromImage(img))
def enterEvent(self, event):
diff --git a/weboob/applications/qcineoob/ui/minimovie.ui b/weboob/applications/qcineoob/ui/minimovie.ui
index 24dfb9b2..13bde7c5 100644
--- a/weboob/applications/qcineoob/ui/minimovie.ui
+++ b/weboob/applications/qcineoob/ui/minimovie.ui
@@ -7,7 +7,7 @@
0
0
464
- 132
+ 136
@@ -89,78 +89,18 @@
- Duration
+ Short description:
-
-
+
TextLabel
-
-
-
-
- 75
- true
-
-
-
- Author
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
-
- 75
- true
-
-
-
- Date
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
-
- 75
- true
-
-
-
- Rating
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
@@ -173,7 +113,7 @@
- -
+
-
TextLabel
diff --git a/weboob/applications/qcineoob/ui/miniperson.ui b/weboob/applications/qcineoob/ui/miniperson.ui
index 5a3f4c51..f2e4ec02 100644
--- a/weboob/applications/qcineoob/ui/miniperson.ui
+++ b/weboob/applications/qcineoob/ui/miniperson.ui
@@ -89,78 +89,18 @@
- Duration
+ Short description
-
-
+
TextLabel
-
-
-
-
- 75
- true
-
-
-
- Author
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
-
- 75
- true
-
-
-
- Date
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
-
- 75
- true
-
-
-
- Rating
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
@@ -173,7 +113,7 @@
- -
+
-
TextLabel
diff --git a/weboob/capabilities/cinema.py b/weboob/capabilities/cinema.py
index a59bf866..38d32794 100644
--- a/weboob/capabilities/cinema.py
+++ b/weboob/capabilities/cinema.py
@@ -60,6 +60,7 @@ class Person(CapBaseObject):
biography = StringField('Full biography of a person')
short_description= StringField('Short description of a person')
roles = Field('Lists of movies related to the person indexed by roles',dict)
+ thumbnail_url = StringField('Url of person thumbnail')
def __init__(self, id, name):
CapBaseObject.__init__(self, id)