diff --git a/modules/imdb/backend.py b/modules/imdb/backend.py index 30887c8e..3e739bc1 100644 --- a/modules/imdb/backend.py +++ b/modules/imdb/backend.py @@ -78,9 +78,9 @@ 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 'description' in fields\ - or 'country' in fields or 'roles' in fields\ - or 'note' in fields or fields == None: + or 'duration' in fields or 'country' in fields\ + or 'roles' in fields or 'note' in fields\ + or fields == None: return self.get_movie(movie.id) else: return movie diff --git a/modules/imdb/browser.py b/modules/imdb/browser.py index 538ed525..fad7a0e0 100644 --- a/modules/imdb/browser.py +++ b/modules/imdb/browser.py @@ -49,12 +49,18 @@ class ImdbBrowser(BaseBrowser): for cat in ['title_popular','title_exact','title_approx']: if jres.has_key(cat): for m in jres[cat]: + tdesc = unicode(m['title_description']) + if '' in tdesc: + short_description = u'%s %s'%(tdesc.split('<')[0].strip(', '), tdesc.split('>')[1].split('<')[0]) + else: + short_description = tdesc.strip(', ') #movie = self.get_movie(m['id']) movie = Movie(m['id'],unicode(m['title'])) movie.other_titles = NotLoaded movie.release_date = NotLoaded movie.duration = NotLoaded - movie.description = NotLoaded + movie.short_description = short_description + movie.pitch = NotLoaded movie.country = NotLoaded movie.note = NotLoaded movie.roles = NotLoaded @@ -75,6 +81,7 @@ class ImdbBrowser(BaseBrowser): person.gender = NotLoaded person.nationality = NotLoaded person.short_biography= NotLoaded + person.short_description= unicode(p['description']) person.roles = NotLoaded yield person @@ -88,7 +95,7 @@ class ImdbBrowser(BaseBrowser): title = NotAvailable duration = NotAvailable release_date = NotAvailable - description = NotAvailable + pitch = NotAvailable country = NotAvailable note = NotAvailable other_titles = [] @@ -123,7 +130,7 @@ class ImdbBrowser(BaseBrowser): country += '%s, '%c country = country[:-2] if jres.has_key('plot_simple'): - description = unicode(jres['plot_simple']) + pitch = unicode(jres['plot_simple']) if jres.has_key('rating') and jres.has_key('rating_count'): note = u'%s/10 (%s votes)'%(jres['rating'],jres['rating_count']) for r in ['actor','director','writer']: @@ -134,7 +141,7 @@ class ImdbBrowser(BaseBrowser): movie.other_titles = other_titles movie.release_date = release_date movie.duration = duration - movie.description = description + movie.pitch = pitch movie.country = country movie.note = note movie.roles = roles diff --git a/modules/imdb/pages.py b/modules/imdb/pages.py index fd2d730d..08d4301d 100644 --- a/modules/imdb/pages.py +++ b/modules/imdb/pages.py @@ -106,6 +106,7 @@ class PersonPage(BasePage): def get_person(self,id): name = NotAvailable short_biography = NotAvailable + short_description = NotAvailable birth_place = NotAvailable birth_date = NotAvailable death_date = NotAvailable @@ -160,6 +161,7 @@ class PersonPage(BasePage): person.gender = gender person.nationality = nationality person.short_biography = short_biography + person.short_description = short_description person.roles = roles return person diff --git a/weboob/applications/cineoob/cineoob.py b/weboob/applications/cineoob/cineoob.py index 5a1da0c4..c89119df 100644 --- a/weboob/applications/cineoob/cineoob.py +++ b/weboob/applications/cineoob/cineoob.py @@ -32,7 +32,7 @@ __all__ = ['Cineoob'] class MovieInfoFormatter(IFormatter): - MANDATORY_FIELDS = ('id', 'original_title', 'release_date', 'other_titles', 'duration', 'description', 'note', 'roles', 'country') + MANDATORY_FIELDS = ('id', 'original_title', 'release_date', 'other_titles', 'duration', 'pitch', 'note', 'roles', 'country') def format_obj(self, obj, alias): result = u'%s%s%s\n' % (self.BOLD, obj.original_title, self.NC) @@ -53,29 +53,23 @@ class MovieInfoFormatter(IFormatter): result += '\n%sOther titles%s\n' % (self.BOLD, self.NC) for t in obj.other_titles: result += ' * %s\n' % t - if obj.description != NotAvailable: - result += '\n%sDescription%s\n' % (self.BOLD, self.NC) - result += '%s'%obj.description + if obj.pitch != NotAvailable: + result += '\n%sStory%s\n' % (self.BOLD, self.NC) + result += '%s'%obj.pitch return result class MovieListFormatter(PrettyFormatter): - MANDATORY_FIELDS = ('id', 'original_title', 'release_date', 'duration', 'note') + MANDATORY_FIELDS = ('id', 'original_title', 'short_description') def get_title(self, obj): return obj.original_title def get_description(self, obj): - date_str = '' - if obj.release_date != NotAvailable and obj.release_date != NotLoaded: - date_str = 'released: %s, '%obj.release_date.strftime('%Y-%m-%d') - duration = '' - if obj.duration != NotAvailable and obj.duration != NotLoaded: - duration = 'duration: %smin, '%obj.duration - note = '' - if obj.note != NotAvailable and obj.note != NotLoaded: - note = 'note: %s, '%obj.note - return ('%s %s %s' % (date_str, note, duration)).strip(', ') + result = u'' + if obj.short_description != NotAvailable: + result = obj.short_description + return result def yearsago(years, from_date=None): if from_date is None: @@ -132,25 +126,16 @@ class PersonInfoFormatter(IFormatter): class PersonListFormatter(PrettyFormatter): - MANDATORY_FIELDS = ('id', 'name', 'real_name', 'birth_date', 'nationality', 'gender') + MANDATORY_FIELDS = ('id', 'name', 'short_description') def get_title(self, obj): return obj.name def get_description(self, obj): - age = '' - if obj.birth_date != NotAvailable and obj.death_date == NotAvailable: - age = 'age: %s'%num_years(obj.birth_date) - gender = '' - if obj.gender != NotAvailable: - gender = 'gender: %s, '%obj.gender - real_name = '' - if obj.real_name != NotAvailable: - real_name = 'real name: %s, '%obj.real_name - nationality = '' - if obj.nationality != NotAvailable: - nationality = 'nationality: %s, '%obj.nationality - return ('%s%s%s%s' % (real_name, age, nationality, gender)).strip(' ,') + result = u'' + if obj.short_description != NotAvailable: + result = obj.short_description + return result class Cineoob(ReplApplication): @@ -276,7 +261,7 @@ class Cineoob(ReplApplication): print >>sys.stderr, 'Movie not found: %s' % id return 3 - backend.fillobj(movie, ('description','duration')) + backend.fillobj(movie, ('duration')) self.start_format() self.format(movie) diff --git a/weboob/capabilities/cinema.py b/weboob/capabilities/cinema.py index caee2ba8..7ea0a992 100644 --- a/weboob/capabilities/cinema.py +++ b/weboob/capabilities/cinema.py @@ -28,14 +28,15 @@ class Movie(CapBaseObject): """ Movie object. """ - original_title = StringField('Original title of the movie') - other_titles = Field('Titles in other countries',list) - release_date = DateField('Release date of the movie') - duration = IntField('Duration of the movie in minutes') - description = StringField('Short 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) + original_title = StringField('Original title of the movie') + other_titles = Field('Titles in other countries',list) + release_date = DateField('Release date of the movie') + duration = IntField('Duration of the movie in minutes') + short_description= StringField('Short description of the movie') + 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) def __init__(self, id, original_title): CapBaseObject.__init__(self, id) @@ -54,6 +55,7 @@ class Person(CapBaseObject): gender = StringField('Gender of a person') nationality = StringField('Nationality of a person') short_biography = StringField('Short 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) def __init__(self, id, name):