Package: forked-daapd Version: 0.12~git0.11-125-gca72ee5-1 Severity: wishlist Tags: patch
The id3 tags of some of my MP3s contain trailing whitespace in the artist or title fields. The whitespace is displayed in iTunes (in the small display on the top when playing a song) when playing these MP3s using forked-daapd. This wasn't the case when using mt-daapd or when playing directly from the iTunes library. The attached patch fixes this behaviour: --- /tmp/forked-daapd-0.12~git0.11-125-gca72ee5/src/filescanner.c 2010-08-05 18:28:02.000000000 +0200 +++ /soft/forked-daapd-0.12~git0.11-125-gca72ee5/src/filescanner.c 2010-09-08 00:36:46.000000000 +0200 @@ -131,6 +131,17 @@ return ret; } +static void +trim_string(char *s) +{ + char *p; + + for (p = s + strlen(s) - 1; *p == ' ' && p >= s; p--) + { + *p = '\0'; + } +} + static void fixup_tags(struct media_file_info *mfi) @@ -145,23 +156,50 @@ mfi->genre = NULL; } - if (mfi->artist && (strlen(mfi->artist) == 0)) + if (mfi->artist) + { + if (strlen(mfi->artist) > 0) + { + trim_string(mfi->artist); + } + if (strlen(mfi->artist) == 0) + { + free(mfi->artist); + mfi->artist = NULL; + } + } + + if (mfi->title) { - free(mfi->artist); - mfi->artist = NULL; + if (strlen(mfi->title) > 0) + { + trim_string(mfi->title); + } + if (strlen(mfi->title) == 0) + { + free(mfi->title); + mfi->title = NULL; + } } - if (mfi->title && (strlen(mfi->title) == 0)) + if (mfi->album) { - free(mfi->title); - mfi->title = NULL; + if (strlen(mfi->album) > 0) + { + trim_string(mfi->album); + } + if (strlen(mfi->album) == 0) + { + free(mfi->album); + mfi->album = NULL; + } } if (!mfi->artist) { if (mfi->orchestra && mfi->conductor) { - len = strlen(mfi->orchestra) + strlen(sep) + strlen(mfi ->conductor); + len = strlen(mfi->orchestra) + strlen(sep) + strlen(mfi->conductor); tag = (char *)malloc(len + 1); if (tag) { -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org