[svn r388] - Created gmyth_recprofile class trunk
authormorphbr
Fri Mar 02 21:25:50 2007 +0000 (2007-03-02)
branchtrunk
changeset 3834071ea7f32e6
parent 382 438858a187f9
child 384 060c3ceb43a0
[svn r388] - Created gmyth_recprofile class
- Updated gmyth_transcode and gmyth_http to use gmyth_recprofile
gmyth/src/Makefile.am
gmyth/src/gmyth.h
gmyth/src/gmyth_http.c
gmyth/src/gmyth_http.h
gmyth/src/gmyth_recprofile.c
gmyth/src/gmyth_recprofile.h
gmyth/src/gmyth_transcode.c
gmyth/src/gmyth_transcode.h
     1.1 --- a/gmyth/src/Makefile.am	Thu Mar 01 20:07:46 2007 +0000
     1.2 +++ b/gmyth/src/Makefile.am	Fri Mar 02 21:25:50 2007 +0000
     1.3 @@ -18,16 +18,17 @@
     1.4  	gmyth_query.c				\
     1.5  	gmyth_socket.c				\
     1.6  	gmyth_stringlist.c			\
     1.7 -	gmyth_monitor_handler.c			\
     1.8 -	gmyth_file_transfer.c			\
     1.9 +	gmyth_monitor_handler.c		\
    1.10 +	gmyth_file_transfer.c		\
    1.11  	gmyth_livetv.c				\
    1.12  	gmyth_backendinfo.c			\
    1.13  	gmyth_programinfo.c			\
    1.14 -	gmyth_uri.c				\
    1.15 +	gmyth_uri.c					\
    1.16  	gmyth_http.c				\
    1.17 -	gmyth_vlc.c				\
    1.18 +	gmyth_vlc.c					\
    1.19  	gmyth_jobqueue.c			\
    1.20  	gmyth_transcode.c			\
    1.21 +	gmyth_recprofile.c			\
    1.22  	$(BUILT_SOURCES)
    1.23  
    1.24  
    1.25 @@ -44,16 +45,16 @@
    1.26  	mv gmyth_marshal.c.tmp gmyth_marshal.c
    1.27  
    1.28  libgmyth_la_CFLAGS = 			\
    1.29 -	-DDATADIR=\"$(pkgdatadir)\" 		\
    1.30 +	-DDATADIR=\"$(pkgdatadir)\" \
    1.31  	$(GLIB_CFLAGS) 				\
    1.32  	$(GOBJECT_CFLAGS)			\
    1.33  	$(GST_CFLAGS) 				\
    1.34  	$(GSTBASE_CFLAGS)			\
    1.35 -	$(GSTPLUGINSBASE_CFLAGS)		\
    1.36 +	$(GSTPLUGINSBASE_CFLAGS)	\
    1.37  	$(MYSQL_CFLAGS)				\
    1.38  	$(LIBXML_CFLAGS)
    1.39  
    1.40 -libgmyth_la_LDFLAGS = 				\
    1.41 +libgmyth_la_LDFLAGS = 			\
    1.42  	-export-dynamic 			\
    1.43  	$(MYSQL_LIBS) 				\
    1.44  	$(GST_LIBS) 				\
    1.45 @@ -65,7 +66,7 @@
    1.46  	$(pkgincludedir)
    1.47  
    1.48  libgmyth_include_HEADERS =    	\
    1.49 -	gmyth.h					\
    1.50 +	gmyth.h						\
    1.51  	gmyth_common.h	 			\
    1.52  	gmyth_debug.h				\
    1.53  	gmyth_epg.h 				\
    1.54 @@ -77,15 +78,16 @@
    1.55  	gmyth_socket.h 				\
    1.56  	gmyth_remote_util.h			\
    1.57  	gmyth_stringlist.h 			\
    1.58 -	gmyth_monitor_handler.h			\
    1.59 -	gmyth_file_transfer.h			\
    1.60 +	gmyth_monitor_handler.h		\
    1.61 +	gmyth_file_transfer.h		\
    1.62  	gmyth_livetv.h				\
    1.63  	gmyth_backendinfo.h			\
    1.64  	gmyth_programinfo.h			\
    1.65 -	gmyth_uri.h				\
    1.66 +	gmyth_uri.h					\
    1.67  	gmyth_http.h				\
    1.68 -	gmyth_vlc.h				\
    1.69 +	gmyth_vlc.h					\
    1.70  	gmyth_jobqueue.h			\
    1.71 -	gmyth_transcode.h			
    1.72 +	gmyth_transcode.h			\
    1.73 +	gmyth_recprofile.h
    1.74  
    1.75  CLEANFILES = $(BUILT_SOURCES)
     2.1 --- a/gmyth/src/gmyth.h	Thu Mar 01 20:07:46 2007 +0000
     2.2 +++ b/gmyth/src/gmyth.h	Fri Mar 02 21:25:50 2007 +0000
     2.3 @@ -50,5 +50,6 @@
     2.4  #include <gmyth_vlc.h>
     2.5  #include <gmyth_jobqueue.h>
     2.6  #include <gmyth_transcode.h>
     2.7 +#include <gmyth_recprofile.h>
     2.8  
     2.9  #endif /* _GMYTH_H_ */
     3.1 --- a/gmyth/src/gmyth_http.c	Thu Mar 01 20:07:46 2007 +0000
     3.2 +++ b/gmyth/src/gmyth_http.c	Fri Mar 02 21:25:50 2007 +0000
     3.3 @@ -38,7 +38,6 @@
     3.4  #include "gmyth_debug.h"
     3.5  #include "gmyth_socket.h"
     3.6  
     3.7 -
     3.8  xmlXPathObjectPtr
     3.9  getnodeset(xmlDocPtr doc, xmlChar *xpath)
    3.10  {
    3.11 @@ -90,38 +89,38 @@
    3.12  GSList* get_Program_List(xmlNodePtr node)
    3.13  {
    3.14    GSList* program_list = NULL;
    3.15 -  
    3.16 +
    3.17    while (node != NULL)
    3.18      {
    3.19        if (g_ascii_strcasecmp((char *)node->name, "text") != 0)
    3.20        {
    3.21 -	  GMythProgram* program = (GMythProgram*)\
    3.22 -	    g_malloc(sizeof(struct _GMythProgram));
    3.23 -	  
    3.24 -	  program->title = g_string_new((char *)\
    3.25 -					xmlGetProp(node, (xmlChar *)"title"));
    3.26 +        GMythProgram* program = (GMythProgram*)\
    3.27 +            g_malloc(sizeof(struct _GMythProgram));
    3.28 +    
    3.29 +        program->title = g_string_new((char *)\
    3.30 +                        xmlGetProp(node, (xmlChar *)"title"));
    3.31 +    
    3.32 +        program->subtitle = g_string_new((char *)\
    3.33 +                        xmlGetProp(node, (xmlChar *)"subtitle"));
    3.34 +    
    3.35 +        program->catType = g_string_new((char *)\
    3.36 +                        xmlGetProp(node, (xmlChar *)"catType"));
    3.37 +    
    3.38 +        program->category = g_string_new((char *)\
    3.39 +                        xmlGetProp(node, (xmlChar *)"category"));
    3.40 +    
    3.41 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"repeat"),\
    3.42 +            "%d", &(program->repeat));
    3.43 +    
    3.44 +        program->startTime = gmyth_util_string_to_time_val \
    3.45 +                    ((char *)xmlGetProp(node,(xmlChar *)"startTime"));
    3.46 +    
    3.47 +        program->endTime = gmyth_util_string_to_time_val \
    3.48 +                    ((char *)xmlGetProp(node,(xmlChar *)"endTime"));
    3.49 +    
    3.50 +        program_list = g_slist_append(program_list, program);
    3.51 +      }
    3.52  
    3.53 -	  program->subtitle = g_string_new((char *)\
    3.54 -					   xmlGetProp(node, (xmlChar *)"subtitle"));
    3.55 -
    3.56 -	  program->catType = g_string_new((char *)\
    3.57 -					  xmlGetProp(node, (xmlChar *)"catType"));
    3.58 -
    3.59 -	  program->category = g_string_new((char *)\
    3.60 -					   xmlGetProp(node, (xmlChar *)"category"));
    3.61 -	  
    3.62 -	  sscanf ((char *)xmlGetProp(node, (xmlChar *)"repeat"),\
    3.63 -		  "%d", &(program->repeat));
    3.64 -	  
    3.65 -	  program->startTime = gmyth_util_string_to_time_val \
    3.66 -	    ((char *)xmlGetProp(node,(xmlChar *)"startTime"));
    3.67 -
    3.68 -	  program->endTime = gmyth_util_string_to_time_val \
    3.69 -	    ((char *)xmlGetProp(node,(xmlChar *)"endTime"));
    3.70 -	  
    3.71 -	  program_list = g_slist_append(program_list, program);
    3.72 -      }
    3.73 -      
    3.74        node = node->next;
    3.75      }
    3.76    
    3.77 @@ -137,33 +136,33 @@
    3.78  void get_Channel_List (xmlNodePtr node, GMythEpg* epg)
    3.79  {
    3.80    epg->channelList = NULL;
    3.81 -  
    3.82 +
    3.83    while (node != NULL) {
    3.84 -    
    3.85 +
    3.86      if (g_ascii_strcasecmp((char *)node->name, "text") != 0)
    3.87      {
    3.88        GMythChannel* channel = (GMythChannel*)g_malloc\
    3.89 -	(sizeof(struct _GMythChannel));
    3.90 -      
    3.91 +                                (sizeof(struct _GMythChannel));
    3.92 +
    3.93        channel->channelName = g_string_new((char *)\
    3.94 -					  xmlGetProp(node,\
    3.95 -						     (xmlChar *)"channelName"));
    3.96 -      
    3.97 +                      xmlGetProp(node,\
    3.98 +                         (xmlChar *)"channelName"));
    3.99 +
   3.100        channel->chanNum = g_string_new((char *)\
   3.101 -				      xmlGetProp(node, (xmlChar *)"chanNum"));
   3.102 -      
   3.103 +                      xmlGetProp(node, (xmlChar *)"chanNum"));
   3.104 +
   3.105        sscanf ((char *)xmlGetProp(node, (xmlChar *)"chanId"),\
   3.106 -	      "%d", &(channel->chanId));
   3.107 -      
   3.108 +          "%d", &(channel->chanId));
   3.109 +
   3.110        sscanf ((char *)xmlGetProp(node, (xmlChar *)"callSign"),\
   3.111 -	      "%d", &(channel->callSign));
   3.112 -      
   3.113 +          "%d", &(channel->callSign));
   3.114 +
   3.115        channel->programList = get_Program_List(node->children);
   3.116 -      
   3.117 +
   3.118        epg->channelList = g_slist_append(epg->channelList, channel);
   3.119 -      
   3.120 +
   3.121      }
   3.122 -    
   3.123 +
   3.124      node=node->next;
   3.125    }
   3.126  }
   3.127 @@ -176,26 +175,26 @@
   3.128   */
   3.129  void get_ProgramGuide_Properties (xmlNodePtr nodeTab, GMythEpg* epg)
   3.130  {
   3.131 -  sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"startChanId"), "%d", &(epg->startChanId));
   3.132 -  sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"endChanId"), "%d", &(epg->endChanId));
   3.133 -  
   3.134 -  epg->version = g_string_new((char *)xmlGetProp(nodeTab, (xmlChar *)"version"));
   3.135 -  
   3.136 -  sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"protoVer"), "%d", &(epg->protoVer));
   3.137 -  sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"totalCount"), "%d", &(epg->totalCount));
   3.138 -  sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"numOfChannels"), "%d", &(epg->numOfChannels));
   3.139 -  
   3.140 -  epg->asOf = gmyth_util_string_to_time_val ((char *)xmlGetProp(nodeTab, (xmlChar *)"asOf"));
   3.141 -  epg->startTime = gmyth_util_string_to_time_val ((char *)xmlGetProp(nodeTab, (xmlChar *)"startTime"));
   3.142 -  epg->endTime = gmyth_util_string_to_time_val ((char *)xmlGetProp(nodeTab, (xmlChar *)"endTime"));
   3.143 -  
   3.144 -  sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"details"), "%d", &(epg->details));
   3.145 -  
   3.146 -  // go to Channel section and retrieve Channels and Programs
   3.147 -  if ( epg->numOfChannels > 0 )
   3.148 -    get_Channel_List(nodeTab->children->next->children->next, epg);
   3.149 -  else
   3.150 -    epg->channelList = NULL;
   3.151 +    sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"startChanId"), "%d", &(epg->startChanId));
   3.152 +    sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"endChanId"), "%d", &(epg->endChanId));
   3.153 +    
   3.154 +    epg->version = g_string_new((char *)xmlGetProp(nodeTab, (xmlChar *)"version"));
   3.155 +    
   3.156 +    sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"protoVer"), "%d", &(epg->protoVer));
   3.157 +    sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"totalCount"), "%d", &(epg->totalCount));
   3.158 +    sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"numOfChannels"), "%d", &(epg->numOfChannels));
   3.159 +    
   3.160 +    epg->asOf = gmyth_util_string_to_time_val ((char *)xmlGetProp(nodeTab, (xmlChar *)"asOf"));
   3.161 +    epg->startTime = gmyth_util_string_to_time_val ((char *)xmlGetProp(nodeTab, (xmlChar *)"startTime"));
   3.162 +    epg->endTime = gmyth_util_string_to_time_val ((char *)xmlGetProp(nodeTab, (xmlChar *)"endTime"));
   3.163 +    
   3.164 +    sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)"details"), "%d", &(epg->details));
   3.165 +    
   3.166 +    // go to Channel section and retrieve Channels and Programs
   3.167 +    if ( epg->numOfChannels > 0 )
   3.168 +        get_Channel_List(nodeTab->children->next->children->next, epg);
   3.169 +    else
   3.170 +        epg->channelList = NULL;
   3.171  }
   3.172  
   3.173  /** Aux function to retrieve the Eletronic Program Guide
   3.174 @@ -216,14 +215,14 @@
   3.175      {
   3.176          nodeset = result->nodesetval;
   3.177          for (i=0; i < nodeset->nodeNr; i++) 
   3.178 -	{
   3.179 -	  keyword = (xmlChar*)nodeset->nodeTab[i]->name;
   3.180 -	  if (g_ascii_strcasecmp((char *)keyword, "ProgramGuide") == 0)
   3.181 -	  {
   3.182 -	    get_ProgramGuide_Properties(nodeset->nodeTab[i], epg);
   3.183 -	    break;
   3.184 -	  }
   3.185 -	}
   3.186 +        {
   3.187 +            keyword = (xmlChar*)nodeset->nodeTab[i]->name;
   3.188 +            if (g_ascii_strcasecmp((char *)keyword, "ProgramGuide") == 0)
   3.189 +            {
   3.190 +                get_ProgramGuide_Properties(nodeset->nodeTab[i], epg);
   3.191 +                break;
   3.192 +            }
   3.193 +        }
   3.194          xmlXPathFreeObject (result);
   3.195      }
   3.196  
   3.197 @@ -237,104 +236,103 @@
   3.198   * @return The epg
   3.199   */
   3.200  GMythEpg gmyth_http_retrieve_epg (GMythBackendInfo *backend_info, \
   3.201 -				  GTimeVal* StartTime, GTimeVal* EndTime, \
   3.202 -				  gint StartChanId, gint NumOfChannels, \
   3.203 -				  gchar* Details)
   3.204 +                  GTimeVal* StartTime, GTimeVal* EndTime, \
   3.205 +                  gint StartChanId, gint NumOfChannels, \
   3.206 +                  gchar* Details)
   3.207  {
   3.208 -  GMythEpg epg;
   3.209 -  MemoryStruct chunk;
   3.210 -  
   3.211 -  chunk.memory=NULL; /* we expect realloc(NULL, size) to work */
   3.212 -  chunk.size = 0;    /* no data at this point */
   3.213 -  
   3.214 -  gchar* starttime = (gchar*)g_malloc(sizeof(gchar)*20);
   3.215 -  starttime = gmyth_util_time_to_mythformat_from_time_val(StartTime);
   3.216 -  
   3.217 -  gchar* endtime = (gchar*)g_malloc(sizeof(gchar)*20);
   3.218 -  endtime = gmyth_util_time_to_mythformat_from_time_val(EndTime);
   3.219 -  
   3.220 -  GString* command = g_string_new("");
   3.221 -  g_string_printf(command, "getProgramGuide?StartTime=%s&EndTime=%s&StartChanId=%d"
   3.222 -		  "&NumOfChannels=%d&Details=%s", starttime, endtime, \
   3.223 -		  StartChanId, NumOfChannels, Details);
   3.224 -  
   3.225 -  chunk = gmyth_http_request(backend_info, command);
   3.226 -  if (chunk.memory != NULL)
   3.227 -  {
   3.228 -    xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory));
   3.229 -    getEpg(doc, &epg);
   3.230 -    free(chunk.memory);
   3.231 -  }
   3.232 - 
   3.233 -  return epg;
   3.234 +    GMythEpg epg;
   3.235 +    MemoryStruct chunk;
   3.236 +    
   3.237 +    chunk.memory=NULL; /* we expect realloc(NULL, size) to work */
   3.238 +    chunk.size = 0;    /* no data at this point */
   3.239 +    
   3.240 +    gchar* starttime = (gchar*)g_malloc(sizeof(gchar)*20);
   3.241 +    starttime = gmyth_util_time_to_mythformat_from_time_val(StartTime);
   3.242 +    
   3.243 +    gchar* endtime = (gchar*)g_malloc(sizeof(gchar)*20);
   3.244 +    endtime = gmyth_util_time_to_mythformat_from_time_val(EndTime);
   3.245 +    
   3.246 +    GString* command = g_string_new("");
   3.247 +    g_string_printf(command, "getProgramGuide?StartTime=%s&EndTime=%s&StartChanId=%d"
   3.248 +            "&NumOfChannels=%d&Details=%s", starttime, endtime, \
   3.249 +            StartChanId, NumOfChannels, Details);
   3.250 +    
   3.251 +    chunk = gmyth_http_request(backend_info, command);
   3.252 +    if (chunk.memory != NULL)
   3.253 +    {
   3.254 +        xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory));
   3.255 +        getEpg(doc, &epg);
   3.256 +        free(chunk.memory);
   3.257 +    }
   3.258 +    
   3.259 +    return epg;
   3.260  }
   3.261  
   3.262  
   3.263  GMythRecorded_Recording 
   3.264  retrieve_recorded_recording (xmlNodePtr node)
   3.265  {
   3.266 -  GMythRecorded_Recording recording;
   3.267 -
   3.268 -  if (g_ascii_strcasecmp((char *)node->name, "text") != 0)
   3.269 -  {
   3.270 -
   3.271 -    sscanf ((char *)xmlGetProp(node, (xmlChar *)"dupInType"),\
   3.272 -	    "%d", &(recording.dupInType));
   3.273 -
   3.274 -    sscanf ((char *)xmlGetProp(node, (xmlChar *)"dupMethod"),\
   3.275 -	    "%d", &(recording.dupMethod));
   3.276 -
   3.277 -    sscanf ((char *)xmlGetProp(node, (xmlChar *)"preRollSeconds"),\
   3.278 -	    "%d", &(recording.preRollSeconds));
   3.279 -
   3.280 -    recording.playGroup = g_string_new((char *)\
   3.281 -					xmlGetProp(node, (xmlChar *)"playGroup"));
   3.282 -
   3.283 -    sscanf ((char *)xmlGetProp(node, (xmlChar *)"recPriority"),\
   3.284 -	    "%d", &(recording.recPriority));
   3.285 -
   3.286 -    recording.recStartTs = gmyth_util_string_to_time_val\
   3.287 -      ((char *)xmlGetProp(node, (xmlChar *)"recStartTs"));
   3.288 -  }
   3.289 -
   3.290 -  return recording;
   3.291 +    GMythRecorded_Recording recording;
   3.292 +    
   3.293 +    if (g_ascii_strcasecmp((char *)node->name, "text") != 0)
   3.294 +    {
   3.295 +    
   3.296 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"dupInType"),\
   3.297 +            "%d", &(recording.dupInType));
   3.298 +    
   3.299 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"dupMethod"),\
   3.300 +            "%d", &(recording.dupMethod));
   3.301 +    
   3.302 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"preRollSeconds"),\
   3.303 +            "%d", &(recording.preRollSeconds));
   3.304 +    
   3.305 +        recording.playGroup = g_string_new((char *)\
   3.306 +                        xmlGetProp(node, (xmlChar *)"playGroup"));
   3.307 +    
   3.308 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"recPriority"),\
   3.309 +            "%d", &(recording.recPriority));
   3.310 +    
   3.311 +        recording.recStartTs = gmyth_util_string_to_time_val\
   3.312 +        ((char *)xmlGetProp(node, (xmlChar *)"recStartTs"));
   3.313 +    }
   3.314 +    
   3.315 +    return recording;
   3.316  }
   3.317  
   3.318  
   3.319 -GMythRecorded_Channel  retrieve_recorded_channel (xmlNodePtr node)
   3.320 +GMythRecorded_Channel retrieve_recorded_channel (xmlNodePtr node)
   3.321  {
   3.322 -  GMythRecorded_Channel channel;
   3.323 -
   3.324 -  if (g_ascii_strcasecmp((char *)node->name, "text") != 0)
   3.325 -  {
   3.326 +    GMythRecorded_Channel channel;
   3.327      
   3.328 +    if (g_ascii_strcasecmp((char *)node->name, "text") != 0)
   3.329 +    {
   3.330      
   3.331 -    channel.chanFilters = g_string_new((char *)\
   3.332 -					xmlGetProp(node, (xmlChar *)"chanFilters"));
   3.333 -
   3.334 -    channel.channelName = g_string_new((char *)\
   3.335 -					xmlGetProp(node, (xmlChar *)"channelName"));
   3.336 -
   3.337 -    sscanf ((char *)xmlGetProp(node, (xmlChar *)"chanNum"),\
   3.338 -	    "%d", &(channel.chanNum));
   3.339 -
   3.340 -    sscanf ((char *)xmlGetProp(node, (xmlChar *)"sourceId"),\
   3.341 -	    "%d", &(channel.sourceId));
   3.342 -
   3.343 -    sscanf ((char *)xmlGetProp(node, (xmlChar *)"commFree"),\
   3.344 -	    "%d", &(channel.commFree));
   3.345 -
   3.346 -    sscanf ((char *)xmlGetProp(node, (xmlChar *)"inputId"),\
   3.347 -	    "%d", &(channel.inputId));
   3.348 -
   3.349 -    sscanf ((char *)xmlGetProp(node, (xmlChar *)"chanId"),\
   3.350 -	    "%d", &(channel.chanId));
   3.351 -
   3.352 -    sscanf ((char *)xmlGetProp(node, (xmlChar *)"callSign"),\
   3.353 -	    "%d", &(channel.callSign));
   3.354 -  }
   3.355 -  
   3.356 -  return channel;
   3.357 +        channel.chanFilters = g_string_new((char *)\
   3.358 +                        xmlGetProp(node, (xmlChar *)"chanFilters"));
   3.359 +    
   3.360 +        channel.channelName = g_string_new((char *)\
   3.361 +                    xmlGetProp(node, (xmlChar *)"channelName"));
   3.362 +    
   3.363 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"chanNum"),\
   3.364 +                "%d", &(channel.chanNum));
   3.365 +    
   3.366 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"sourceId"),\
   3.367 +                "%d", &(channel.sourceId));
   3.368 +    
   3.369 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"commFree"),\
   3.370 +                "%d", &(channel.commFree));
   3.371 +    
   3.372 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"inputId"),\
   3.373 +                "%d", &(channel.inputId));
   3.374 +    
   3.375 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"chanId"),\
   3.376 +                "%d", &(channel.chanId));
   3.377 +    
   3.378 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"callSign"),\
   3.379 +                "%d", &(channel.callSign));
   3.380 +    }
   3.381 +    
   3.382 +    return channel;
   3.383  }
   3.384  
   3.385  
   3.386 @@ -347,78 +345,77 @@
   3.387   */
   3.388  GSList* get_Recorded_Programs(xmlNodePtr node)
   3.389  {
   3.390 -  GSList* programList = NULL;
   3.391 -  
   3.392 -  while (node != NULL) {
   3.393 +    GSList* programList = NULL;
   3.394      
   3.395 -    if (g_ascii_strcasecmp((char *)node->name, "text") != 0)
   3.396 -    {
   3.397 -
   3.398 -      GMythRecorded_Program* program = (GMythRecorded_Program*)g_malloc\
   3.399 -	(sizeof(struct _GMythRecorded_Program));
   3.400 -      
   3.401 -      sscanf ((char *)xmlGetProp(node, (xmlChar *)"programFlags"),\
   3.402 -	      "%d", &(program->programFlags));
   3.403 -      
   3.404 -      program->title = g_string_new((char *)\
   3.405 -				    xmlGetProp(node, (xmlChar *)"title"));
   3.406 -      
   3.407 -      
   3.408 -      sscanf ((char *)xmlGetProp(node, (xmlChar *)"programId"),\
   3.409 -	      "%d", &(program->programId));
   3.410 -      
   3.411 -      program->catType = g_string_new((char *)\
   3.412 -				      xmlGetProp(node, (xmlChar *)"catType"));
   3.413 -      
   3.414 -      program->category = g_string_new((char *)\
   3.415 -				       xmlGetProp(node, (xmlChar *)"category"));
   3.416 -      
   3.417 -      sscanf ((char *)xmlGetProp(node, (xmlChar *)"seriesId"),\
   3.418 -	      "%d", &(program->seriesId));
   3.419 -      
   3.420 -      
   3.421 -      program->startTime = gmyth_util_string_to_time_val\
   3.422 -	((char *)xmlGetProp(node, (xmlChar *)"startTime"));
   3.423 -      
   3.424 -      program->endTime = gmyth_util_string_to_time_val\
   3.425 -	((char *)xmlGetProp(node, (xmlChar *)"endTime"));
   3.426 -      
   3.427 -      program->lastModified = gmyth_util_string_to_time_val\
   3.428 -	((char *)xmlGetProp(node, (xmlChar *)"lastModified"));
   3.429 -      
   3.430 -      /* TODO: FIX ME at gmyth_util
   3.431 -	 program->asOf = gmyth_util_string_to_time_val\
   3.432 -	 ((char *)xmlGetProp(node, (xmlChar *)"airdate"));*/
   3.433 -      
   3.434 -      
   3.435 -      program->subTitle = g_string_new((char *)\
   3.436 -				       xmlGetProp(node, (xmlChar *)"subTitle"));
   3.437 -      
   3.438 -      sscanf ((char *)xmlGetProp(node, (xmlChar *)"stars"),\
   3.439 -	      "%d", &(program->stars));
   3.440 -      
   3.441 -      sscanf ((char *)xmlGetProp(node, (xmlChar *)"repeat"),\
   3.442 -	      "%d", &(program->repeat));
   3.443 -      
   3.444 -      sscanf ((char *)xmlGetProp(node, (xmlChar *)"fileSize"),\
   3.445 -	      "%d", &(program->repeat));
   3.446 -      
   3.447 -      program->hostname = g_string_new((char *)\
   3.448 -					 xmlGetProp(node, (xmlChar *)"hostname"));
   3.449 -
   3.450 -      program->channel = retrieve_recorded_channel(node->children);
   3.451 -
   3.452 -      // Skip the \n
   3.453 -      program->recording = retrieve_recorded_recording(node->children->next->next);
   3.454 -      
   3.455 -      // add to the list
   3.456 -      programList = g_slist_append(programList, program);
   3.457 +    while (node != NULL) {
   3.458 +        
   3.459 +        if (g_ascii_strcasecmp((char *)node->name, "text") != 0)
   3.460 +        {
   3.461 +    
   3.462 +        GMythRecorded_Program* program = (GMythRecorded_Program*)g_malloc\
   3.463 +                                            (sizeof(struct _GMythRecorded_Program));
   3.464 +    
   3.465 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"programFlags"),\
   3.466 +            "%d", &(program->programFlags));
   3.467 +    
   3.468 +        program->title = g_string_new((char *)\
   3.469 +                        xmlGetProp(node, (xmlChar *)"title"));
   3.470 +    
   3.471 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"programId"),\
   3.472 +                        "%d", &(program->programId));
   3.473 +    
   3.474 +        program->catType = g_string_new((char *)\
   3.475 +                        xmlGetProp(node, (xmlChar *)"catType"));
   3.476 +    
   3.477 +        program->category = g_string_new((char *)\
   3.478 +                        xmlGetProp(node, (xmlChar *)"category"));
   3.479 +    
   3.480 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"seriesId"),\
   3.481 +            "%d", &(program->seriesId));
   3.482 +    
   3.483 +    
   3.484 +        program->startTime = gmyth_util_string_to_time_val\
   3.485 +        ((char *)xmlGetProp(node, (xmlChar *)"startTime"));
   3.486 +        
   3.487 +        program->endTime = gmyth_util_string_to_time_val\
   3.488 +        ((char *)xmlGetProp(node, (xmlChar *)"endTime"));
   3.489 +        
   3.490 +        program->lastModified = gmyth_util_string_to_time_val\
   3.491 +        ((char *)xmlGetProp(node, (xmlChar *)"lastModified"));
   3.492 +        
   3.493 +        /* TODO: FIX ME at gmyth_util
   3.494 +        program->asOf = gmyth_util_string_to_time_val\
   3.495 +        ((char *)xmlGetProp(node, (xmlChar *)"airdate"));*/
   3.496 +        
   3.497 +        
   3.498 +        program->subTitle = g_string_new((char *)\
   3.499 +                        xmlGetProp(node, (xmlChar *)"subTitle"));
   3.500 +        
   3.501 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"stars"),\
   3.502 +            "%d", &(program->stars));
   3.503 +        
   3.504 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"repeat"),\
   3.505 +            "%d", &(program->repeat));
   3.506 +        
   3.507 +        sscanf ((char *)xmlGetProp(node, (xmlChar *)"fileSize"),\
   3.508 +            "%d", &(program->repeat));
   3.509 +        
   3.510 +        program->hostname = g_string_new((char *)\
   3.511 +                        xmlGetProp(node, (xmlChar *)"hostname"));
   3.512 +    
   3.513 +        program->channel = retrieve_recorded_channel(node->children);
   3.514 +    
   3.515 +        // Skip the \n
   3.516 +        program->recording = retrieve_recorded_recording(node->children->next->next);
   3.517 +        
   3.518 +        // add to the list
   3.519 +        programList = g_slist_append(programList, program);
   3.520 +        }
   3.521 +    
   3.522 +        node = node->next;
   3.523      }
   3.524 -
   3.525 -    node = node->next;
   3.526 -  }
   3.527 -
   3.528 -  return programList;
   3.529 +    
   3.530 +    return programList;
   3.531  }
   3.532  
   3.533  /** Retrieves the properties from Recorded XML
   3.534 @@ -429,21 +426,21 @@
   3.535   */
   3.536  void get_Recorded_Properties (xmlNodePtr nodeTab, GMythRecorded* recorded)
   3.537  {
   3.538 -  recorded->version = g_string_new((char *)\
   3.539 -				   xmlGetProp(nodeTab, (xmlChar *)"version"));
   3.540 -  
   3.541 -  sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)\
   3.542 -			     "protoVer"), "%d", &(recorded->protoVer));
   3.543 -
   3.544 -  sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)\
   3.545 -			     "totalCount"), "%d", &(recorded->totalCount));
   3.546 -  
   3.547 -
   3.548 -  recorded->asOf = gmyth_util_string_to_time_val \
   3.549 -    ((char *)xmlGetProp(nodeTab, (xmlChar *)"asOf"));
   3.550 - 
   3.551 -  if ( recorded->totalCount > 0)
   3.552 -    recorded->programList = get_Recorded_Programs(nodeTab->children->next);
   3.553 +    recorded->version = g_string_new((char *)\
   3.554 +                    xmlGetProp(nodeTab, (xmlChar *)"version"));
   3.555 +    
   3.556 +    sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)\
   3.557 +                    "protoVer"), "%d", &(recorded->protoVer));
   3.558 +    
   3.559 +    sscanf ((char *)xmlGetProp(nodeTab, (xmlChar *)\
   3.560 +                    "totalCount"), "%d", &(recorded->totalCount));
   3.561 +    
   3.562 +    
   3.563 +    recorded->asOf = gmyth_util_string_to_time_val \
   3.564 +        ((char *)xmlGetProp(nodeTab, (xmlChar *)"asOf"));
   3.565 +    
   3.566 +    if ( recorded->totalCount > 0)
   3.567 +        recorded->programList = get_Recorded_Programs(nodeTab->children->next);
   3.568    
   3.569  }
   3.570  
   3.571 @@ -466,14 +463,14 @@
   3.572      {
   3.573          nodeset = result->nodesetval;
   3.574          for (i=0; i < nodeset->nodeNr; i++) 
   3.575 -	{
   3.576 -	  keyword = (xmlChar*)nodeset->nodeTab[i]->name;
   3.577 -	  if (g_ascii_strcasecmp((char *)keyword, "Recorded") == 0)
   3.578 -	  {
   3.579 -	    get_Recorded_Properties(nodeset->nodeTab[i], recorded);
   3.580 -	    break;
   3.581 -	  }
   3.582 -	}
   3.583 +        {
   3.584 +           keyword = (xmlChar*)nodeset->nodeTab[i]->name;
   3.585 +           if (g_ascii_strcasecmp((char *)keyword, "Recorded") == 0)
   3.586 +           {
   3.587 +               get_Recorded_Properties(nodeset->nodeTab[i], recorded);
   3.588 +               break;
   3.589 +           }
   3.590 +    }
   3.591          xmlXPathFreeObject (result);
   3.592      }
   3.593  
   3.594 @@ -485,25 +482,24 @@
   3.595   */
   3.596  GMythRecorded gmyth_http_retrieve_recorded (GMythBackendInfo *backend_info)
   3.597  {
   3.598 -  GMythRecorded recorded;
   3.599 -  MemoryStruct chunk;
   3.600 +    GMythRecorded recorded;
   3.601 +    MemoryStruct chunk;
   3.602  
   3.603 -  chunk.memory = NULL;
   3.604 -  chunk.size = 0;
   3.605 +    chunk.memory = NULL;
   3.606 +    chunk.size = 0;
   3.607  
   3.608 -  GString* command = g_string_new("");
   3.609 -  g_string_printf(command, "getRecorded");
   3.610 -  
   3.611 -  chunk = gmyth_http_request(backend_info, command);
   3.612 -  if (chunk.memory != NULL)
   3.613 -  {
   3.614 -    xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory));
   3.615 -    getRecorded(doc, &recorded);
   3.616 -    free(chunk.memory);
   3.617 -  }
   3.618 +    GString* command = g_string_new("");
   3.619 +    g_string_printf(command, "getRecorded");
   3.620  
   3.621 +    chunk = gmyth_http_request(backend_info, command);
   3.622 +    if (chunk.memory != NULL)
   3.623 +    {
   3.624 +        xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory));
   3.625 +        getRecorded(doc, &recorded);
   3.626 +        free(chunk.memory);
   3.627 +    }
   3.628  
   3.629 -  return recorded;
   3.630 +    return recorded;
   3.631  }
   3.632  
   3.633  /** Function to retrieve settings on the backend
   3.634 @@ -521,7 +517,7 @@
   3.635      xmlChar *keyword;
   3.636      MemoryStruct chunk;
   3.637      gchar* value = NULL;
   3.638 -  
   3.639 +
   3.640      chunk.memory = NULL;
   3.641      chunk.size = 0;
   3.642  
   3.643 @@ -555,6 +551,171 @@
   3.644      return value;
   3.645  }
   3.646  
   3.647 +/** Common steps for rec_profile's functions
   3.648 + *
   3.649 + * @param backend_info infos about the backend
   3.650 + * @param id the profile's id that you want to delete
   3.651 + * @return 0 if OK
   3.652 + */
   3.653 +gint rec_profile_common(GMythBackendInfo *backend_info,
   3.654 +                        GString* command)
   3.655 +{
   3.656 +    xmlXPathObjectPtr result;
   3.657 +    xmlNodeSetPtr nodeset;
   3.658 +    xmlChar *keyword;
   3.659 +    MemoryStruct chunk;
   3.660 +
   3.661 +    chunk.memory = NULL;
   3.662 +    chunk.size = 0;
   3.663 +
   3.664 +    int ret = -1;
   3.665 +
   3.666 +    chunk = gmyth_http_request(backend_info, command);
   3.667 +
   3.668 +    if (chunk.memory != NULL)
   3.669 +    {
   3.670 +    xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory));
   3.671 +
   3.672 +    result = getXPath((xmlChar *)"/*", doc);
   3.673 +
   3.674 +    if (result)
   3.675 +    {
   3.676 +        nodeset = result->nodesetval;
   3.677 +        keyword = (xmlChar*)nodeset->nodeTab[0]->name;
   3.678 +
   3.679 +        if (g_ascii_strcasecmp((char *)keyword, "Success") == 0)
   3.680 +            ret = 0;
   3.681 +
   3.682 +        xmlXPathFreeObject (result);
   3.683 +    }
   3.684 +
   3.685 +    free(chunk.memory);
   3.686 +    }
   3.687 +
   3.688 +    return ret;
   3.689 +}
   3.690 +
   3.691 +
   3.692 +/** Function to delete recording profiles
   3.693 + *
   3.694 + * @param backend_info infos about the backend
   3.695 + * @param id the profile's id that you want to delete
   3.696 + * @return 0 if OK
   3.697 + */
   3.698 +gint gmyth_http_del_rec_profile (GMythBackendInfo *backend_info,
   3.699 +                                 gint id)
   3.700 +{
   3.701 +    int ret = -1;
   3.702 +
   3.703 +    GString* command = g_string_new("");
   3.704 +    g_string_printf(command, "delRecProfiles?id=%d", id);
   3.705 +
   3.706 +
   3.707 +    return rec_profile_common(backend_info, command);
   3.708 +}
   3.709 +
   3.710 +/** Function to create recording profiles
   3.711 + *
   3.712 + * @param backend_info infos about the backend
   3.713 + * @param profilename the name of profile you want to use
   3.714 + * @param groupname the name of groupname you want to use
   3.715 + * @param vcodec the name of the video codec you want to use
   3.716 + * @param acodec the name of the audo codec you want to use
   3.717 + * @return 0 if OK
   3.718 + */
   3.719 +gint gmyth_http_create_rec_profile (GMythBackendInfo *backend_info,
   3.720 +                                    GMythRecProfile* profile)
   3.721 +{
   3.722 +
   3.723 +    if (profile->name != NULL && profile->group != NULL &&
   3.724 +        profile->vcodec && profile->acodec)
   3.725 +    {
   3.726 +        GString* command = g_string_new("");
   3.727 +        g_string_printf(command, "createRecProfiles?profilename=%s&"\
   3.728 +                                "groupname=%s&vcodec=%s&acodec=%s",
   3.729 +                                profile->name->str, profile->group->str,
   3.730 +                                profile->vcodec->str, profile->acodec->str);
   3.731 +
   3.732 +
   3.733 +        return rec_profile_common(backend_info, command);
   3.734 +    } 
   3.735 +    else
   3.736 +        return -1;
   3.737 +}
   3.738 +
   3.739 +/** Function to retrieve recording profiles
   3.740 + *
   3.741 + * @param backend_info infos about the backend
   3.742 + * @param groupname the name of group you want to retrieve
   3.743 + * @return the list of profiles
   3.744 + */
   3.745 +GSList* gmyth_http_retrieve_rec_profiles (GMythBackendInfo *backend_info,\
   3.746 +                                         gchar* groupname)
   3.747 +{
   3.748 +    xmlXPathObjectPtr result;
   3.749 +    xmlNodeSetPtr nodeset;
   3.750 +    xmlChar *keyword;
   3.751 +    MemoryStruct chunk;
   3.752 +    GSList* profiles = NULL;
   3.753 +
   3.754 +    chunk.memory = NULL;
   3.755 +    chunk.size = 0;
   3.756 +
   3.757 +    GString* command = g_string_new("");
   3.758 +    g_string_printf(command, "getRecProfiles?groupname=%s", groupname);
   3.759 +
   3.760 +    chunk = gmyth_http_request(backend_info, command);
   3.761 +
   3.762 +    if (chunk.memory != NULL)
   3.763 +    {
   3.764 +      xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory));
   3.765 +
   3.766 +      result = getXPath((xmlChar *)"/*", doc);
   3.767 +
   3.768 +      if (result)
   3.769 +      {
   3.770 +        nodeset = result->nodesetval;
   3.771 +        keyword = (xmlChar*)nodeset->nodeTab[0]->name;
   3.772 +
   3.773 +        if (g_ascii_strcasecmp((char *)keyword, "Profiles") == 0)
   3.774 +        {
   3.775 +            xmlNodePtr node = nodeset->nodeTab[0]->children->next;
   3.776 +            GMythRecProfile* profile;
   3.777 +
   3.778 +            while (node != NULL)
   3.779 +            {
   3.780 +                if (g_ascii_strcasecmp((char *)node->name, "text") != 0)
   3.781 +                {
   3.782 +                    profile = gmyth_recprofile_new();
   3.783 +
   3.784 +                    sscanf ((char *)xmlGetProp(node, (xmlChar *)\
   3.785 +                                    "id"), "%d", &(profile->id));
   3.786 +
   3.787 +                    profile->name = g_string_new((char *)\
   3.788 +                                        xmlGetProp(node, (xmlChar *)"name"));
   3.789 +
   3.790 +                    profile->vcodec = g_string_new((char *)\
   3.791 +                                        xmlGetProp(node, (xmlChar *)"vcodec"));
   3.792 +
   3.793 +                    profile->acodec = g_string_new((char *)\
   3.794 +                                        xmlGetProp(node, (xmlChar *)"acodec"));
   3.795 +
   3.796 +                    profile->group = g_string_new(groupname);
   3.797 +
   3.798 +                    profiles = g_slist_append(profiles, profile);
   3.799 +                }
   3.800 +                node = node->next;
   3.801 +            }
   3.802 +
   3.803 +        }
   3.804 +        xmlXPathFreeObject (result);
   3.805 +      }
   3.806 +
   3.807 +      free(chunk.memory);
   3.808 +    }
   3.809 +
   3.810 +    return profiles;
   3.811 +}
   3.812  
   3.813  
   3.814  
   3.815 @@ -572,18 +733,18 @@
   3.816  size_t
   3.817  WriteMemoryCallback (void *ptr, size_t size, size_t nmemb, void *data)
   3.818  {
   3.819 -	size_t realsize = size * nmemb;
   3.820 -	MemoryStruct *mem = (struct _MemoryStruct *)data;
   3.821 +    size_t realsize = size * nmemb;
   3.822 +    MemoryStruct *mem = (struct _MemoryStruct *)data;
   3.823  
   3.824 -	mem->memory = (char *)myrealloc(mem->memory, mem->size + realsize + 1);
   3.825 -	if (mem->memory) 
   3.826 -	{
   3.827 -		memcpy(&(mem->memory[mem->size]), ptr, realsize);
   3.828 -		mem->size += realsize;
   3.829 -		mem->memory[mem->size] = 0;
   3.830 -	}
   3.831 +    mem->memory = (char *)myrealloc(mem->memory, mem->size + realsize + 1);
   3.832 +    if (mem->memory) 
   3.833 +    {
   3.834 +        memcpy(&(mem->memory[mem->size]), ptr, realsize);
   3.835 +        mem->size += realsize;
   3.836 +        mem->memory[mem->size] = 0;
   3.837 +    }
   3.838  
   3.839 -	return realsize;
   3.840 +    return realsize;
   3.841  }
   3.842  
   3.843  /** Create a String containing the URL with the command
   3.844 @@ -634,9 +795,9 @@
   3.845  
   3.846      gchar *URL = (gchar *)g_malloc(sizeof(gchar)*size);
   3.847      g_snprintf(URL, size, "http://%s:%d/%s", \
   3.848 -	       backend_info->hostname, \
   3.849 -	       backend_info->status_port, \
   3.850 -	       command->str);
   3.851 +           backend_info->hostname, \
   3.852 +           backend_info->status_port, \
   3.853 +           command->str);
   3.854  
   3.855      CURL *curl_handle;
   3.856      
     4.1 --- a/gmyth/src/gmyth_http.h	Thu Mar 01 20:07:46 2007 +0000
     4.2 +++ b/gmyth/src/gmyth_http.h	Fri Mar 02 21:25:50 2007 +0000
     4.3 @@ -39,6 +39,7 @@
     4.4  
     4.5  #include "gmyth_backendinfo.h"
     4.6  #include "gmyth_util.h"
     4.7 +#include "gmyth_recprofile.h"
     4.8  
     4.9  #include <curl/curl.h>
    4.10  #include <curl/types.h>
    4.11 @@ -49,8 +50,8 @@
    4.12  #define MYTH_PORT_STATUS 6544
    4.13  
    4.14  typedef struct _GMythRecorded_Recording GMythRecorded_Recording;
    4.15 -typedef struct _GMythRecorded_Channel GMythRecorded_Channel;
    4.16 -typedef struct _GMythRecorded_Program GMythRecorded_Program;
    4.17 +typedef struct _GMythRecorded_Channel   GMythRecorded_Channel;
    4.18 +typedef struct _GMythRecorded_Program   GMythRecorded_Program;
    4.19  typedef struct _GMythRecorded   GMythRecorded;
    4.20  typedef struct _GMythProgram    GMythProgram;
    4.21  typedef struct _GMythChannel	GMythChannel;
    4.22 @@ -63,7 +64,6 @@
    4.23      size_t size;
    4.24  };
    4.25  
    4.26 -
    4.27  struct _GMythProgram
    4.28  {
    4.29    GString* title;
    4.30 @@ -156,7 +156,7 @@
    4.31  
    4.32  
    4.33  gchar* gmyth_http_retrieve_setting (GMythBackendInfo *backend_info,\
    4.34 -									gchar* key, gchar* hostname);
    4.35 +                                    gchar* key, gchar* hostname);
    4.36  
    4.37  GMythEpg gmyth_http_retrieve_epg(GMythBackendInfo *backend_info, \
    4.38                        GTimeVal* StartTime, GTimeVal* EndTime, \
    4.39 @@ -164,6 +164,15 @@
    4.40  
    4.41  GMythRecorded gmyth_http_retrieve_recorded (GMythBackendInfo *backend_info);
    4.42  
    4.43 +GSList* gmyth_http_retrieve_rec_profiles (GMythBackendInfo *backend_info,\
    4.44 +                                         gchar* groupname);
    4.45 +
    4.46 +gint gmyth_http_create_rec_profile (GMythBackendInfo *backend_info,\
    4.47 +                                    GMythRecProfile* profile);
    4.48 +
    4.49 +gint gmyth_http_del_rec_profile (GMythBackendInfo *backend_info,
    4.50 +                                 gint id);
    4.51 +
    4.52  MemoryStruct gmyth_http_request (GMythBackendInfo *backend_info, GString *command);
    4.53  
    4.54  G_END_DECLS
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/gmyth/src/gmyth_recprofile.c	Fri Mar 02 21:25:50 2007 +0000
     5.3 @@ -0,0 +1,153 @@
     5.4 +/**
     5.5 + * GMyth Library
     5.6 + * 
     5.7 + * @file gmyth/gmyth_recprofile.c
     5.8 + * 
     5.9 + * @brief <p> This file contains the recprofile class.
    5.10 + *
    5.11 + * Copyright (C) 2007 INdT - Instituto Nokia de Tecnologia.
    5.12 + * @author Artur Duque de Souza <artur.souza@indt.org.br>
    5.13 + *
    5.14 + */
    5.15 +/*
    5.16 + * 
    5.17 + * This program is free software; you can redistribute it and/or modify
    5.18 + * it under the terms of the GNU Lesser General Public License as published by
    5.19 + * the Free Software Foundation; either version 2 of the License, or
    5.20 + * (at your option) any later version.
    5.21 + *
    5.22 + * This program is distributed in the hope that it will be useful,
    5.23 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.24 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.25 + * GNU General Public License for more details.
    5.26 + *
    5.27 + * You should have received a copy of the GNU Lesser General Public License
    5.28 + * along with this program; if not, write to the Free Software
    5.29 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    5.30 + */
    5.31 +
    5.32 + 
    5.33 +#ifdef HAVE_CONFIG_H
    5.34 +#include "config.h"
    5.35 +#endif
    5.36 +
    5.37 +#include <stdlib.h>
    5.38 +#include <string.h>
    5.39 +#include <assert.h>
    5.40 +
    5.41 +#include "gmyth_recprofile.h"
    5.42 +#include "gmyth_util.h"
    5.43 +#include "gmyth_debug.h"
    5.44 +#include "gmyth_http.h"
    5.45 +
    5.46 +static void gmyth_recprofile_class_init          (GMythRecProfileClass *klass);
    5.47 +static void gmyth_recprofile_init                (GMythRecProfile *object);
    5.48 +
    5.49 +static void gmyth_recprofile_dispose  (GObject *object);
    5.50 +static void gmyth_recprofile_finalize (GObject *object);
    5.51 +
    5.52 +G_DEFINE_TYPE(GMythRecProfile, gmyth_recprofile, G_TYPE_OBJECT)
    5.53 +
    5.54 +static void
    5.55 +gmyth_recprofile_class_init (GMythRecProfileClass *klass)
    5.56 +{
    5.57 +    GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
    5.58 +    gobject_class->dispose  = gmyth_recprofile_dispose;
    5.59 +    gobject_class->finalize = gmyth_recprofile_finalize;
    5.60 +}
    5.61 +
    5.62 +static void
    5.63 +gmyth_recprofile_init (GMythRecProfile *recprofile)
    5.64 +{
    5.65 +}
    5.66 +
    5.67 +static void
    5.68 +gmyth_recprofile_dispose (GObject *object)
    5.69 +{
    5.70 +    GMythRecProfile *recprofile = GMYTH_RECPROFILE(object);
    5.71 +
    5.72 +    if (recprofile->name)
    5.73 +        g_free(recprofile->name);
    5.74 +
    5.75 +    if (recprofile->group)
    5.76 +        g_free(recprofile->group);
    5.77 +
    5.78 +    if (recprofile->vcodec)
    5.79 +        g_free(recprofile->vcodec);
    5.80 +
    5.81 +    if (recprofile->acodec)
    5.82 +        g_free(recprofile->acodec);
    5.83 +
    5.84 +	G_OBJECT_CLASS (gmyth_recprofile_parent_class)->dispose (object);
    5.85 +}
    5.86 +
    5.87 +static void
    5.88 +gmyth_recprofile_finalize (GObject *object)
    5.89 +{
    5.90 +    g_signal_handlers_destroy (object);
    5.91 +    G_OBJECT_CLASS (gmyth_recprofile_parent_class)->finalize (object);
    5.92 +}
    5.93 +
    5.94 +/**
    5.95 + * Creates a new instance of GMythRecProfile.
    5.96 + * 
    5.97 + * @return a new instance of GMythRecProfile.
    5.98 + **/
    5.99 +GMythRecProfile*
   5.100 +gmyth_recprofile_new (void)
   5.101 +{
   5.102 +    GMythRecProfile *recprofile = GMYTH_RECPROFILE\
   5.103 +                            (g_object_new(GMYTH_RECPROFILE_TYPE, NULL));
   5.104 +
   5.105 +    recprofile->id = 0;
   5.106 +    recprofile->name = NULL;
   5.107 +    recprofile->group = NULL;
   5.108 +    recprofile->vcodec = NULL;
   5.109 +    recprofile->acodec = NULL;
   5.110 +
   5.111 +    return recprofile;
   5.112 +}
   5.113 +
   5.114 +
   5.115 +/**
   5.116 + *
   5.117 + * gmyth_recprofile_get_profile_list
   5.118 + * @brief get profile list from the backend
   5.119 + * @param backend_info GMythBackendInfo*
   5.120 + * @return GSList
   5.121 + *
   5.122 + **/
   5.123 +GSList* gmyth_recprofile_get_profile_list (GMythBackendInfo *backend_info)
   5.124 +{
   5.125 +    return gmyth_http_retrieve_rec_profiles(backend_info, "Transcoders");
   5.126 +}
   5.127 +
   5.128 +/**
   5.129 + *
   5.130 + * gmyth_recprofile_create_profile
   5.131 + * @brief get profile list from the backend
   5.132 + * @param backend_info GMythBackendInfo*
   5.133 + * @param profile GMythRecProfile*
   5.134 + * @return gint representing the result
   5.135 + *
   5.136 + **/
   5.137 +gint gmyth_recprofile_create_profile (GMythBackendInfo *backend_info,
   5.138 +                                      GMythRecProfile* profile)
   5.139 +{
   5.140 +    return gmyth_http_create_rec_profile (backend_info, profile);
   5.141 +}
   5.142 +
   5.143 +/**
   5.144 + *
   5.145 + * gmyth_recprofile_del_profile
   5.146 + * @brief del profile from the backend
   5.147 + * @param backend_info GMythBackendInfo*
   5.148 + * @param id profile's id
   5.149 + * @return gint representing the result
   5.150 + *
   5.151 + **/
   5.152 +gint gmyth_recprofile_del_profile_list (GMythBackendInfo *backend_info,
   5.153 +                                        gint id)
   5.154 +{
   5.155 +    return gmyth_http_del_rec_profile(backend_info, id);
   5.156 +}
   5.157 \ No newline at end of file
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/gmyth/src/gmyth_recprofile.h	Fri Mar 02 21:25:50 2007 +0000
     6.3 @@ -0,0 +1,83 @@
     6.4 +/**
     6.5 + * GMyth Library
     6.6 + * 
     6.7 + * @file gmyth/gmyth_recprofile.h
     6.8 + * 
     6.9 + * @brief <p> This file contains the recprofile class.
    6.10 + *
    6.11 + * Copyright (C) 2007 INdT - Instituto Nokia de Tecnologia.
    6.12 + * @author Artur Duque de Souza <artur.souza@indt.org.br>
    6.13 + *
    6.14 + */
    6.15 +/*
    6.16 + * 
    6.17 + * This program is free software; you can redistribute it and/or modify
    6.18 + * it under the terms of the GNU Lesser General Public License as published by
    6.19 + * the Free Software Foundation; either version 2 of the License, or
    6.20 + * (at your option) any later version.
    6.21 + *
    6.22 + * This program is distributed in the hope that it will be useful,
    6.23 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.24 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6.25 + * GNU General Public License for more details.
    6.26 + *
    6.27 + * You should have received a copy of the GNU Lesser General Public License
    6.28 + * along with this program; if not, write to the Free Software
    6.29 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    6.30 + */
    6.31 +
    6.32 +#ifndef _GMYTH_RECPROFILE_H
    6.33 +#define _GMYTH_RECPROFILE_H
    6.34 +
    6.35 +#include <glib.h>
    6.36 +#include <glib-object.h>
    6.37 +
    6.38 +#include "gmyth_stringlist.h"
    6.39 +#include "gmyth_backendinfo.h"
    6.40 +#include "gmyth_socket.h"
    6.41 +
    6.42 +G_BEGIN_DECLS
    6.43 +
    6.44 +#define GMYTH_RECPROFILE_TYPE               (gmyth_recprofile_get_type ())
    6.45 +#define GMYTH_RECPROFILE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_RECPROFILE_TYPE, GMythRecProfile))
    6.46 +#define GMYTH_RECPROFILE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_RECPROFILE_TYPE, GMythRecProfileClass))
    6.47 +#define IS_GMYTH_RECPROFILE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_RECPROFILE_TYPE))
    6.48 +#define IS_GMYTH_RECPROFILE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_RECPROFILE_TYPE))
    6.49 +#define GMYTH_RECPROFILE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_RECPROFILE_TYPE, GMythRecProfileClass))
    6.50 +
    6.51 +typedef struct _GMythRecProfile         GMythRecProfile;
    6.52 +typedef struct _GMythRecProfileClass    GMythRecProfileClass;
    6.53 +
    6.54 +struct _GMythRecProfileClass
    6.55 +{
    6.56 +  GObjectClass parent_class;
    6.57 +
    6.58 +  /* callbacks */
    6.59 +};
    6.60 +
    6.61 +struct _GMythRecProfile
    6.62 +{
    6.63 +  gint	id;
    6.64 +  GString* name;
    6.65 +  GString* group;
    6.66 +  GString* vcodec;
    6.67 +  GString* acodec;
    6.68 +};
    6.69 +
    6.70 +
    6.71 +
    6.72 +GType gmyth_recprofile_type (void);
    6.73 +
    6.74 +GMythRecProfile* gmyth_recprofile_new (void);
    6.75 +
    6.76 +GSList* gmyth_recprofile_get_profile_list (GMythBackendInfo *backend_info);
    6.77 +
    6.78 +gint gmyth_recprofile_create_profile (GMythBackendInfo *backend_info,\
    6.79 +                                      GMythRecProfile* profile);
    6.80 +
    6.81 +gint gmyth_recprofile_del_profile_list (GMythBackendInfo *backend_info,\
    6.82 +                                        gint id);
    6.83 +
    6.84 +G_END_DECLS
    6.85 +
    6.86 +#endif /*_GMYTH_RECPROFILE_H*/
     7.1 --- a/gmyth/src/gmyth_transcode.c	Thu Mar 01 20:07:46 2007 +0000
     7.2 +++ b/gmyth/src/gmyth_transcode.c	Fri Mar 02 21:25:50 2007 +0000
     7.3 @@ -58,14 +58,6 @@
     7.4  static void
     7.5  gmyth_transcode_init (GMythTranscode *transcode)
     7.6  {
     7.7 -    transcode->backend_info = NULL;
     7.8 -    transcode->output_filename = NULL;
     7.9 -    transcode->filename = NULL;
    7.10 -    transcode->profile = NULL;
    7.11 -    transcode->starttime = NULL;
    7.12 -
    7.13 -    transcode->cutlist = FALSE;
    7.14 -    transcode->output = FALSE;
    7.15  }
    7.16  
    7.17  static void
    7.18 @@ -105,6 +97,7 @@
    7.19  {
    7.20      GMythTranscode *transcode = GMYTH_TRANSCODE\
    7.21                                   (g_object_new(GMYTH_TRANSCODE_TYPE, NULL));
    7.22 +
    7.23      return transcode;
    7.24  }
    7.25  
    7.26 @@ -194,31 +187,3 @@
    7.27          transcode->filename = g_string_new(file);
    7.28      }
    7.29  }
    7.30 -
    7.31 -/**
    7.32 - *
    7.33 - * gmyth_transcode_get_profile_list
    7.34 - * @brief get profile list from the backend
    7.35 - * @param backend_info GMythBackendInfo*
    7.36 - * @return GSList
    7.37 - *
    7.38 - **/
    7.39 -GSList* gmyth_transcode_get_profile_list (GMythBackendInfo *backend_info)
    7.40 -{
    7.41 -    //TODO: CODE THIS
    7.42 -    return NULL;
    7.43 -}
    7.44 -
    7.45 -/**
    7.46 - *
    7.47 - * gmyth_transcode_create_profile
    7.48 - * @brief get profile list from the backend
    7.49 - * @param backend_info GMythBackendInfo*
    7.50 - * @return gint representing the result
    7.51 - *
    7.52 - **/
    7.53 -gint gmyth_transcode_create_profile (GMythBackendInfo *backend_info)
    7.54 -{
    7.55 -    //TODO: CODE THIS
    7.56 -    return 0;
    7.57 -}
     8.1 --- a/gmyth/src/gmyth_transcode.h	Thu Mar 01 20:07:46 2007 +0000
     8.2 +++ b/gmyth/src/gmyth_transcode.h	Fri Mar 02 21:25:50 2007 +0000
     8.3 @@ -35,6 +35,8 @@
     8.4  #include "gmyth_stringlist.h"
     8.5  #include "gmyth_backendinfo.h"
     8.6  #include "gmyth_socket.h"
     8.7 +#include "gmyth_http.h"
     8.8 +#include "gmyth_recprofile.h"
     8.9  
    8.10  G_BEGIN_DECLS
    8.11