diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-21 21:36:32 +0100 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-21 21:47:56 +0100 |
commit | 454f852f361477b0f365a9705574a700339497ac (patch) | |
tree | 24bf5f0a2239527c74d35fcf95b8c0dbfc284ada /playlist.c | |
parent | f89029d063c855b03adbcd20d09380fd42cb11c9 (diff) | |
parent | 4d12a12570876810d0376d31b280674b5c49054a (diff) |
Merge branch 'master' into devel
Conflicts:
Makefile.am
configure.ac
deadbeef.h
main.c
plugins/oss/Makefile.am
plugins/oss/oss.c
Diffstat (limited to 'playlist.c')
-rw-r--r-- | playlist.c | 28 |
1 files changed, 25 insertions, 3 deletions
@@ -1576,9 +1576,10 @@ pl_format_elapsed (const char *ret, char *elapsed, int size) { } int -pl_format_title (playItem_t *it, char *s, int size, int id, const char *fmt) { +pl_format_title (playItem_t *it, int idx, char *s, int size, int id, const char *fmt) { char dur[50]; char elp[50]; + char fno[50]; const char *artist = NULL; const char *album = NULL; const char *track = NULL; @@ -1589,10 +1590,18 @@ pl_format_title (playItem_t *it, char *s, int size, int id, const char *fmt) { const char *genre = NULL; const char *comment = NULL; const char *copyright = NULL; + const char *filename = NULL; if (id != -1) { const char *text = NULL; switch (id) { + case DB_COLUMN_FILENUMBER: + if (idx == -1) { + idx = pl_get_idx_of (it); + } + snprintf (fno, sizeof (fno), "%d", idx+1); + text = fno; + break; case DB_COLUMN_PLAYING: return pl_format_item_queue (it, s, size); case DB_COLUMN_ARTIST_ALBUM: @@ -1692,6 +1701,16 @@ pl_format_title (playItem_t *it, char *s, int size, int id, const char *fmt) { n--; } } + else if (*fmt == 'f') { + filename = it->fname + strlen (it->fname) - 1; + while (filename > it->fname && (*filename) != '/') { + filename--; + } + if (*filename == '/') { + filename++; + } + meta = filename; + } else { *s++ = *fmt; n--; @@ -1714,6 +1733,9 @@ pl_format_title (playItem_t *it, char *s, int size, int id, const char *fmt) { void pl_sort (int iter, int id, const char *format, int ascending) { + if (id == DB_COLUMN_FILENUMBER) { + return; + } int sorted = 0; do { sorted = 1; @@ -1743,8 +1765,8 @@ pl_sort (int iter, int id, const char *format, int ascending) { } } else { - pl_format_title (it, title1, sizeof (title1), id, format); - pl_format_title (next, title2, sizeof (title2), id, format); + pl_format_title (it, -1, title1, sizeof (title1), id, format); + pl_format_title (next, -1, title2, sizeof (title2), id, format); } int cmp = ascending ? strcmp (title1, title2) < 0 : strcmp (title1, title2) > 0; if (cmp) { |