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