On Mon, 2005-11-21 at 17:59 -0500, Ben Konrath wrote: > Rhythmbox 0.8.x allowed me to import folders from sftp gnome-vfs mounts > (which is a super convenient feature :). With rhythmbox 0.9.x, the sftp > mounts no longer show up in the import file chooser. Are they being > filtered out? If so, what's the reason? G'day everyone, Attached is the latest version of the patch to fully support accessing remote gnome-vfs tracks. It's against cvs head, but should hopefully apply cleanly to 0.9.2 as well. I've tested this with local files, sftp not requiring user intervention, sftp requiring a password and sftp requiring to be given access to the keyring. I also tried having RB on machine A load music from machine B via sftp, and then had RB on machine B play this back via DAAP - and it worked :) One issue that I'm aware of is that remote files will be removed from normal playlists, due to bug 319278 - this should work fine as soon as that bug is fixed. The only other issue I've seen is that importing a remote folder can seem to block the UI for a while. The cause is that the metadata load has to be performed in the main thread (because of gstreamer 0.8 threading issues) and performing this on remote files is slow. If anyone who has music on a remote machine can check this out, in particular for any hangs that I've missed, that would be great. Cheers, James "Doc" Livingston -- "Only one parameter per register please " -- MPW C error message
Index: rhythmdb/rhythmdb.c =================================================================== RCS file: /cvs/gnome/rhythmbox/rhythmdb/rhythmdb.c,v retrieving revision 1.136 diff -u -u -r1.136 rhythmdb.c --- rhythmdb/rhythmdb.c 30 Nov 2005 08:47:22 -0000 1.136 +++ rhythmdb/rhythmdb.c 30 Nov 2005 12:17:41 -0000 @@ -154,9 +154,11 @@ char *real_uri; /* Target of a symlink, if any */ GError *error; + RhythmDB *db; /* STAT */ GnomeVFSFileInfo *vfsinfo; + GnomeVFSAsyncHandle *handle; /* LOAD */ RBMetaData *metadata; /* QUERY_COMPLETE */ @@ -881,6 +883,10 @@ ret->artist = rb_refstring_ref (db->priv->empty_string); ret->album = rb_refstring_ref (db->priv->empty_string); ret->mimetype = rb_refstring_ref (db->priv->octet_stream_str); + + /* don't show songs until they have been stat'd */ + if (type == RHYTHMDB_ENTRY_TYPE_SONG) + ret->hidden = TRUE; if ((type == RHYTHMDB_ENTRY_TYPE_PODCAST_POST) || (type == RHYTHMDB_ENTRY_TYPE_PODCAST_FEED)) @@ -1038,6 +1044,7 @@ /* disable until we have proper library monitoring * because it doesn't work properly now. event = g_new0 (struct RhythmDBEvent, 1) + event->db = db; event->uri = g_strdup (info_uri); event->type = RHYTHMDB_EVENT_FILE_CREATED; g_async_queue_push (db->priv->event_queue, event); @@ -1046,12 +1053,14 @@ case GNOME_VFS_MONITOR_EVENT_CHANGED: case GNOME_VFS_MONITOR_EVENT_METADATA_CHANGED: event = g_new0 (struct RhythmDBEvent, 1); + event->db = db; event->uri = g_strdup (info_uri); event->type = RHYTHMDB_EVENT_FILE_MODIFIED; g_async_queue_push (db->priv->event_queue, event); break; case GNOME_VFS_MONITOR_EVENT_DELETED: event = g_new0 (struct RhythmDBEvent, 1); + event->db = db; event->uri = g_strdup (info_uri); event->type = RHYTHMDB_EVENT_FILE_DELETED; g_async_queue_push (db->priv->event_queue, event); @@ -1327,7 +1336,9 @@ GValue val = {0, }; GTimeVal time; const char *mount_point; - + + rhythmdb_entry_set_visibility (db, entry, TRUE); + /* Update mount point if necessary (main reason is * that we want to set the mount point in legacy * rhythmdb that doesn't have it already @@ -1366,6 +1377,7 @@ new_event = g_new0 (struct RhythmDBEvent, 1); new_event->uri = g_strdup (event->real_uri); new_event->type = RHYTHMDB_EVENT_FILE_MODIFIED; + new_event->db = db; g_async_queue_push (db->priv->event_queue, new_event); } @@ -1691,6 +1703,7 @@ rb_debug ("exiting"); result = g_new0 (struct RhythmDBEvent, 1); result->type = RHYTHMDB_EVENT_THREAD_EXITED; + result->db = data->db; g_async_queue_push (data->db->priv->event_queue, result); g_free (data->uri); g_free (data); @@ -1698,33 +1711,88 @@ } static void +rhythmdb_execute_stat_info_cb (GnomeVFSAsyncHandle *handle, + GList *results, /* GnomeVFSGetFileInfoResult* items */ + struct RhythmDBEvent *event) +{ + GnomeVFSGetFileInfoResult *info_result = results->data; + char *uri = gnome_vfs_uri_to_string (info_result->uri, GNOME_VFS_URI_HIDE_NONE); + + if (uri) { + g_free (event->real_uri); + event->real_uri = uri; + } + + if (info_result->result == GNOME_VFS_OK) { + event->vfsinfo = gnome_vfs_file_info_dup (info_result->file_info); + + if (event->type == RHYTHMDB_EVENT_METADATA_LOAD) { + event->metadata = rb_metadata_new (); + rb_metadata_load (event->metadata, event->real_uri, + &event->error); + } + } else { + char *unescaped = gnome_vfs_unescape_string_for_display (uri); + event->error = g_error_new (RHYTHMDB_ERROR, + RHYTHMDB_ERROR_ACCESS_FAILED, + _("Couldn't access %s: %s"), + unescaped, + gnome_vfs_result_to_string (info_result->result)); + rb_debug ("got error on %s: %s", unescaped, event->error->message); + g_free (unescaped); + event->vfsinfo = NULL; + } + g_async_queue_push (event->db->priv->event_queue, event); +} + + +static void rhythmdb_execute_stat (RhythmDB *db, const char *uri, struct RhythmDBEvent *event) { - GnomeVFSResult vfsresult = GNOME_VFS_OK; - char *unescaped; + GnomeVFSURI *vfs_uri = gnome_vfs_uri_new (uri); - vfsresult = GNOME_VFS_ERROR_GENERIC; - event->real_uri = rb_uri_resolve_symlink (uri); - if (!event->real_uri) - goto error; - event->vfsinfo = gnome_vfs_file_info_new (); - if ((vfsresult = gnome_vfs_get_file_info (uri, - event->vfsinfo, - GNOME_VFS_FILE_INFO_FOLLOW_LINKS)) - == GNOME_VFS_OK) - return; -error: - unescaped = gnome_vfs_unescape_string_for_display (uri); - event->error = g_error_new (RHYTHMDB_ERROR, - RHYTHMDB_ERROR_ACCESS_FAILED, - _("Couldn't access %s: %s"), - unescaped, - gnome_vfs_result_to_string (vfsresult)); - rb_debug ("got error on %s: %s", unescaped, event->error->message); - g_free (unescaped); - if (event->vfsinfo) - gnome_vfs_file_info_unref (event->vfsinfo); - event->vfsinfo = NULL; + if (gnome_vfs_uri_is_local (vfs_uri)) { + GnomeVFSResult vfsresult; + + event->real_uri = rb_uri_resolve_symlink (uri); + event->vfsinfo = gnome_vfs_file_info_new (); + + vfsresult = gnome_vfs_get_file_info (uri, + event->vfsinfo, + GNOME_VFS_FILE_INFO_FOLLOW_LINKS); + if (vfsresult != GNOME_VFS_OK) { + char *unescaped = gnome_vfs_unescape_string_for_display (uri); + event->error = g_error_new (RHYTHMDB_ERROR, + RHYTHMDB_ERROR_ACCESS_FAILED, + _("Couldn't access %s: %s"), + unescaped, + gnome_vfs_result_to_string (vfsresult)); + rb_debug ("got error on %s: %s", unescaped, event->error->message); + g_free (unescaped); + if (event->vfsinfo) + gnome_vfs_file_info_unref (event->vfsinfo); + event->vfsinfo = NULL; + } else { + if (event->type == RHYTHMDB_EVENT_METADATA_LOAD) { + event->metadata = rb_metadata_new (); + rb_metadata_load (event->metadata, event->real_uri, + &event->error); + } + } + + gnome_vfs_uri_unref (vfs_uri); + g_async_queue_push (db->priv->event_queue, event); + } else { + GList *uri_list = g_list_append (NULL, vfs_uri); + event->real_uri = g_strdup (uri); + + gnome_vfs_async_get_file_info (&event->handle, uri_list, + GNOME_VFS_FILE_INFO_FOLLOW_LINKS, + GNOME_VFS_PRIORITY_DEFAULT, + (GnomeVFSAsyncGetFileInfoCallback) rhythmdb_execute_stat_info_cb, + event); + g_list_free (uri_list); + } } @@ -1821,29 +1889,23 @@ { result = g_new0 (struct RhythmDBEvent, 1); result->type = RHYTHMDB_EVENT_STAT; + result->db = db; rb_debug ("executing RHYTHMDB_ACTION_STAT for \"%s\"", action->uri); rhythmdb_execute_stat (db, action->uri, result); - - g_async_queue_push (db->priv->event_queue, result); } break; case RHYTHMDB_ACTION_LOAD: { result = g_new0 (struct RhythmDBEvent, 1); result->type = RHYTHMDB_EVENT_METADATA_LOAD; + result->db = db; rb_debug ("executing RHYTHMDB_ACTION_LOAD for \"%s\"", action->uri); /* First do another stat */ rhythmdb_execute_stat (db, action->uri, result); - if (!result->error) { - result->metadata = rb_metadata_new (); - rb_metadata_load (result->metadata, result->real_uri, - &result->error); - } - g_async_queue_push (db->priv->event_queue, result); } break; case RHYTHMDB_ACTION_SYNC: @@ -1897,6 +1959,7 @@ rb_debug ("exiting main thread"); result = g_new0 (struct RhythmDBEvent, 1); result->type = RHYTHMDB_EVENT_THREAD_EXITED; + result->db = db; g_async_queue_push (db->priv->event_queue, result); g_thread_exit (NULL); @@ -1972,6 +2035,7 @@ rb_debug ("queuing db load complete signal"); result = g_new0 (struct RhythmDBEvent, 1); result->type = RHYTHMDB_EVENT_DB_LOAD; + result->db = db; g_async_queue_push (db->priv->event_queue, result); } @@ -2015,10 +2079,12 @@ out: result = g_new0 (struct RhythmDBEvent, 1); result->type = RHYTHMDB_EVENT_DB_SAVED; + result->db = db; g_async_queue_push (db->priv->event_queue, result); result = g_new0 (struct RhythmDBEvent, 1); result->type = RHYTHMDB_EVENT_THREAD_EXITED; + result->db = db; g_async_queue_push (db->priv->event_queue, result); return NULL; } @@ -2071,6 +2137,7 @@ result = g_new0 (struct RhythmDBEvent, 1); result->type = RHYTHMDB_EVENT_ENTRY_SET; + result->db = db; rb_debug ("queuing RHYTHMDB_ACTION_ENTRY_SET"); @@ -2947,6 +3014,7 @@ result = g_new0 (struct RhythmDBEvent, 1); result->type = RHYTHMDB_EVENT_QUERY_COMPLETE; + result->db = data->db; result->model = RHYTHMDB_QUERY_MODEL (data->main_model); g_async_queue_push (data->db->priv->event_queue, result); @@ -2964,6 +3032,7 @@ result = g_new0 (struct RhythmDBEvent, 1); result->type = RHYTHMDB_EVENT_THREAD_EXITED; + result->db = data->db; g_async_queue_push (data->db->priv->event_queue, result); g_free (data); return NULL; @@ -3466,11 +3535,6 @@ g_value_set_boolean (&new_val, !visible); rhythmdb_entry_set_internal (db, entry, FALSE, RHYTHMDB_PROP_HIDDEN, &new_val); - - g_signal_emit (G_OBJECT (db), rhythmdb_signals[ENTRY_CHANGED], - 0, entry, RHYTHMDB_PROP_HIDDEN, - &old_val, &new_val); - g_value_unset (&new_val); } g_value_unset (&old_val); Index: shell/main.c =================================================================== RCS file: /cvs/gnome/rhythmbox/shell/main.c,v retrieving revision 1.76 diff -u -u -r1.76 main.c --- shell/main.c 21 Nov 2005 10:19:19 -0000 1.76 +++ shell/main.c 30 Nov 2005 12:17:42 -0000 @@ -26,6 +26,7 @@ #include <libgnome/gnome-program.h> #include <libgnome/gnome-i18n.h> #include <libgnomeui/gnome-ui-init.h> +#include <libgnomeui/gnome-authentication-manager.h> #include <gtk/gtk.h> #include <gdk/gdkx.h> /* For _get_user_time... */ #include <glade/glade-init.h> @@ -200,13 +201,7 @@ g_value_init (&context_as_value, G_TYPE_POINTER)); poptContext = g_value_get_pointer (&context_as_value); - /* Disabled because it breaks internet radio and other things - - * doing synchronous calls in the main thread causes deadlock. - * This is too hard to fix right now, so we punt. - */ -#if 0 gnome_authentication_manager_init (); -#endif g_random_set_seed (time(0)); Index: shell/rb-playlist-manager.c =================================================================== RCS file: /cvs/gnome/rhythmbox/shell/rb-playlist-manager.c,v retrieving revision 1.70 diff -u -u -r1.70 rb-playlist-manager.c --- shell/rb-playlist-manager.c 28 Nov 2005 09:48:37 -0000 1.70 +++ shell/rb-playlist-manager.c 30 Nov 2005 12:17:42 -0000 @@ -1026,7 +1026,7 @@ dialog = rb_file_chooser_new (_("Load Playlist"), GTK_WINDOW (mgr->priv->window), GTK_FILE_CHOOSER_ACTION_OPEN, - TRUE); + FALSE); g_signal_connect_object (G_OBJECT (dialog), "response", G_CALLBACK (load_playlist_response_cb), mgr, 0); @@ -1064,7 +1064,7 @@ dialog = rb_file_chooser_new (_("Save Playlist"), GTK_WINDOW (mgr->priv->window), GTK_FILE_CHOOSER_ACTION_SAVE, - TRUE); + FALSE); g_signal_connect_object (G_OBJECT (dialog), "response", G_CALLBACK (save_playlist_response_cb), Index: shell/rb-shell.c =================================================================== RCS file: /cvs/gnome/rhythmbox/shell/rb-shell.c,v retrieving revision 1.360 diff -u -u -r1.360 rb-shell.c --- shell/rb-shell.c 29 Nov 2005 07:12:28 -0000 1.360 +++ shell/rb-shell.c 30 Nov 2005 12:17:44 -0000 @@ -1854,7 +1854,7 @@ dialog = rb_file_chooser_new (_("Import Folder into Library"), GTK_WINDOW (shell->priv->window), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, - TRUE); + FALSE); if (dir) gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog), dir); @@ -1876,7 +1876,7 @@ dialog = rb_file_chooser_new (_("Import File into Library"), GTK_WINDOW (shell->priv->window), GTK_FILE_CHOOSER_ACTION_OPEN, - TRUE); + FALSE); if (dir) gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog), dir); Index: sources/rb-playlist-source.c =================================================================== RCS file: /cvs/gnome/rhythmbox/sources/rb-playlist-source.c,v retrieving revision 1.89 diff -u -u -r1.89 rb-playlist-source.c --- sources/rb-playlist-source.c 30 Nov 2005 08:47:22 -0000 1.89 +++ sources/rb-playlist-source.c 30 Nov 2005 12:17:44 -0000 @@ -753,7 +753,8 @@ return; } - if (rb_uri_is_directory (location)) { + /* if there is an entry, it won't be a directory */ + if (entry == NULL && rb_uri_is_directory (location)) { rb_uri_handle_recursively (location, (GFunc) rb_playlist_source_add_location_swapped, NULL, Index: widgets/rb-druid.c =================================================================== RCS file: /cvs/gnome/rhythmbox/widgets/rb-druid.c,v retrieving revision 1.10 diff -u -u -r1.10 rb-druid.c --- widgets/rb-druid.c 30 Nov 2005 08:47:23 -0000 1.10 +++ widgets/rb-druid.c 30 Nov 2005 12:17:44 -0000 @@ -324,7 +324,7 @@ dialog = rb_file_chooser_new (_("Load folder into Library"), GTK_WINDOW (druid->priv->window), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, - TRUE); + FALSE); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); g_signal_connect_object (G_OBJECT (dialog), "response",
Attachment:
signature.asc
Description: This is a digitally signed message part