more plural cleanup
This commit is contained in:
parent
4e5ad8c17e
commit
5916e26203
3 changed files with 9 additions and 6 deletions
|
@ -273,7 +273,9 @@ class Item(models.Model):
|
||||||
if len(self.itemId) == 7:
|
if len(self.itemId) == 7:
|
||||||
data = ox.web.imdb.Imdb(self.itemId)
|
data = ox.web.imdb.Imdb(self.itemId)
|
||||||
#FIXME: all this should be in ox.web.imdb.Imdb
|
#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:
|
if key in data:
|
||||||
data[key[:-1]] = data.pop(key)
|
data[key[:-1]] = data.pop(key)
|
||||||
if 'countries' in data:
|
if 'countries' in data:
|
||||||
|
@ -469,13 +471,13 @@ class Item(models.Model):
|
||||||
|
|
||||||
def oxid(self):
|
def oxid(self):
|
||||||
return utils.oxid(self.get('title', ''), self.get('director', []), str(self.get('year', '')),
|
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', ''))
|
self.get('season', ''), self.get('episode', ''))
|
||||||
|
|
||||||
def oxdb_id(self):
|
def oxdb_id(self):
|
||||||
return utils.oxdb_id(self.get('title', ''), self.get('director', []), str(self.get('year', '')),
|
return utils.oxdb_id(self.get('title', ''), self.get('director', []), str(self.get('year', '')),
|
||||||
self.get('season', ''), self.get('episode', ''),
|
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
|
Search related functions
|
||||||
|
|
|
@ -39,12 +39,12 @@ def oxid(title, directors, year='', seriesTitle='', episodeTitle='', season=0, e
|
||||||
return u"0x" + oxid
|
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()
|
# new id function, will replace oxid()
|
||||||
def get_hash(string):
|
def get_hash(string):
|
||||||
return hashlib.sha1(string.encode('utf-8')).hexdigest().upper()
|
return hashlib.sha1(string.encode('utf-8')).hexdigest().upper()
|
||||||
director = ', '.join(directors)
|
director = ', '.join(director)
|
||||||
episode_director = ', '.join(episode_directors)
|
episode_director = ', '.join(episode_director)
|
||||||
if not episode:
|
if not episode:
|
||||||
oxdb_id = get_hash(director)[:8] + get_hash('\n'.join([title, str(year)]))[:8]
|
oxdb_id = get_hash(director)[:8] + get_hash('\n'.join([title, str(year)]))[:8]
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -200,6 +200,7 @@ Positions
|
||||||
r[p] = m.get(p, '')
|
r[p] = m.get(p, '')
|
||||||
return r
|
return r
|
||||||
qs = qs[query['range'][0]:query['range'][1]]
|
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')]
|
response['data']['items'] = [only_p(m['json']) for m in qs.values('json')]
|
||||||
else: # otherwise stats
|
else: # otherwise stats
|
||||||
items = query['qs']
|
items = query['qs']
|
||||||
|
|
Loading…
Reference in a new issue