# HG changeset patch # User renatofilho # Date 1193247702 -3600 # Node ID 56cfd1feef30a0dae585fa1706bc73657218f0d3 # Parent c25708b9b1e3abb68ad272a8a32e687eb14c01d6 [svn r870] created function stop recording diff -r c25708b9b1e3 -r 56cfd1feef30 gmyth/src/gmyth_backendinfo.h --- a/gmyth/src/gmyth_backendinfo.h Tue Oct 23 13:58:20 2007 +0100 +++ b/gmyth/src/gmyth_backendinfo.h Wed Oct 24 18:41:42 2007 +0100 @@ -116,7 +116,6 @@ gboolean gmyth_backend_info_is_local_file (GMythBackendInfo *backend_info); GMythSocket* gmyth_backend_info_get_connected_socket (GMythBackendInfo *backend_info); - G_END_DECLS #endif /* __GMYTH_BACKEND_INFO_H__ */ diff -r c25708b9b1e3 -r 56cfd1feef30 gmyth/src/gmyth_scheduler.c --- a/gmyth/src/gmyth_scheduler.c Tue Oct 23 13:58:20 2007 +0100 +++ b/gmyth/src/gmyth_scheduler.c Wed Oct 24 18:41:42 2007 +0100 @@ -738,7 +738,7 @@ */ GMythProgramInfo* gmyth_scheduler_get_recorded_on_time(GMythScheduler* scheduler, - GString* channel) + guint channel_id) { MYSQL_RES *msql_res; GMythProgramInfo *proginfo = NULL; @@ -757,8 +757,8 @@ "category,findid,duplicate " "FROM recorded " "LEFT JOIN channel " "ON recorded.chanid = channel.chanid " - "WHERE recorded.chanid = \"%s\" " - "ORDER BY starttime DESC", channel->str); + "WHERE recorded.chanid = %d " + "ORDER BY starttime DESC", channel_id); msql_res = gmyth_query_process_statement(scheduler->msqlquery, query_str->str); @@ -980,6 +980,116 @@ return proginfo; } +gboolean +gmyth_scheduler_stop_recording (GMythScheduler * scheduler, + gint channel_id, + time_t start) +{ + GMythProgramInfo *program; + GMythSocket *socket; + gboolean res = FALSE; + GMythStringList *slist; + + socket = gmyth_backend_info_get_connected_socket (scheduler->backend_info); + program = gmyth_scheduler_get_recorded_on_time (scheduler, channel_id); + + if (program) { + slist = gmyth_string_list_new(); + gmyth_string_list_append_char_array(slist, "STOP_RECORDING"); + + gmyth_string_list_append_string(slist, program->title); /* 0 */ + gmyth_string_list_append_string(slist, program->subtitle); /* 1 */ + gmyth_string_list_append_string(slist, program->description); /* 2 */ + gmyth_string_list_append_string(slist, program->category); /* 3 */ + gmyth_string_list_append_string(slist, program->chanid); /* 4 */ + gmyth_string_list_append_string(slist, program->chanstr); /* 5 */ + gmyth_string_list_append_string(slist, program->chansign); /* 6 */ + gmyth_string_list_append_string(slist, program->channame); /* 7 */ + gmyth_string_list_append_string(slist, program->pathname); /* 8 */ + gmyth_string_list_append_int64(slist, program->filesize); /* 9 */ + + if (program->startts) + gmyth_string_list_append_int(slist, program->startts->tv_sec); /* 10 */ + else + gmyth_string_list_append_int(slist, 0); + + if (program->endts) + gmyth_string_list_append_int(slist, program->endts->tv_sec); /* 11 */ + else + gmyth_string_list_append_int(slist, 0); + + gmyth_string_list_append_int(slist, program->duplicate); /* 12 */ + gmyth_string_list_append_int(slist, program->shareable); /* 13 */ + gmyth_string_list_append_int(slist, program->findid); /* 14 */ + gmyth_string_list_append_string(slist, program->hostname); /* 15 */ + gmyth_string_list_append_int(slist, program->sourceid); /* 16 */ + gmyth_string_list_append_int(slist, program->cardid); /* 17 */ + gmyth_string_list_append_int(slist, program->inputid); /* 18 */ + gmyth_string_list_append_int(slist, program->recpriority); /* 19 */ + + // recstatus == recording + gmyth_string_list_append_int(slist, -3); /* 20 */ + + gmyth_string_list_append_int(slist, program->recordid); /* 21 */ + gmyth_string_list_append_int(slist, program->rectype); /* 22 */ + gmyth_string_list_append_int(slist, program->dupin); /* 23 */ + gmyth_string_list_append_int(slist, program->dupmethod); /* 24 */ + + + //fixme + program->recstartts->tv_sec -= (60*60); + + gmyth_string_list_append_int(slist, + program->recstartts != NULL ? + program->recstartts->tv_sec : 0); /* 26 */ + + gmyth_string_list_append_int(slist, + program->recendts != NULL ? + program->recendts->tv_sec : 0); /* 27 */ + + gmyth_string_list_append_int(slist, program->repeat); /* 28 */ + gmyth_string_list_append_int(slist, program->programflags); /* 29 */ + + gmyth_string_list_append_char_array(slist, + program->recgroup != NULL ? + program->recgroup->str : "Default"); /* 30 */ + + gmyth_string_list_append_int(slist, program->chancommfree); /* 31 */ + gmyth_string_list_append_string(slist, program->chanOutputFilters); /* 32 */ + gmyth_string_list_append_string(slist, program->seriesid); /* 33 */ + gmyth_string_list_append_string(slist, program->programid); /* 34 */ + + gmyth_string_list_append_int(slist, + program->lastmodified != NULL ? + program->lastmodified->tv_sec : 0); /* 35 */ + + gmyth_string_list_append_float(slist, program->stars); /* 36 */ + + gmyth_string_list_append_int(slist, + program->originalAirDate != NULL ? + program->originalAirDate->tv_sec : 0); /* 37 */ + + gmyth_string_list_append_int(slist, program->hasAirDate); /* 38 */ + + gmyth_string_list_append_char_array(slist, + program->playgroup != NULL ? + program->playgroup->str : "Default"); /* 39 */ + + gmyth_string_list_append_int(slist, program->recpriority2); /* 40 */ + gmyth_string_list_append_int(slist, program->recpriority2); /* 40 */ + + gmyth_socket_sendreceive_stringlist(socket, slist); + res = (gmyth_string_list_get_int(slist, 0) == 1); + + g_object_unref (program); + g_object_unref (slist); + } + + g_object_unref (socket); + return res; +} + + /** Notifies the backend of an update in the db. * * @param record_id the id of the modified recording. diff -r c25708b9b1e3 -r 56cfd1feef30 gmyth/src/gmyth_scheduler.h --- a/gmyth/src/gmyth_scheduler.h Tue Oct 23 13:58:20 2007 +0100 +++ b/gmyth/src/gmyth_scheduler.h Wed Oct 24 18:41:42 2007 +0100 @@ -136,52 +136,55 @@ } RecordedInfo; -GType gmyth_scheduler_get_type (void); +GType gmyth_scheduler_get_type (void); -GMythScheduler *gmyth_scheduler_new (void); -gboolean gmyth_scheduler_connect (GMythScheduler * scheduler, - GMythBackendInfo * backend_info); -gboolean gmyth_scheduler_connect_with_timeout(GMythScheduler * scheduler, - GMythBackendInfo * backend_info, - guint timeout); -gboolean gmyth_scheduler_disconnect (GMythScheduler * scheduler); -gint gmyth_scheduler_get_schedule_list (GMythScheduler * scheduler, - GList ** sched_list); -gint gmyth_scheduler_get_recorded_list (GMythScheduler * scheduler, - GList ** rec_list); -RecordedInfo* gmyth_scheduler_get_recorded_info (GMythScheduler *scheduler, - const char *basename); +GMythScheduler* gmyth_scheduler_new (void); +gboolean gmyth_scheduler_connect (GMythScheduler * scheduler, + GMythBackendInfo * backend_info); +gboolean gmyth_scheduler_connect_with_timeout (GMythScheduler * scheduler, + GMythBackendInfo * backend_info, + guint timeout); +gboolean gmyth_scheduler_disconnect (GMythScheduler * scheduler); +gint gmyth_scheduler_get_schedule_list (GMythScheduler * scheduler, + GList ** sched_list); +gint gmyth_scheduler_get_recorded_list (GMythScheduler * scheduler, + GList ** rec_list); +RecordedInfo* gmyth_scheduler_get_recorded_info (GMythScheduler *scheduler, + const char *basename); +gboolean gmyth_scheduler_was_recorded_before (GMythScheduler* scheduler, + gint channel_id, + time_t start_time); +gboolean gmyth_scheduler_reactivate_schedule (GMythScheduler* scheduler, + gint channel_id, + time_t start_time); +GMythProgramInfo* gmyth_scheduler_get_recorded_on_time (GMythScheduler* scheduler, + guint channel_id); +GMythProgramInfo* gmyth_scheduler_get_recorded (GMythScheduler * scheduler, + GString * channel, + GTimeVal * starttime); +gint gmyth_scheduler_add_schedule (GMythScheduler * scheduler, + ScheduleInfo * schedule_info); +gboolean gmyth_scheduler_add_schedule_full (GMythScheduler * scheduler, + ScheduleInfo * schedule_info, + GMythScheduleType type); +gboolean gmyth_scheduler_add_exception (GMythScheduler *scheduler, + gint schedule_id, + ScheduleInfo *exception_info); +gint gmyth_scheduler_delete_schedule (GMythScheduler * scheduler, + gint record_id); +gint gmyth_scheduler_delete_recorded (GMythScheduler * scheduler, + gint record_id); +gboolean gmyth_scheduler_stop_recording (GMythScheduler * scheduler, + gint channel_id, + time_t start); +void gmyth_scheduler_recorded_info_get_preview(RecordedInfo * info, + GByteArray * data); -gboolean gmyth_scheduler_was_recorded_before(GMythScheduler* scheduler, gint channel_id, - time_t start_time); -gboolean gmyth_scheduler_reactivate_schedule(GMythScheduler* scheduler, gint channel_id, - time_t start_time); -GMythProgramInfo* -gmyth_scheduler_get_recorded_on_time(GMythScheduler* scheduler, - GString* channel); -GMythProgramInfo *gmyth_scheduler_get_recorded (GMythScheduler * scheduler, - GString * channel, - GTimeVal * starttime); -gint gmyth_scheduler_add_schedule (GMythScheduler * scheduler, - ScheduleInfo * schedule_info); -gboolean gmyth_scheduler_add_schedule_full (GMythScheduler * scheduler, - ScheduleInfo * schedule_info, GMythScheduleType type); -gboolean gmyth_scheduler_add_exception (GMythScheduler *scheduler, gint schedule_id, - ScheduleInfo *exception_info); - - -gint gmyth_scheduler_delete_schedule (GMythScheduler * scheduler, - gint record_id); -gint gmyth_scheduler_delete_recorded (GMythScheduler * scheduler, - gint record_id); -void gmyth_scheduler_recorded_info_get_preview - (RecordedInfo * info, - GByteArray * data); -void gmyth_recorded_info_free (RecordedInfo * info); -void gmyth_schedule_info_free (ScheduleInfo * info); -void gmyth_recorded_info_list_free (GList * list); -void gmyth_schedule_info_list_free (GList * list); +void gmyth_recorded_info_free (RecordedInfo * info); +void gmyth_schedule_info_free (ScheduleInfo * info); +void gmyth_recorded_info_list_free (GList * list); +void gmyth_schedule_info_list_free (GList * list); G_END_DECLS #endif /* __GMYTH_SCHEDULER_H__ */