commit aea991b8156a25f0e4e228a5fe4479da48ef4e28
Author: phantomjinx <p.g.richard...@phantomjinx.co.uk>
Date:   Sun Dec 5 14:37:18 2010 +0000

    Fix m3u playlists to support Windows carriage returns
    
    * Strange errors while importing music library, claiming some files
      did not exist.
    * m3u files were being picked up as well, and because these were made on
      a Windows system they contained Windows newlines.
    * Since the importer only strips off the \n, gtkpod was trying to open
      'filename.mp3\r'.
    
    * Thanks to Jop Zinkweg (jzink...@gmail.com) for the patch

 libgtkpod/file.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/libgtkpod/file.c b/libgtkpod/file.c
index f7386b4..00702cd 100644
--- a/libgtkpod/file.c
+++ b/libgtkpod/file.c
@@ -191,8 +191,20 @@ add_playlist_by_filename(iTunesDB *itdb, gchar *plfile, 
Playlist *plitem, gint p
         ++line;
         if (len == 0)
             continue; /* skip empty lines */
-        if (bufp[len - 1] == 0x0a)
+
+        /* remove linux / windows newline characters */
+        if (bufp[len - 1] == 0x0a) {
+            bufp[len - 1] = 0;
+            --len;
+        }
+
+        /* remove windows carriage return
+           to support playlist files created on Windows */
+        if (bufp[len -1] == 0x0d) {
             bufp[len - 1] = 0;
+            --len;
+        }
+
         if (!filetype_is_playlist_filetype(type)) {
             /* skip whitespace */
             while (isspace (*bufp))

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
gtkpod-cvs2 mailing list
gtkpod-cvs2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to