business as usual

This commit is contained in:
j 2011-08-09 10:30:13 +02:00
parent aaf5990381
commit 9333abbd1b

View file

@ -41,6 +41,14 @@ class Imdb(SiteParser):
'type': 'list' 'type': 'list'
}, },
'budget': {
'page': 'business',
're': [
'<h5>Budget</h5>(.*?)<br',
lambda data: findRe(data.replace(',', ''), '\d+')
],
'type': 'int'
},
'cast': { 'cast': {
'page': 'combined', 'page': 'combined',
're': [ 're': [
@ -113,6 +121,14 @@ class Imdb(SiteParser):
're': '<a href="/Sections/Genres/.*?/">(.*?)</a>', 're': '<a href="/Sections/Genres/.*?/">(.*?)</a>',
'type': 'list' 'type': 'list'
}, },
'gross': {
'page': 'business',
're': [
'<h5>Gross</h5>(.*?)\(',
lambda data: findRe(data.replace(',', ''), '\d+')
],
'type': 'int'
},
'keywords': { 'keywords': {
'page': 'keywords', 'page': 'keywords',
're': '<a href="/keyword/.*?/">(.*?)</a>', 're': '<a href="/keyword/.*?/">(.*?)</a>',
@ -210,6 +226,14 @@ class Imdb(SiteParser):
're': '<a href="ratings" class="tn15more">([\d,]*?) votes</a>', 're': '<a href="ratings" class="tn15more">([\d,]*?) votes</a>',
'type': 'string' 'type': 'string'
}, },
'worldwide_gross': {
'page': 'business',
're': [
'\$([\d,]+?) \(Worldwide\)',
lambda data: int(data.replace(',', '')),
],
'type': 'list'
},
'writers': { 'writers': {
'page': 'combined', 'page': 'combined',
're': [ 're': [
@ -305,6 +329,15 @@ class Imdb(SiteParser):
if key in self: if key in self:
del self[key] del self[key]
if 'worldwide_gross' in self:
if not 'gross' in self:
self['gross'] = 0
self['gross'] += max(self['worldwide_gross'])
del self['worldwide_gross']
if 'budget' in self and 'gross' in self:
self['profit'] = self['gross'] - self['budget']
class ImdbCombined(Imdb): class ImdbCombined(Imdb):
def __init__(self, id, timeout=-1): def __init__(self, id, timeout=-1):
_regex = {} _regex = {}