rhythmbox r6043 - in trunk: . plugins/generic-player
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: rhythmbox r6043 - in trunk: . plugins/generic-player
- Date: Wed, 12 Nov 2008 10:56:30 +0000 (UTC)
Author: hadess
Date: Wed Nov 12 10:56:29 2008
New Revision: 6043
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=6043&view=rev
Log:
2008-11-12 Bastien Nocera <hadess hadess net>
* plugins/generic-player/rb-psp-source.c (find_music_dir),
(visit_playlist_dirs), (rb_psp_source_create_playlists):
Enumerate sub-directories ourselves, as the PSP only handles
only one level of directories underneath the main music dir,
add a FIXME
Modified:
trunk/ChangeLog
trunk/plugins/generic-player/rb-psp-source.c
Modified: trunk/plugins/generic-player/rb-psp-source.c
==============================================================================
--- trunk/plugins/generic-player/rb-psp-source.c (original)
+++ trunk/plugins/generic-player/rb-psp-source.c Wed Nov 12 10:56:29 2008
@@ -184,16 +184,16 @@
root = g_mount_get_root (mount);
if (root != NULL) {
music_dir = find_dir_no_case (root, TRUE);
+ /* FIXME create directories if they don't exist */
g_object_unref (root);
}
return music_dir;
}
-static gboolean
-visit_playlist_dirs (GFile *file,
- gboolean dir,
- RBPspSource *source)
+static void
+visit_playlist_dirs (RBPspSource *source,
+ GFile *file)
{
RBShell *shell;
RhythmDB *db;
@@ -203,10 +203,6 @@
RBSource *playlist;
GPtrArray *query;
- if (dir == FALSE) {
- return TRUE;
- }
-
playlist_path = g_file_get_uri (file); /* or _get_path? */
g_object_get (source,
@@ -217,6 +213,8 @@
"db", &db,
NULL);
+ /* FIXME this isn't good enough, we only need the files directly under the playlist directory,
+ * not sub-dirs */
query = rhythmdb_query_parse (db,
RHYTHMDB_QUERY_PROP_EQUALS, RHYTHMDB_PROP_TYPE, entry_type,
RHYTHMDB_QUERY_PROP_PREFIX, RHYTHMDB_PROP_LOCATION, playlist_path,
@@ -236,8 +234,6 @@
g_object_unref (shell);
g_object_unref (db);
-
- return TRUE;
}
@@ -252,14 +248,26 @@
g_object_unref (mount);
if (music_dir != NULL) {
- char *music_dir_uri;
+ GFileEnumerator *e;
+ GFileInfo *info;
- music_dir_uri = g_file_get_uri (music_dir);
- rb_uri_handle_recursively (music_dir_uri,
- NULL,
- (RBUriRecurseFunc) visit_playlist_dirs,
- source);
- g_free (music_dir_uri);
+ e = g_file_enumerate_children (music_dir, G_FILE_ATTRIBUTE_STANDARD_NAME","G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ G_FILE_QUERY_INFO_NONE, NULL, NULL);
+ if (e != NULL) {
+ while ((info = g_file_enumerator_next_file (e, NULL, NULL)) != NULL) {
+ GFile *file;
+ const char *name;
+ if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
+ g_object_unref (info);
+ continue;
+ }
+ name = g_file_info_get_name (info);
+ file = g_file_resolve_relative_path (music_dir, name);
+ visit_playlist_dirs (RB_PSP_SOURCE (source), file);
+ g_object_unref (file);
+ }
+ g_object_unref (e);
+ }
g_object_unref (music_dir);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]