refine description, fixes #1397
This commit is contained in:
parent
58bac6981f
commit
31d28e733d
4 changed files with 18 additions and 12 deletions
|
|
@ -594,6 +594,14 @@ class Item(models.Model):
|
|||
return info
|
||||
return i
|
||||
|
||||
def get_item_description(self):
|
||||
if settings.USE_IMDB:
|
||||
info = tuple([self.data.get(k, 0) for k in ['hue', 'saturation', 'lightness']])
|
||||
description = 'Hue: %.3f, Saturation: %.3f, Lightness: %.3f' % info
|
||||
else:
|
||||
description = ox.strip_tags(self.get('summary', ''))
|
||||
return description
|
||||
|
||||
def oxdb_id(self):
|
||||
if not self.get('title') and not self.get('director'):
|
||||
return self.itemId
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ def update_sitemap(base_url):
|
|||
url = ET.SubElement(urlset, "url")
|
||||
# URL of the page. This URL must begin with the protocol (such as http)
|
||||
loc = ET.SubElement(url, "loc")
|
||||
loc.text = absolute_url("%s" % i.itemId)
|
||||
loc.text = absolute_url("%s/info" % i.itemId)
|
||||
# This date should be in W3C Datetime format, can be %Y-%m-%d
|
||||
lastmod = ET.SubElement(url, "lastmod")
|
||||
lastmod.text = i.modified.strftime("%Y-%m-%d")
|
||||
|
|
@ -150,7 +150,7 @@ def update_sitemap(base_url):
|
|||
el.text = i.get('title')
|
||||
el = ET.SubElement(video, "video:thumbnail_loc")
|
||||
el.text = absolute_url("%s/96p.jpg" % i.itemId)
|
||||
description = i.get('description', i.get('summary', ''))
|
||||
description = i.get_item_description()
|
||||
if description:
|
||||
el = ET.SubElement(video, "video:description")
|
||||
el.text = i.get('description', i.get('summary', ''))
|
||||
|
|
|
|||
|
|
@ -1216,17 +1216,15 @@ def item(request, id):
|
|||
'data': data,
|
||||
'clips': clips,
|
||||
'icon': settings.CONFIG['user']['ui']['icons'] == 'frames' and 'icon' or 'poster',
|
||||
|
||||
'title': item.get('title', ''),
|
||||
'description': item.get_item_description()
|
||||
}
|
||||
for key in ('title', 'description', 'keywords'):
|
||||
value = item.get({
|
||||
'description': 'summary',
|
||||
'keywords': 'topic' in keys and 'topic' or 'keywords'
|
||||
}.get(key, key))
|
||||
if not settings.USE_IMDB:
|
||||
value = item.get('topic' in keys and 'topic' or 'keywords')
|
||||
if isinstance(value, list):
|
||||
value = value = ', '.join(value)
|
||||
if value:
|
||||
ctx[key] = ox.strip_tags(value)
|
||||
ctx['keywords'] = ox.strip_tags(value)
|
||||
|
||||
context = RequestContext(request, ctx)
|
||||
return render_to_response(template, context)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue