#include <vlc/vout.h>
#include <vlc_video.h>
#include <vlc_osd.h>
+#include <vlc_update.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
vlc_value_t, vlc_value_t, void * );
static int Menu ( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
+static void checkUpdates( intf_thread_t *p_intf, char *psz_arg );
/* Status Callbacks */
static int TimeOffsetChanged( vlc_object_t *, char const *,
#endif
free( p_intf->p_sys->psz_unix_path );
}
- vlc_mutex_destroy( &p_intf->p_sys->status_lock );
+ vlc_mutex_destroy( &p_intf->p_sys->status_lock );
free( p_intf->p_sys );
}
/* OSD menu commands */
var_Create( p_intf, "menu", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
- var_AddCallback( p_intf, "menu", Menu, NULL );
+ var_AddCallback( p_intf, "menu", Menu, NULL );
/* DVD commands */
var_Create( p_intf, "pause", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
Help( p_intf, b_longhelp );
}
+ else if( !strcmp( psz_cmd, "check-updates" ) )
+ {
+ checkUpdates( p_intf, psz_arg );
+ }
else switch( psz_cmd[0] )
{
case 'f':
msg_rc(_("| mosaic-cols #. . . . . . . . . . .number of cols"));
msg_rc(_("| mosaic-keep-aspect-ratio {0,1} . . .aspect ratio"));
msg_rc( "| ");
+ msg_rc(_("| check-updates [newer] [equal] [older]\n"
+ "| [undef] [info] [source] [binary] [plugin]"));
+ msg_rc( "| ");
}
msg_rc(_("| help . . . . . . . . . . . . . this help message"));
msg_rc(_("| longhelp . . . . . . . . . a longer help message"));
if( p_playlist->p_input )
{
vlc_value_t val;
-
+
var_Get( p_playlist->p_input, "rate", &val );
if( val.i_int != INPUT_RATE_DEFAULT )
{
}
else if (!strcmp( psz_cmd, "goto" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
- playlist_Goto( p_playlist, val.i_int);
+ playlist_Goto( p_playlist, val.i_int);
}
}
else if( !strcmp( psz_cmd, "stop" ) )
val.psz_string = newval.psz_string;
var_Set( p_input->p_libvlc, "marq-marquee", val );
}
- else
+ else
{
val.psz_string = "";
var_Set( p_input->p_libvlc, "marq-marquee", val);
}
else if( !strcmp( psz_cmd, "marq-x" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc, "marq-x", val );
}
else if( !strcmp( psz_cmd, "marq-y" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc, "marq-y", val );
}
else if( !strcmp( psz_cmd, "marq-position" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc, "marq-position", val );
}
else if( !strcmp( psz_cmd, "marq-color" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = strtol( newval.psz_string, NULL, 0 );
var_Set( p_input->p_libvlc, "marq-color", val );
}
else if( !strcmp( psz_cmd, "marq-opacity" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = strtol( newval.psz_string, NULL, 0 );
var_Set( p_input->p_libvlc, "marq-opacity", val );
}
else if( !strcmp( psz_cmd, "marq-size" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc, "marq-size", val );
}
else if( !strcmp( psz_cmd, "marq-timeout" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_input, "marq-timeout", val );
val.psz_string = newval.psz_string;
var_Set( p_input->p_libvlc, "time-format", val );
}
- else
+ else
{
val.psz_string = "";
var_Set( p_input->p_libvlc, "time-format", val);
}
else if( !strcmp( psz_cmd, "time-x" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc, "time-x", val );
}
else if( !strcmp( psz_cmd, "time-y" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc, "time-y", val );
}
else if( !strcmp( psz_cmd, "time-position" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc, "time-position", val );
}
else if( !strcmp( psz_cmd, "time-color" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = strtol( newval.psz_string, NULL, 0 );
var_Set( p_input->p_libvlc, "time-color", val );
}
else if( !strcmp( psz_cmd, "time-opacity" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = strtol( newval.psz_string, NULL, 0 );
var_Set( p_input->p_libvlc, "time-opacity", val );
}
else if( !strcmp( psz_cmd, "time-size" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc, "time-size", val );
}
else if( !strcmp( psz_cmd, "logo-x" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc, "logo-x", val );
}
else if( !strcmp( psz_cmd, "logo-y" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc, "logo-y", val );
}
else if( !strcmp( psz_cmd, "logo-position" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
var_Set( p_input->p_libvlc, "logo-position", val );
}
else if( !strcmp( psz_cmd, "logo-transparency" ) )
{
- if( strlen( newval.psz_string ) > 0)
+ if( strlen( newval.psz_string ) > 0)
{
val.i_int = strtol( newval.psz_string, NULL, 0 );
var_Set( p_input->p_libvlc, "logo-transparency", val );
return p_item;
}
+
+/*****************************************************************************
+ * checkUpdates : check for updates
+ ****************************************************************************/
+static void checkUpdates( intf_thread_t *p_intf, char *psz_arg )
+{
+ update_iterator_t *p_uit;
+ update_t *p_u = update_New( p_intf );
+ if( p_u == NULL ) return;
+ p_uit = update_iterator_New( p_u );
+ if( p_uit )
+ {
+ int s = 0, t = 0;
+
+ if( strstr( psz_arg, "newer" ) )
+ s |= UPDATE_RELEASE_STATUS_NEWER;
+ if( strstr( psz_arg, "equal" ) )
+ s |= UPDATE_RELEASE_STATUS_EQUAL;
+ if( strstr( psz_arg, "older" ) )
+ s |= UPDATE_RELEASE_STATUS_OLDER;
+ if( s ) p_uit->i_rs = s;
+ else p_uit->i_rs = UPDATE_RELEASE_STATUS_NEWER;
+
+ if( strstr( psz_arg, "undef" ) )
+ t |= UPDATE_FILE_TYPE_UNDEF;
+ if( strstr( psz_arg, "info" ) )
+ t |= UPDATE_FILE_TYPE_INFO;
+ if( strstr( psz_arg, "source" ) )
+ t |= UPDATE_FILE_TYPE_SOURCE;
+ if( strstr( psz_arg, "binary" ) )
+ t |= UPDATE_FILE_TYPE_BINARY;
+ if( strstr( psz_arg, "plugin" ) )
+ t |= UPDATE_FILE_TYPE_PLUGIN;
+ if( t ) p_uit->i_t = t;
+
+ update_Check( p_u, VLC_FALSE );
+ update_iterator_Action( p_uit, UPDATE_MIRROR );
+ msg_rc( "\nUsing mirror: %s (%s) [%s]",
+ p_uit->mirror.psz_name,
+ p_uit->mirror.psz_location,
+ p_uit->mirror.psz_type );
+ while( (s = update_iterator_Action( p_uit, UPDATE_FILE )) != UPDATE_FAIL )
+ {
+ char *psz_tmp;
+ if( s & UPDATE_RELEASE )
+ {
+ switch( p_uit->release.i_status )
+ {
+ case UPDATE_RELEASE_STATUS_OLDER:
+ psz_tmp = strdup( "older" );
+ break;
+ case UPDATE_RELEASE_STATUS_EQUAL:
+ psz_tmp = strdup( "equal" );
+ break;
+ case UPDATE_RELEASE_STATUS_NEWER:
+ psz_tmp = strdup( "newer" );
+ break;
+ default:
+ psz_tmp = strdup( "?!?" );
+ break;
+ }
+ msg_rc( "\n+----[ VLC %s %s (%s) ] ",
+ p_uit->release.psz_version,
+ p_uit->release.psz_svn_revision,
+ psz_tmp );
+ free( psz_tmp );
+ }
+ switch( p_uit->file.i_type )
+ {
+ case UPDATE_FILE_TYPE_UNDEF:
+ psz_tmp = strdup( "undef" );
+ break;
+ case UPDATE_FILE_TYPE_INFO:
+ psz_tmp = strdup( "info" );
+ break;
+ case UPDATE_FILE_TYPE_SOURCE:
+ psz_tmp = strdup( "source" );
+ break;
+ case UPDATE_FILE_TYPE_BINARY:
+ psz_tmp = strdup( "binary" );
+ break;
+ case UPDATE_FILE_TYPE_PLUGIN:
+ psz_tmp = strdup( "plugin" );
+ break;
+ default:
+ psz_tmp = strdup( "?!?" );
+ break;
+ }
+ msg_rc( "| %s (%s)", p_uit->file.psz_description, psz_tmp );
+ free( psz_tmp );
+ if( p_uit->file.l_size )
+ {
+ if( p_uit->file.l_size > 1024 * 1024 * 1024 )
+ asprintf( &psz_tmp, "(%ld GB)",
+ p_uit->file.l_size / (1024*1024*1024) );
+ if( p_uit->file.l_size > 1024 * 1024 )
+ asprintf( &psz_tmp, "(%ld MB)",
+ p_uit->file.l_size / (1024*1024) );
+ else if( p_uit->file.l_size > 1024 )
+ asprintf( &psz_tmp, "(%ld kB)",
+ p_uit->file.l_size / 1024 );
+ else
+ asprintf( &psz_tmp, "(%ld B)", p_uit->file.l_size );
+ }
+ else
+ {
+ psz_tmp = strdup( "" );
+ }
+ msg_rc( "| %s %s", p_uit->file.psz_url, psz_tmp );
+ msg_rc( "+----" );
+ free( psz_tmp );
+ }
+ msg_rc( "" );
+ update_iterator_Delete( p_uit );
+ }
+ update_Delete( p_u );
+}