summaryrefslogtreecommitdiff
path: root/misc.py
diff options
context:
space:
mode:
authorjerous <jerous@gmail.com>2008-09-10 04:48:46 +0200
committerjerous <jerous@gmail.com>2008-09-10 04:48:46 +0200
commit84c0d868ae4e0b7c998fcf0fa3c7e9dd61c5d750 (patch)
tree57a3ca03f61f4b1e65f1289295ffd2f5b3caeadd /misc.py
parent2119e0ac3dba26d795af9dd202760cd410b35fcf (diff)
grouping by custom tags
Diffstat (limited to 'misc.py')
-rw-r--r--misc.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/misc.py b/misc.py
index 8b93326..329238e 100644
--- a/misc.py
+++ b/misc.py
@@ -29,15 +29,17 @@ def unique(seq):
seen = []
return t(c for c in seq if not (c in seen or seen.append(c)))
-def format(string, song=None, xtra_tags={}):
+def format(string, song=None, overwrite={}, ensure={}):
"""Replace all tags in $str with their respective value."""
# what tags are available?
+ tags={}
+ for tag in ensure:
+ tags[tag]=ensure[tag]
if song:
- tags=song._data
- else:
- tags={}
- for tag in xtra_tags:
- tags[tag]=xtra_tags[tag]
+ for tag in song._data:
+ tags[tag]=song._data[tag]
+ for tag in overwrite:
+ tags[tag]=overwrite[tag]
ret=string
# first perform some functions: $name(value)