diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-03-15 21:04:17 +0100 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-03-15 21:04:17 +0100 |
commit | 9ae11e954d52343a048af8bcdab80bf38ee9b5d5 (patch) | |
tree | 2668d11542904ddffe46f9b54abdb44712351f58 /playlist.c | |
parent | 3171cc56c6323ab7d9770f487c1084825a60e132 (diff) |
fixed handling of playlist switching in several places
Diffstat (limited to 'playlist.c')
-rw-r--r-- | playlist.c | 34 |
1 files changed, 27 insertions, 7 deletions
@@ -227,6 +227,16 @@ void plt_remove (int plt) { int i; PLT_LOCK; + + // find playlist and notify streamer + playlist_t *p = playlists_head; + playlist_t *prev = NULL; + for (i = 0; p && i < plt; i++) { + prev = p; + p = p->next; + } + streamer_notify_playlist_deleted (p); + if (!plt_loading && (playlists_head && !playlists_head->next)) { trace ("warning: deleting last playlist\n"); pl_clear (); @@ -237,12 +247,6 @@ plt_remove (int plt) { plug_trigger_event (DB_EV_PLAYLISTSWITCH, 0); return; } - playlist_t *prev = NULL; - playlist_t *p = playlists_head; - for (i = 0; p && i < plt; i++) { - prev = p; - p = p->next; - } if (i != plt) { trace ("plt_remove %d failed\n", i); } @@ -311,6 +315,22 @@ plt_get_curr (void) { } int +plt_get_idx_of (playlist_t *plt) { + int i; + PLT_LOCK; + playlist_t *p = playlists_head; + for (i = 0; p && i < playlists_count; i++) { + if (p == plt) { + PLT_UNLOCK; + return i; + } + p = p->next; + } + PLT_UNLOCK; + return -1; +} + +int plt_get_title (int plt, char *buffer, int bufsize) { int i; PLT_LOCK; @@ -1961,7 +1981,7 @@ pl_delete_all_meta (playItem_t *it) { while (it->meta) { metaInfo_t *m = it->meta; it->meta = m->next; - free (m->value); + metacache_remove_string (m->value); free (m); } it->meta = NULL; |