summaryrefslogtreecommitdiff
path: root/plugins/vfs_curl
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-09-18 20:29:25 +0200
committerGravatar waker <wakeroid@gmail.com>2011-09-18 20:29:25 +0200
commit5f5f515df4bba18769c580a6d7e13e8905109f77 (patch)
tree9ad2fb6e0797ce63a7e2c4c82f341108cc4844bd /plugins/vfs_curl
parent1463b4fb8fa4e6ca39a2029df1a33c8d4e6c49e2 (diff)
send "songstarted" event whenever icy metadata is updated
Diffstat (limited to 'plugins/vfs_curl')
-rw-r--r--plugins/vfs_curl/vfs_curl.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/plugins/vfs_curl/vfs_curl.c b/plugins/vfs_curl/vfs_curl.c
index 5e7d0060..37ba65e6 100644
--- a/plugins/vfs_curl/vfs_curl.c
+++ b/plugins/vfs_curl/vfs_curl.c
@@ -202,22 +202,47 @@ http_parse_shoutcast_meta (HTTP_FILE *fp, const char *meta, int size) {
title[s] = 0;
trace ("got stream title: %s\n", title);
if (fp->track) {
+ int songstarted = 0;
char *tit = strstr (title, " - ");
+ deadbeef->pl_lock ();
if (tit) {
*tit = 0;
tit += 3;
- vfs_curl_set_meta (fp->track, "artist", title);
- vfs_curl_set_meta (fp->track, "title", tit);
+
+ const char *orig_title = deadbeef->pl_find_meta (fp->track, "title");
+ const char *orig_artist = deadbeef->pl_find_meta (fp->track, "artist");
+
+ if (!orig_title || strcasecmp (orig_title, tit)) {
+ vfs_curl_set_meta (fp->track, "title", tit);
+ songstarted = 1;
+ }
+ if (!orig_artist || strcasecmp (orig_artist, title)) {
+ vfs_curl_set_meta (fp->track, "artist", title);
+ songstarted = 1;
+ }
}
else {
- vfs_curl_set_meta (fp->track, "title", title);
+ const char *orig_title = deadbeef->pl_find_meta (fp->track, "title");
+ if (!orig_title || strcasecmp (orig_title, tit)) {
+ vfs_curl_set_meta (fp->track, "title", title);
+ songstarted = 1;
+ }
}
+ deadbeef->pl_unlock ();
ddb_playlist_t *plt = deadbeef->plt_get_curr ();
if (plt) {
deadbeef->plt_modified (plt);
deadbeef->plt_unref (plt);
}
deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0);
+ if (songstarted) {
+ ddb_event_track_t *ev = (ddb_event_track_t *)deadbeef->event_alloc (DB_EV_SONGSTARTED);
+ ev->track = fp->track;
+ if (ev->track) {
+ deadbeef->pl_item_ref (ev->track);
+ }
+ deadbeef->event_send ((ddb_event_t *)ev, 0, 0);
+ }
}
return 0;
}