aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/playlist.c21
-rw-r--r--src/tag.c24
-rw-r--r--src/tag.h2
3 files changed, 35 insertions, 12 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 429bfe903..4d9c0da96 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -735,23 +735,22 @@ int playPlaylist(FILE * fp, int song, int stopOnError) {
}
void syncCurrentPlayerDecodeMetadata() {
- long i = 0;
Song * songPlayer = playerCurrentDecodeSong();
Song * song;
if(!songPlayer) return;
- for(i=0; i<playlist.length; i++) {
- song = playlist.songs[i];
+ if(playlist_state!=PLAYLIST_STATE_PLAY);
- if(song->type == SONG_TYPE_URL &&
- 0 == strcmp(song->utf8url,
- songPlayer->utf8url))
- {
- if(song->tag) freeMpdTag(song->tag);
- song->tag = mpdTagDup(songPlayer->tag);
- incrPlaylistVersion();
- }
+ song = playlist.songs[playlist.order[playlist.current]];
+
+ if(song->type == SONG_TYPE_URL &&
+ 0 == strcmp(song->utf8url, songPlayer->utf8url) &&
+ !mpdTagsAreEqual(song->tag, songPlayer->tag))
+ {
+ if(song->tag) freeMpdTag(song->tag);
+ song->tag = mpdTagDup(songPlayer->tag);
+ incrPlaylistVersion();
}
}
diff --git a/src/tag.c b/src/tag.c
index 2c58a3c16..ae9d41040 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -184,4 +184,26 @@ MpdTag * mpdTagDup(MpdTag * tag) {
return ret;
}
-/* vim:set shiftwidth=4 tabstop=8 expandtab: */
+
+int mpdTagStringsAreEqual(char * s1, char * s2) {
+ if(s1 && s2) {
+ if(strcmp(s1, s2)) return 0;
+ }
+ else if(s1 || s2) return 0;
+
+ return 1;
+}
+
+int mpdTagsAreEqual(MpdTag * tag1, MpdTag * tag2) {
+ if(tag1 == NULL && tag2 == NULL) return 1;
+ else if(!tag1 || ! !tag2) return 0;
+
+ if(tag1->time != tag2->time) return 0;
+
+ if(!mpdTagStringsAreEqual(tag1->artist, tag2->artist)) return 0;
+ if(!mpdTagStringsAreEqual(tag1->album, tag2->album)) return 0;
+ if(!mpdTagStringsAreEqual(tag1->track, tag2->track)) return 0;
+ if(!mpdTagStringsAreEqual(tag1->title, tag2->title)) return 0;
+
+ return 1;
+}
diff --git a/src/tag.h b/src/tag.h
index a06750cf9..87cac2b97 100644
--- a/src/tag.h
+++ b/src/tag.h
@@ -45,5 +45,7 @@ MpdTag * mpdTagDup(MpdTag * tag);
void validateUtf8Tag(MpdTag * tag);
+int mpdTagsAreEqual(MpdTag * tag1, MpdTag * tag2);
+
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */