From e22869ebdd98ecc3f870cb1d6c5c31fd1b5d61ee Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 14 Jun 2008 16:08:35 +0200 Subject: Finally implemented "create station" This may be a bit buggy, because no return values are checked or returned. A big cleanup session is waiting... --- libpiano/xml.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'libpiano/xml.c') diff --git a/libpiano/xml.c b/libpiano/xml.c index 6f8cb55..5ac8d97 100644 --- a/libpiano/xml.c +++ b/libpiano/xml.c @@ -245,6 +245,34 @@ void PianoXmlParseStations (PianoHandle_t *ph, char *xml) { xmlFreeDoc (doc); } +void PianoXmlParseCreateStation (PianoHandle_t *ph, char *xml) { + xmlNode *docRoot; + xmlDocPtr doc; + PianoStation_t *tmpStation; + + if (PianoXmlInitDoc (xml, &doc, &docRoot) != PIANO_RET_OK) { + return; + } + + /* get node */ + xmlNode *dataRoot = docRoot->children->children->children->children; + tmpStation = calloc (1, sizeof (*tmpStation)); + PianoXmlStructParser (dataRoot, PianoXmlParseStationsCb, tmpStation); + /* FIXME: copy & waste */ + /* start new linked list or append */ + if (ph->stations == NULL) { + ph->stations = tmpStation; + } else { + PianoStation_t *curStation = ph->stations; + while (curStation->next != NULL) { + curStation = curStation->next; + } + curStation->next = tmpStation; + } + + xmlFreeDoc (doc); +} + /* parses playlist; used when searching too * @author PromyLOPh * @added 2008-06-12 -- cgit v1.2.3