From 233c18b2e1dbef280c194fba7d49d67f89f25ba2 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Mon, 18 Mar 2013 01:40:39 +0100 Subject: [PATCH] [qcineoob] graphical fixes add 'genres' field to Movie object of ICapCinema --- modules/imdb/backend.py | 1 + modules/imdb/browser.py | 5 + weboob/applications/cineoob/cineoob.py | 4 + weboob/applications/qcineoob/movie.py | 8 + weboob/applications/qcineoob/torrent.py | 11 ++ weboob/applications/qcineoob/ui/movie.ui | 197 +++++++++++++++----- weboob/applications/qcineoob/ui/person.ui | 42 +++++ weboob/applications/qcineoob/ui/subtitle.ui | 50 ++++- weboob/applications/qcineoob/ui/torrent.ui | 84 +++++++-- weboob/capabilities/cinema.py | 5 +- 10 files changed, 338 insertions(+), 69 deletions(-) diff --git a/modules/imdb/backend.py b/modules/imdb/backend.py index 782eb9832b..8fb30a0524 100644 --- a/modules/imdb/backend.py +++ b/modules/imdb/backend.py @@ -105,6 +105,7 @@ def fill_movie(self, movie, fields): movie.country = mov.country movie.note = mov.note movie.roles = mov.roles + movie.genres = mov.genres movie.short_description = mov.short_description movie.thumbnail_url = mov.thumbnail_url diff --git a/modules/imdb/browser.py b/modules/imdb/browser.py index c3b48f2492..519cfe0b3e 100644 --- a/modules/imdb/browser.py +++ b/modules/imdb/browser.py @@ -106,6 +106,7 @@ def get_movie(self, id): short_description = NotAvailable thumbnail_url = NotAvailable other_titles = [] + genres = [] roles = {} if 'title' not in jres: @@ -115,6 +116,9 @@ def get_movie(self, id): thumbnail_url = unicode(jres['poster']) if 'directors' in jres: short_description = unicode(', '.join(jres['directors'])) + if 'genres' in jres: + for g in jres['genres']: + genres.append(g) if 'runtime' in jres: dur_str = jres['runtime'][0].split(':') if len(dur_str) == 1: @@ -154,6 +158,7 @@ def get_movie(self, id): movie.other_titles = other_titles movie.release_date = release_date movie.duration = duration + movie.genres = genres movie.pitch = pitch movie.country = country movie.note = note diff --git a/weboob/applications/cineoob/cineoob.py b/weboob/applications/cineoob/cineoob.py index c46b796cdb..6741f01ef6 100644 --- a/weboob/applications/cineoob/cineoob.py +++ b/weboob/applications/cineoob/cineoob.py @@ -52,6 +52,10 @@ def format_obj(self, obj, alias): if not empty(obj.duration): result += 'Duration: %smin\n' % obj.duration result += 'Note: %s\n' % obj.note + if not empty(obj.genres): + result += '\n%sGenres%s\n' % (self.BOLD, self.NC) + for g in obj.genres: + result += ' * %s\n' % g if not empty(obj.roles): result += '\n%sRelated persons%s\n' % (self.BOLD, self.NC) for role, lpersons in obj.roles.items(): diff --git a/weboob/applications/qcineoob/movie.py b/weboob/applications/qcineoob/movie.py index 748dc3750e..a420be23ac 100644 --- a/weboob/applications/qcineoob/movie.py +++ b/weboob/applications/qcineoob/movie.py @@ -55,6 +55,14 @@ def __init__(self, movie, backend, parent=None): self.ui.otherTitlesPlain.setPlainText('\n'.join(movie.other_titles)) else: self.ui.otherTitlesPlain.parent().hide() + if not empty(movie.genres): + genres = u'' + for g in movie.genres: + genres += '%s, ' % g + genres = genres[:-2] + self.ui.genresLabel.setText(genres) + else: + self.ui.genresLabel.parent().hide() if not empty(movie.release_date): self.ui.releaseDateLabel.setText(movie.release_date.strftime('%Y-%m-%d')) else: diff --git a/weboob/applications/qcineoob/torrent.py b/weboob/applications/qcineoob/torrent.py index 870b2ae39f..b84ca9ca5e 100644 --- a/weboob/applications/qcineoob/torrent.py +++ b/weboob/applications/qcineoob/torrent.py @@ -48,6 +48,17 @@ def __init__(self, torrent, backend, parent=None): if not empty(torrent.magnet): self.ui.downloadButton.setText(u'Download not available\nbut magnet link provided') self.ui.downloadButton.setToolTip(u'Use the magnet link') + if not empty(torrent.description): + self.ui.descriptionPlain.setText(u'%s' % torrent.description) + else: + self.ui.descriptionPlain.parent().hide() + if not empty(torrent.files): + files = u'' + for f in torrent.files: + files += '%s\n' % f + self.ui.filesPlain.setText(u'%s' % files) + else: + self.ui.filesPlain.parent().hide() if not empty(torrent.magnet): self.ui.magnetEdit.setText(u'%s' % torrent.magnet) else: diff --git a/weboob/applications/qcineoob/ui/movie.ui b/weboob/applications/qcineoob/ui/movie.ui index 6399fbd3bc..765a7d6a72 100644 --- a/weboob/applications/qcineoob/ui/movie.ui +++ b/weboob/applications/qcineoob/ui/movie.ui @@ -18,8 +18,8 @@ - 2000 - 600 + 10000 + 10000 @@ -149,7 +149,7 @@ 16777215 - 600 + 9000 @@ -182,6 +182,12 @@ + + + 75 + true + + Id: @@ -217,6 +223,12 @@ + + + 75 + true + + Title: @@ -232,50 +244,6 @@ - - - - - 0 - 0 - - - - - 16777215 - 200 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - 100 - 16777215 - - - - Other titles: - - - - - - - Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - @@ -293,6 +261,12 @@ + + + 75 + true + + Duration: @@ -325,6 +299,12 @@ + + + 75 + true + + Release date: @@ -345,7 +325,7 @@ 16777215 - 200 + 150 @@ -357,6 +337,12 @@ + + + 75 + true + + Pitch: @@ -364,6 +350,12 @@ + + + 0 + 0 + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse @@ -389,6 +381,12 @@ + + + 75 + true + + Country: @@ -404,6 +402,47 @@ + + + + + 16777215 + 35 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 75 + true + + + + Genres: + + + + + + + + + + true + + + + + + @@ -421,6 +460,12 @@ + + + 75 + true + + Note: @@ -453,6 +498,12 @@ + + + 75 + true + + All release dates: @@ -468,6 +519,56 @@ + + + + + 0 + 0 + + + + + 16777215 + 200 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 100 + 16777215 + + + + + 75 + true + + + + Other titles: + + + + + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + diff --git a/weboob/applications/qcineoob/ui/person.ui b/weboob/applications/qcineoob/ui/person.ui index 3e53f736c4..91e3fb59be 100644 --- a/weboob/applications/qcineoob/ui/person.ui +++ b/weboob/applications/qcineoob/ui/person.ui @@ -107,6 +107,12 @@ filmography + + + 75 + true + + Id: @@ -136,6 +142,12 @@ filmography + + + 75 + true + + name: @@ -162,6 +174,12 @@ filmography + + + 75 + true + + Birth date: @@ -188,6 +206,12 @@ filmography + + + 75 + true + + Real Name: @@ -214,6 +238,12 @@ filmography + + + 75 + true + + Birth place: @@ -240,6 +270,12 @@ filmography + + + 75 + true + + Death date: @@ -275,6 +311,12 @@ filmography + + + 75 + true + + Short biography: diff --git a/weboob/applications/qcineoob/ui/subtitle.ui b/weboob/applications/qcineoob/ui/subtitle.ui index 30022dbc3c..e93b864b09 100644 --- a/weboob/applications/qcineoob/ui/subtitle.ui +++ b/weboob/applications/qcineoob/ui/subtitle.ui @@ -47,13 +47,6 @@ QFrame::Raised - - - - Download - - - @@ -77,6 +70,12 @@ + + + 75 + true + + Id: @@ -112,6 +111,12 @@ + + + 75 + true + + Name: @@ -147,6 +152,12 @@ + + + 75 + true + + Nb CD: @@ -179,6 +190,12 @@ + + + 75 + true + + Lang: @@ -211,6 +228,12 @@ + + + 75 + true + + Description: @@ -252,6 +275,12 @@ + + + 75 + true + + Url: @@ -263,6 +292,13 @@ + + + + Download + + + diff --git a/weboob/applications/qcineoob/ui/torrent.ui b/weboob/applications/qcineoob/ui/torrent.ui index 0fd173ae08..172d4501af 100644 --- a/weboob/applications/qcineoob/ui/torrent.ui +++ b/weboob/applications/qcineoob/ui/torrent.ui @@ -7,7 +7,7 @@ 0 0 629 - 552 + 571 @@ -18,8 +18,8 @@ - 2000 - 600 + 10000 + 10000 @@ -37,7 +37,7 @@ 16777215 - 600 + 10000 @@ -47,13 +47,6 @@ QFrame::Raised - - - - Download - - - @@ -77,6 +70,12 @@ + + + 75 + true + + Id: @@ -112,6 +111,12 @@ + + + 75 + true + + Name: @@ -144,6 +149,12 @@ + + + 75 + true + + Seed/leech: @@ -176,6 +187,12 @@ + + + 75 + true + + Size: @@ -193,10 +210,16 @@ + + + 0 + 150 + + 16777215 - 200 + 500 @@ -208,6 +231,12 @@ + + + 75 + true + + Description: @@ -221,6 +250,12 @@ + + + 0 + 120 + + 16777215 @@ -236,6 +271,12 @@ + + + 75 + true + + Files: @@ -270,6 +311,12 @@ + + + 75 + true + + Url: @@ -304,6 +351,12 @@ + + + 75 + true + + Magnet: @@ -315,6 +368,13 @@ + + + + Download + + + diff --git a/weboob/capabilities/cinema.py b/weboob/capabilities/cinema.py index 38d327940a..e57015657e 100644 --- a/weboob/capabilities/cinema.py +++ b/weboob/capabilities/cinema.py @@ -29,15 +29,16 @@ class Movie(CapBaseObject): Movie object. """ original_title = StringField('Original title of the movie') - other_titles = Field('Titles in other countries',list) + other_titles = Field('Titles in other countries', list) release_date = DateField('Release date of the movie') all_release_dates= StringField('Release dates list of the movie') duration = IntField('Duration of the movie in minutes') short_description= StringField('Short description of the movie') + genres = Field('Genres of the movie', list) pitch = StringField('Short story description of the movie') country = StringField('Origin country of the movie') note = StringField('Notation of the movie') - roles = Field('Lists of Persons related to the movie indexed by roles',dict) + roles = Field('Lists of Persons related to the movie indexed by roles', dict) thumbnail_url = StringField('Url of movie thumbnail') def __init__(self, id, original_title): -- GitLab