[svn r390] - Changed all GString* members to gchar* members trunk
authormorphbr
Sun Mar 04 06:53:50 2007 +0000 (2007-03-04)
branchtrunk
changeset 385ab93678082df
parent 384 060c3ceb43a0
child 386 4184f56767b8
[svn r390] - Changed all GString* members to gchar* members
gmyth/src/gmyth_http.c
gmyth/src/gmyth_http.h
gmyth/src/gmyth_jobqueue.c
gmyth/src/gmyth_recprofile.c
gmyth/src/gmyth_recprofile.h
gmyth/src/gmyth_transcode.c
gmyth/src/gmyth_transcode.h
gmyth/tests/gmyth_test_http.c
     1.1 --- a/gmyth/src/gmyth_http.c	Sat Mar 03 00:01:34 2007 +0000
     1.2 +++ b/gmyth/src/gmyth_http.c	Sun Mar 04 06:53:50 2007 +0000
     1.3 @@ -41,30 +41,30 @@
     1.4  xmlXPathObjectPtr
     1.5  getnodeset(xmlDocPtr doc, xmlChar *xpath)
     1.6  {
     1.7 -  
     1.8 -  xmlXPathContextPtr context;
     1.9 -  xmlXPathObjectPtr result;
    1.10 -  
    1.11 -  context = xmlXPathNewContext(doc);
    1.12 -  result = xmlXPathEvalExpression(xpath, context);
    1.13 -  
    1.14 -  if(xmlXPathNodeSetIsEmpty(result->nodesetval))
    1.15 +
    1.16 +    xmlXPathContextPtr context;
    1.17 +    xmlXPathObjectPtr result;
    1.18 +
    1.19 +    context = xmlXPathNewContext(doc);
    1.20 +    result = xmlXPathEvalExpression(xpath, context);
    1.21 +
    1.22 +    if(xmlXPathNodeSetIsEmpty(result->nodesetval))
    1.23      {
    1.24 -      g_fprintf(stderr, "Error: No result at XPath\n");
    1.25 -      return NULL;
    1.26 +        g_fprintf(stderr, "Error: No result at XPath\n");
    1.27 +        return NULL;
    1.28      }
    1.29 -  
    1.30 -  xmlXPathFreeContext(context);
    1.31 -  return result;
    1.32 +
    1.33 +    xmlXPathFreeContext(context);
    1.34 +    return result;
    1.35  }
    1.36  
    1.37  
    1.38 -xmlDocPtr XMLParse (const char *content, int length) 
    1.39 +xmlDocPtr XMLParse (const char *content, int length)
    1.40  {
    1.41      xmlDocPtr doc; /* the resulting document tree */
    1.42  
    1.43      doc = xmlReadMemory(content, length, NULL, NULL, 0);
    1.44 -    if (doc == NULL) 
    1.45 +    if (doc == NULL)
    1.46      {
    1.47          g_fprintf(stderr, "Error: Failed to parse XML document\n");
    1.48          return NULL;
    1.49 @@ -96,34 +96,34 @@
    1.50        {
    1.51          GMythProgram* program = (GMythProgram*)\
    1.52              g_malloc(sizeof(struct _GMythProgram));
    1.53 -    
    1.54 -        program->title = g_string_new((char *)\
    1.55 +
    1.56 +        program->title = g_strdup((char *)\
    1.57                          xmlGetProp(node, (xmlChar *)"title"));
    1.58 -    
    1.59 -        program->subtitle = g_string_new((char *)\
    1.60 +
    1.61 +        program->subtitle = g_strdup((char *)\
    1.62                          xmlGetProp(node, (xmlChar *)"subtitle"));
    1.63 -    
    1.64 -        program->catType = g_string_new((char *)\
    1.65 +
    1.66 +        program->catType = g_strdup((char *)\
    1.67                          xmlGetProp(node, (xmlChar *)"catType"));
    1.68 -    
    1.69 -        program->category = g_string_new((char *)\
    1.70 +
    1.71 +        program->category = g_strdup((char *)\
    1.72                          xmlGetProp(node, (xmlChar *)"category"));
    1.73 -    
    1.74 +
    1.75          sscanf ((char *)xmlGetProp(node, (xmlChar *)"repeat"),\
    1.76              "%d", &(program->repeat));
    1.77 -    
    1.78 +
    1.79          program->startTime = gmyth_util_string_to_time_val \
    1.80                      ((char *)xmlGetProp(node,(xmlChar *)"startTime"));
    1.81 -    
    1.82 +
    1.83          program->endTime = gmyth_util_string_to_time_val \
    1.84                      ((char *)xmlGetProp(node,(xmlChar *)"endTime"));
    1.85 -    
    1.86 +
    1.87          program_list = g_slist_append(program_list, program);
    1.88        }
    1.89  
    1.90        node = node->next;
    1.91      }
    1.92 -  
    1.93 +
    1.94    return program_list;
    1.95  }
    1.96  
    1.97 @@ -144,11 +144,11 @@
    1.98        GMythChannel* channel = (GMythChannel*)g_malloc\
    1.99                                  (sizeof(struct _GMythChannel));
   1.100  
   1.101 -      channel->channelName = g_string_new((char *)\
   1.102 +      channel->channelName = g_strdup((char *)\
   1.103                        xmlGetProp(node,\
   1.104                           (xmlChar *)"channelName"));
   1.105  
   1.106 -      channel->chanNum = g_string_new((char *)\
   1.107 +      channel->chanNum = g_strdup((char *)\
   1.108                        xmlGetProp(node, (xmlChar *)"chanNum"));
   1.109  
   1.110        sscanf ((char *)xmlGetProp(node, (xmlChar *)"chanId"),\
   1.111 @@ -177,19 +177,19 @@
   1.112  {
   1.113      sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"startChanId"), "%d", &(epg->startChanId));
   1.114      sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"endChanId"), "%d", &(epg->endChanId));
   1.115 -    
   1.116 -    epg->version = g_string_new((char *)xmlGetProp(nodeTab, (xmlChar *)"version"));
   1.117 -    
   1.118 +
   1.119 +    epg->version = g_strdup((char *)xmlGetProp(nodeTab, (xmlChar *)"version"));
   1.120 +
   1.121      sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"protoVer"), "%d", &(epg->protoVer));
   1.122      sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"totalCount"), "%d", &(epg->totalCount));
   1.123      sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"numOfChannels"), "%d", &(epg->numOfChannels));
   1.124 -    
   1.125 +
   1.126      epg->asOf = gmyth_util_string_to_time_val ((char *)xmlGetProp(nodeTab, (xmlChar *)"asOf"));
   1.127      epg->startTime = gmyth_util_string_to_time_val ((char *)xmlGetProp(nodeTab, (xmlChar *)"startTime"));
   1.128      epg->endTime = gmyth_util_string_to_time_val ((char *)xmlGetProp(nodeTab, (xmlChar *)"endTime"));
   1.129 -    
   1.130 +
   1.131      sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"details"), "%d", &(epg->details));
   1.132 -    
   1.133 +
   1.134      // go to Channel section and retrieve Channels and Programs
   1.135      if ( epg->numOfChannels > 0 )
   1.136          get_Channel_List(nodeTab->children->next->children->next, epg);
   1.137 @@ -242,21 +242,21 @@
   1.138  {
   1.139      GMythEpg epg;
   1.140      MemoryStruct chunk;
   1.141 -    
   1.142 +
   1.143      chunk.memory=NULL; /* we expect realloc(NULL, size) to work */
   1.144      chunk.size = 0;    /* no data at this point */
   1.145 -    
   1.146 -    gchar* starttime = (gchar*)g_malloc(sizeof(gchar)*20);
   1.147 +
   1.148 +    gchar* starttime;
   1.149      starttime = gmyth_util_time_to_mythformat_from_time_val(StartTime);
   1.150 -    
   1.151 -    gchar* endtime = (gchar*)g_malloc(sizeof(gchar)*20);
   1.152 +
   1.153 +    gchar* endtime;
   1.154      endtime = gmyth_util_time_to_mythformat_from_time_val(EndTime);
   1.155 -    
   1.156 +
   1.157      GString* command = g_string_new("");
   1.158      g_string_printf(command, "getProgramGuide?StartTime=%s&EndTime=%s&StartChanId=%d"
   1.159              "&NumOfChannels=%d&Details=%s", starttime, endtime, \
   1.160              StartChanId, NumOfChannels, Details);
   1.161 -    
   1.162 +
   1.163      chunk = gmyth_http_request(backend_info, command);
   1.164      if (chunk.memory != NULL)
   1.165      {
   1.166 @@ -264,7 +264,7 @@
   1.167          getEpg(doc, &epg);
   1.168          free(chunk.memory);
   1.169      }
   1.170 -    
   1.171 +
   1.172      return epg;
   1.173  }
   1.174  
   1.175 @@ -273,29 +273,29 @@
   1.176  retrieve_recorded_recording (xmlNodePtr node)
   1.177  {
   1.178      GMythRecorded_Recording recording;
   1.179 -    
   1.180 +
   1.181      if (g_ascii_strcasecmp((char *)node->name, "text") != 0)
   1.182      {
   1.183 -    
   1.184 +
   1.185          sscanf ((char *)xmlGetProp(node, (xmlChar *)"dupInType"),\
   1.186              "%d", &(recording.dupInType));
   1.187 -    
   1.188 +
   1.189          sscanf ((char *)xmlGetProp(node, (xmlChar *)"dupMethod"),\
   1.190              "%d", &(recording.dupMethod));
   1.191 -    
   1.192 +
   1.193          sscanf ((char *)xmlGetProp(node, (xmlChar *)"preRollSeconds"),\
   1.194              "%d", &(recording.preRollSeconds));
   1.195 -    
   1.196 -        recording.playGroup = g_string_new((char *)\
   1.197 +
   1.198 +        recording.playGroup = g_strdup((char *)\
   1.199                          xmlGetProp(node, (xmlChar *)"playGroup"));
   1.200 -    
   1.201 +
   1.202          sscanf ((char *)xmlGetProp(node, (xmlChar *)"recPriority"),\
   1.203              "%d", &(recording.recPriority));
   1.204 -    
   1.205 +
   1.206          recording.recStartTs = gmyth_util_string_to_time_val\
   1.207          ((char *)xmlGetProp(node, (xmlChar *)"recStartTs"));
   1.208      }
   1.209 -    
   1.210 +
   1.211      return recording;
   1.212  }
   1.213  
   1.214 @@ -303,35 +303,35 @@
   1.215  GMythRecorded_Channel retrieve_recorded_channel (xmlNodePtr node)
   1.216  {
   1.217      GMythRecorded_Channel channel;
   1.218 -    
   1.219 +
   1.220      if (g_ascii_strcasecmp((char *)node->name, "text") != 0)
   1.221      {
   1.222 -    
   1.223 -        channel.chanFilters = g_string_new((char *)\
   1.224 +
   1.225 +        channel.chanFilters = g_strdup((char *)\
   1.226                          xmlGetProp(node, (xmlChar *)"chanFilters"));
   1.227 -    
   1.228 -        channel.channelName = g_string_new((char *)\
   1.229 +
   1.230 +        channel.channelName = g_strdup((char *)\
   1.231                      xmlGetProp(node, (xmlChar *)"channelName"));
   1.232 -    
   1.233 +
   1.234          sscanf ((char *)xmlGetProp(node, (xmlChar *)"chanNum"),\
   1.235                  "%d", &(channel.chanNum));
   1.236 -    
   1.237 +
   1.238          sscanf ((char *)xmlGetProp(node, (xmlChar *)"sourceId"),\
   1.239                  "%d", &(channel.sourceId));
   1.240 -    
   1.241 +
   1.242          sscanf ((char *)xmlGetProp(node, (xmlChar *)"commFree"),\
   1.243                  "%d", &(channel.commFree));
   1.244 -    
   1.245 +
   1.246          sscanf ((char *)xmlGetProp(node, (xmlChar *)"inputId"),\
   1.247                  "%d", &(channel.inputId));
   1.248 -    
   1.249 +
   1.250          sscanf ((char *)xmlGetProp(node, (xmlChar *)"chanId"),\
   1.251                  "%d", &(channel.chanId));
   1.252 -    
   1.253 +
   1.254          sscanf ((char *)xmlGetProp(node, (xmlChar *)"callSign"),\
   1.255                  "%d", &(channel.callSign));
   1.256      }
   1.257 -    
   1.258 +
   1.259      return channel;
   1.260  }
   1.261  
   1.262 @@ -346,75 +346,74 @@
   1.263  GSList* get_Recorded_Programs(xmlNodePtr node)
   1.264  {
   1.265      GSList* programList = NULL;
   1.266 -    
   1.267 +
   1.268      while (node != NULL) {
   1.269 -        
   1.270 +
   1.271          if (g_ascii_strcasecmp((char *)node->name, "text") != 0)
   1.272          {
   1.273 -    
   1.274 +
   1.275          GMythRecorded_Program* program = (GMythRecorded_Program*)g_malloc\
   1.276                                              (sizeof(struct _GMythRecorded_Program));
   1.277 -    
   1.278 +
   1.279          sscanf ((char *)xmlGetProp(node, (xmlChar *)"programFlags"),\
   1.280              "%d", &(program->programFlags));
   1.281 -    
   1.282 -        program->title = g_string_new((char *)\
   1.283 +
   1.284 +        program->title = g_strdup((char *)\
   1.285                          xmlGetProp(node, (xmlChar *)"title"));
   1.286 -    
   1.287 +
   1.288          sscanf ((char *)xmlGetProp(node, (xmlChar *)"programId"),\
   1.289                          "%d", &(program->programId));
   1.290 -    
   1.291 -        program->catType = g_string_new((char *)\
   1.292 +
   1.293 +        program->catType = g_strdup((char *)\
   1.294                          xmlGetProp(node, (xmlChar *)"catType"));
   1.295 -    
   1.296 -        program->category = g_string_new((char *)\
   1.297 +
   1.298 +        program->category = g_strdup((char *)\
   1.299                          xmlGetProp(node, (xmlChar *)"category"));
   1.300 -    
   1.301 +
   1.302          sscanf ((char *)xmlGetProp(node, (xmlChar *)"seriesId"),\
   1.303              "%d", &(program->seriesId));
   1.304 -    
   1.305 -    
   1.306 +
   1.307 +
   1.308          program->startTime = gmyth_util_string_to_time_val\
   1.309          ((char *)xmlGetProp(node, (xmlChar *)"startTime"));
   1.310 -        
   1.311 +
   1.312          program->endTime = gmyth_util_string_to_time_val\
   1.313          ((char *)xmlGetProp(node, (xmlChar *)"endTime"));
   1.314 -        
   1.315 +
   1.316          program->lastModified = gmyth_util_string_to_time_val\
   1.317          ((char *)xmlGetProp(node, (xmlChar *)"lastModified"));
   1.318 -        
   1.319 +
   1.320          /* TODO: FIX ME at gmyth_util
   1.321          program->asOf = gmyth_util_string_to_time_val\
   1.322          ((char *)xmlGetProp(node, (xmlChar *)"airdate"));*/
   1.323 -        
   1.324 -        
   1.325 -        program->subTitle = g_string_new((char *)\
   1.326 +
   1.327 +        program->subTitle = g_strdup((char *)\
   1.328                          xmlGetProp(node, (xmlChar *)"subTitle"));
   1.329 -        
   1.330 +
   1.331          sscanf ((char *)xmlGetProp(node, (xmlChar *)"stars"),\
   1.332              "%d", &(program->stars));
   1.333 -        
   1.334 +
   1.335          sscanf ((char *)xmlGetProp(node, (xmlChar *)"repeat"),\
   1.336              "%d", &(program->repeat));
   1.337 -        
   1.338 +
   1.339          sscanf ((char *)xmlGetProp(node, (xmlChar *)"fileSize"),\
   1.340              "%d", &(program->repeat));
   1.341 -        
   1.342 -        program->hostname = g_string_new((char *)\
   1.343 +
   1.344 +        program->hostname = g_strdup((char *)\
   1.345                          xmlGetProp(node, (xmlChar *)"hostname"));
   1.346 -    
   1.347 +
   1.348          program->channel = retrieve_recorded_channel(node->children);
   1.349 -    
   1.350 +
   1.351          // Skip the \n
   1.352          program->recording = retrieve_recorded_recording(node->children->next->next);
   1.353 -        
   1.354 +
   1.355          // add to the list
   1.356          programList = g_slist_append(programList, program);
   1.357          }
   1.358 -    
   1.359 +
   1.360          node = node->next;
   1.361      }
   1.362 -    
   1.363 +
   1.364      return programList;
   1.365  }
   1.366  
   1.367 @@ -426,22 +425,21 @@
   1.368   */
   1.369  void get_Recorded_Properties (xmlNodePtr nodeTab, GMythRecorded* recorded)
   1.370  {
   1.371 -    recorded->version = g_string_new((char *)\
   1.372 +    recorded->version = g_strdup((char *)\
   1.373                      xmlGetProp(nodeTab, (xmlChar *)"version"));
   1.374 -    
   1.375 +
   1.376      sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)\
   1.377                      "protoVer"), "%d", &(recorded->protoVer));
   1.378 -    
   1.379 +
   1.380      sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)\
   1.381                      "totalCount"), "%d", &(recorded->totalCount));
   1.382 -    
   1.383 -    
   1.384 +
   1.385      recorded->asOf = gmyth_util_string_to_time_val \
   1.386          ((char *)xmlGetProp(nodeTab, (xmlChar *)"asOf"));
   1.387 -    
   1.388 +
   1.389      if ( recorded->totalCount > 0)
   1.390          recorded->programList = get_Recorded_Programs(nodeTab->children->next);
   1.391 -  
   1.392 +
   1.393  }
   1.394  
   1.395  
   1.396 @@ -605,7 +603,6 @@
   1.397  gint gmyth_http_del_rec_profile (GMythBackendInfo *backend_info,
   1.398                                   gint id)
   1.399  {
   1.400 -    int ret = -1;
   1.401  
   1.402      GString* command = g_string_new("");
   1.403      g_string_printf(command, "delRecProfiles?id=%d", id);
   1.404 @@ -633,8 +630,8 @@
   1.405          GString* command = g_string_new("");
   1.406          g_string_printf(command, "createRecProfiles?profilename=%s&"\
   1.407                                  "groupname=%s&vcodec=%s&acodec=%s",
   1.408 -                                profile->name->str, profile->group->str,
   1.409 -                                profile->vcodec->str, profile->acodec->str);
   1.410 +                                profile->name, profile->group,
   1.411 +                                profile->vcodec, profile->acodec);
   1.412  
   1.413  
   1.414          return rec_profile_common(backend_info, command);
   1.415 @@ -691,16 +688,16 @@
   1.416                      sscanf ((char *)xmlGetProp(node, (xmlChar *)\
   1.417                                      "id"), "%d", &(profile->id));
   1.418  
   1.419 -                    profile->name = g_string_new((char *)\
   1.420 +                    profile->name = g_strdup((char *)\
   1.421                                          xmlGetProp(node, (xmlChar *)"name"));
   1.422  
   1.423 -                    profile->vcodec = g_string_new((char *)\
   1.424 +                    profile->vcodec = g_strdup((char *)\
   1.425                                          xmlGetProp(node, (xmlChar *)"vcodec"));
   1.426  
   1.427 -                    profile->acodec = g_string_new((char *)\
   1.428 +                    profile->acodec = g_strdup((char *)\
   1.429                                          xmlGetProp(node, (xmlChar *)"acodec"));
   1.430  
   1.431 -                    profile->group = g_string_new(groupname);
   1.432 +                    profile->group = g_strdup(groupname);
   1.433  
   1.434                      profiles = g_slist_append(profiles, profile);
   1.435                  }
   1.436 @@ -747,38 +744,6 @@
   1.437      return realsize;
   1.438  }
   1.439  
   1.440 -/** Create a String containing the URL with the command
   1.441 - *
   1.442 - * @param command A string with the command
   1.443 - * @param variables Vars to use with their values \
   1.444 - *                    MUST FINISH WITH NULL!!!
   1.445 - * @return The response
   1.446 - */
   1.447 -GString* gmyth_http_create_command (GString *command, ...)
   1.448 -{
   1.449 -    va_list args;
   1.450 -    va_start(args, command);
   1.451 -    gchar* s = NULL;
   1.452 -
   1.453 -    g_string_append(command, "?");
   1.454 -
   1.455 -    /* Sintax: var, value */
   1.456 -    while ( (s = va_arg(args, gchar *)) != NULL ) 
   1.457 -    {
   1.458 -        g_string_append(command, s);
   1.459 -        g_string_append(command, "=");
   1.460 -        s = va_arg(args, gchar *);
   1.461 -        g_string_append(command, s);
   1.462 -        g_string_append(command, "&");
   1.463 -    }
   1.464 -
   1.465 -    free(s);
   1.466 -    va_end(args);
   1.467 -
   1.468 -    return command;
   1.469 -}
   1.470 -
   1.471 -
   1.472  
   1.473  /** Send HTTP Command and receives the result of it
   1.474   *
   1.475 @@ -786,7 +751,7 @@
   1.476   *          NULL if there is no response.
   1.477   */
   1.478  MemoryStruct gmyth_http_request (GMythBackendInfo *backend_info, \
   1.479 -				 GString *command)
   1.480 +                                 GString *command)
   1.481  {
   1.482      LIBXML_TEST_VERSION
   1.483  
   1.484 @@ -800,33 +765,33 @@
   1.485             command->str);
   1.486  
   1.487      CURL *curl_handle;
   1.488 -    
   1.489 +
   1.490      MemoryStruct chunk;
   1.491 -    
   1.492 +
   1.493      chunk.memory=NULL; /* we expect realloc(NULL, size) to work */
   1.494      chunk.size = 0;    /* no data at this point */
   1.495 -    
   1.496 +
   1.497      curl_global_init(CURL_GLOBAL_ALL);
   1.498 -    
   1.499 +
   1.500      /* init the curl session */
   1.501      curl_handle = curl_easy_init();
   1.502 -    
   1.503 +
   1.504      /* specify URL to get */
   1.505      curl_easy_setopt(curl_handle, CURLOPT_URL, URL);
   1.506 -    
   1.507 +
   1.508      /* send all data to this function  */
   1.509      curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
   1.510 -    
   1.511 +
   1.512      /* we pass our 'chunk' struct to the callback function */
   1.513      curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
   1.514 -    
   1.515 +
   1.516      /* some servers don't like requests that are made without a user-agent
   1.517          field, so we provide one */
   1.518      curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0");
   1.519 -    
   1.520 +
   1.521      /* get it! */
   1.522      curl_easy_perform(curl_handle);
   1.523 -    
   1.524 +
   1.525      /* cleanup curl stuff */
   1.526      curl_easy_cleanup(curl_handle);
   1.527  
     2.1 --- a/gmyth/src/gmyth_http.h	Sat Mar 03 00:01:34 2007 +0000
     2.2 +++ b/gmyth/src/gmyth_http.h	Sun Mar 04 06:53:50 2007 +0000
     2.3 @@ -66,10 +66,10 @@
     2.4  
     2.5  struct _GMythProgram
     2.6  {
     2.7 -  GString* title;
     2.8 -  GString* subtitle;
     2.9 -  GString* catType;
    2.10 -  GString* category;
    2.11 +  gchar* title;
    2.12 +  gchar* subtitle;
    2.13 +  gchar* catType;
    2.14 +  gchar* category;
    2.15    gint	repeat;
    2.16    GTimeVal* startTime;
    2.17    GTimeVal* endTime;
    2.18 @@ -77,8 +77,8 @@
    2.19  
    2.20  struct _GMythChannel
    2.21  {
    2.22 -  GString* channelName;
    2.23 -  GString* chanNum;
    2.24 +  gchar* channelName;
    2.25 +  gchar* chanNum;
    2.26    gint chanId;
    2.27    gint callSign;
    2.28    GSList* programList;
    2.29 @@ -88,7 +88,7 @@
    2.30  {
    2.31    gint startChanId;
    2.32    gint endChanId;
    2.33 -  GString* version;
    2.34 +  gchar* version;
    2.35    gint protoVer;
    2.36    gint totalCount;
    2.37    gint numOfChannels;
    2.38 @@ -105,7 +105,7 @@
    2.39    gint dupInType;
    2.40    gint dupMethod;
    2.41    gint preRollSeconds;
    2.42 -  GString* playGroup;
    2.43 +  gchar* playGroup;
    2.44    gint recPriority;
    2.45    GTimeVal* recStartTs;
    2.46  };
    2.47 @@ -113,8 +113,8 @@
    2.48  
    2.49  struct _GMythRecorded_Channel
    2.50  {
    2.51 -  GString* chanFilters;
    2.52 -  GString* channelName;
    2.53 +  gchar* chanFilters;
    2.54 +  gchar* channelName;
    2.55    gint chanNum;
    2.56    gint sourceId;
    2.57    gint commFree;
    2.58 @@ -127,27 +127,27 @@
    2.59  struct _GMythRecorded_Program
    2.60  {
    2.61    gint programFlags;
    2.62 -  GString* title;
    2.63 +  gchar* title;
    2.64    gint programId;
    2.65 -  GString* catType;
    2.66 -  GString* category;
    2.67 +  gchar* catType;
    2.68 +  gchar* category;
    2.69    gint seriesId;
    2.70    GTimeVal* startTime;
    2.71    GTimeVal* endTime;
    2.72    GTimeVal* airdate; //?
    2.73    GTimeVal* lastModified;
    2.74 -  GString* subTitle;
    2.75 +  gchar* subTitle;
    2.76    gint stars;
    2.77    gint repeat;
    2.78    gint fileSize;
    2.79 -  GString* hostname;
    2.80 +  gchar* hostname;
    2.81    GMythRecorded_Channel channel;
    2.82    GMythRecorded_Recording recording;
    2.83  };
    2.84  
    2.85  struct _GMythRecorded
    2.86  {
    2.87 -  GString* version;
    2.88 +  gchar* version;
    2.89    gint protoVer;
    2.90    gint totalCount;
    2.91    GTimeVal* asOf;
    2.92 @@ -170,8 +170,7 @@
    2.93  gint gmyth_http_create_rec_profile (GMythBackendInfo *backend_info,\
    2.94                                      GMythRecProfile* profile);
    2.95  
    2.96 -gint gmyth_http_del_rec_profile (GMythBackendInfo *backend_info,
    2.97 -                                 gint id);
    2.98 +gint gmyth_http_del_rec_profile (GMythBackendInfo *backend_info, gint id);
    2.99  
   2.100  MemoryStruct gmyth_http_request (GMythBackendInfo *backend_info, GString *command);
   2.101  
     3.1 --- a/gmyth/src/gmyth_jobqueue.c	Sat Mar 03 00:01:34 2007 +0000
     3.2 +++ b/gmyth/src/gmyth_jobqueue.c	Sun Mar 04 06:53:50 2007 +0000
     3.3 @@ -125,14 +125,14 @@
     3.4  
     3.5              if (transcode->output)
     3.6                  g_string_append_printf(options, " JOB_OUTPUT %s",\
     3.7 -                                       transcode->output_filename->str);
     3.8 +                                       transcode->output_filename);
     3.9  
    3.10              if (transcode->profile != NULL)
    3.11 -                g_string_append_printf(options, " %s", transcode->profile->str);
    3.12 +                g_string_append_printf(options, " %s", transcode->profile);
    3.13          }
    3.14  
    3.15          GString* ret = send_command(socket, "ADD", job, transcode->chanid,
    3.16 -                                    transcode->starttime->str, options->str);
    3.17 +                                    transcode->starttime, options->str);
    3.18  
    3.19          return test_result(ret->str, "JOBQUEUE_OK");
    3.20      }
    3.21 @@ -159,7 +159,7 @@
    3.22      {
    3.23          GString* ret = send_command(socket, action, job,
    3.24                                      transcode->chanid,
    3.25 -                                    transcode->starttime->str, "");
    3.26 +                                    transcode->starttime, "");
    3.27  
    3.28          return test_result(ret->str, "JOBQUEUE_CHANGED_CMD_OK");
    3.29      }
     4.1 --- a/gmyth/src/gmyth_recprofile.c	Sat Mar 03 00:01:34 2007 +0000
     4.2 +++ b/gmyth/src/gmyth_recprofile.c	Sun Mar 04 06:53:50 2007 +0000
     4.3 @@ -150,4 +150,112 @@
     4.4                                          gint id)
     4.5  {
     4.6      return gmyth_http_del_rec_profile(backend_info, id);
     4.7 -}
     4.8 \ No newline at end of file
     4.9 +}
    4.10 +
    4.11 +/**
    4.12 + *
    4.13 + * gmyth_recprofile_set_id
    4.14 + * @brief set recprofile's id
    4.15 + * @param rec GMythRecProfile*
    4.16 + * @param id profile's id
    4.17 + * @return gint representing the result
    4.18 + *
    4.19 + **/
    4.20 +gint gmyth_recprofile_set_id (GMythRecProfile* rec, gint id)
    4.21 +{
    4.22 +    rec->id = id;
    4.23 +    return 0;
    4.24 +}
    4.25 +
    4.26 +/**
    4.27 + *
    4.28 + * gmyth_recprofile_set
    4.29 + * @brief set recprofile's property
    4.30 + * @param rec GMythRecProfile*
    4.31 + * @param member the member you want to modify
    4.32 + * @param value the value
    4.33 + * @return gint representing the result
    4.34 + *
    4.35 + **/
    4.36 +gint gmyth_recprofile_set (GMythRecProfile* rec, 
    4.37 +                           gchar* member, gchar* value)
    4.38 +{
    4.39 +    int ret = 0;
    4.40 +    if (value != NULL)
    4.41 +    {
    4.42 +        if (g_ascii_strcasecmp(member, "name") == 0)
    4.43 +            rec->name = g_strndup(value, strlen(value));
    4.44 +        else
    4.45 +        if (g_ascii_strcasecmp(member, "group") == 0)
    4.46 +            rec->group = g_strndup(value, strlen(value));
    4.47 +        else
    4.48 +        if (g_ascii_strcasecmp(member, "vcodec") == 0)
    4.49 +            rec->vcodec = g_strndup(value, strlen(value));
    4.50 +        else
    4.51 +        if (g_ascii_strcasecmp(member, "acodec") == 0)
    4.52 +            rec->acodec = g_strndup(value, strlen(value));
    4.53 +        else
    4.54 +            ret = -1;
    4.55 +    }
    4.56 +    else 
    4.57 +        ret = -1;
    4.58 +
    4.59 +    return ret;
    4.60 +}
    4.61 +
    4.62 +/**
    4.63 + *
    4.64 + * gmyth_recprofile_set_name
    4.65 + * @brief set recprofile's name
    4.66 + * @param rec GMythRecProfile*
    4.67 + * @param name profile's name
    4.68 + * @return gint representing the result
    4.69 + *
    4.70 + **/
    4.71 +gint gmyth_recprofile_set_name (GMythRecProfile* rec, gchar* name)
    4.72 +{
    4.73 +    return gmyth_recprofile_set(rec, "name", name);
    4.74 +}
    4.75 +
    4.76 +/**
    4.77 + *
    4.78 + * gmyth_recprofile_set_group
    4.79 + * @brief set recprofile's group
    4.80 + * @param rec GMythRecProfile*
    4.81 + * @param group profile's group
    4.82 + * @return gint representing the result
    4.83 + *
    4.84 + **/
    4.85 +gint gmyth_recprofile_set_group (GMythRecProfile* rec, gchar* group)
    4.86 +{
    4.87 +    return gmyth_recprofile_set(rec, "group", group);
    4.88 +}
    4.89 +
    4.90 +/**
    4.91 + *
    4.92 + * gmyth_recprofile_set_vcodec
    4.93 + * @brief set recprofile's vcodec
    4.94 + * @param rec GMythRecProfile*
    4.95 + * @param vcodec profile's vcodec
    4.96 + * @return gint representing the result
    4.97 + *
    4.98 + **/
    4.99 +gint gmyth_recprofile_set_vcodec (GMythRecProfile* rec, gchar* vcodec)
   4.100 +{
   4.101 +    return gmyth_recprofile_set(rec, "vcodec", vcodec);
   4.102 +}
   4.103 +
   4.104 +/**
   4.105 + *
   4.106 + * gmyth_recprofile_set_acodec
   4.107 + * @brief set recprofile's acodec
   4.108 + * @param rec GMythRecProfile*
   4.109 + * @param acodec profile's acodec
   4.110 + * @return gint representing the result
   4.111 + *
   4.112 + **/
   4.113 +gint gmyth_recprofile_set_acodec (GMythRecProfile* rec, gchar* acodec)
   4.114 +{
   4.115 +    return gmyth_recprofile_set(rec, "acodec", acodec);
   4.116 +}
   4.117 +
     5.1 --- a/gmyth/src/gmyth_recprofile.h	Sat Mar 03 00:01:34 2007 +0000
     5.2 +++ b/gmyth/src/gmyth_recprofile.h	Sun Mar 04 06:53:50 2007 +0000
     5.3 @@ -51,17 +51,17 @@
     5.4  struct _GMythRecProfileClass
     5.5  {
     5.6    GObjectClass parent_class;
     5.7 -
     5.8 +  gint teste;
     5.9    /* callbacks */
    5.10  };
    5.11  
    5.12  struct _GMythRecProfile
    5.13  {
    5.14    gint	id;
    5.15 -  GString* name;
    5.16 -  GString* group;
    5.17 -  GString* vcodec;
    5.18 -  GString* acodec;
    5.19 +  gchar* name;
    5.20 +  gchar* group;
    5.21 +  gchar* vcodec;
    5.22 +  gchar* acodec;
    5.23  };
    5.24  
    5.25  
    5.26 @@ -78,6 +78,12 @@
    5.27  gint gmyth_recprofile_del_profile_list (GMythBackendInfo *backend_info,\
    5.28                                          gint id);
    5.29  
    5.30 +gint gmyth_recprofile_set_acodec (GMythRecProfile* rec, gchar* acodec);
    5.31 +gint gmyth_recprofile_set_vcodec (GMythRecProfile* rec, gchar* vcodec);
    5.32 +gint gmyth_recprofile_set_group (GMythRecProfile* rec, gchar* group);
    5.33 +gint gmyth_recprofile_set_name (GMythRecProfile* rec, gchar* name);
    5.34 +gint gmyth_recprofile_set_id (GMythRecProfile* rec, gint id);
    5.35 +
    5.36  G_END_DECLS
    5.37  
    5.38  #endif /*_GMYTH_RECPROFILE_H*/
     6.1 --- a/gmyth/src/gmyth_transcode.c	Sat Mar 03 00:01:34 2007 +0000
     6.2 +++ b/gmyth/src/gmyth_transcode.c	Sun Mar 04 06:53:50 2007 +0000
     6.3 @@ -109,7 +109,7 @@
     6.4   * @return gchar* with file or iso format
     6.5   *
     6.6   **/
     6.7 -GString* gmyth_transcode_date_change_format (gchar* date_s, int format)
     6.8 +gchar* gmyth_transcode_date_change_format (gchar* date_s, int format)
     6.9  {
    6.10      if (date_s != NULL)
    6.11      {
    6.12 @@ -137,7 +137,7 @@
    6.13              dst[19] = '\0';
    6.14          }
    6.15  
    6.16 -        GString* ret = g_string_new(dst);
    6.17 +        gchar* ret = g_strdup(dst);
    6.18  
    6.19          g_free(src);
    6.20          g_free(dst);
    6.21 @@ -160,7 +160,7 @@
    6.22                                   gboolean value, gchar* outputfile)
    6.23  {
    6.24      transcode->output = value;
    6.25 -    transcode->output_filename = g_string_new(outputfile);
    6.26 +    transcode->output_filename = g_strdup(outputfile);
    6.27  }
    6.28  
    6.29  /**
    6.30 @@ -184,6 +184,27 @@
    6.31          gchar** date = g_strsplit(splited[1], ".", 2);
    6.32          transcode->starttime = gmyth_transcode_date_change_format(date[0], DATE_ISO);
    6.33  
    6.34 -        transcode->filename = g_string_new(file);
    6.35 +        transcode->filename = g_strdup(file);
    6.36      }
    6.37  }
    6.38 +
    6.39 +
    6.40 +/**
    6.41 + *
    6.42 + * gmyth_transcode_set_profile
    6.43 + * @brief set transcode's profile
    6.44 + * @param rec GMythTranscode*
    6.45 + * @param value the value
    6.46 + * @return gint representing the result
    6.47 + *
    6.48 + **/
    6.49 +gint gmyth_transcode_set_profile (GMythTranscode* trans,
    6.50 +                                  gchar* value)
    6.51 +{
    6.52 +    if (value != NULL)
    6.53 +        trans->profile = g_strndup(value, strlen(value));
    6.54 +    else 
    6.55 +        return -1;
    6.56 +
    6.57 +    return 0;
    6.58 +}
     7.1 --- a/gmyth/src/gmyth_transcode.h	Sat Mar 03 00:01:34 2007 +0000
     7.2 +++ b/gmyth/src/gmyth_transcode.h	Sun Mar 04 06:53:50 2007 +0000
     7.3 @@ -72,12 +72,12 @@
     7.4      gboolean output;
     7.5  
     7.6      /* private begin */
     7.7 -    GString* output_filename;
     7.8 -    GString* filename;
     7.9 -    GString* profile;
    7.10 +    gchar* output_filename;
    7.11 +    gchar* filename;
    7.12 +    gchar* profile;
    7.13      /* private end */
    7.14  
    7.15 -    GString* starttime;
    7.16 +    gchar* starttime;
    7.17  
    7.18      gint chanid;
    7.19  
    7.20 @@ -93,6 +93,8 @@
    7.21  
    7.22  void gmyth_transcode_set_filename (GMythTranscode* transcode, gchar* file);
    7.23  
    7.24 +gint gmyth_transcode_set_profile (GMythTranscode* trans, gchar* value);
    7.25 +
    7.26  G_END_DECLS
    7.27  
    7.28  #endif /*_GMYTH_TRANSCODE_H*/
     8.1 --- a/gmyth/tests/gmyth_test_http.c	Sat Mar 03 00:01:34 2007 +0000
     8.2 +++ b/gmyth/tests/gmyth_test_http.c	Sun Mar 04 06:53:50 2007 +0000
     8.3 @@ -11,19 +11,39 @@
     8.4  
     8.5      backend_info = gmyth_backend_info_new ();
     8.6  
     8.7 -    gmyth_backend_info_set_hostname (backend_info, "127.0.0.1");
     8.8 +    gmyth_backend_info_set_hostname (backend_info, "192.168.3.165");
     8.9      gmyth_backend_info_set_port (backend_info, 6543);
    8.10      gmyth_backend_info_set_status_port (backend_info, 6544);
    8.11      
    8.12 -    GTimeVal* start = gmyth_util_string_to_time_val("2006-01-01T00:00");
    8.13 -    GTimeVal* end = gmyth_util_string_to_time_val("2007-01-01T00:00");
    8.14 -    GMythEpg epg;
    8.15 -    epg  = gmyth_http_retrieve_epg(backend_info, start, end, 0, 2, "True");
    8.16 +    //GTimeVal* start = gmyth_util_string_to_time_val("2006-01-01T00:00");
    8.17 +    //GTimeVal* end = gmyth_util_string_to_time_val("2007-01-01T00:00");
    8.18 +    //GMythEpg epg;
    8.19 +    //epg  = gmyth_http_retrieve_epg(backend_info, start, end, 0, 2, "True");
    8.20  
    8.21 -    GMythRecorded recorded;
    8.22 -    recorded = gmyth_http_retrieve_recorded(backend_info);
    8.23 +    //GMythRecorded recorded;
    8.24 +    //recorded = gmyth_http_retrieve_recorded(backend_info);
    8.25  
    8.26 -    GMythRecorded_Program* program = recorded.programList->data;
    8.27 +    //GMythRecorded_Program* program = recorded.programList->data;
    8.28 +
    8.29 +    //GSList* profiles = gmyth_http_retrieve_rec_profiles(backend_info, "Transcoders");
    8.30 +
    8.31 +    //GMythRecProfile* prof = profiles->data;
    8.32 +
    8.33 +
    8.34 +
    8.35 +    GMythRecProfile* profile = gmyth_recprofile_new();
    8.36 +
    8.37 +    gmyth_recprofile_set_name(profile, "Teste");
    8.38 +    gmyth_recprofile_set_group(profile, "Transcoders");
    8.39 +    gmyth_recprofile_set_vcodec(profile, "MPEG-4");
    8.40 +    gmyth_recprofile_set_acodec(profile, "MP3");
    8.41 + 
    8.42 +
    8.43 +    int teste = gmyth_http_create_rec_profile(backend_info, profile);
    8.44 +	
    8.45 +    printf("Hello: %d\n", teste);
    8.46 +
    8.47 +    int teste2 = gmyth_http_del_rec_profile(backend_info, 56);
    8.48  
    8.49      return 0;    
    8.50  }