[svn r389] Some improvements on recorded file detection.
1.1 --- a/gmyth/src/gmyth_backendinfo.c Fri Mar 02 21:25:50 2007 +0000
1.2 +++ b/gmyth/src/gmyth_backendinfo.c Sat Mar 03 00:01:34 2007 +0000
1.3 @@ -145,7 +145,7 @@
1.4 gmyth_backend_info_set_db_name (backend_info, path_parts != NULL && path_parts[0] != NULL
1.5 && strlen( path_parts[0] ) > 0 ? g_strstrip( g_strdup( g_strdelimit( path_parts[0], "/?", ' ' ) ) )
1.6 : gmyth_uri_get_path( backend_info->uri ) );
1.7 - gmyth_backend_info_set_port (backend_info, gmyth_uri_get_port( backend_info->uri ) );
1.8 + gmyth_backend_info_set_port ( backend_info, gmyth_uri_get_port( backend_info->uri ) );
1.9
1.10 g_strfreev( path_parts );
1.11
2.1 --- a/gmyth/src/gmyth_file_transfer.c Fri Mar 02 21:25:50 2007 +0000
2.2 +++ b/gmyth/src/gmyth_file_transfer.c Sat Mar 03 00:01:34 2007 +0000
2.3 @@ -481,7 +481,7 @@
2.4 query = g_string_new (GMYTHTV_QUERY_HEADER);
2.5 g_string_append_printf (query, "%d", transfer->file_id);
2.6
2.7 - myth_control_acquire_context( transfer, TRUE );
2.8 + /* myth_control_acquire_context( transfer, TRUE ); */
2.9
2.10 gmyth_string_list_append_string( strlist, query );
2.11 gmyth_string_list_append_char_array( strlist, "SEEK" );
2.12 @@ -501,7 +501,7 @@
2.13 gmyth_debug ( "[%s] got reading position pointer from the streaming = %lld\n",
2.14 __FUNCTION__, retval );
2.15
2.16 - myth_control_release_context( transfer );
2.17 + /* myth_control_release_context( transfer ); */
2.18
2.19 return retval;
2.20 }
3.1 --- a/gmyth/src/gmyth_util.c Fri Mar 02 21:25:50 2007 +0000
3.2 +++ b/gmyth/src/gmyth_util.c Sat Mar 03 00:01:34 2007 +0000
3.3 @@ -458,6 +458,68 @@
3.4 return res;
3.5 }
3.6
3.7 +gboolean
3.8 +gmyth_util_file_exists_and_get_remote_dir (GMythBackendInfo *backend_info,
3.9 + const gchar* filename, gchar** current_dir)
3.10 +{
3.11 + GMythSocket *socket;
3.12 + gboolean res;
3.13 +
3.14 + *current_dir = NULL;
3.15 +
3.16 + socket = gmyth_socket_new ();
3.17 + res = gmyth_socket_connect_to_backend (socket, backend_info->hostname,
3.18 + backend_info->port, TRUE);
3.19 +
3.20 + if (res == TRUE) {
3.21 + GMythStringList *slist;
3.22 + GMythProgramInfo *program = NULL;
3.23 +
3.24 + program = gmyth_program_info_new();
3.25 + program->pathname = g_string_new (filename);
3.26 +
3.27 + slist = gmyth_string_list_new ();
3.28 + gmyth_string_list_append_char_array (slist, "QUERY_CHECKFILE");
3.29 +
3.30 + gmyth_program_info_to_string_list (program, slist);
3.31 +
3.32 + gmyth_socket_sendreceive_stringlist (socket, slist);
3.33 +
3.34 + res = (gmyth_string_list_get_int (slist, 0) == 1);
3.35 +
3.36 + if ( ( gmyth_string_list_length( slist ) > 1 ) &&
3.37 + gmyth_string_list_get_char_array (slist, 1) != NULL )
3.38 + *current_dir = g_strdup( gmyth_string_list_get_char_array (slist, 1) );
3.39 +
3.40 + g_object_unref (program);
3.41 +
3.42 + g_object_unref (slist);
3.43 +
3.44 + gmyth_socket_close_connection (socket);
3.45 + }
3.46 + g_object_unref (socket);
3.47 + return res;
3.48 +}
3.49 +
3.50 +gchar*
3.51 +gmyth_util_create_filename( const gint chan_id, const GTimeVal* start_time )
3.52 +{
3.53 + gchar* basename = NULL;
3.54 +
3.55 + g_return_val_if_fail( start_time != NULL, NULL );
3.56 +
3.57 + gchar *isodate = gmyth_util_time_to_isoformat_from_time_val_fmt ( "%Y%m%d%H%M%S",
3.58 + start_time );
3.59 +
3.60 + basename = g_strdup_printf( "%d_%s", chan_id, isodate );
3.61 +
3.62 + gmyth_debug ("Basename (from chan_id and start_time): %s", basename);
3.63 +
3.64 + if (isodate)
3.65 + g_free(isodate);
3.66 +
3.67 + return basename;
3.68 +}
3.69
3.70 #if !GLIB_CHECK_VERSION (2, 10, 0)
3.71
4.1 --- a/gmyth/src/gmyth_util.h Fri Mar 02 21:25:50 2007 +0000
4.2 +++ b/gmyth/src/gmyth_util.h Sat Mar 03 00:01:34 2007 +0000
4.3 @@ -61,6 +61,11 @@
4.4
4.5 gboolean gmyth_util_file_exists (GMythBackendInfo *backend_info, const gchar* filename);
4.6
4.7 +gboolean gmyth_util_file_exists_and_get_remote_dir (GMythBackendInfo *backend_info,
4.8 + const gchar* filename, gchar** current_dir);
4.9 +
4.10 +gchar* gmyth_util_create_filename( const gint chan_id, const GTimeVal* start_time );
4.11 +
4.12 G_END_DECLS
4.13
4.14 #endif /*GMYTH_UTIL_H_*/