[rhythmbox] context: show the release year in the album list
- From: Jonathan Matthew <jmatthew src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rhythmbox] context: show the release year in the album list
- Date: Thu, 5 Nov 2009 21:40:13 +0000 (UTC)
commit 93b4e3d29f235d7140da69dbe7ba1a1c8a0ee8c3
Author: Jonathan Matthew <jonathan d14n org>
Date: Fri Nov 6 07:39:51 2009 +1000
context: show the release year in the album list
plugins/context/tmpl/album-tmpl.html | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/plugins/context/tmpl/album-tmpl.html b/plugins/context/tmpl/album-tmpl.html
index c542e6f..c718417 100644
--- a/plugins/context/tmpl/album-tmpl.html
+++ b/plugins/context/tmpl/album-tmpl.html
@@ -3,8 +3,11 @@
<%!
import re
import cgi
+ import rfc822
+
def cleanup(text):
return re.sub(r'\([^\)]*\)', '', text)
+
def sec2hms(time):
hr = time / 3600
if hr > 0:
@@ -15,6 +18,17 @@
return _("%d:%02d:%02d") % (hr,mn,sec)
else:
return _("%d:%02d") %(mn,sec)
+
+ def format_year(date):
+ try:
+ parsed = rfc822.parsedate(date)
+ except Exception, e:
+ return ""
+ if parsed is None:
+ return ""
+ else:
+ return '[' + str(parsed[0]) + ']'
+
%>
<link rel="stylesheet" href="${stylesheet}" type="text/css" />
<script language="javascript">
@@ -49,7 +63,11 @@
%>
<div id="album${entry['id'] | h}" class="album">
<img width="64" src="${entry['images'][1] | h}" alt="${entry['images'] | h}"/>
- <h2>${entry['title'] | h}</h2>
+ <h2>${entry['title'] | h}
+ %if 'releasedate' in entry:
+ ${ format_year(entry['releasedate']) }
+ %endif
+ </h2>
%if 'duration' in entry:
<%
album_time = sec2hms(entry['duration'])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]