diff options
author | 2011-03-26 12:50:34 +0100 | |
---|---|---|
committer | 2011-03-26 12:50:34 +0100 | |
commit | 1c1da4bb688f0e912faeea76b91fbef73a81887a (patch) | |
tree | 2b6729140b1a58fee7bc8d8333bafbfe5311bf79 | |
parent | c43fabc77c076280136b4bcb5ee11117834bc24a (diff) |
title formatting: prefix 0-9 track numbers (%n) with 0, to improve sorting and grouping
-rw-r--r-- | playlist.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -3002,6 +3002,20 @@ pl_format_title_int (const char *escape_chars, playItem_t *it, int idx, char *s, } else if (*fmt == 'n') { meta = pl_find_meta (it, "track"); + if (meta) { + // check if it's numbers only + const char *p = meta; + while (*p) { + if (!isdigit (*p)) { + break; + } + p++; + } + if (!(*p)) { + snprintf (fno, sizeof (fno), "%02d", atoi (meta)); + meta = fno; + } + } } else if (*fmt == 'N') { meta = pl_find_meta (it, "numtracks"); |