1.1 --- a/gmyth/debian/changelog Thu Mar 22 19:37:16 2007 +0000
1.2 +++ b/gmyth/debian/changelog Thu Mar 22 20:22:05 2007 +0000
1.3 @@ -1,7 +1,8 @@
1.4 gmyth (0.2) unstable; urgency=low
1.5
1.6 - * Included remote file transcoding
1.7 - * Included recording profile management
1.8 + * Included several http_requests in order to replace mysql queries (MythProtocol >= 33)
1.9 + * Included remote file transcoding request and jobqueue request (need to apply patch)
1.10 + * Included recording profile management (need to apply patch)
1.11 * Several bug fixes
1.12
1.13 -- Hallyson Melo <hallyson.melo@indt.org.br> Mon, 5 Mar 2007 14:46:08 -0300
2.1 --- a/gmyth/src/gmyth_http.c Thu Mar 22 19:37:16 2007 +0000
2.2 +++ b/gmyth/src/gmyth_http.c Thu Mar 22 20:22:05 2007 +0000
2.3 @@ -540,6 +540,85 @@
2.4 return recorded;
2.5 }
2.6
2.7 +
2.8 +
2.9 +/** Function to retrieve jobqueue status
2.10 + *
2.11 + */
2.12 +gint gmyth_http_retrieve_job_status (GMythBackendInfo *backend_info,
2.13 + gint chanid, GTimeVal* start)
2.14 +{
2.15 + gint status = 0;
2.16 + gint count = 0;
2.17 + gint temp_chanid = 0;
2.18 + GTimeVal* temp_start = NULL;
2.19 + int i;
2.20 +
2.21 + xmlXPathObjectPtr result;
2.22 + xmlNodeSetPtr nodeset;
2.23 + xmlNodePtr node;
2.24 + MemoryStruct chunk;
2.25 +
2.26 + chunk.memory = NULL;
2.27 + chunk.size = 0;
2.28 +
2.29 + GString* command = g_string_new("");
2.30 + g_string_printf(command, "GetStatus");
2.31 +
2.32 + chunk = gmyth_http_request(backend_info, command);
2.33 +
2.34 + if (chunk.memory != NULL)
2.35 + {
2.36 + xmlDocPtr doc = XMLParse(chunk.memory, strlen(chunk.memory));
2.37 +
2.38 + result = getXPath((xmlChar*)"/Status/JobQueue", doc);
2.39 + if (result)
2.40 + {
2.41 + nodeset = result->nodesetval;
2.42 + node = nodeset->nodeTab[0];
2.43 + sscanf((char *)xmlGetProp(node, (xmlChar*)"count"),\
2.44 + "%d", &count);
2.45 +
2.46 + if (count > 0)
2.47 + {
2.48 +
2.49 + // Get the first child
2.50 + node = node->children->next;
2.51 +
2.52 + for (i = 0; i < count; i++)
2.53 + {
2.54 +
2.55 + sscanf((char *)xmlGetProp(node, (xmlChar*)"chanId"),\
2.56 + "%d", &temp_chanid);
2.57 +
2.58 + if (chanid == temp_chanid)
2.59 + {
2.60 + temp_start = gmyth_util_string_to_time_val \
2.61 + ((char *)xmlGetProp(node,(xmlChar *)"startTime"));
2.62 +
2.63 + if ( (temp_start->tv_sec == start->tv_sec) &&
2.64 + (temp_start->tv_usec == start->tv_usec) )
2.65 + sscanf((char *)xmlGetProp(node, (xmlChar*)"status"),\
2.66 + "%d", &status);
2.67 + }
2.68 +
2.69 + // Escape "text" node
2.70 + node = node->next->next;
2.71 + }
2.72 + }
2.73 +
2.74 + }
2.75 +
2.76 + xmlXPathFreeObject (result);
2.77 + free(chunk.memory);
2.78 +
2.79 + }
2.80 +
2.81 + return status;
2.82 +}
2.83 +
2.84 +
2.85 +
2.86 /** Function to retrieve settings on the backend
2.87 *
2.88 * @param backend_info infos about the backend
2.89 @@ -845,10 +924,20 @@
2.90 strlen(command->str) + 20;
2.91
2.92 gchar *URL = (gchar *)g_malloc(sizeof(gchar)*size);
2.93 - g_snprintf(URL, size, "http://%s:%d/Myth/%s", \
2.94 + gchar *mid = (gchar *)g_malloc(sizeof(gchar)*6);
2.95 +
2.96 + mid = "";
2.97 +
2.98 + if ( g_ascii_strcasecmp(command->str, "GetStatus") && \
2.99 + g_ascii_strcasecmp(command->str, "GetStatusHTML") )
2.100 + {
2.101 + mid = "Myth/";
2.102 + }
2.103 +
2.104 + g_snprintf(URL, size, "http://%s:%d/%s%s", \
2.105 backend_info->hostname, \
2.106 backend_info->status_port, \
2.107 - command->str);
2.108 + mid, command->str);
2.109
2.110 CURL *curl_handle;
2.111
3.1 --- a/gmyth/src/gmyth_http.h Thu Mar 22 19:37:16 2007 +0000
3.2 +++ b/gmyth/src/gmyth_http.h Thu Mar 22 20:22:05 2007 +0000
3.3 @@ -49,6 +49,25 @@
3.4
3.5 #define MYTH_PORT_STATUS 6544
3.6
3.7 +#define JOB_UNKNOWN 0x0000
3.8 +#define JOB_QUEUED 0x0001
3.9 +#define JOB_PENDING 0x0002
3.10 +#define JOB_STARTING 0x0003
3.11 +#define JOB_RUNNING 0x0004
3.12 +#define JOB_STOPPING 0x0005
3.13 +#define JOB_PAUSED 0x0006
3.14 +#define JOB_RETRY 0x0007
3.15 +#define JOB_ERRORING 0x0008
3.16 +#define JOB_ABORTING 0x0009
3.17 +
3.18 +// JOB_DONE is a mask to indicate the job is done
3.19 +// whatever the status is
3.20 +#define JOB_DONE 0x0100
3.21 +#define JOB_FINISHED 0x0110
3.22 +#define JOB_ABORTED 0x0120
3.23 +#define JOB_ERRORED 0x0130
3.24 +#define JOB_CANCELLED 0x0140
3.25 +
3.26 typedef struct _GMythRecorded_Recording GMythRecorded_Recording;
3.27 typedef struct _GMythRecorded_Channel GMythRecorded_Channel;
3.28 typedef struct _GMythRecorded_Program GMythRecorded_Program;
3.29 @@ -161,6 +180,9 @@
3.30 };
3.31
3.32
3.33 +gint gmyth_http_retrieve_job_status (GMythBackendInfo *backend_info, \
3.34 + gint chanid, GTimeVal* start);
3.35 +
3.36 gchar* gmyth_http_retrieve_setting (GMythBackendInfo *backend_info,\
3.37 gchar* key, gchar* hostname);
3.38
4.1 --- a/gmyth/src/gmyth_transcoder.h Thu Mar 22 19:37:16 2007 +0000
4.2 +++ b/gmyth/src/gmyth_transcoder.h Thu Mar 22 20:22:05 2007 +0000
4.3 @@ -50,6 +50,26 @@
4.4 #define DATE_ISO 0
4.5 #define DATE_FILE 1
4.6
4.7 +#define JOB_UNKNOWN 0x0000
4.8 +#define JOB_QUEUED 0x0001
4.9 +#define JOB_PENDING 0x0002
4.10 +#define JOB_STARTING 0x0003
4.11 +#define JOB_RUNNING 0x0004
4.12 +#define JOB_STOPPING 0x0005
4.13 +#define JOB_PAUSED 0x0006
4.14 +#define JOB_RETRY 0x0007
4.15 +#define JOB_ERRORING 0x0008
4.16 +#define JOB_ABORTING 0x0009
4.17 +
4.18 +// JOB_DONE is a mask to indicate the job is done
4.19 +// whatever the status
4.20 +#define JOB_DONE 0x0100
4.21 +#define JOB_FINISHED 0x0110
4.22 +#define JOB_ABORTED 0x0120
4.23 +#define JOB_ERRORED 0x0130
4.24 +#define JOB_CANCELLED 0x0140
4.25 +
4.26 +
4.27 typedef struct _GMythTranscoder GMythTranscoder;
4.28 typedef struct _GMythTranscoderClass GMythTranscoderClass;
4.29
5.1 --- a/gmyth/tests/gmyth_test_http.c Thu Mar 22 19:37:16 2007 +0000
5.2 +++ b/gmyth/tests/gmyth_test_http.c Thu Mar 22 20:22:05 2007 +0000
5.3 @@ -15,39 +15,43 @@
5.4 gmyth_backend_info_set_port (backend_info, 6543);
5.5 gmyth_backend_info_set_status_port (backend_info, 6544);
5.6
5.7 - GTimeVal* start = gmyth_util_string_to_time_val("2006-01-01T00:00:00");
5.8 - GTimeVal* end = gmyth_util_string_to_time_val("2007-03-10T00:00:00");
5.9 + GTimeVal* start = gmyth_util_string_to_time_val("2007-03-19T17:00:00");
5.10 + //GTimeVal* end = gmyth_util_string_to_time_val("2007-03-10T00:00:00");
5.11
5.12 - GMythEpg epg;
5.13 - epg = gmyth_http_retrieve_epg(backend_info, start, end, 1000, 10000, "1");
5.14 + //GMythEpg epg;
5.15 + //epg = gmyth_http_retrieve_epg(backend_info, start, end, 1000, 10000, "1");
5.16
5.17 //if ( NULL == epg.channelList || g_slist_length( epg.channelList ) <= 0 )
5.18 // printf( "Channel list is empty!!!" );
5.19
5.20 - GMythRecorded recorded;
5.21 - recorded = gmyth_http_retrieve_recorded(backend_info);
5.22 + //GMythRecorded recorded;
5.23 + //recorded = gmyth_http_retrieve_recorded(backend_info);
5.24
5.25 - GMythRecorded_Program* program = recorded.programList->data;
5.26 + //GMythRecorded_Program* program = recorded.programList->data;
5.27
5.28 - GSList* profiles = gmyth_http_retrieve_rec_profiles(backend_info, "Transcoders");
5.29 + //GSList* profiles = gmyth_http_retrieve_rec_profiles(backend_info, "Transcoders");
5.30
5.31 - GMythRecProfile* prof = profiles->data;
5.32 + //GMythRecProfile* prof = profiles->data;
5.33
5.34 - gchar* sett = gmyth_http_retrieve_setting(backend_info, "JobQueueTranscodeCommand", "wakko");
5.35 + //gchar* sett = gmyth_http_retrieve_setting(backend_info, "JobQueueTranscodeCommand", "wakko");
5.36
5.37 - GMythRecProfile* profile = gmyth_recprofile_new();
5.38 + //GMythRecProfile* profile = gmyth_recprofile_new();
5.39
5.40 - gmyth_recprofile_set_name(profile, "Teste");
5.41 - gmyth_recprofile_set_group(profile, "Transcoders");
5.42 - gmyth_recprofile_set_vcodec(profile, "MPEG-4");
5.43 - gmyth_recprofile_set_acodec(profile, "MP3");
5.44 + //gmyth_recprofile_set_name(profile, "Teste");
5.45 + //gmyth_recprofile_set_group(profile, "Transcoders");
5.46 + //gmyth_recprofile_set_vcodec(profile, "MPEG-4");
5.47 + //gmyth_recprofile_set_acodec(profile, "MP3");
5.48
5.49
5.50 - int teste = gmyth_http_create_rec_profile(backend_info, profile);
5.51 + //int teste = gmyth_http_create_rec_profile(backend_info, profile);
5.52
5.53 - printf("Hello: %d\n", teste);
5.54 + //printf("Hello: %d\n", teste);
5.55
5.56 - int teste2 = gmyth_http_del_rec_profile(backend_info, 56);
5.57 + //int teste2 = gmyth_http_del_rec_profile(backend_info, 56);
5.58 +
5.59 + gint ret = gmyth_http_retrieve_job_status(backend_info, 1000, start);
5.60 + printf("Status: %d\n\n", ret);
5.61 +
5.62
5.63 return 0;
5.64 }
6.1 --- a/gmyth/tests/gmyth_test_transcode.c Thu Mar 22 19:37:16 2007 +0000
6.2 +++ b/gmyth/tests/gmyth_test_transcode.c Thu Mar 22 20:22:05 2007 +0000
6.3 @@ -24,8 +24,8 @@
6.4 transcode->cutlist = TRUE;
6.5
6.6 //gmyth_transcoder_set_output (transcode, TRUE, "/tmp/teste.mp4");
6.7 - gmyth_transcoder_set_filename (transcode, "1000_20070309160500.nuv");
6.8 - //gmyth_transcoder_set_filename (transcode, "1000_20070319170000.nuv");
6.9 + //gmyth_transcoder_set_filename (transcode, "1000_20070309160500.nuv");
6.10 + gmyth_transcoder_set_filename (transcode, "1000_20070319170000.nuv");
6.11 int teste = gmyth_jobqueue_add_job(transcode, "JOB_TRANSCODE");
6.12
6.13 teste = gmyth_jobqueue_change_cmd(transcode, "STOP", "JOB_TRANSCODE");