[Rhythmbox-devel] [PATCH] Put podcasts on the Podcasts playlist
- From: Steven Walter <stevenrwalter gmail com>
- To: rhythmbox-devel gnome org
- Subject: [Rhythmbox-devel] [PATCH] Put podcasts on the Podcasts playlist
- Date: Wed, 28 Mar 2007 19:56:04 -0400
Attached is a patch to better manage Podcasts on the iPod. Currently,
if a podcast is downloaded onto the iPod, it is only added to the master
playlist. If a user were to then look in the "Podcasts" menu of the
iPod, it would be confusingly empty.
This patch does two things. First, in creating an iPod track from a
RhythmDBEntry, the mediatype is set to PODCAST appropriately. Second,
after adding the track to the master playlist, the track is additionally
added to the Podcasts playlist, both in the RB UI and in the itdb.
Comments on this code? I'm not terribly familiar with the rhythmbox
code, so please let me know if there's anything in it that would keep it
from being applied.
Thanks
--
-Steven Walter <stevenrwalter gmail com>
Index: plugins/ipod/rb-ipod-source.c
===================================================================
--- plugins/ipod/rb-ipod-source.c (revision 4986)
+++ plugins/ipod/rb-ipod-source.c (working copy)
@@ -368,6 +368,10 @@
}
#ifdef ENABLE_IPOD_WRITING
+
+#define MEDIATYPE_AUDIO 0x1
+#define MEDIATYPE_PODCAST 0x4
+
static Itdb_Track *
create_ipod_song_from_entry (RhythmDBEntry *entry, const char *mimetype)
{
@@ -393,6 +397,12 @@
track->rating = rhythmdb_entry_get_double (entry, RHYTHMDB_PROP_RATING);
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;
}
@@ -1043,6 +1053,30 @@
}
}
+static void
+add_to_podcasts (RBiPodSourcePrivate *priv, Itdb_Track *song)
+{
+ GList *it, *it2;
+ gchar *filename;
+
+ for (it = priv->ipod_db->playlists, it2 = priv->playlists;
+ it != NULL && it2 != NULL;
+ it = it->next, it2 = it2->next) {
+ Itdb_Playlist *ipl = (Itdb_Playlist *)it->data;
+ RBStaticPlaylistSource *rbpl = RB_STATIC_PLAYLIST_SOURCE(it2->data);
+
+ if (!itdb_playlist_is_podcasts (ipl))
+ continue;
+
+ itdb_playlist_add_track (ipl, song, -1);
+ filename = ipod_path_to_uri (priv->ipod_mount_path,
+ song->ipod_path);
+ rb_static_playlist_source_add_location (rbpl, filename, -1);
+ g_free (filename);
+ return;
+ }
+}
+
static gboolean
impl_track_added (RBRemovableMediaSource *source,
RhythmDBEntry *entry,
@@ -1066,6 +1100,8 @@
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);
request_artwork (isource, entry, db, song);
add_ipod_song_to_db (isource, db, song);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]