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