1.1 --- a/gmyth/gmyth/gmyth_programinfo.c Sun Dec 13 23:02:37 2009 +0000
1.2 +++ b/gmyth/gmyth/gmyth_programinfo.c Tue Dec 15 20:48:32 2009 +0000
1.3 @@ -322,20 +322,18 @@
1.4 */
1.5 gmyth_string_list_append_string(slist, prog->seriesid); /* 33 */
1.6 gmyth_string_list_append_string(slist, prog->program_id); /* 34 */
1.7 - gmyth_string_list_append_char_array(slist, ""); /* 35 */
1.8 - gmyth_string_list_append_int(slist, prog->lastmodified != NULL ? prog->lastmodified->tv_sec : 0); /* 36
1.9 - */// DATETIME_TO_LIST(lastmodified)
1.10 - gmyth_string_list_append_int(slist, 0); /* 37 */// FLOAT_TO_LIST(stars)
1.11 - gmyth_string_list_append_int(slist, prog->originalAirDate != NULL ? prog->originalAirDate->tv_sec : 0); /* 38
1.12 - */// DATETIME_TO_LIST(QDateTime(originalAirDate))
1.13 - gmyth_string_list_append_int(slist, prog->hasAirDate); /* 39 */
1.14 - gmyth_string_list_append_char_array(slist, "Default"); /* 40 */// prog->(playgroup
1.15 - //
1.16 - //
1.17 - // != "") ?
1.18 - // playgroup :
1.19 - // "Default")
1.20 - gmyth_string_list_append_int(slist, prog->recpriority2); /* 41 */
1.21 + gmyth_string_list_append_int(slist, prog->lastmodified != NULL ? prog->lastmodified->tv_sec : 0); /* 35 */
1.22 + gmyth_string_list_append_int(slist, 0); /* 36: stars */
1.23 + gmyth_string_list_append_int(slist, prog->originalAirDate != NULL ? prog->originalAirDate->tv_sec : 0); /* 37 */
1.24 + gmyth_string_list_append_int(slist, prog->hasAirDate); /* 38 */
1.25 + gmyth_string_list_append_char_array(slist, "Default"); /* 39: playgroup */
1.26 + gmyth_string_list_append_int(slist, prog->recpriority2); /* 40 */
1.27 + gmyth_string_list_append_int(slist, 0); /* 41: parentid */
1.28 + gmyth_string_list_append_char_array(slist, "Default"); /* 42: storagegroup */
1.29 + gmyth_string_list_append_int(slist, 0); /* 43: audioproperties */
1.30 + gmyth_string_list_append_int(slist, 0); /* 44: videoproperties */
1.31 + gmyth_string_list_append_int(slist, 0); /* 45: subtitleType */
1.32 + gmyth_string_list_append_char_array(slist, ""); /* 46: year */
1.33
1.34 return slist;
1.35 }
1.36 @@ -410,25 +408,21 @@
1.37 // :
1.38 // "Default")
1.39 prog->chancommfree = gmyth_string_list_get_int(slist, pos + 31);
1.40 - prog->chanOutputFilters =
1.41 - gmyth_string_list_get_string(slist, pos + 32);
1.42 + prog->chanOutputFilters = gmyth_string_list_get_string(slist, pos + 32);
1.43 prog->seriesid = gmyth_string_list_get_string(slist, pos + 33);
1.44 prog->program_id = gmyth_string_list_get_string(slist, pos + 34);
1.45 - gmyth_string_list_get_string(slist, pos + 35);
1.46 - prog->lastmodified = gmyth_util_string_to_time_val((gmyth_util_time_to_isoformat((time_t) gmyth_string_list_get_int(slist, pos + 36)))->str); // DATETIME_TO_LIST(lastmodified)
1.47 - gmyth_string_list_get_int(slist, pos + 37); // FLOAT_TO_LIST(stars)
1.48 - prog->originalAirDate = gmyth_util_string_to_time_val((gmyth_util_time_to_isoformat((time_t) gmyth_string_list_get_int(slist, pos + 38)))->str); // DATETIME_TO_LIST(QDateTime(originalAirDate))
1.49 - prog->hasAirDate = gmyth_string_list_get_int(slist, pos + 39);
1.50 - prog->playgroup = gmyth_string_list_get_string(slist, pos + 40); // prog->(playgroup
1.51 - //
1.52 - //
1.53 - // !=
1.54 - // "")
1.55 - // ?
1.56 - // playgroup
1.57 - // :
1.58 - // "Default")
1.59 - prog->recpriority2 = gmyth_string_list_get_int(slist, pos + 41);
1.60 + prog->lastmodified = gmyth_util_string_to_time_val((gmyth_util_time_to_isoformat((time_t) gmyth_string_list_get_int(slist, pos + 35)))->str);
1.61 + gmyth_string_list_get_int(slist, pos + 36); // FLOAT_TO_LIST(stars)
1.62 + prog->originalAirDate = gmyth_util_string_to_time_val((gmyth_util_time_to_isoformat((time_t) gmyth_string_list_get_int(slist, pos + 37)))->str);
1.63 + prog->hasAirDate = gmyth_string_list_get_int(slist, pos + 38);
1.64 + prog->playgroup = gmyth_string_list_get_string(slist, pos + 39);
1.65 + prog->recpriority2 = gmyth_string_list_get_int(slist, pos + 40);
1.66 + /* 41: parentid */
1.67 + /* 42: storagegroup */
1.68 + /* 43: audioproperties */
1.69 + /* 44: videoproperties */
1.70 + /* 45: subtitleType */
1.71 + /* 46: year */
1.72
1.73 return prog;
1.74 }
2.1 --- a/gmyth/gmyth/gmyth_util.c Sun Dec 13 23:02:37 2009 +0000
2.2 +++ b/gmyth/gmyth/gmyth_util.c Tue Dec 15 20:48:32 2009 +0000
2.3 @@ -451,22 +451,44 @@
2.4 const gchar *filename)
2.5 {
2.6 gboolean res = FALSE;
2.7 - gint length = 0;
2.8 - GMythStringList *slist;
2.9 - GMythProgramInfo *program = NULL;
2.10 + GString *path;
2.11 + GMythProgramInfo *program;
2.12
2.13 program = gmyth_program_info_new();
2.14 program->pathname = g_string_new(filename);
2.15
2.16 + path = gmyth_util_check_file_from_socket (sock, program);
2.17 +
2.18 + if (path) {
2.19 + res = TRUE;
2.20 + g_string_free(path, TRUE);
2.21 + }
2.22 +
2.23 + g_object_unref(program);
2.24 +
2.25 + return res;
2.26 +}
2.27 +
2.28 +GString *
2.29 +gmyth_util_check_file_from_socket (GMythSocket *sock,
2.30 + GMythProgramInfo *program)
2.31 +{
2.32 + GString *res;
2.33 + gint length;
2.34 + GMythStringList *slist;
2.35 +
2.36 slist = gmyth_string_list_new();
2.37 gmyth_string_list_append_char_array(slist, "QUERY_CHECKFILE");
2.38 + if (gmyth_socket_get_protocol_version(sock) >= 32)
2.39 + gmyth_string_list_append_int(slist, 1);
2.40 gmyth_program_info_to_string_list(program, slist);
2.41
2.42 length = gmyth_socket_sendreceive_stringlist (sock, slist);
2.43 - if (length > 0)
2.44 - res = (gmyth_string_list_get_int(slist, 0) == 1);
2.45 + if (length > 1 && gmyth_string_list_get_int(slist, 0) == 1)
2.46 + res = gmyth_string_list_get_string(slist, 1);
2.47 + else
2.48 + res = NULL;
2.49
2.50 - g_object_unref(program);
2.51 g_object_unref(slist);
2.52
2.53 return res;
2.54 @@ -526,25 +548,18 @@
2.55 backend_info->port, TRUE);
2.56
2.57 if (res == TRUE) {
2.58 - GMythStringList *slist;
2.59 - GMythProgramInfo *program = NULL;
2.60 + GMythProgramInfo *program;
2.61 + GString *path;
2.62
2.63 program = gmyth_program_info_new();
2.64 program->pathname = g_string_new(filename);
2.65
2.66 - slist = gmyth_string_list_new();
2.67 - gmyth_string_list_append_char_array(slist, "QUERY_CHECKFILE");
2.68 + path = gmyth_util_check_file_from_socket (socket, program);
2.69
2.70 - gmyth_program_info_to_string_list(program, slist);
2.71 + res = !!path;
2.72
2.73 - gmyth_socket_sendreceive_stringlist(socket, slist);
2.74 -
2.75 - res = (gmyth_string_list_get_int(slist, 0) == 1);
2.76 -
2.77 - if ((gmyth_string_list_length(slist) > 1) &&
2.78 - gmyth_string_list_get_char_array(slist, 1) != NULL)
2.79 - *current_dir =
2.80 - g_strdup(gmyth_string_list_get_char_array(slist, 1));
2.81 + if (path)
2.82 + *current_dir = g_string_free(path, FALSE);
2.83
2.84 if (*current_dir != NULL)
2.85 gmyth_debug("Current directory = %s.", (*current_dir != NULL)
2.86 @@ -552,8 +567,6 @@
2.87
2.88 g_object_unref(program);
2.89
2.90 - g_object_unref(slist);
2.91 -
2.92 gmyth_socket_close_connection(socket);
2.93 }
2.94 g_object_unref(socket);
3.1 --- a/gmyth/gmyth/gmyth_util.h Sun Dec 13 23:02:37 2009 +0000
3.2 +++ b/gmyth/gmyth/gmyth_util.h Tue Dec 15 20:48:32 2009 +0000
3.3 @@ -67,6 +67,8 @@
3.4 const gchar * filename);
3.5 gboolean gmyth_util_file_exists_from_socket (GMythSocket *sock,
3.6 const gchar *filename);
3.7 +GString* gmyth_util_check_file_from_socket (GMythSocket *sock,
3.8 + GMythProgramInfo *program);
3.9 gboolean gmyth_util_file_exists_and_get_remote_dir (GMythBackendInfo *backend_info,
3.10 const gchar *filename,
3.11 gchar **current_dir);
4.1 --- a/gmyth/samples/gmyth_ls.c Sun Dec 13 23:02:37 2009 +0000
4.2 +++ b/gmyth/samples/gmyth_ls.c Tue Dec 15 20:48:32 2009 +0000
4.3 @@ -120,6 +120,9 @@
4.4 *iter;
4.5 gint res = 0,
4.6 count = 0;
4.7 + GMythSocket *socket;
4.8 + GString *path;
4.9 + GMythProgramInfo *program;
4.10
4.11 g_return_val_if_fail(options != NULL, FALSE);
4.12 g_return_val_if_fail(options->b_info != NULL, FALSE);
4.13 @@ -145,17 +148,26 @@
4.14 }
4.15
4.16 iter = list;
4.17 + socket = gmyth_backend_info_get_connected_socket(options->b_info);
4.18 while (iter) {
4.19 RecordedInfo *recorded_info = (RecordedInfo *) iter->data;
4.20
4.21 - if (gmyth_util_file_exists
4.22 - (options->b_info, recorded_info->basename->str)) {
4.23 + program = gmyth_program_info_new();
4.24 + program->pathname = g_string_new(recorded_info->basename->str);
4.25 + program->channel_id = recorded_info->channel_id;
4.26 + program->recstartts = g_memdup(recorded_info->start_time,
4.27 + sizeof(*program->startts));
4.28 + path = gmyth_util_check_file_from_socket(socket, program);
4.29 + if (path) {
4.30 count++;
4.31 g_print("%s\n", recorded_info->basename->str);
4.32 + g_string_free(path, TRUE);
4.33 }
4.34 gmyth_recorded_info_free(recorded_info);
4.35 + g_object_unref(program);
4.36 iter = g_list_next(iter);
4.37 }
4.38 + g_object_unref(socket);
4.39
4.40 if (!count)
4.41 g_print("No recorded programs.\n");