diff -up rhythmbox-0.10.1/plugins/ipod/rb-ipod-source.c.podcast rhythmbox-0.10.1/plugins/ipod/rb-ipod-source.c
--- rhythmbox-0.10.1/plugins/ipod/rb-ipod-source.c.podcast 2007-09-24 02:18:38.000000000 -0400
+++ rhythmbox-0.10.1/plugins/ipod/rb-ipod-source.c 2007-09-24 02:30:19.000000000 -0400
@@ -50,6 +50,8 @@
#define PHONE_PRODUCT_ID 0x4810
#endif
+static const char *ITDB_PLAYLIST_DATA = "itdb-playlist";
+
static GObject *rb_ipod_source_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties);
@@ -96,6 +98,7 @@ typedef struct
GList *playlists;
gboolean needs_shuffle_db;
+ RBStaticPlaylistSource *podcast_pl;
guint load_idle_id;
} RBiPodSourcePrivate;
@@ -324,6 +327,11 @@ add_rb_playlist (RBiPodSource *source, I
}
priv->playlists = g_list_prepend (priv->playlists, playlist_source);
+ g_object_set_data_full (g_object_ref (playlist_source),
+ ITDB_PLAYLIST_DATA, playlist, g_object_unref);
+ if (itdb_playlist_is_podcasts(playlist)) {
+ priv->podcast_pl = RB_STATIC_PLAYLIST_SOURCE (playlist_source);
+ }
rb_shell_append_source (shell, playlist_source, RB_SOURCE (source));
g_object_unref (shell);
@@ -352,6 +360,10 @@ load_ipod_playlists (RBiPodSource *sourc
}
#ifdef ENABLE_IPOD_WRITING
+
+#define MEDIATYPE_AUDIO 0x0001
+#define MEDIATYPE_PODCAST 0x0004
+
static Itdb_Track *
create_ipod_song_from_entry (RhythmDBEntry *entry, const char *mimetype)
{
@@ -378,6 +390,12 @@ create_ipod_song_from_entry (RhythmDBEnt
track->app_rating = track->rating;
track->playcount = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_PLAY_COUNT);
+ if (rhythmdb_entry_get_pointer (entry, RHYTHMDB_PROP_TYPE) == RHYTHMDB_ENTRY_TYPE_PODCAST_POST) {
+ track->mediatype = MEDIATYPE_PODCAST;
+ } else {
+ track->mediatype = MEDIATYPE_AUDIO;
+ }
+
return track;
}
#endif
@@ -964,6 +982,23 @@ impl_build_dest_uri (RBRemovableMediaSou
return NULL;
}
+static void
+add_to_podcasts (RBiPodSourcePrivate *priv, Itdb_Track *song)
+{
+ gchar *filename;
+ Itdb_Playlist *ipod_playlist;
+
+ if (priv->podcast_pl == NULL)
+ return;
+
+ ipod_playlist = g_object_get_data (G_OBJECT (priv->podcast_pl), ITDB_PLAYLIST_DATA);
+ itdb_playlist_add_track (ipod_playlist, song, -1);
+
+ filename = ipod_path_to_uri (priv->ipod_mount_path, song->ipod_path);
+ rb_static_playlist_source_add_location (priv->podcast_pl, filename, -1);
+ g_free (filename);
+}
+
static gboolean
impl_track_added (RBRemovableMediaSource *source,
RhythmDBEntry *entry,
@@ -987,6 +1022,9 @@ impl_track_added (RBRemovableMediaSource
itdb_track_add (priv->ipod_db, song, -1);
itdb_playlist_add_track (itdb_playlist_mpl (priv->ipod_db),
song, -1);
+ if (song->mediatype == MEDIATYPE_PODCAST) {
+ add_to_podcasts (priv, song);
+ }
add_ipod_song_to_db (isource, db, song);
itdb_schedule_save (isource);