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 info
|
||||||
return i
|
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):
|
def oxdb_id(self):
|
||||||
if not self.get('title') and not self.get('director'):
|
if not self.get('title') and not self.get('director'):
|
||||||
return self.itemId
|
return self.itemId
|
||||||
|
|
|
@ -130,7 +130,7 @@ def update_sitemap(base_url):
|
||||||
url = ET.SubElement(urlset, "url")
|
url = ET.SubElement(urlset, "url")
|
||||||
# URL of the page. This URL must begin with the protocol (such as http)
|
# URL of the page. This URL must begin with the protocol (such as http)
|
||||||
loc = ET.SubElement(url, "loc")
|
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
|
# This date should be in W3C Datetime format, can be %Y-%m-%d
|
||||||
lastmod = ET.SubElement(url, "lastmod")
|
lastmod = ET.SubElement(url, "lastmod")
|
||||||
lastmod.text = i.modified.strftime("%Y-%m-%d")
|
lastmod.text = i.modified.strftime("%Y-%m-%d")
|
||||||
|
@ -150,7 +150,7 @@ def update_sitemap(base_url):
|
||||||
el.text = i.get('title')
|
el.text = i.get('title')
|
||||||
el = ET.SubElement(video, "video:thumbnail_loc")
|
el = ET.SubElement(video, "video:thumbnail_loc")
|
||||||
el.text = absolute_url("%s/96p.jpg" % i.itemId)
|
el.text = absolute_url("%s/96p.jpg" % i.itemId)
|
||||||
description = i.get('description', i.get('summary', ''))
|
description = i.get_item_description()
|
||||||
if description:
|
if description:
|
||||||
el = ET.SubElement(video, "video:description")
|
el = ET.SubElement(video, "video:description")
|
||||||
el.text = i.get('description', i.get('summary', ''))
|
el.text = i.get('description', i.get('summary', ''))
|
||||||
|
|
|
@ -1216,17 +1216,15 @@ def item(request, id):
|
||||||
'data': data,
|
'data': data,
|
||||||
'clips': clips,
|
'clips': clips,
|
||||||
'icon': settings.CONFIG['user']['ui']['icons'] == 'frames' and 'icon' or 'poster',
|
'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'):
|
if not settings.USE_IMDB:
|
||||||
value = item.get({
|
value = item.get('topic' in keys and 'topic' or 'keywords')
|
||||||
'description': 'summary',
|
|
||||||
'keywords': 'topic' in keys and 'topic' or 'keywords'
|
|
||||||
}.get(key, key))
|
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
value = value = ', '.join(value)
|
value = value = ', '.join(value)
|
||||||
if value:
|
if value:
|
||||||
ctx[key] = ox.strip_tags(value)
|
ctx['keywords'] = ox.strip_tags(value)
|
||||||
|
|
||||||
context = RequestContext(request, ctx)
|
context = RequestContext(request, ctx)
|
||||||
return render_to_response(template, context)
|
return render_to_response(template, context)
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="/static/js/pandora.js?{{settings.CONFIG.site.version}}"></script>
|
<script type="text/javascript" src="/static/js/pandora.js?{{settings.CONFIG.site.version}}"></script>
|
||||||
<meta name="title" content="{{title}}" />
|
<meta name="title" content="{{title}}" />
|
||||||
<meta name="description" content="{{description}}"/>
|
{%if description %}<meta name="description" content="{{description|safe}}"/> {%endif%}
|
||||||
<meta name="keywords" content="{{keywords|safe}}"/>
|
{%if keywords %}<meta name="keywords" content="{{keywords|safe}}"/> {%endif%}
|
||||||
<meta content="{{url}}/96p.jpg" name="thumbnail"/>
|
<meta content="{{url}}/96p.jpg" name="thumbnail"/>
|
||||||
<meta content="{{url}}/96p.jpg" name="image_src"/>
|
<meta content="{{url}}/96p.jpg" name="image_src"/>
|
||||||
<meta property="og:title" content="{{title}}"/>
|
<meta property="og:title" content="{{title}}"/>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
<meta property="og:url" content="{{url}}"/>
|
<meta property="og:url" content="{{url}}"/>
|
||||||
<meta property="og:image" content="{{url}}/96p.jpg"/>
|
<meta property="og:image" content="{{url}}/96p.jpg"/>
|
||||||
<meta property="og:site_name" content="{{settings.SITENAME}}"/>
|
<meta property="og:site_name" content="{{settings.SITENAME}}"/>
|
||||||
<meta property="og:description" content="{{description}}"/>
|
{%if description %}<meta property="og:description" content="{{description}}"/>{%endif%}
|
||||||
<meta name="google" value="notranslate"/>
|
<meta name="google" value="notranslate"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in a new issue