Update of /cvsroot/gtkpod/gtkpod/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21924/src

Modified Files:
        file.c file_itunesdb.c misc_track.c 
Log Message:
        * src/file.c
          src/file_itunesdb.c
          src/misc_track.c: When podcasts were first introduced,
          iTunes did not add podcasts to the master playlist and only
          showed them in the Podcast playlist. This has changed in the
          meanwhile and Podcasts also appear in the master playlist
          (i.e. when browsing through the music files on an
          iPod). This patch make gtkpod behave the same. Old iTunesDBs
          with podcasts not listed in the MPL are automagically updated.



Index: file.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/file.c,v
retrieving revision 1.196
retrieving revision 1.197
diff -u -d -r1.196 -r1.197
--- file.c      18 Jan 2007 16:16:43 -0000      1.196
+++ file.c      28 Mar 2007 14:44:48 -0000      1.197
@@ -1,4 +1,4 @@
-/* Time-stamp: <2007-01-19 00:59:20 jcs>
+/* Time-stamp: <2007-03-28 23:12:46 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -1731,7 +1731,7 @@
    position in the track view */
 gboolean add_track_by_filename (iTunesDB *itdb, gchar *fname,
                                Playlist *plitem, gboolean descend,
-                              AddTrackFunc addtrackfunc, gpointer data)
+                               AddTrackFunc addtrackfunc, gpointer data)
 {
   static gint count = 0; /* do a gtkpod_tracks_statusbar_update() every
                            10 tracks */
@@ -1888,7 +1888,9 @@
              }
          }
          else
-         {   /* add track to master playlist if it wasn't a
+         {
+#if 0 /* initially iTunes didn't add podcasts to the MPL */
+             /* add track to master playlist if it wasn't a
               * duplicate and plitem is not the podcasts playlist
               */
              if (added_track == track)
@@ -1896,6 +1898,12 @@
                  if (!itdb_playlist_is_podcasts (plitem))
                      gp_playlist_add_track (mpl, added_track, TRUE);
              }
+#else
+             if (added_track == track)
+             {
+                 gp_playlist_add_track (mpl, added_track, TRUE);
+             }
+#endif
              /* add track to specified playlist -- unless adding
               * to podcasts list and track already exists there */
              if (itdb_playlist_is_podcasts (plitem) &&

Index: file_itunesdb.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/file_itunesdb.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- file_itunesdb.c     27 Feb 2007 22:42:44 -0000      1.112
+++ file_itunesdb.c     28 Mar 2007 14:44:49 -0000      1.113
@@ -1,4 +1,4 @@
-/* Time-stamp: <2007-02-23 21:49:12 jcs>
+/* Time-stamp: <2007-03-28 22:53:36 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -454,6 +454,7 @@
 {
     gchar *cfgdir = prefs_get_cfgdir ();
     GList *gl;
+    Playlist *pod_pl;
     ExtraiTunesDBData *eitdb;
     iTunesDB *itdb = NULL;
     GError *error = NULL;
@@ -758,6 +759,23 @@
        eitdb->data_changed = old_eitdb->data_changed;
     }
 
+    /* Repair old iTunesDB where we didn't add podcasts to the MPL */
+    pod_pl = itdb_playlist_podcasts (itdb);
+    if (pod_pl)
+    {
+       Playlist *mpl = itdb_playlist_mpl (itdb);
+       for (gl=pod_pl->members; gl; gl=gl->next)
+       {
+           Track *tr = gl->data;
+           g_return_val_if_fail (tr, NULL);
+           if (!itdb_playlist_contains_track (mpl, tr))
+           {   /* track contained in Podcasts playlist but not in MPL
+                  -> add to MPL */
+               itdb_playlist_add_track (mpl, tr, -1);
+           }
+       }
+    }
+
     release_widgets();
 
     return itdb;

Index: misc_track.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/misc_track.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- misc_track.c        18 Mar 2007 14:27:19 -0000      1.59
+++ misc_track.c        28 Mar 2007 14:44:49 -0000      1.60
@@ -1,4 +1,4 @@
-/* Time-stamp: <2007-03-18 21:43:39 jcs>
+/* Time-stamp: <2007-03-28 22:53:37 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -1341,12 +1341,13 @@
                /* set flags to 'podcast' if adding to podcast list */
                if (itdb_playlist_is_podcasts (pl))
                    gp_track_set_flags_podcast (track);
-
+#if 0 /* initially iTunes didn't add podcasts to the MPL */
                if (!itdb_playlist_contains_track (to_mpl, track))
                {   /* add to MPL if not already present (will happen
                     * if dragged from the podcasts playlist */
                    gp_playlist_add_track (to_mpl, track, TRUE);
                }
+#endif
                if (!itdb_playlist_is_mpl (pl))
                {
                    /* add to designated playlist -- unless adding
@@ -1415,6 +1416,7 @@
 
                if (addtr == duptr)
                {   /* no duplicate */
+#if 0 /* initially iTunes didn't add podcasts to the MPL */
                    /* we need to add to the MPL if the track is no
                       duplicate and will not be added to the podcasts
                       playlist */
@@ -1423,7 +1425,13 @@
                           playlist */
                        gp_playlist_add_track (to_mpl, addtr, TRUE);
                    }
+#else
+                   /* we need to add to the MPL if the track is no
+                      duplicate */
+                   gp_playlist_add_track (to_mpl, addtr, TRUE);
+#endif
                }
+#if 0 /* initially iTunes didn't add podcasts to the MPL */
                else
                {   /* duplicate */
                    /* we also need to add to the MPL if the track is a
@@ -1436,6 +1444,7 @@
                        gp_playlist_add_track (to_mpl, addtr, TRUE);
                    }
                }
+#endif
                /* add to designated playlist (if not mpl) -- unless
                 * adding to podcasts list and track already * exists
                 * there */


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to