gmyth/src/gmyth_jobqueue.c
branchtrunk
changeset 389 dbf952e956b5
parent 386 4184f56767b8
child 410 7b062aa36323
     1.1 --- a/gmyth/src/gmyth_jobqueue.c	Mon Mar 05 21:58:21 2007 +0000
     1.2 +++ b/gmyth/src/gmyth_jobqueue.c	Tue Mar 06 00:55:35 2007 +0000
     1.3 @@ -39,7 +39,7 @@
     1.4   * @return gboolean - result of connection
     1.5   *
     1.6   */
     1.7 -GMythSocket*
     1.8 +static GMythSocket*
     1.9  backend_connect (GMythBackendInfo *backend_info)
    1.10  {
    1.11      GMythSocket *socket = gmyth_socket_new ();
    1.12 @@ -66,7 +66,7 @@
    1.13   * @return the value returned by the backend
    1.14   *
    1.15   */
    1.16 -GString* send_command(GMythSocket *socket, gchar* action,
    1.17 +static GString* send_command(GMythSocket *socket, gchar* action,
    1.18                        gchar* job, gint chanid, gchar* starttime,
    1.19                        gchar* options)
    1.20  {
    1.21 @@ -94,28 +94,27 @@
    1.22   * @return 0 if success and -1 if error
    1.23   *
    1.24   */
    1.25 -gint test_result(gchar* ret, gchar* value)
    1.26 +static gboolean test_result(gchar* ret, gchar* value)
    1.27  {
    1.28 -        if (g_ascii_strcasecmp(ret, value) == 0)
    1.29 -            return 0;
    1.30 -        else
    1.31 -        {
    1.32 -            g_debug("JobQueue Error: %s", ret);
    1.33 -            return -1;
    1.34 -        }
    1.35 -
    1.36 +    if (g_ascii_strcasecmp(ret, value) == 0)
    1.37 +        return TRUE;
    1.38 +    else {
    1.39 +        g_debug("JobQueue Error: %s", ret);
    1.40 +        return FALSE;
    1.41 +    }
    1.42  }
    1.43  
    1.44  /** Function to add a job inside JOBQUEUE
    1.45   *
    1.46   * @param transcode object holding all the info about the transcoding
    1.47   * @param job the job you want to add the action
    1.48 - * @return the value of the key
    1.49 + * @return TRUE if the job was added, FALSE if not
    1.50   *
    1.51   */
    1.52 -gint gmyth_jobqueue_add_job (GMythTranscode* transcode, gchar* job)
    1.53 +gint gmyth_jobqueue_add_job (GMythTranscoder* transcode, gchar* job)
    1.54  {
    1.55 -    GMythSocket *socket = backend_connect(transcode->backend_info);
    1.56 +    //fixme: disconnect this socket
    1.57 +    GMythSocket *socket = backend_connect (transcode->backend_info);
    1.58      if (socket != NULL)
    1.59      {
    1.60          GString* options = g_string_new ("");
    1.61 @@ -133,6 +132,7 @@
    1.62                  g_string_append_printf(options, " %s", transcode->profile);
    1.63          }
    1.64  
    1.65 +	//fixme: allocation 
    1.66          GString* ret = send_command(socket, "ADD", job, transcode->chanid,
    1.67                                      transcode->starttime, options->str);
    1.68  
    1.69 @@ -142,9 +142,7 @@
    1.70          g_free(ret);
    1.71  
    1.72          return res;
    1.73 -    }
    1.74 -    else
    1.75 -    {
    1.76 +    } else {
    1.77          g_debug("JobQueue Connection Failed");
    1.78          return -1;
    1.79      }
    1.80 @@ -158,7 +156,7 @@
    1.81   * @return the value of the key
    1.82   *
    1.83   */
    1.84 -gint gmyth_jobqueue_change_cmd (GMythTranscode* transcode, gchar* action,
    1.85 +gboolean gmyth_jobqueue_change_cmd (GMythTranscoder* transcode, gchar* action,
    1.86                                  gchar* job)
    1.87  {
    1.88      GMythSocket *socket = backend_connect(transcode->backend_info);
    1.89 @@ -173,9 +171,7 @@
    1.90          g_free(ret);
    1.91  
    1.92          return res;
    1.93 -    }
    1.94 -    else
    1.95 -    {
    1.96 +    } else {
    1.97          g_debug("JobQueue Connection Failed");
    1.98          return -1;
    1.99      }