File import patch
Jop Zinkweg <[email protected]>
| Newsgroups | gmane.comp.ipod.gtkpod |
|---|---|
| Message-ID | <[email protected]> |
Hello everyone, I've made a small patch for your consideration. When trying out gtkpod for my new ipod today I came across some strange errors while importing my music library. It claimed some files did not exist. After some digging I discovered my 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'. Attached is a patch which will strip both \r and \n characters from the end of the character buffer. This should make it possible to load 'dos' m3u files containing entries for mp3 files in the same directory. Regards, Jop Zinkweg ------------------------------------------------------------------------------ Oracle to DB2 Conversion Guide: New IBM DB2 features make compatibility easy. Learn about native support for PL/SQL, new data types, scalar functions, improved concurrency, built-in packages, OCI, SQL*Plus, data movement tools, best practices and more - all designed to run applications on both DB2 and Oracle platforms. http://p.sf.net/sfu/oracle-sfdev2dev _______________________________________________ Gtkpod-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gtkpod-devel
file.c.patch
(application/octet-stream, 955 B)
diff --git a/libgtkpod/file.c b/libgtkpod/file.c
index f7386b4..0794bea 100644
--- a/libgtkpod/file.c
+++ b/libgtkpod/file.c
@@ -189,10 +189,19 @@ add_playlist_by_filename(iTunesDB *itdb, gchar *plfile, Playlist *plitem, gint p
gint len = strlen(bufp); /* remove newline */
++line;
+ /* remove linux / windows newline characters */
+ if ((len > 0) && (bufp[len - 1] == 0x0a)) {
+ bufp[len - 1] = 0;
+ --len;
+ }
+ /* remove windows carriage return
+ to support playlist files created on Windows */
+ if ((len > 0) && (bufp[len -1] == 0x0d)) {
+ bufp[len - 1] = 0;
+ --len;
+ }
if (len == 0)
continue; /* skip empty lines */
- if (bufp[len - 1] == 0x0a)
- bufp[len - 1] = 0;
if (!filetype_is_playlist_filetype(type)) {
/* skip whitespace */
while (isspace (*bufp))