Code

playlist: addded playlist_get_index_from_same_song()
authorMax Kellermann <max@duempel.org>
Thu, 9 Jul 2009 17:21:38 +0000 (19:21 +0200)
committerMax Kellermann <max@duempel.org>
Thu, 9 Jul 2009 17:21:38 +0000 (19:21 +0200)
src/playlist.h
src/screen_browser.c

index 77983f6ed6ec1b2a0beccd4e52d808e282dde286..ca0950d34c41bf953d3e688f51fd65c3fd3239e6 100644 (file)
@@ -133,4 +133,11 @@ playlist_get_index_from_id(const struct mpdclient *c, gint id);
 gint
 playlist_get_index_from_file(const struct mpdclient *c, const gchar *filename);
 
+static inline gint
+playlist_get_index_from_same_song(const struct mpdclient *c,
+                                 const struct mpd_song *song)
+{
+       return playlist_get_index_from_file(c, song->file);
+}
+
 #endif
index 152ee9a1c4baadcbfd59374cbbd834f8e01dac1e..f8386bb426a45e1904ded9680882238fcb311ff1 100644 (file)
@@ -79,7 +79,7 @@ sync_highlights(mpdclient_t *c, mpdclient_filelist_t *fl)
                if ( entity && entity->type==MPD_INFO_ENTITY_TYPE_SONG ) {
                        mpd_Song *song = entity->info.song;
 
-                       if( playlist_get_index_from_file(c, song->file) >= 0 )
+                       if (playlist_get_index_from_same_song(c, song) >= 0)
                                entry->flags |= HIGHLIGHT;
                        else
                                entry->flags &= ~HIGHLIGHT;
@@ -264,7 +264,7 @@ enqueue_and_play(mpdclient_t *c, filelist_entry_t *entry)
        }
 #endif
 
-       idx = playlist_get_index_from_file(c, song->file);
+       idx = playlist_get_index_from_same_song(c, song);
        mpdclient_cmd_play(c, idx);
        return true;
 }
@@ -360,7 +360,7 @@ browser_select_entry(mpdclient_t *c, filelist_entry_t *entry,
 
                entry->flags &= ~HIGHLIGHT;
 
-               while ((idx = playlist_get_index_from_file(c, song->file)) >=0)
+               while ((idx = playlist_get_index_from_same_song(c, song)) >= 0)
                        mpdclient_cmd_delete(c, idx);
 #endif
        }