gmyth-dbus/src/gmyth-dbus-server.c
branchtrunk
changeset 891 0cc42675b88d
parent 881 c5a9d9583e64
child 896 9f80dd75cd8a
     1.1 --- a/gmyth-dbus/src/gmyth-dbus-server.c	Mon Nov 19 17:57:40 2007 +0000
     1.2 +++ b/gmyth-dbus/src/gmyth-dbus-server.c	Wed Jan 23 20:04:59 2008 +0000
     1.3 @@ -140,7 +140,7 @@
     1.4                                                       GError **error);
     1.5  static gboolean gmyth_dbus_server_add_schedule      (GObject *obj,
     1.6                                                       guint channel_id,
     1.7 -                                                     guint program_id,
     1.8 +                                                     const gchar *program_id,
     1.9                                                       const gchar *start_time,
    1.10                                                       const gchar *end_time,
    1.11                                                       gboolean recurring,
    1.12 @@ -150,7 +150,7 @@
    1.13  static gboolean gmyth_dbus_server_add_exception     (GObject *obj,
    1.14                                                       guint schedule_id,
    1.15                                                       guint channel_id,
    1.16 -                                                     guint program_id,
    1.17 +                                                     const gchar *program_id,
    1.18                                                       const gchar *start_time,
    1.19                                                       const gchar *end_time,
    1.20                                                       const gchar *description,
    1.21 @@ -220,6 +220,7 @@
    1.22                       GMYTH_DBUS_ERROR_CONNECTION,
    1.23                       _("Not connected"));
    1.24  
    1.25 +        gmyth_debug ("Not connected with MythTV Server");
    1.26          return FALSE;
    1.27      }
    1.28  
    1.29 @@ -235,12 +236,13 @@
    1.30                           GMYTH_DBUS_ERROR,
    1.31                           GMYTH_DBUS_ERROR_EPG,
    1.32                           _("Fail to connect with EPG"));
    1.33 -
    1.34 +            gmyth_debug ("Fail to connected with EPG");
    1.35              return FALSE;
    1.36  
    1.37          }
    1.38      }
    1.39  
    1.40 +    gmyth_debug ("Connected EPG");
    1.41      return TRUE;
    1.42  }
    1.43  
    1.44 @@ -258,6 +260,7 @@
    1.45                       GMYTH_DBUS_ERROR_CONNECTION,
    1.46                       _("Not connected"));
    1.47  
    1.48 +        gmyth_debug ("Not connected with MythTV Server");
    1.49          return FALSE;
    1.50      }
    1.51  
    1.52 @@ -275,10 +278,12 @@
    1.53                           GMYTH_DBUS_ERROR_SCHEDULE,
    1.54                           _("Fail to connect with Schedule"));
    1.55  
    1.56 +            gmyth_debug (_("Fail to connect with Schedule"));
    1.57              return FALSE;
    1.58          }
    1.59      }
    1.60  
    1.61 +    gmyth_debug ("Connected with Schedule");
    1.62      return TRUE;
    1.63  }
    1.64  
    1.65 @@ -293,12 +298,13 @@
    1.66      GMythSocket *s;
    1.67      GMythDbusServerPrivate *priv;
    1.68  
    1.69 -    g_debug ("%s:%d", __FUNCTION__, __LINE__);
    1.70  
    1.71 +    gmyth_debug ("");
    1.72      priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
    1.73  
    1.74      if (priv->connected)
    1.75      {
    1.76 +        gmyth_debug ("Release Old connection");
    1.77          gmyth_dbus_server_internal_disconnect (obj, NULL);
    1.78      }
    1.79  
    1.80 @@ -313,11 +319,13 @@
    1.81      s = gmyth_backend_info_get_connected_socket (priv->myth_backend);
    1.82      if (s)
    1.83      {
    1.84 +        gmyth_debug ("Connected");
    1.85          priv->connected = TRUE;
    1.86          g_object_unref (s);
    1.87      }
    1.88      else
    1.89      {
    1.90 +        gmyth_debug ("Fail to connect with MythTVServer");
    1.91          priv->connected = FALSE;
    1.92          g_object_unref (priv->myth_backend);
    1.93          priv->myth_backend = NULL;
    1.94 @@ -338,8 +346,8 @@
    1.95  {
    1.96      GMythDbusServerPrivate *priv;
    1.97  
    1.98 -    g_debug ("%s:%d", __FUNCTION__, __LINE__);
    1.99  
   1.100 +    gmyth_debug ("");
   1.101      priv = GMYTH_DBUS_SERVER_GET_PRIVATE (obj);
   1.102  
   1.103      if (priv->myth_backend)
   1.104 @@ -625,7 +633,7 @@
   1.105          end_str = g_time_val_to_iso8601 (data->endts);
   1.106  
   1.107          dbus_g_type_struct_set (&program,
   1.108 -                                0, data->chanid->str,
   1.109 +                                0, data->xx_channel_id,
   1.110                                  1, start_str,
   1.111                                  2, end_str,
   1.112                                  3, data->title->str,
   1.113 @@ -658,8 +666,8 @@
   1.114  
   1.115      dbus_g_type_struct_set (val,
   1.116                              0, info->record_id,
   1.117 -                            1, info->program_id,
   1.118 -                            2, info->channel_id,
   1.119 +                            1, info->xx_program_id->str,
   1.120 +                            2, info->xx_channel_id,
   1.121                              3, start_str,
   1.122                              4, end_str,
   1.123                              5, info->title->str,
   1.124 @@ -816,8 +824,8 @@
   1.125  
   1.126          dbus_g_type_struct_set (&schedule,
   1.127                              0, data->schedule_id,
   1.128 -                            1, data->program_id,
   1.129 -                            2, data->channel_id,
   1.130 +                            1, data->xx_program_id->str,
   1.131 +                            2, data->xx_channel_id,
   1.132                              3, start_str_time,
   1.133                              4, end_str_time,
   1.134                              5, data->title->str,
   1.135 @@ -1006,7 +1014,7 @@
   1.136  static ScheduleInfo*
   1.137  gmyth_dbus_server_new_schedule_info (const gchar* description,
   1.138                                       guint channel_id,
   1.139 -                                     guint program_id,
   1.140 +                                     const gchar* program_id,
   1.141                                       GTimeVal *start_vtime,
   1.142                                       GTimeVal *end_vtime)
   1.143  {
   1.144 @@ -1017,8 +1025,8 @@
   1.145      /* record_id == -1 for generating a new id */
   1.146      new_sched_info->schedule_id = -1;
   1.147  
   1.148 -    new_sched_info->channel_id = channel_id;
   1.149 -    new_sched_info->program_id = program_id;
   1.150 +    new_sched_info->xx_channel_id = channel_id;
   1.151 +    new_sched_info->xx_program_id = g_string_new (program_id);
   1.152      new_sched_info->start_time = g_new0 (GTimeVal, 1);
   1.153      *new_sched_info->start_time = *start_vtime;
   1.154      new_sched_info->end_time = g_new0 (GTimeVal, 1);
   1.155 @@ -1039,7 +1047,7 @@
   1.156  static gboolean
   1.157  gmyth_dbus_server_add_schedule (GObject *obj,
   1.158                                  guint channel_id,
   1.159 -                                guint program_id,
   1.160 +                                const gchar *program_id,
   1.161                                  const gchar *start_time,
   1.162                                  const gchar *end_time,
   1.163                                  gboolean recurring,
   1.164 @@ -1065,11 +1073,14 @@
   1.165  
   1.166      g_time_val_from_iso8601 (start_time, &start_vtime);
   1.167      g_time_val_from_iso8601 (end_time, &end_vtime);
   1.168 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   1.169      sch_info = gmyth_dbus_server_new_schedule_info (description,
   1.170                                                      channel_id,
   1.171                                                      program_id,
   1.172                                                      &start_vtime,
   1.173                                                      &end_vtime);
   1.174 +
   1.175 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   1.176      if (sch_info != NULL) {
   1.177          GMythScheduleType type;
   1.178          GTimeVal t_now;
   1.179 @@ -1081,17 +1092,20 @@
   1.180  
   1.181          g_get_current_time (&t_now);
   1.182  
   1.183 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   1.184          has_record = gmyth_scheduler_was_recorded_before (priv->myth_scheduler, 
   1.185                                                            channel_id,
   1.186                                                            (time_t) start_vtime.tv_sec);
   1.187  
   1.188  
   1.189 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   1.190          if ((t_now.tv_sec >= start_vtime.tv_sec)
   1.191              && (t_now.tv_sec <= end_vtime.tv_sec) && has_record)
   1.192          {
   1.193              GMythSocket    *socket;
   1.194              gboolean        res = FALSE;
   1.195  
   1.196 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   1.197              socket = gmyth_backend_info_get_connected_socket (priv->myth_backend);
   1.198              res = gmyth_scheduler_reactivate_schedule(priv->myth_scheduler,
   1.199                                                        channel_id,
   1.200 @@ -1099,17 +1113,21 @@
   1.201              if (res) {
   1.202                  GMythStringList *slist = gmyth_string_list_new();
   1.203  
   1.204 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   1.205                  gmyth_string_list_append_char_array(slist, "RESCHEDULE_RECORDINGS 0");
   1.206                  gmyth_socket_sendreceive_stringlist(socket, slist);
   1.207                  res = (gmyth_string_list_get_int(slist, 0) == 1);
   1.208                  g_object_unref(slist);
   1.209 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   1.210              }
   1.211 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   1.212  
   1.213              g_object_unref(socket);
   1.214              return res;
   1.215          }
   1.216          else
   1.217          {
   1.218 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   1.219              if (!gmyth_scheduler_add_schedule_full (priv->myth_scheduler,
   1.220                                                      sch_info,
   1.221                                                      type))
   1.222 @@ -1118,8 +1136,11 @@
   1.223                  return FALSE;
   1.224              }
   1.225  
   1.226 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   1.227              (*schedule_id) = sch_info->schedule_id;
   1.228 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   1.229              gmyth_schedule_info_free (sch_info);
   1.230 +    g_debug ("%s:%d", __FUNCTION__, __LINE__);
   1.231              return TRUE;
   1.232          }
   1.233      }
   1.234 @@ -1130,7 +1151,7 @@
   1.235  gmyth_dbus_server_add_exception (GObject *obj,
   1.236                                   guint schedule_id,
   1.237                                   guint channel_id,
   1.238 -                                 guint program_id,
   1.239 +                                 const gchar *program_id,
   1.240                                   const gchar *start_time,
   1.241                                   const gchar *end_time,
   1.242                                   const gchar *description,