gmyth/src/gmyth_http.h
author melunko
Wed Aug 22 14:55:41 2007 +0100 (2007-08-22)
branchtrunk
changeset 820 a223e9d89b01
parent 750 312d6bc514f3
permissions -rw-r--r--
[svn r826] gmyth-ls and gmyth_query now considers db_port. Thanks to Bastien Nocera for his patch.
     1 /**
     2  * GMyth Library
     3  *
     4  * @file gmyth/gmyth_http.h
     5  * 
     6  * @brief <p> GMythHttp library provides a wrapper to access
     7  * data from the database using http+xml
     8  *
     9  * Copyright (C) 2007 INdT - Instituto Nokia de Tecnologia.
    10  * @author Artur Duque de Souza <artur.souza@indt.org.br>
    11  *
    12  *
    13  * This program is free software; you can redistribute it and/or modify
    14  * it under the terms of the GNU Lesser General Public License as published by
    15  * the Free Software Foundation; either version 2 of the License, or
    16  * (at your option) any later version.
    17  *
    18  * This program is distributed in the hope that it will be useful,
    19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    21  * GNU General Public License for more details.
    22  *
    23  * You should have received a copy of the GNU Lesser General Public License
    24  * along with this program; if not, write to the Free Software
    25  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    26  */
    27 
    28 #ifndef __GMYTH_HTTP_H__
    29 #define __GMYTH_HTTP_H__
    30 
    31 #include <glib-object.h>
    32 
    33 #include <stdio.h>
    34 #include <stdlib.h>
    35 #include <string.h>
    36 #include <stdarg.h>
    37 #include <glib.h>
    38 #include <glib/gprintf.h>
    39 
    40 #include "gmyth_backendinfo.h"
    41 #include "gmyth_util.h"
    42 #include "gmyth_recprofile.h"
    43 
    44 #include <curl/curl.h>
    45 #include <curl/types.h>
    46 #include <curl/easy.h>
    47 
    48 G_BEGIN_DECLS
    49 #define MYTH_PORT_STATUS 6544
    50 #define JOB_UNKNOWN   0x0000
    51 #define JOB_QUEUED    0x0001
    52 #define JOB_PENDING   0x0002
    53 #define JOB_STARTING  0x0003
    54 #define JOB_RUNNING   0x0004
    55 #define JOB_STOPPING  0x0005
    56 #define JOB_PAUSED    0x0006
    57 #define JOB_RETRY     0x0007
    58 #define JOB_ERRORING  0x0008
    59 #define JOB_ABORTING  0x0009
    60     // JOB_DONE is a mask to indicate the job is done
    61     // whatever the status is
    62 #define JOB_DONE      0x0100
    63 #define JOB_FINISHED  0x0110
    64 #define JOB_ABORTED   0x0120
    65 #define JOB_ERRORED   0x0130
    66 #define JOB_CANCELLED 0x0140
    67 typedef struct _GMythRecorded_Recording GMythRecorded_Recording;
    68 typedef struct _GMythRecorded_Channel GMythRecorded_Channel;
    69 typedef struct _GMythRecorded_Program GMythRecorded_Program;
    70 typedef struct _GMythRecorded GMythRecorded;
    71 typedef struct _GMythProgram GMythProgram;
    72 typedef struct _GMythChannel GMythChannel;
    73 typedef struct _GMythEpg GMythEpg;
    74 typedef struct _MemoryStruct MemoryStruct;
    75 
    76 struct _MemoryStruct {
    77     char           *memory;
    78     size_t          size;
    79 };
    80 
    81 struct _GMythProgram {
    82     gchar          *title;
    83     gchar          *subtitle;
    84     gchar          *catType;
    85     gchar          *category;
    86     gint            repeat;
    87     GTimeVal       *startTime;
    88     GTimeVal       *endTime;
    89 };
    90 
    91 struct _GMythChannel {
    92     gchar          *channelName;
    93     gchar          *chanNum;
    94     gint            chanId;
    95     gint            callSign;
    96     GSList         *programList;
    97 };
    98 
    99 struct _GMythEpg {
   100     gint            startChanId;
   101     gint            endChanId;
   102     gchar          *version;
   103     gint            protoVer;
   104     gint            totalCount;
   105     gint            numOfChannels;
   106     GTimeVal       *asOf;
   107     GTimeVal       *startTime;
   108     GTimeVal       *endTime;
   109     gint            details;
   110     GSList         *channelList;
   111 };
   112 
   113 
   114 struct _GMythRecorded_Recording {
   115     gint            dupInType;
   116     gint            dupMethod;
   117     gchar          *playGroup;
   118     gchar          *recGroup;
   119     gchar          *recProfile;
   120     gint            recPriority;
   121     gint            recStatus;
   122     gint            encoderId;
   123     gint            recordId;
   124     gint            recType;
   125     GTimeVal       *recStartTs;
   126     GTimeVal       *recEndTs;
   127 };
   128 
   129 
   130 struct _GMythRecorded_Channel {
   131     gchar          *chanFilters;
   132     gchar          *channelName;
   133     gint            chanNum;
   134     gint            sourceId;
   135     gint            commFree;
   136     gint            inputId;
   137     gint            chanId;
   138     gint            callSign;
   139 };
   140 
   141 
   142 struct _GMythRecorded_Program {
   143     gint            programFlags;
   144     gchar          *title;
   145     gint            programId;
   146     gchar          *catType;
   147     gchar          *category;
   148     gint            seriesId;
   149     GTimeVal       *startTime;
   150     GTimeVal       *endTime;
   151     GTimeVal       *airdate;    // ?
   152     GTimeVal       *lastModified;
   153     gchar          *subTitle;
   154     gint            stars;
   155     gint            repeat;
   156     gint            fileSize;
   157     gchar          *hostname;
   158     GMythRecorded_Channel channel;
   159     GMythRecorded_Recording recording;
   160 };
   161 
   162 struct _GMythRecorded {
   163     gchar          *version;
   164     gint            protoVer;
   165     gint            totalCount;
   166     GTimeVal       *asOf;
   167     GSList         *programList;
   168 };
   169 
   170 
   171 gint            gmyth_http_retrieve_job_status(GMythBackendInfo *
   172                                                backend_info, gint chanid,
   173                                                GTimeVal * start);
   174 
   175 gchar          *gmyth_http_retrieve_setting(GMythBackendInfo *
   176                                             backend_info, gchar * key,
   177                                             gchar * hostname);
   178 
   179 GMythEpg        gmyth_http_retrieve_epg(GMythBackendInfo * backend_info,
   180                                         GTimeVal * StartTime,
   181                                         GTimeVal * EndTime,
   182                                         gint StartChanId,
   183                                         gint NumOfChannels,
   184                                         gchar * Details);
   185 
   186 GMythRecorded   gmyth_http_retrieve_recorded(GMythBackendInfo *
   187                                              backend_info);
   188 
   189 GSList         *gmyth_http_retrieve_rec_profiles(GMythBackendInfo *
   190                                                  backend_info,
   191                                                  gchar * groupname);
   192 
   193 gint            gmyth_http_create_rec_profile(GMythBackendInfo *
   194                                               backend_info,
   195                                               GMythRecProfile * profile);
   196 
   197 gint            gmyth_http_del_rec_profile(GMythBackendInfo * backend_info,
   198                                            gint id);
   199 
   200 MemoryStruct    gmyth_http_request(GMythBackendInfo * backend_info,
   201                                    GString * command);
   202 
   203 G_END_DECLS
   204 #endif                          /* __GMYTH_HTTP_H__ */