[Rhythmbox-devel] Patch for bug 551402
- From: Chad Braun-Duin <chadbraunduin gmail com>
- To: rhythmbox-devel gnome org
- Subject: [Rhythmbox-devel] Patch for bug 551402
- Date: Tue, 26 Jan 2010 20:14:56 -0500
Guys,
I was having the same issues as described in
https://bugzilla.gnome.org/show_bug.cgi?id=551402. So I made a couple
of changes to podcasts/rb-podcast-manager.c which seems to fix the
problem for me. Please take a look at the submitted patch and let me
know what you think.
Thanks,
--
Chad Braun-Duin
diff --git a/podcast/rb-podcast-manager.c b/podcast/rb-podcast-manager.c
index 82019da..d5edc87 100644
--- a/podcast/rb-podcast-manager.c
+++ b/podcast/rb-podcast-manager.c
@@ -710,8 +710,8 @@ download_file_info_cb (GFile *source,
g_assert (rb_is_main_thread ());
- rb_debug ("got file info results for %s",
- get_remote_location (data->entry));
+ rb_debug ("got file info results for %s",
+ get_remote_location (data->entry));
src_info = g_file_query_info_finish (source, result, &error);
@@ -1103,6 +1103,32 @@ rb_podcast_manager_add_post (RhythmDB *db,
if (entry)
return NULL;
+ /*does the title with this filesize already exist?*/
+ RhythmDBQueryModel *existing_entries = NULL;
+ existing_entries = rhythmdb_query_model_new_empty (db);
+ rhythmdb_do_full_query (db, RHYTHMDB_QUERY_RESULTS (existing_entries),
+ RHYTHMDB_QUERY_PROP_EQUALS,
+ RHYTHMDB_PROP_TYPE,
+ RHYTHMDB_ENTRY_TYPE_PODCAST_POST,
+ RHYTHMDB_QUERY_PROP_EQUALS,
+ RHYTHMDB_PROP_SUBTITLE,
+ subtitle,
+ RHYTHMDB_QUERY_PROP_EQUALS,
+ RHYTHMDB_PROP_TITLE,
+ title,
+ RHYTHMDB_QUERY_PROP_EQUALS,
+ RHYTHMDB_PROP_FILE_SIZE,
+ filesize,
+ RHYTHMDB_QUERY_END);
+ if (existing_entries != NULL) {
+ GtkTreeIter iter;
+
+ /* look for an existing entry; don't add duplicate titles */
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (existing_entries), &iter)) {
+ return NULL;
+ }
+ }
+
entry = rhythmdb_entry_new (db,
RHYTHMDB_ENTRY_TYPE_PODCAST_POST,
uri);
@@ -1808,7 +1834,7 @@ rb_podcast_manager_insert_feed (RBPodcastManager *pd, RBPodcastChannel *data)
GList *lst_songs;
new_feed = TRUE;
-
+
/* processing podcast head */
entry = rhythmdb_entry_lookup_by_location (db, (gchar *)data->url);
if (entry) {
@@ -1909,54 +1935,60 @@ rb_podcast_manager_insert_feed (RBPodcastManager *pd, RBPodcastChannel *data)
updated = FALSE;
download_last = (eel_gconf_get_integer (CONF_STATE_PODCAST_DOWNLOAD_INTERVAL) != UPDATE_MANUALLY);
for (lst_songs = data->posts; lst_songs != NULL; lst_songs = g_list_next (lst_songs)) {
- RBPodcastItem *item = (RBPodcastItem *) lst_songs->data;
- RhythmDBEntry *post_entry;
-
- if (existing_entries != NULL) {
- GtkTreeIter iter;
- RhythmDBEntry *entry = NULL;
-
- /* look for an existing entry with this remote location */
- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (existing_entries), &iter)) {
- do {
- entry = rhythmdb_query_model_iter_to_entry (existing_entries, &iter);
- if (strcmp (get_remote_location (entry), item->url) == 0) {
- break;
- }
- entry = NULL;
-
- } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (existing_entries), &iter));
- }
-
- if (entry != NULL) {
- /* mark this entry as still being available */
- rhythmdb_query_model_remove_entry (existing_entries, entry);
- }
- }
-
- if (item->pub_date > last_post || item->pub_date == 0) {
- updated = TRUE;
-
- post_entry =
- rb_podcast_manager_add_post (db,
- title,
- (gchar *) item->title,
- (gchar *) data->url,
- (gchar *) (item->author ? item->author : data->author),
- (gchar *) item->url,
- (gchar *) item->description,
- (gulong) (item->pub_date > 0 ? item->pub_date : data->pub_date),
- (gulong) item->duration,
- item->filesize);
- if (post_entry && item->pub_date >= new_last_post) {
- if (item->pub_date > new_last_post) {
- g_list_free (download_entries);
- download_entries = NULL;
- }
- download_entries = g_list_prepend (download_entries, post_entry);
- new_last_post = item->pub_date;
- }
- }
+ RBPodcastItem *item = (RBPodcastItem *) lst_songs->data;
+ RhythmDBEntry *post_entry;
+
+ /*
+ cull existing items off of the internal list if they have not been downloaded
+ and do not exist in the feed anymore
+ */
+ if (existing_entries != NULL) {
+ GtkTreeIter iter;
+ RhythmDBEntry *entry = NULL;
+
+ /* look for an existing entry with this remote location */
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (existing_entries), &iter)) {
+ /* cull off entries which no longer exist in the feed */
+ do {
+ entry = rhythmdb_query_model_iter_to_entry (existing_entries, &iter);
+ if (strcmp (get_remote_location (entry), item->url) == 0) {
+ break;
+ }
+ entry = NULL;
+
+ } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (existing_entries), &iter));
+ }
+
+ if (entry != NULL) {
+ /* mark this entry as still being available */
+ rhythmdb_query_model_remove_entry (existing_entries, entry);
+ }
+ }
+
+ /* sync up all posts in the feed */
+ post_entry =
+ rb_podcast_manager_add_post (db,
+ title,
+ (gchar *) item->title,
+ (gchar *) data->url,
+ (gchar *) (item->author ? item->author : data->author),
+ (gchar *) item->url,
+ (gchar *) item->description,
+ (gulong) (item->pub_date > 0 ? item->pub_date : data->pub_date),
+ (gulong) item->duration,
+ item->filesize);
+
+ if (post_entry)
+ updated = TRUE;
+
+ if (post_entry && item->pub_date > new_last_post) {
+ if (item->pub_date > new_last_post) {
+ g_list_free (download_entries);
+ download_entries = NULL;
+ }
+ download_entries = g_list_prepend (download_entries, post_entry);
+ new_last_post = item->pub_date;
+ }
}
if (download_last) {
@@ -1976,8 +2008,7 @@ rb_podcast_manager_insert_feed (RBPodcastManager *pd, RBPodcastChannel *data)
g_list_free (download_entries);
if (updated)
- g_signal_emit (pd, rb_podcast_manager_signals[FEED_UPDATES_AVAILABLE],
- 0, entry);
+ g_signal_emit (pd, rb_podcast_manager_signals[FEED_UPDATES_AVAILABLE], 0, entry);
if (data->pub_date > new_last_post)
new_last_post = data->pub_date;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]