# HG changeset patch # User morphbr # Date 1171287089 0 # Node ID d803a518d7ca29d1ccffa7c59d3577f0a035e863 # Parent c331f46391116724f3f697c4a420794b51a7e707 [svn r354] - Bug fixes in gmyth_http.c: node=node->next inside epg loop. - Coded "retrieve_recorded" inside gmyth_http.c - Added status_port to backend_info struct diff -r c331f4639111 -r d803a518d7ca gmyth/src/gmyth_backendinfo.c --- a/gmyth/src/gmyth_backendinfo.c Sat Feb 10 22:12:54 2007 +0000 +++ b/gmyth/src/gmyth_backendinfo.c Mon Feb 12 13:31:29 2007 +0000 @@ -196,12 +196,25 @@ if ( port <= 0 ) { - gmyth_debug ( "Error trying to set a hostname equals to NULL (it doesn't using UPnP)." ); + gmyth_debug ( "Error trying to set a port less than 0." ); } else { backend_info->port = port; } } +void +gmyth_backend_info_set_status_port (GMythBackendInfo *backend_info, const gint port ) +{ + g_return_if_fail (backend_info != NULL); + + if ( port <= 0 ) + { + gmyth_debug ( "Error trying to set the status port to less than zero." ); + } else { + backend_info->status_port = port; + } +} + const gchar* gmyth_backend_info_get_hostname (GMythBackendInfo *backend_info) { diff -r c331f4639111 -r d803a518d7ca gmyth/src/gmyth_backendinfo.h --- a/gmyth/src/gmyth_backendinfo.h Sat Feb 10 22:12:54 2007 +0000 +++ b/gmyth/src/gmyth_backendinfo.h Mon Feb 12 13:31:29 2007 +0000 @@ -61,6 +61,7 @@ gchar *password; gchar *db_name; gint port; + gint status_port; gchar *path; GMythURI* uri; @@ -85,6 +86,8 @@ const gchar *db_name); void gmyth_backend_info_set_port (GMythBackendInfo *backend_info, gint port); +void gmyth_backend_info_set_status_port (GMythBackendInfo *backend_info, + gint port); const gchar* gmyth_backend_info_get_hostname (GMythBackendInfo *backend_info); const gchar* gmyth_backend_info_get_username (GMythBackendInfo *backend_info); const gchar* gmyth_backend_info_get_password (GMythBackendInfo *backend_info); diff -r c331f4639111 -r d803a518d7ca gmyth/src/gmyth_http.c --- a/gmyth/src/gmyth_http.c Sat Feb 10 22:12:54 2007 +0000 +++ b/gmyth/src/gmyth_http.c Mon Feb 12 13:31:29 2007 +0000 @@ -42,21 +42,21 @@ xmlXPathObjectPtr getnodeset(xmlDocPtr doc, xmlChar *xpath) { - - xmlXPathContextPtr context; - xmlXPathObjectPtr result; - - context = xmlXPathNewContext(doc); - result = xmlXPathEvalExpression(xpath, context); - - if(xmlXPathNodeSetIsEmpty(result->nodesetval)) + + xmlXPathContextPtr context; + xmlXPathObjectPtr result; + + context = xmlXPathNewContext(doc); + result = xmlXPathEvalExpression(xpath, context); + + if(xmlXPathNodeSetIsEmpty(result->nodesetval)) { - g_fprintf(stderr, "Error: No result at XPath\n"); - return NULL; + g_fprintf(stderr, "Error: No result at XPath\n"); + return NULL; } - - xmlXPathFreeContext(context); - return result; + + xmlXPathFreeContext(context); + return result; } @@ -89,33 +89,43 @@ */ GSList* get_Program_List(xmlNodePtr node) { - GSList* program_list = NULL; - - while (node != NULL) - { - if (g_ascii_strcasecmp((char *)node->name, "text") != 0) - { - GMythProgram* program = (GMythProgram*)g_malloc(sizeof(struct _GMythProgram)); + GSList* program_list = NULL; + + while (node != NULL) + { + if (g_ascii_strcasecmp((char *)node->name, "text") != 0) + { + GMythProgram* program = (GMythProgram*)\ + g_malloc(sizeof(struct _GMythProgram)); + + program->title = g_string_new((char *)\ + xmlGetProp(node, (xmlChar *)"title")); - program->title = g_string_new((char *)xmlGetProp(node, (xmlChar *)"title")); - program->subtitle = g_string_new((char *)xmlGetProp(node, (xmlChar *)"subtitle")); - program->catType = g_string_new((char *)xmlGetProp(node, (xmlChar *)"catType")); - program->category = g_string_new((char *)xmlGetProp(node, (xmlChar *)"category")); - - sscanf ((char *)xmlGetProp(node, (xmlChar *)"repeat"), "%d", &(program->repeat)); + program->subtitle = g_string_new((char *)\ + xmlGetProp(node, (xmlChar *)"subtitle")); - program->startTime = gmyth_util_string_to_time_val ((char *)xmlGetProp(node, \ - (xmlChar *)"startTime")); - program->endTime = gmyth_util_string_to_time_val ((char *)xmlGetProp(node, \ - (xmlChar *)"endTime")); + program->catType = g_string_new((char *)\ + xmlGetProp(node, (xmlChar *)"catType")); - program_list = g_slist_append(program_list, program); - } + program->category = g_string_new((char *)\ + xmlGetProp(node, (xmlChar *)"category")); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"repeat"),\ + "%d", &(program->repeat)); + + program->startTime = gmyth_util_string_to_time_val \ + ((char *)xmlGetProp(node,(xmlChar *)"startTime")); - node = node->next; - } - - return program_list; + program->endTime = gmyth_util_string_to_time_val \ + ((char *)xmlGetProp(node,(xmlChar *)"endTime")); + + program_list = g_slist_append(program_list, program); + } + + node = node->next; + } + + return program_list; } /** Retrieves the Channel List from the ProgramGuide @@ -126,26 +136,36 @@ */ void get_Channel_List (xmlNodePtr node, GMythEpg* epg) { - int i; - epg->channelList = NULL; - - if (node != NULL) { - - for (i=1; i <= epg->numOfChannels; i++) - { - GMythChannel* channel = (GMythChannel*)g_malloc(sizeof(struct _GMythChannel)); - - channel->channelName = g_string_new((char *)xmlGetProp(node, (xmlChar *)"channelName")); - channel->chanNum = g_string_new((char *)xmlGetProp(node, (xmlChar *)"chanNum")); - - sscanf ((char *)xmlGetProp(node, (xmlChar *)"chanId"), "%d", &(channel->chanId)); - sscanf ((char *)xmlGetProp(node, (xmlChar *)"callSign"), "%d", &(channel->callSign)); - - channel->programList = get_Program_List(node->children); - - epg->channelList = g_slist_append(epg->channelList, channel); - } + epg->channelList = NULL; + + while (node != NULL) { + + if (g_ascii_strcasecmp((char *)node->name, "text") != 0) + { + GMythChannel* channel = (GMythChannel*)g_malloc\ + (sizeof(struct _GMythChannel)); + + channel->channelName = g_string_new((char *)\ + xmlGetProp(node,\ + (xmlChar *)"channelName")); + + channel->chanNum = g_string_new((char *)\ + xmlGetProp(node, (xmlChar *)"chanNum")); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"chanId"),\ + "%d", &(channel->chanId)); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"callSign"),\ + "%d", &(channel->callSign)); + + channel->programList = get_Program_List(node->children); + + epg->channelList = g_slist_append(epg->channelList, channel); + } + + node=node->next; + } } /** Retrieves the properties from the ProgramGuide @@ -156,26 +176,26 @@ */ void get_ProgramGuide_Properties (xmlNodePtr nodeTab, GMythEpg* epg) { - sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"startChanId"), "%d", &(epg->startChanId)); - sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"endChanId"), "%d", &(epg->endChanId)); - - epg->version = g_string_new((char *)xmlGetProp(nodeTab, (xmlChar *)"version")); - - sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"protoVer"), "%d", &(epg->protoVer)); - sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"totalCount"), "%d", &(epg->totalCount)); - sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"numOfChannels"), "%d", &(epg->numOfChannels)); - - epg->asOf = gmyth_util_string_to_time_val ((char *)xmlGetProp(nodeTab, (xmlChar *)"asOf")); - epg->startTime = gmyth_util_string_to_time_val ((char *)xmlGetProp(nodeTab, (xmlChar *)"startTime")); - epg->endTime = gmyth_util_string_to_time_val ((char *)xmlGetProp(nodeTab, (xmlChar *)"endTime")); - - sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"details"), "%d", &(epg->details)); - - // go to Channel section and retrieve Channels and Programs - if ( epg->numOfChannels > 0 ) - get_Channel_List(nodeTab->children->next->children->next, epg); - else - epg->channelList = NULL; + sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"startChanId"), "%d", &(epg->startChanId)); + sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"endChanId"), "%d", &(epg->endChanId)); + + epg->version = g_string_new((char *)xmlGetProp(nodeTab, (xmlChar *)"version")); + + sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"protoVer"), "%d", &(epg->protoVer)); + sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"totalCount"), "%d", &(epg->totalCount)); + sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"numOfChannels"), "%d", &(epg->numOfChannels)); + + epg->asOf = gmyth_util_string_to_time_val ((char *)xmlGetProp(nodeTab, (xmlChar *)"asOf")); + epg->startTime = gmyth_util_string_to_time_val ((char *)xmlGetProp(nodeTab, (xmlChar *)"startTime")); + epg->endTime = gmyth_util_string_to_time_val ((char *)xmlGetProp(nodeTab, (xmlChar *)"endTime")); + + sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"details"), "%d", &(epg->details)); + + // go to Channel section and retrieve Channels and Programs + if ( epg->numOfChannels > 0 ) + get_Channel_List(nodeTab->children->next->children->next, epg); + else + epg->channelList = NULL; } /** Aux function to retrieve the Eletronic Program Guide @@ -196,17 +216,303 @@ { nodeset = result->nodesetval; for (i=0; i < nodeset->nodeNr; i++) - { - keyword = (xmlChar*)nodeset->nodeTab[i]->name; - if (g_ascii_strcasecmp((char *)keyword, "ProgramGuide") == 0) - get_ProgramGuide_Properties(nodeset->nodeTab[i], epg); - } + { + keyword = (xmlChar*)nodeset->nodeTab[i]->name; + if (g_ascii_strcasecmp((char *)keyword, "ProgramGuide") == 0) + { + get_ProgramGuide_Properties(nodeset->nodeTab[i], epg); + break; + } + } xmlXPathFreeObject (result); } } + +/** Retrieves the Eletronic Program Guide from the backend + * + * @param doc An XML document (xmlDocPtr) + * @return The epg + */ +GMythEpg gmyth_http_retrieve_epg (GMythBackendInfo *backend_info, \ + GTimeVal* StartTime, GTimeVal* EndTime, \ + gint StartChanId, gint NumOfChannels, \ + gchar* Details) +{ + GMythEpg epg; + MemoryStruct chunk; + + chunk.memory=NULL; /* we expect realloc(NULL, size) to work */ + chunk.size = 0; /* no data at this point */ + + gchar* starttime = (gchar*)g_malloc(sizeof(gchar)*20); + starttime = gmyth_util_time_to_mythformat_from_time_val(StartTime); + + gchar* endtime = (gchar*)g_malloc(sizeof(gchar)*20); + endtime = gmyth_util_time_to_mythformat_from_time_val(EndTime); + + GString* command = g_string_new(""); + g_string_printf(command, "getProgramGuide?StartTime=%s&EndTime=%s&StartChanId=%d" + "&NumOfChannels=%d&Details=%s", starttime, endtime, \ + StartChanId, NumOfChannels, Details); + + chunk = gmyth_http_request(backend_info, command); + if (chunk.memory != NULL) + { + xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory)); + getEpg(doc, &epg); + free(chunk.memory); + } + + return epg; +} + + +GMythRecorded_Recording +retrieve_recorded_recording (xmlNodePtr node) +{ + GMythRecorded_Recording recording; + + if (g_ascii_strcasecmp((char *)node->name, "text") != 0) + { + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"dupInType"),\ + "%d", &(recording.dupInType)); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"dupMethod"),\ + "%d", &(recording.dupMethod)); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"preRollSeconds"),\ + "%d", &(recording.preRollSeconds)); + + recording.playGroup = g_string_new((char *)\ + xmlGetProp(node, (xmlChar *)"playGroup")); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"recPriority"),\ + "%d", &(recording.recPriority)); + + recording.recStartTs = gmyth_util_string_to_time_val\ + ((char *)xmlGetProp(node, (xmlChar *)"recStartTs")); + } + + return recording; +} + + +GMythRecorded_Channel retrieve_recorded_channel (xmlNodePtr node) +{ + GMythRecorded_Channel channel; + + if (g_ascii_strcasecmp((char *)node->name, "text") != 0) + { + + + channel.chanFilters = g_string_new((char *)\ + xmlGetProp(node, (xmlChar *)"chanFilters")); + + channel.channelName = g_string_new((char *)\ + xmlGetProp(node, (xmlChar *)"channelName")); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"chanNum"),\ + "%d", &(channel.chanNum)); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"sourceId"),\ + "%d", &(channel.sourceId)); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"commFree"),\ + "%d", &(channel.commFree)); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"inputId"),\ + "%d", &(channel.inputId)); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"chanId"),\ + "%d", &(channel.chanId)); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"callSign"),\ + "%d", &(channel.callSign)); + } + + return channel; +} + + + +/** Retrieves all the programs from Recorded XML + * + * @param nodeTab A pointer to a node inside the XML + * @param recorded The struct where is the current epg + * @return list with all the recorded programs + */ +GSList* get_Recorded_Programs(xmlNodePtr node) +{ + GSList* programList = NULL; + + while (node != NULL) { + + if (g_ascii_strcasecmp((char *)node->name, "text") != 0) + { + + GMythRecorded_Program* program = (GMythRecorded_Program*)g_malloc\ + (sizeof(struct _GMythRecorded_Program)); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"programFlags"),\ + "%d", &(program->programFlags)); + + program->title = g_string_new((char *)\ + xmlGetProp(node, (xmlChar *)"title")); + + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"programId"),\ + "%d", &(program->programId)); + + program->catType = g_string_new((char *)\ + xmlGetProp(node, (xmlChar *)"catType")); + + program->category = g_string_new((char *)\ + xmlGetProp(node, (xmlChar *)"category")); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"seriesId"),\ + "%d", &(program->seriesId)); + + + program->startTime = gmyth_util_string_to_time_val\ + ((char *)xmlGetProp(node, (xmlChar *)"startTime")); + + program->endTime = gmyth_util_string_to_time_val\ + ((char *)xmlGetProp(node, (xmlChar *)"endTime")); + + program->lastModified = gmyth_util_string_to_time_val\ + ((char *)xmlGetProp(node, (xmlChar *)"lastModified")); + + /* TODO: FIX ME at gmyth_util + program->asOf = gmyth_util_string_to_time_val\ + ((char *)xmlGetProp(node, (xmlChar *)"airdate"));*/ + + + program->subTitle = g_string_new((char *)\ + xmlGetProp(node, (xmlChar *)"subTitle")); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"stars"),\ + "%d", &(program->stars)); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"repeat"),\ + "%d", &(program->repeat)); + + sscanf ((char *)xmlGetProp(node, (xmlChar *)"fileSize"),\ + "%d", &(program->repeat)); + + program->hostname = g_string_new((char *)\ + xmlGetProp(node, (xmlChar *)"hostname")); + + program->channel = retrieve_recorded_channel(node->children); + + // Skip the \n + program->recording = retrieve_recorded_recording(node->children->next->next); + + // add to the list + programList = g_slist_append(programList, program); + } + + node = node->next; + } + + return programList; +} + +/** Retrieves the properties from Recorded XML + * + * @param nodeTab A pointer to a node inside the XML + * @param recorded The struct where is the current epg + * @return "recorded" from "param" updated + */ +void get_Recorded_Properties (xmlNodePtr nodeTab, GMythRecorded* recorded) +{ + recorded->version = g_string_new((char *)\ + xmlGetProp(nodeTab, (xmlChar *)"version")); + + sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)\ + "protoVer"), "%d", &(recorded->protoVer)); + + sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)\ + "totalCount"), "%d", &(recorded->totalCount)); + + + recorded->asOf = gmyth_util_string_to_time_val \ + ((char *)xmlGetProp(nodeTab, (xmlChar *)"asOf")); + + if ( recorded->totalCount > 0) + recorded->programList = get_Recorded_Programs(nodeTab->children->next); + +} + + +/** Aux function to retrieve Recorded programs + * + * @param doc An XML document (xmlDocPtr) + * @return The recorded var updated + */ +void getRecorded(xmlDocPtr doc, GMythRecorded* recorded) +{ + xmlXPathObjectPtr result; + xmlNodeSetPtr nodeset; + xmlChar *keyword; + + int i; + result = getXPath((xmlChar *)"/*", doc); + + if (result) + { + nodeset = result->nodesetval; + for (i=0; i < nodeset->nodeNr; i++) + { + keyword = (xmlChar*)nodeset->nodeTab[i]->name; + if (g_ascii_strcasecmp((char *)keyword, "Recorded") == 0) + { + get_Recorded_Properties(nodeset->nodeTab[i], recorded); + break; + } + } + xmlXPathFreeObject (result); + } + +} + + +/** Function to retrieve the files that are recorded + * + */ +GMythRecorded gmyth_http_retrieve_recorded (GMythBackendInfo *backend_info) +{ + GMythRecorded recorded; + MemoryStruct chunk; + + chunk.memory = NULL; + chunk.size = 0; + + GString* command = g_string_new(""); + g_string_printf(command, "getRecorded"); + + chunk = gmyth_http_request(backend_info, command); + if (chunk.memory != NULL) + { + xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory)); + getRecorded(doc, &recorded); + free(chunk.memory); + } + + + return recorded; +} + +/** Function to retrieve settings on the backend + * + * @param backend_info infos about the backend + * @param key the key you want to retrieve + * @param hostname the hostname that the key is set up + * @return the value of the key + */ gchar* gmyth_http_retrieve_setting (GMythBackendInfo *backend_info,\ gchar* key, gchar* hostname) { @@ -215,7 +521,7 @@ xmlChar *keyword; MemoryStruct chunk; gchar* value = NULL; - + chunk.memory = NULL; chunk.size = 0; @@ -250,40 +556,7 @@ } -/** Retrieves the Eletronic Program Guide from the backend - * - * @param doc An XML document (xmlDocPtr) - * @return The epg - */ -GMythEpg retrieve_epg (GMythBackendInfo *backend_info, int port, \ - GTimeVal* StartTime, GTimeVal* EndTime, \ - gint StartChanId, gint NumOfChannels, \ - gchar* Details) -{ - GMythEpg epg; - MemoryStruct chunk; - chunk.memory=NULL; /* we expect realloc(NULL, size) to work */ - chunk.size = 0; /* no data at this point */ - - gchar* starttime = (gchar*)g_malloc(sizeof(gchar)*20); - starttime = gmyth_util_time_to_mythformat_from_time_val(StartTime); - - gchar* endtime = (gchar*)g_malloc(sizeof(gchar)*20); - endtime = gmyth_util_time_to_mythformat_from_time_val(EndTime); - - GString* command = g_string_new(""); - g_string_printf(command, "getProgramGuide?StartTime=%s&EndTime=%s&StartChanId=%d" - "&NumOfChannels=%d&Details=%s", starttime, endtime, \ - StartChanId, NumOfChannels, Details); - - chunk = gmyth_http_request(backend_info, command); - xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory)); - getEpg(doc, &epg); - free(chunk.memory); - - return epg; -} /* Aux functions got from libcurl */ void *myrealloc (void *ptr, size_t size) @@ -351,13 +624,19 @@ * @return A string with the response from the server * NULL if there is no response. */ -MemoryStruct gmyth_http_request (GMythBackendInfo *backend_info, GString *command) +MemoryStruct gmyth_http_request (GMythBackendInfo *backend_info, \ + GString *command) { LIBXML_TEST_VERSION - size_t size = strlen(backend_info->hostname) + strlen(command->str) + 14; + size_t size = strlen(backend_info->hostname) + \ + strlen(command->str) + 14; + gchar *URL = (gchar *)g_malloc(sizeof(gchar)*size); - g_snprintf(URL, size, "http://%s:6544/%s", backend_info->hostname, command->str); + g_snprintf(URL, size, "http://%s:%d/%s", \ + backend_info->hostname, \ + backend_info->status_port, \ + command->str); CURL *curl_handle; diff -r c331f4639111 -r d803a518d7ca gmyth/src/gmyth_http.h --- a/gmyth/src/gmyth_http.h Sat Feb 10 22:12:54 2007 +0000 +++ b/gmyth/src/gmyth_http.h Mon Feb 12 13:31:29 2007 +0000 @@ -48,60 +48,122 @@ #define MYTH_PORT_STATUS 6544 +typedef struct _GMythRecorded_Recording GMythRecorded_Recording; +typedef struct _GMythRecorded_Channel GMythRecorded_Channel; +typedef struct _GMythRecorded_Program GMythRecorded_Program; +typedef struct _GMythRecorded GMythRecorded; typedef struct _GMythProgram GMythProgram; typedef struct _GMythChannel GMythChannel; -typedef struct _GMythEpg GMythEpg; -typedef struct _MemoryStruct MemoryStruct; +typedef struct _GMythEpg GMythEpg; +typedef struct _MemoryStruct MemoryStruct; struct _MemoryStruct { - char *memory; - size_t size; + char *memory; + size_t size; }; struct _GMythProgram { - GString* title; - GString* subtitle; - GString* catType; - GString* category; - gint repeat; - GTimeVal* startTime; - GTimeVal* endTime; + GString* title; + GString* subtitle; + GString* catType; + GString* category; + gint repeat; + GTimeVal* startTime; + GTimeVal* endTime; }; struct _GMythChannel { - GString* channelName; - GString* chanNum; - gint chanId; - gint callSign; - GSList* programList; + GString* channelName; + GString* chanNum; + gint chanId; + gint callSign; + GSList* programList; }; struct _GMythEpg { - gint startChanId; - gint endChanId; - GString* version; - gint protoVer; - gint totalCount; - gint numOfChannels; - GTimeVal* asOf; - GTimeVal* startTime; - GTimeVal* endTime; - gint details; - GSList* channelList; + gint startChanId; + gint endChanId; + GString* version; + gint protoVer; + gint totalCount; + gint numOfChannels; + GTimeVal* asOf; + GTimeVal* startTime; + GTimeVal* endTime; + gint details; + GSList* channelList; }; + +struct _GMythRecorded_Recording +{ + gint dupInType; + gint dupMethod; + gint preRollSeconds; + GString* playGroup; + gint recPriority; + GTimeVal* recStartTs; +}; + + +struct _GMythRecorded_Channel +{ + GString* chanFilters; + GString* channelName; + gint chanNum; + gint sourceId; + gint commFree; + gint inputId; + gint chanId; + gint callSign; +}; + + +struct _GMythRecorded_Program +{ + gint programFlags; + GString* title; + gint programId; + GString* catType; + GString* category; + gint seriesId; + GTimeVal* startTime; + GTimeVal* endTime; + GTimeVal* airdate; //? + GTimeVal* lastModified; + GString* subTitle; + gint stars; + gint repeat; + gint fileSize; + GString* hostname; + GMythRecorded_Channel channel; + GMythRecorded_Recording recording; +}; + +struct _GMythRecorded +{ + GString* version; + gint protoVer; + gint totalCount; + GTimeVal* asOf; + GSList* programList; +}; + + gchar* gmyth_http_retrieve_setting (GMythBackendInfo *backend_info,\ - gchar* key, gchar* hostname); + gchar* key, gchar* hostname); -GMythEpg retrieve_epg(GMythBackendInfo *backend_info, int port,\ +GMythEpg gmyth_http_retrieve_epg(GMythBackendInfo *backend_info, \ GTimeVal* StartTime, GTimeVal* EndTime, \ gint StartChanId, gint NumOfChannels, gchar* Details); +GMythRecorded gmyth_http_retrieve_recorded (GMythBackendInfo *backend_info); + MemoryStruct gmyth_http_request (GMythBackendInfo *backend_info, GString *command); G_END_DECLS diff -r c331f4639111 -r d803a518d7ca gmyth/tests/gmyth_test_http.c --- a/gmyth/tests/gmyth_test_http.c Sat Feb 10 22:12:54 2007 +0000 +++ b/gmyth/tests/gmyth_test_http.c Mon Feb 12 13:31:29 2007 +0000 @@ -11,14 +11,19 @@ backend_info = gmyth_backend_info_new (); - gmyth_backend_info_set_hostname (backend_info, "192.168.3.165"); + gmyth_backend_info_set_hostname (backend_info, "127.0.0.1"); gmyth_backend_info_set_port (backend_info, 6543); + gmyth_backend_info_set_status_port (backend_info, 6544); GTimeVal* start = gmyth_util_string_to_time_val("2006-01-01T00:00"); GTimeVal* end = gmyth_util_string_to_time_val("2007-01-01T00:00"); GMythEpg epg; - epg = retrieve_epg(backend_info, 6544, start, end, 0, 2, "True"); + epg = gmyth_http_retrieve_epg(backend_info, start, end, 0, 2, "True"); + GMythRecorded recorded; + recorded = gmyth_http_retrieve_recorded(backend_info); + + GMythRecorded_Program* program = recorded.programList->data; return 0; }