static void load_playlist_file (RBGenericPlayerSource *source, const char *playlist_path, const char *rel_path) { RhythmDBEntryType entry_type; RBGenericPlayerPlaylistSource *playlist; RBShell *shell; char *mount_path; g_object_get (source, "shell", &shell, "entry-type", &entry_type, NULL); mount_path = rb_generic_player_source_get_mount_path (source); rb_debug ("loading playlist %s", playlist_path); playlist = RB_GENERIC_PLAYER_PLAYLIST_SOURCE ( rb_generic_player_playlist_source_new (shell, source, playlist_path, mount_path, entry_type)); if (playlist != NULL) { rb_generic_player_source_add_playlist (source, shell, RB_SOURCE (playlist)); } g_boxed_free (RHYTHMDB_TYPE_ENTRY_TYPE, entry_type); g_object_unref (shell); g_free (mount_path); }
static void rb_generic_player_plugin_new_playlist (GtkAction *action, RBSource *source) { RBShell *shell; RBSourceList *sourcelist; RBSource *playlist; RhythmDBEntryType *entry_type; g_return_if_fail (RB_IS_GENERIC_PLAYER_SOURCE (source)); g_object_get (source, "shell", &shell, "entry-type", &entry_type, NULL); playlist = rb_generic_player_playlist_source_new (shell, RB_GENERIC_PLAYER_SOURCE (source), NULL, NULL, entry_type); g_object_unref (entry_type); rb_generic_player_source_add_playlist (RB_GENERIC_PLAYER_SOURCE (source), shell, playlist); g_object_get (shell, "sourcelist", &sourcelist, NULL); rb_sourcelist_edit_source_name (sourcelist, playlist); g_object_unref (sourcelist); g_object_unref (shell); }
static void impl_add_playlist (RBMediaPlayerSource *source, char *name, GList *entries) { RBSource *playlist; RhythmDBEntryType *entry_type; RBShell *shell; GList *i; g_object_get (source, "shell", &shell, "entry-type", &entry_type, NULL); playlist = rb_generic_player_playlist_source_new (shell, RB_GENERIC_PLAYER_SOURCE (source), NULL, NULL, entry_type); g_object_unref (entry_type); rb_generic_player_source_add_playlist (RB_GENERIC_PLAYER_SOURCE (source), shell, playlist); g_object_set (playlist, "name", name, NULL); for (i = entries; i != NULL; i = i->next) { rb_static_playlist_source_add_entry (RB_STATIC_PLAYLIST_SOURCE (playlist), i->data, -1); } g_object_unref (shell); }
static void new_playlist_action_cb (GSimpleAction *action, GVariant *parameters, gpointer data) { RBGenericPlayerSource *source = RB_GENERIC_PLAYER_SOURCE (data); RBShell *shell; RBSource *playlist; RBDisplayPageTree *page_tree; RhythmDBEntryType *entry_type; GMenuModel *playlist_menu; g_object_get (source, "shell", &shell, "entry-type", &entry_type, "playlist-menu", &playlist_menu, NULL); playlist = rb_generic_player_playlist_source_new (shell, source, NULL, NULL, entry_type, playlist_menu); g_object_unref (entry_type); rb_generic_player_source_add_playlist (source, shell, playlist); g_object_get (shell, "display-page-tree", &page_tree, NULL); rb_display_page_tree_edit_source_name (page_tree, playlist); g_object_unref (page_tree); g_object_unref (playlist_menu); g_object_unref (shell); }
static void visit_playlist_dirs (RBPspSource *source, GFile *file) { RBShell *shell; RhythmDB *db; RhythmDBEntryType *entry_type; char *playlist_path; char *playlist_name; RBSource *playlist; GPtrArray *query; playlist_path = g_file_get_uri (file); /* or _get_path? */ g_object_get (source, "shell", &shell, "entry-type", &entry_type, NULL); g_object_get (shell, "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, RHYTHMDB_QUERY_END); g_free (playlist_path); g_object_unref (entry_type); playlist_name = g_file_get_basename (file); playlist = rb_auto_playlist_source_new (shell, playlist_name, FALSE); g_free (playlist_name); rb_auto_playlist_source_set_query (RB_AUTO_PLAYLIST_SOURCE (playlist), query, RHYTHMDB_QUERY_MODEL_LIMIT_NONE, NULL, NULL, 0); rb_generic_player_source_add_playlist (RB_GENERIC_PLAYER_SOURCE (source), shell, RB_SOURCE (playlist)); rhythmdb_query_free (query); g_object_unref (shell); g_object_unref (db); }