<html><head></head><body>I will ignore this mail with zero arguments.<br><br>Schedule never even really worked. Except on Linux, in timezones with no DST.<br><br><div class="gmail_quote">Le 28 août 2020 09:22:09 GMT+03:00, Jean-Baptiste Kempf <jb@videolan.org> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">I disagree about removing this feature.<br><br>-1<br><br>On Thu, 27 Aug 2020, at 18:43, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">Way back when, VLC developers cared primarily about live TV. VLM<br>broadcast was the immediate VCR and VLM schedule was the programmed VCR.<br><br>Nobody uses this. On the fora, you'll see people having troubles with<br>VLC from crontab, not with VLM schedule. (By the way, this never grew<br>support for daylight saving offsets, forget time zones.)<hr> src/input/vlm.c | 99 +------<br> src/input/vlm_internal.h | 25 --<br> src/input/vlmshell.c | 600 ++-------------------------------------<br> 3 files changed, 20 insertions(+), 704 deletions(-)<br><br>diff --git a/src/input/vlm.c b/src/input/vlm.c<br>index 116fc5296e..124a092d8a 100644<br>--- a/src/input/vlm.c<br>+++ b/src/input/vlm.c<br>@@ -143,7 +143,6 @@ vlm_t *vlm_New( libvlc_int_t *libvlc, const char <br>*psz_vlmconf )<br> p_vlm->exiting = false;<br> p_vlm->i_id = 1;<br> TAB_INIT( p_vlm->i_media, p_vlm->media );<br>- TAB_INIT( p_vlm->i_schedule, p_vlm->schedule );<br> var_Create( p_vlm, "intf-event", VLC_VAR_ADDRESS );<br> <br> if( vlc_clone( &p_vlm->thread, Manage, p_vlm, VLC_THREAD_PRIORITY_LOW ) )<br>@@ -202,9 +201,6 @@ void vlm_Delete( vlm_t *p_vlm )<br> vlc_mutex_lock( &p_vlm->lock );<br> vlm_ControlInternal( p_vlm, VLM_CLEAR_MEDIAS );<br> TAB_CLEAN( p_vlm->i_media, p_vlm->media );<br>-<br>- vlm_ControlInternal( p_vlm, VLM_CLEAR_SCHEDULES );<br>- TAB_CLEAN( p_vlm->i_schedule, p_vlm->schedule );<br> vlc_mutex_unlock( &p_vlm->lock );<br> <br> vlc_mutex_lock( &p_vlm->lock_manage );<br>@@ -247,9 +243,6 @@ static void* Manage( void* p_object )<br> <br> do<br> {<br>- char **ppsz_scheduled_commands = NULL;<br>- int i_scheduled_commands = 0;<br>-<br> /* destroy the inputs that wants to die, and launch the next input */<br> vlc_mutex_lock( &vlm->lock );<br> for( int i = 0; i < vlm->i_media; i++ )<br>@@ -286,89 +279,12 @@ static void* Manage( void* p_object )<br> }<br> }<br> <br>- /* scheduling */<br>- time_t now, nextschedule = 0;<br>-<br>- time(&now);<br>-<br>- for( int i = 0; i < vlm->i_schedule; i++ )<br>- {<br>- time_t real_date = vlm->schedule[i]->date;<br>-<br>- if( vlm->schedule[i]->b_enabled )<br>- {<br>- bool b_now = false;<br>- if( vlm->schedule[i]->date == 0 ) // now !<br>- {<br>- vlm->schedule[i]->date = now;<br>- real_date = now;<br>- b_now = true;<br>- }<br>- else if( vlm->schedule[i]->period != 0 )<br>- {<br>- int j = 0;<br>- while( ((vlm->schedule[i]->date + j *<br>- vlm->schedule[i]->period) <= lastcheck) &&<br>- ( vlm->schedule[i]->i_repeat > j ||<br>- vlm->schedule[i]->i_repeat < 0 ) )<br>- {<br>- j++;<br>- }<br>-<br>- real_date = vlm->schedule[i]->date + j *<br>- vlm->schedule[i]->period;<br>- }<br>-<br>- if( real_date <= now )<br>- {<br>- if( real_date > lastcheck || b_now )<br>- {<br>- for( int j = 0; j < <br>vlm->schedule[i]->i_command; j++ )<br>- {<br>- TAB_APPEND( i_scheduled_commands,<br>- ppsz_scheduled_commands,<br>- <br>strdup(vlm->schedule[i]->command[j] ) );<br>- }<br>- }<br>- }<br>- else if( nextschedule == 0 || real_date < nextschedule <br>)<br>- {<br>- nextschedule = real_date;<br>- }<br>- }<br>- }<br>-<br>- while( i_scheduled_commands )<br>- {<br>- vlm_message_t *message = NULL;<br>- char *psz_command = ppsz_scheduled_commands[0];<br>- ExecuteCommand( vlm, psz_command,&message );<br>-<br>- /* for now, drop the message */<br>- vlm_MessageDelete( message );<br>- TAB_REMOVE( i_scheduled_commands,<br>- ppsz_scheduled_commands,<br>- psz_command );<br>- free( psz_command );<br>- }<br>-<br>- lastcheck = now;<br> vlc_mutex_unlock( &vlm->lock );<br> <br> vlc_mutex_lock( &vlm->lock_manage );<br> <br> while( !vlm->input_state_changed && !(exiting = vlm->exiting) )<br>- {<br>- if( nextschedule )<br>- {<br>- if( vlc_cond_timedwait_daytime( &vlm->wait_manage,<br>- &vlm->lock_manage,<br>- nextschedule ) )<br>- break;<br>- }<br>- else<br>- vlc_cond_wait( &vlm->wait_manage, &vlm->lock_manage );<br>- }<br>+ vlc_cond_wait( &vlm->wait_manage, &vlm->lock_manage );<br> vlm->input_state_changed = false;<br> vlc_mutex_unlock( &vlm->lock_manage );<br> }<br>@@ -414,7 +330,7 @@ static vlm_media_sys_t *vlm_ControlMediaGetByName( <br>vlm_t *p_vlm, const char *psz<br> static int vlm_MediaDescriptionCheck( vlm_t *p_vlm, vlm_media_t *p_cfg <br>)<br> {<br> if( !p_cfg || !p_cfg->psz_name ||<br>- !strcmp( p_cfg->psz_name, "all" ) || !strcmp( p_cfg->psz_name, <br>"media" ) || !strcmp( p_cfg->psz_name, "schedule" ) )<br>+ !strcmp( p_cfg->psz_name, "all" ) || !strcmp( p_cfg->psz_name, <br>"media" ) )<br> return VLC_EGENERIC;<br> <br> for( int i = 0; i < p_vlm->i_media; i++ )<br>@@ -845,14 +761,6 @@ static int vlm_ControlMediaInstanceClear( vlm_t <br>*p_vlm, int64_t id )<br> return VLC_SUCCESS;<br> }<br> <br>-static int vlm_ControlScheduleClear( vlm_t *p_vlm )<br>-{<br>- while( p_vlm->i_schedule > 0 )<br>- vlm_ScheduleDelete( p_vlm, p_vlm->schedule[0] );<br>-<br>- return VLC_SUCCESS;<br>-}<br>-<br> static int vlm_vaControlInternal( vlm_t *p_vlm, int i_query, va_list <br>args )<br> {<br> vlm_media_t *p_dsc;<br>@@ -955,9 +863,6 @@ static int vlm_vaControlInternal( vlm_t *p_vlm, int <br>i_query, va_list args )<br> d_double = (double)va_arg( args, double );<br> return vlm_ControlMediaInstanceSetTimePosition( p_vlm, id, <br>psz_id, -1, d_double );<br> <br>- case VLM_CLEAR_SCHEDULES:<br>- return vlm_ControlScheduleClear( p_vlm );<br>-<br> default:<br> msg_Err( p_vlm, "unknown VLM query" );<br> return VLC_EGENERIC;<br>diff --git a/src/input/vlm_internal.h b/src/input/vlm_internal.h<br>index 2a74930343..40036f054f 100644<br>--- a/src/input/vlm_internal.h<br>+++ b/src/input/vlm_internal.h<br>@@ -54,26 +54,6 @@ typedef struct<br> vlm_media_instance_sys_t **instance;<br> } vlm_media_sys_t;<br> <br>-typedef struct<br>-{<br>- /* names "schedule" is reserved */<br>- char *psz_name;<br>- bool b_enabled;<br>- /* list of commands to execute on date */<br>- int i_command;<br>- char **command;<br>-<br>- /* the date of 1st execution */<br>- time_t date;<br>-<br>- /* if != 0, repeat period in seconds */<br>- time_t period;<br>- /* number of times you have to repeat<br>- i_repeat < 0 : endless repeat */<br>- int i_repeat;<br>-} vlm_schedule_sys_t;<br>-<br>-<br> struct vlm_t<br> {<br> struct vlc_object_t obj;<br>@@ -93,14 +73,9 @@ struct vlm_t<br> /* Media list */<br> int i_media;<br> vlm_media_sys_t **media;<br>-<br>- /* Schedule list */<br>- int i_schedule;<br>- vlm_schedule_sys_t **schedule;<br> };<br> <br> int vlm_ControlInternal( vlm_t *p_vlm, int i_query, ... );<br> int ExecuteCommand( vlm_t *, const char *, vlm_message_t ** );<br>-void vlm_ScheduleDelete( vlm_t *vlm, vlm_schedule_sys_t *sched );<br> <br> #endif<br>diff --git a/src/input/vlmshell.c b/src/input/vlmshell.c<br>index 8b4b0fb309..661a64c782 100644<br>--- a/src/input/vlmshell.c<br>+++ b/src/input/vlmshell.c<br>@@ -39,7 +39,6 @@<br> <br> #ifdef ENABLE_VLM<br> <br>-#include <time.h> /* ctime() */<br> #include <limits.h><br> #include <fcntl.h><br> #include <sys/stat.h><br>@@ -59,17 +58,11 @@<br> *****************************************************************************/<br> <br> /* */<br>-static vlm_message_t *vlm_Show( vlm_t *, vlm_media_sys_t *, <br>vlm_schedule_sys_t *, const char * );<br>-<br>-static vlm_schedule_sys_t *vlm_ScheduleSearch( vlm_t *, const char * );<br>+static vlm_message_t *vlm_Show( vlm_t *, vlm_media_sys_t *, const char <br>* );<br> <br> static char *Save( vlm_t * );<br> static int Load( vlm_t *, char * );<br> <br>-static vlm_schedule_sys_t *vlm_ScheduleNew( vlm_t *vlm, const char <br>*psz_name );<br>-static int vlm_ScheduleSetup( vlm_schedule_sys_t *schedule, const char <br>*psz_cmd,<br>- const char *psz_value );<br>-<br> /* */<br> static vlm_media_sys_t *vlm_MediaSearch( vlm_t *, const char *);<br> <br>@@ -224,42 +217,21 @@ static bool ExecuteIsMedia( vlm_t *p_vlm, const <br>char *psz_name )<br> return false;<br> return true;<br> }<br>-static bool ExecuteIsSchedule( vlm_t *p_vlm, const char *psz_name )<br>-{<br>- if( !psz_name || !vlm_ScheduleSearch( p_vlm, psz_name ) )<br>- return false;<br>- return true;<br>-}<br> <br> static int ExecuteDel( vlm_t *p_vlm, const char *psz_name, <br>vlm_message_t **pp_status )<br> {<br> vlm_media_sys_t *p_media;<br>- vlm_schedule_sys_t *p_schedule;<br> <br> p_media = vlm_MediaSearch( p_vlm, psz_name );<br>- p_schedule = vlm_ScheduleSearch( p_vlm, psz_name );<br> <br>- if( p_schedule != NULL )<br>- {<br>- vlm_ScheduleDelete( p_vlm, p_schedule );<br>- }<br>- else if( p_media != NULL )<br>+ if( p_media != NULL )<br> {<br> vlm_ControlInternal( p_vlm, VLM_DEL_MEDIA, p_media->cfg.id );<br> }<br>- else if( !strcmp(psz_name, "media") )<br>+ else if( !strcmp(psz_name, "media") || !strcmp(psz_name, "all") )<br> {<br> vlm_ControlInternal( p_vlm, VLM_CLEAR_MEDIAS );<br> }<br>- else if( !strcmp(psz_name, "schedule") )<br>- {<br>- vlm_ControlInternal( p_vlm, VLM_CLEAR_SCHEDULES );<br>- }<br>- else if( !strcmp(psz_name, "all") )<br>- {<br>- vlm_ControlInternal( p_vlm, VLM_CLEAR_MEDIAS );<br>- vlm_ControlInternal( p_vlm, VLM_CLEAR_SCHEDULES );<br>- }<br> else<br> {<br> *pp_status = vlm_MessageNew( "del", "%s: media unknown", <br>psz_name );<br>@@ -273,23 +245,19 @@ static int ExecuteDel( vlm_t *p_vlm, const char <br>*psz_name, vlm_message_t **pp_st<br> static int ExecuteShow( vlm_t *p_vlm, const char *psz_name, <br>vlm_message_t **pp_status )<br> {<br> vlm_media_sys_t *p_media;<br>- vlm_schedule_sys_t *p_schedule;<br> <br> if( !psz_name )<br> {<br>- *pp_status = vlm_Show( p_vlm, NULL, NULL, NULL );<br>+ *pp_status = vlm_Show( p_vlm, NULL, NULL );<br> return VLC_SUCCESS;<br> }<br> <br> p_media = vlm_MediaSearch( p_vlm, psz_name );<br>- p_schedule = vlm_ScheduleSearch( p_vlm, psz_name );<br> <br>- if( p_schedule != NULL )<br>- *pp_status = vlm_Show( p_vlm, NULL, p_schedule, NULL );<br>- else if( p_media != NULL )<br>- *pp_status = vlm_Show( p_vlm, p_media, NULL, NULL );<br>+ if( p_media != NULL )<br>+ *pp_status = vlm_Show( p_vlm, p_media, NULL );<br> else<br>- *pp_status = vlm_Show( p_vlm, NULL, NULL, psz_name );<br>+ *pp_status = vlm_Show( p_vlm, NULL, psz_name );<br> <br> return VLC_SUCCESS;<br> }<br>@@ -306,10 +274,10 @@ static int ExecuteHelp( vlm_message_t **pp_status )<br> *pp_status = vlm_MessageSimpleNew( "help" );<br> <br> message_child = MessageAdd( "Commands Syntax:" );<br>- MessageAddChild( "new (name) broadcast|schedule [properties]" );<br>+ MessageAddChild( "new (name) broadcast [properties]" );<br> MessageAddChild( "setup (name) (properties)" );<br>- MessageAddChild( "show [(name)|media|schedule]" );<br>- MessageAddChild( "del (name)|all|media|schedule" );<br>+ MessageAddChild( "show [(name)|media]" );<br>+ MessageAddChild( "del (name)|all|media" );<br> MessageAddChild( "control (name) [instance_name] (command)" );<br> MessageAddChild( "save (config_file)" );<br> MessageAddChild( "export" );<br>@@ -325,15 +293,6 @@ static int ExecuteHelp( vlm_message_t **pp_status )<br> MessageAddChild( "loop|unloop (broadcast only)" );<br> MessageAddChild( "mux (mux_name)" );<br> <br>- message_child = MessageAdd( "Schedule Proprieties Syntax:" );<br>- MessageAddChild( "enabled|disabled" );<br>- MessageAddChild( "append (command_until_rest_of_the_line)" );<br>- MessageAddChild( "date (year)/(month)/(day)-(hour):(minutes):"<br>- "(seconds)|now" );<br>- MessageAddChild( "period <br>(years_aka_12_months)/(months_aka_30_days)/"<br>- "(days)-(hours):(minutes):(seconds)" );<br>- MessageAddChild( "repeat (number_of_repetitions)" );<br>-<br> message_child = MessageAdd( "Control Commands Syntax:" );<br> MessageAddChild( "play [input_number]" );<br> MessageAddChild( "pause" );<br>@@ -563,88 +522,6 @@ static int ExecuteLoad( vlm_t *p_vlm, const char <br>*psz_path, vlm_message_t **pp_s<br> return VLC_SUCCESS;<br> }<br> <br>-static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t <br>*p_schedule, bool b_new,<br>- const int i_property, char <br>*ppsz_property[], vlm_message_t **pp_status )<br>-{<br>- const char *psz_cmd = b_new ? "new" : "setup";<br>- int i;<br>-<br>- for( i = 0; i < i_property; i++ )<br>- {<br>- if( !strcmp( ppsz_property[i], "enabled" ) ||<br>- !strcmp( ppsz_property[i], "disabled" ) )<br>- {<br>- if ( vlm_ScheduleSetup( p_schedule, ppsz_property[i], NULL <br>) )<br>- goto error;<br>- }<br>- else if( !strcmp( ppsz_property[i], "append" ) )<br>- {<br>- char *psz_line, *psz_realloc;<br>- int j, i_ret = VLC_SUCCESS;<br>- /* Beware: everything behind append is considered as<br>- * command line */<br>-<br>- if( ++i >= i_property )<br>- break;<br>-<br>- psz_line = strdup( ppsz_property[i] );<br>- if( unlikely(psz_line == NULL) )<br>- goto error;<br>-<br>- for( j = i+1; j < i_property; j++ )<br>- {<br>- psz_realloc = realloc( psz_line,<br>- strlen(psz_line) + <br>strlen(ppsz_property[j]) + 1 + 1 );<br>- if( likely(psz_realloc) )<br>- {<br>- psz_line = psz_realloc;<br>- strcat( psz_line, " " );<br>- strcat( psz_line, ppsz_property[j] );<br>- }<br>- else<br>- {<br>- i_ret = VLC_ENOMEM;<br>- break;<br>- }<br>- }<br>-<br>- if( i_ret == VLC_SUCCESS )<br>- i_ret = vlm_ScheduleSetup( p_schedule, "append", <br>psz_line );<br>- free( psz_line );<br>-<br>- if( i_ret )<br>- goto error;<br>- break;<br>- }<br>- else<br>- {<br>- if( i + 1 >= i_property )<br>- {<br>- if( b_new )<br>- vlm_ScheduleDelete( p_vlm, p_schedule );<br>- return ExecuteSyntaxError( psz_cmd, pp_status );<br>- }<br>-<br>- if( vlm_ScheduleSetup( p_schedule, ppsz_property[i], <br>ppsz_property[i+1] ) )<br>- goto error;<br>- i++;<br>- }<br>- }<br>- *pp_status = vlm_MessageSimpleNew( psz_cmd );<br>-<br>- vlc_mutex_lock( &p_vlm->lock_manage );<br>- p_vlm->input_state_changed = true;<br>- vlc_cond_signal( &p_vlm->wait_manage );<br>- vlc_mutex_unlock( &p_vlm->lock_manage );<br>-<br>- return VLC_SUCCESS;<br>-<br>-error:<br>- *pp_status = vlm_MessageNew( psz_cmd, "Error while setting the <br>property '%s' to the schedule",<br>- ppsz_property[i] );<br>- return VLC_EGENERIC;<br>-}<br>-<br> static int ExecuteMediaProperty( vlm_t *p_vlm, int64_t id, bool b_new,<br> const int i_property, char <br>*ppsz_property[], vlm_message_t **pp_status )<br> {<br>@@ -762,28 +639,18 @@ error:<br> static int ExecuteNew( vlm_t *p_vlm, const char *psz_name, const char <br>*psz_type, const int i_property, char *ppsz_property[], vlm_message_t <br>**pp_status )<br> {<br> /* Check name */<br>- if( !strcmp( psz_name, "all" ) || !strcmp( psz_name, "media" ) || <br>!strcmp( psz_name, "schedule" ) )<br>+ if( !strcmp( psz_name, "all" ) || !strcmp( psz_name, "media" ) )<br> {<br>- *pp_status = vlm_MessageNew( "new", "\"all\", \"media\" and <br>\"schedule\" are reserved names" );<br>+ *pp_status = vlm_MessageNew( "new", "\"all\" and \"media\" are <br>reserved names" );<br> return VLC_EGENERIC;<br> }<br>- if( ExecuteIsMedia( p_vlm, psz_name ) || ExecuteIsSchedule( p_vlm, <br>psz_name ) )<br>+ if( ExecuteIsMedia( p_vlm, psz_name ) )<br> {<br> *pp_status = vlm_MessageNew( "new", "%s: Name already in use", <br>psz_name );<br> return VLC_EGENERIC;<br> }<br> /* */<br>- if( !strcmp( psz_type, "schedule" ) )<br>- {<br>- vlm_schedule_sys_t *p_schedule = vlm_ScheduleNew( p_vlm, <br>psz_name );<br>- if( !p_schedule )<br>- {<br>- *pp_status = vlm_MessageNew( "new", "could not create <br>schedule" );<br>- return VLC_EGENERIC;<br>- }<br>- return ExecuteScheduleProperty( p_vlm, p_schedule, true, <br>i_property, ppsz_property, pp_status );<br>- }<br>- else if( !strcmp( psz_type, "broadcast" ) )<br>+ if( !strcmp( psz_type, "broadcast" ) )<br> {<br> vlm_media_t cfg;<br> int64_t id;<br>@@ -802,19 +669,14 @@ static int ExecuteNew( vlm_t *p_vlm, const char <br>*psz_name, const char *psz_type,<br> }<br> else<br> {<br>- *pp_status = vlm_MessageNew( "new", "%s: Choose between <br>broadcast or schedule", psz_type );<br>+ *pp_status = vlm_MessageNew( "new", "%s: unknown media type", <br>psz_type );<br> return VLC_EGENERIC;<br> }<br> }<br> <br> static int ExecuteSetup( vlm_t *p_vlm, const char *psz_name, const int <br>i_property, char *ppsz_property[], vlm_message_t **pp_status )<br> {<br>- if( ExecuteIsSchedule( p_vlm, psz_name ) )<br>- {<br>- vlm_schedule_sys_t *p_schedule = vlm_ScheduleSearch( p_vlm, <br>psz_name );<br>- return ExecuteScheduleProperty( p_vlm, p_schedule, false, <br>i_property, ppsz_property, pp_status );<br>- }<br>- else if( ExecuteIsMedia( p_vlm, psz_name ) )<br>+ if( ExecuteIsMedia( p_vlm, psz_name ) )<br> {<br> int64_t id;<br> if( vlm_ControlInternal( p_vlm, VLM_GET_MEDIA_ID, psz_name, <br>&id ) )<br>@@ -948,246 +810,6 @@ vlm_media_sys_t *vlm_MediaSearch( vlm_t *vlm, <br>const char *psz_name )<br> return NULL;<br> }<br> <br>-/*****************************************************************************<br>- * Schedule handling<br>- <br>*****************************************************************************/<br>-static vlm_schedule_sys_t *vlm_ScheduleNew( vlm_t *vlm, const char <br>*psz_name )<br>-{<br>- if( !psz_name )<br>- return NULL;<br>-<br>- vlm_schedule_sys_t *p_sched = malloc( sizeof( vlm_schedule_sys_t ) <br>);<br>- if( !p_sched )<br>- return NULL;<br>-<br>- p_sched->psz_name = strdup( psz_name );<br>- p_sched->b_enabled = false;<br>- p_sched->i_command = 0;<br>- p_sched->command = NULL;<br>- p_sched->date = 0;<br>- p_sched->period = 0;<br>- p_sched->i_repeat = -1;<br>-<br>- TAB_APPEND( vlm->i_schedule, vlm->schedule, p_sched );<br>-<br>- return p_sched;<br>-}<br>-<br>-/* for now, simple delete. After, del with options (last arg) */<br>-void vlm_ScheduleDelete( vlm_t *vlm, vlm_schedule_sys_t *sched )<br>-{<br>- int i;<br>- if( sched == NULL ) return;<br>-<br>- TAB_REMOVE( vlm->i_schedule, vlm->schedule, sched );<br>-<br>- if( vlm->i_schedule == 0 ) free( vlm->schedule );<br>- free( sched->psz_name );<br>-<br>- for ( i = 0; i < sched->i_command; i++ )<br>- free( sched->command[i] );<br>- free( sched->command );<br>- free( sched );<br>-}<br>-<br>-static vlm_schedule_sys_t *vlm_ScheduleSearch( vlm_t *vlm, const char <br>*psz_name )<br>-{<br>- int i;<br>-<br>- for( i = 0; i < vlm->i_schedule; i++ )<br>- {<br>- if( strcmp( psz_name, vlm->schedule[i]->psz_name ) == 0 )<br>- {<br>- return vlm->schedule[i];<br>- }<br>- }<br>-<br>- return NULL;<br>-}<br>-<br>-/* Ok, setup schedule command will be able to support only one <br>(argument value) at a time */<br>-static int vlm_ScheduleSetup( vlm_schedule_sys_t *schedule, const char <br>*psz_cmd,<br>- const char *psz_value )<br>-{<br>- if( !strcmp( psz_cmd, "enabled" ) )<br>- {<br>- schedule->b_enabled = true;<br>- }<br>- else if( !strcmp( psz_cmd, "disabled" ) )<br>- {<br>- schedule->b_enabled = false;<br>- }<br>- else if( !strcmp( psz_cmd, "date" ) )<br>- {<br>- struct tm time;<br>- const char *p;<br>-<br>- time.tm_sec = 0; /* seconds */<br>- time.tm_min = 0; /* minutes */<br>- time.tm_hour = 0; /* hours */<br>- time.tm_mday = 0; /* day of the month */<br>- time.tm_mon = 0; /* month */<br>- time.tm_year = 0; /* year */<br>- time.tm_wday = 0; /* day of the week */<br>- time.tm_yday = 0; /* day in the year */<br>- time.tm_isdst = -1; /* daylight saving time */<br>-<br>- /* date should be year/month/day-hour:minutes:seconds */<br>- p = strchr( psz_value, '-' );<br>-<br>- if( !strcmp( psz_value, "now" ) )<br>- {<br>- schedule->date = 0;<br>- }<br>- else if(p == NULL)<br>- {<br>- return 1;<br>- }<br>- else<br>- {<br>- unsigned i,j,k;<br>-<br>- switch( sscanf( p + 1, "%u:%u:%u", &i, &j, &k ) )<br>- {<br>- case 1:<br>- time.tm_sec = i;<br>- break;<br>- case 2:<br>- time.tm_min = i;<br>- time.tm_sec = j;<br>- break;<br>- case 3:<br>- time.tm_hour = i;<br>- time.tm_min = j;<br>- time.tm_sec = k;<br>- break;<br>- default:<br>- return 1;<br>- }<br>-<br>- switch( sscanf( psz_value, "%d/%d/%d", &i, &j, &k ) )<br>- {<br>- case 1:<br>- time.tm_mday = i;<br>- break;<br>- case 2:<br>- time.tm_mon = i - 1;<br>- time.tm_mday = j;<br>- break;<br>- case 3:<br>- time.tm_year = i - 1900;<br>- time.tm_mon = j - 1;<br>- time.tm_mday = k;<br>- break;<br>- default:<br>- return 1;<br>- }<br>-<br>- schedule->date = mktime(&time);<br>- }<br>- }<br>- else if( !strcmp( psz_cmd, "period" ) )<br>- {<br>- struct tm time;<br>- const char *p;<br>- const char *psz_time = NULL, *psz_date = NULL;<br>- unsigned i,j,k;<br>-<br>- /* First, if date or period are modified, repeat should be <br>equal to -1 */<br>- schedule->i_repeat = -1;<br>-<br>- time.tm_sec = 0; /* seconds */<br>- time.tm_min = 0; /* minutes */<br>- time.tm_hour = 0; /* hours */<br>- time.tm_mday = 0; /* day of </blockquote></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>