more plural cleanup

This commit is contained in:
j 2011-01-04 12:20:52 +05:30
parent 4e5ad8c17e
commit 5916e26203
3 changed files with 9 additions and 6 deletions

View file

@ -273,7 +273,9 @@ class Item(models.Model):
if len(self.itemId) == 7:
data = ox.web.imdb.Imdb(self.itemId)
#FIXME: all this should be in ox.web.imdb.Imdb
for key in ('directors', 'writers', 'editors', 'producers', 'cinematographers', 'languages', 'genres', 'keywords'):
for key in ('directors', 'writers', 'editors', 'producers',
'cinematographers', 'languages', 'genres', 'keywords',
'episode_directors'):
if key in data:
data[key[:-1]] = data.pop(key)
if 'countries' in data:
@ -469,13 +471,13 @@ class Item(models.Model):
def oxid(self):
return utils.oxid(self.get('title', ''), self.get('director', []), str(self.get('year', '')),
self.get('series title', ''), self.get('episode title', ''),
self.get('series_title', ''), self.get('episode_title', ''),
self.get('season', ''), self.get('episode', ''))
def oxdb_id(self):
return utils.oxdb_id(self.get('title', ''), self.get('director', []), str(self.get('year', '')),
self.get('season', ''), self.get('episode', ''),
self.get('episode_title', ''), self.get('episode_directors', ''), self.get('episode_year', ''))
self.get('episode_title', ''), self.get('episode_director', []), self.get('episode_year', ''))
'''
Search related functions

View file

@ -39,12 +39,12 @@ def oxid(title, directors, year='', seriesTitle='', episodeTitle='', season=0, e
return u"0x" + oxid
def oxdb_id(title, directors=[], year='', season='', episode='', episode_title='', episode_directors=[], episode_year=''):
def oxdb_id(title, director=[], year='', season='', episode='', episode_title='', episode_director=[], episode_year=''):
# new id function, will replace oxid()
def get_hash(string):
return hashlib.sha1(string.encode('utf-8')).hexdigest().upper()
director = ', '.join(directors)
episode_director = ', '.join(episode_directors)
director = ', '.join(director)
episode_director = ', '.join(episode_director)
if not episode:
oxdb_id = get_hash(director)[:8] + get_hash('\n'.join([title, str(year)]))[:8]
else:

View file

@ -200,6 +200,7 @@ Positions
r[p] = m.get(p, '')
return r
qs = qs[query['range'][0]:query['range'][1]]
#response['data']['items'] = [only_p(m.get_json()) for m in qs]
response['data']['items'] = [only_p(m['json']) for m in qs.values('json')]
else: # otherwise stats
items = query['qs']