diff --git a/pandora/item/models.py b/pandora/item/models.py index 5aad7ea1c..64f00b9a4 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -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 diff --git a/pandora/item/tasks.py b/pandora/item/tasks.py index 8512343b4..14dff5d7b 100644 --- a/pandora/item/tasks.py +++ b/pandora/item/tasks.py @@ -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', '')) diff --git a/pandora/item/views.py b/pandora/item/views.py index 0347a45f7..83b5661dd 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -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) diff --git a/pandora/templates/item.html b/pandora/templates/item.html index 06be5fecf..3687e2ec3 100644 --- a/pandora/templates/item.html +++ b/pandora/templates/item.html @@ -14,8 +14,8 @@ - - + {%if description %} {%endif%} + {%if keywords %} {%endif%} @@ -23,7 +23,7 @@ - + {%if description %}{%endif%}