/** * rb_static_playlist_source_new_from_xml: * @shell: the #RBShell * @node: XML node containing playlist entries * * Constructs a new playlist from the given XML document node. * * Return value: playlist read from XML */ RBSource * rb_static_playlist_source_new_from_xml (RBShell *shell, xmlNodePtr node) { RBSource *psource = rb_static_playlist_source_new (shell, NULL, NULL, TRUE, RHYTHMDB_ENTRY_TYPE_SONG); RBStaticPlaylistSource *source = RB_STATIC_PLAYLIST_SOURCE (psource); rb_static_playlist_source_load_from_xml (source, node); return RB_SOURCE (source); }
/** * rb_playlist_source_new_from_xml: * @shell: the #RBShell instance * @node: libxml node containing the playlist * * Constructs a playlist source instance from the XML serialized * format. This function knows about all the playlist types that * can be saved to disk, and it hands off the XML node to the * appropriate constructor based on the 'type' attribute of * the root node of the playlist. * * Return value: the playlist */ RBSource * rb_playlist_source_new_from_xml (RBShell *shell, xmlNodePtr node) { RBSource *source = NULL; xmlChar *tmp; xmlChar *name; g_return_val_if_fail (RB_IS_SHELL (shell), NULL); /* Try to get name from XML and remove translated names */ name = get_playlist_name_from_xml (node); tmp = xmlGetProp (node, RB_PLAYLIST_TYPE); if (!xmlStrcmp (tmp, RB_PLAYLIST_AUTOMATIC)) source = rb_auto_playlist_source_new_from_xml (shell, (const char *)name, node); else if (!xmlStrcmp (tmp, RB_PLAYLIST_STATIC)) source = rb_static_playlist_source_new_from_xml (shell, (const char *)name, node); else if (!xmlStrcmp (tmp, RB_PLAYLIST_QUEUE)) { RBStaticPlaylistSource *queue; g_object_get (shell, "queue-source", &queue, NULL); rb_static_playlist_source_load_from_xml (queue, node); apply_source_settings (RB_PLAYLIST_SOURCE (queue), node); g_object_unref (queue); } else { g_warning ("attempting to load playlist '%s' of unknown type '%s'", name, tmp); } xmlFree (name); xmlFree (tmp); if (source != NULL) { apply_source_settings (RB_PLAYLIST_SOURCE (source), node); } return source; }