diff options
author | jerous <jerous@gmail.com> | 2008-09-10 04:48:46 +0200 |
---|---|---|
committer | jerous <jerous@gmail.com> | 2008-09-10 04:48:46 +0200 |
commit | 84c0d868ae4e0b7c998fcf0fa3c7e9dd61c5d750 (patch) | |
tree | 57a3ca03f61f4b1e65f1289295ffd2f5b3caeadd /misc.py | |
parent | 2119e0ac3dba26d795af9dd202760cd410b35fcf (diff) |
grouping by custom tags
Diffstat (limited to 'misc.py')
-rw-r--r-- | misc.py | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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) |