summaryrefslogtreecommitdiff
path: root/playlist.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-08-07 22:37:32 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-08-07 22:37:32 +0200
commit4fa0d0375913a45ae93103ce6f006f8fa134357b (patch)
treeae8621292e93fefe963c433d191384daa1a36668 /playlist.c
parent403128abb088f8db7d64ef00b965198192194e4a (diff)
added flac vorbiscomment metadata support
Diffstat (limited to 'playlist.c')
-rw-r--r--playlist.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/playlist.c b/playlist.c
index 830ab003..c86c46f2 100644
--- a/playlist.c
+++ b/playlist.c
@@ -213,8 +213,10 @@ ps_insert_cue (playItem_t *after, const char *cuename) {
it->timestart = tstart;
it->timeend = -1; // will be filled by next read, or by codec
after = ps_insert_item (after, it);
-// ps_append_item (it);
-// printf ("added item %x\n", it);
+ ps_add_meta (it, "artist", performer);
+ ps_add_meta (it, "album", albumtitle);
+ ps_add_meta (it, "track", track);
+ ps_add_meta (it, "title", title);
prev = it;
track[0] = 0;
}
@@ -748,8 +750,29 @@ ps_start_current (void) {
void
ps_add_meta (playItem_t *it, const char *key, const char *value) {
+ char str[256];
if (!value || !*value) {
- value = "?";
+ if (!strcmp (key, "title")) {
+ int len = 256;
+ // cut filename without path and extension
+ const char *pext = it->fname + strlen (it->fname) - 1;
+ while (pext >= it->fname && *pext != '.') {
+ pext--;
+ }
+ const char *pname = pext;
+ while (pname >= it->fname && *pname != '/') {
+ pname--;
+ }
+ if (*pname == '/') {
+ pname++;
+ }
+ strncpy (str, pname, pext-pname);
+ str[pext-pname] = 0;
+ value = str;
+ }
+ else {
+ value = "?";
+ }
}
metaInfo_t *m = malloc (sizeof (metaInfo_t));
m->key = key;