Commit 788d3b65 authored by Antoine Cellerier's avatar Antoine Cellerier

* playlist.c, asx.c: add new --playlist-skip-ads option (default enabled) to...

* playlist.c, asx.c: add new --playlist-skip-ads option (default enabled) to skip autodetected ads. Test playlist: "http://www.zoomin.tv/asx/dsp_asxplaylist.cfm?id=251350&pid=lefigaro&quality=2&WMCache=0&iebr=0". Assumption is: if the playlist states that an item shouldn't be skipped or can't be seeked in, then it's an ad.
parent 666c5ea2
...@@ -45,6 +45,7 @@ struct demux_sys_t ...@@ -45,6 +45,7 @@ struct demux_sys_t
char *psz_data; char *psz_data;
int64_t i_data_len; int64_t i_data_len;
vlc_bool_t b_utf8; vlc_bool_t b_utf8;
vlc_bool_t b_skip_ads;
}; };
/***************************************************************************** /*****************************************************************************
...@@ -207,6 +208,7 @@ int E_(Import_ASX)( vlc_object_t *p_this ) ...@@ -207,6 +208,7 @@ int E_(Import_ASX)( vlc_object_t *p_this )
p_demux->p_sys->psz_data = NULL; p_demux->p_sys->psz_data = NULL;
p_demux->p_sys->i_data_len = -1; p_demux->p_sys->i_data_len = -1;
p_demux->p_sys->b_utf8 = VLC_FALSE; p_demux->p_sys->b_utf8 = VLC_FALSE;
p_demux->p_sys->b_skip_ads = config_GetInt( p_demux, "playlist-skip-ads" );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -278,6 +280,7 @@ static int Demux( demux_t *p_demux ) ...@@ -278,6 +280,7 @@ static int Demux( demux_t *p_demux )
char *psz_moreinfo_entry = NULL; char *psz_moreinfo_entry = NULL;
char *psz_abstract_entry = NULL; char *psz_abstract_entry = NULL;
int i_entry_count = 0; int i_entry_count = 0;
vlc_bool_t b_skip_entry = VLC_FALSE;
char *psz_href = NULL; char *psz_href = NULL;
int i_starttime = 0; int i_starttime = 0;
...@@ -495,6 +498,13 @@ static int Demux( demux_t *p_demux ) ...@@ -495,6 +498,13 @@ static int Demux( demux_t *p_demux )
continue; continue;
} }
if( p_sys->b_skip_ads && b_skip_entry )
{
msg_Dbg( p_demux, "skipped entry %d %s (%s)",
i_entry_count, ( psz_title_entry ? psz_title_entry : p_current->p_input->psz_name ), psz_href );
}
else
{
if( i_starttime || i_duration ) if( i_starttime || i_duration )
{ {
if( i_starttime ) { if( i_starttime ) {
...@@ -530,6 +540,8 @@ static int Demux( demux_t *p_demux ) ...@@ -530,6 +540,8 @@ static int Demux( demux_t *p_demux )
PLAYLIST_APPEND | PLAYLIST_SPREPARSE PLAYLIST_APPEND | PLAYLIST_SPREPARSE
, PLAYLIST_END, NULL, NULL, , PLAYLIST_END, NULL, NULL,
VLC_FALSE ); VLC_FALSE );
}
/* cleanup entry */ /* cleanup entry */
FREENULL( psz_href ) FREENULL( psz_href )
FREENULL( psz_title_entry ) FREENULL( psz_title_entry )
...@@ -542,6 +554,7 @@ static int Demux( demux_t *p_demux ) ...@@ -542,6 +554,7 @@ static int Demux( demux_t *p_demux )
} }
else if( !strncasecmp( psz_parse, "<Entry", 6 ) ) else if( !strncasecmp( psz_parse, "<Entry", 6 ) )
{ {
char *psz_clientskip;
psz_parse+=6; psz_parse+=6;
if( b_entry ) if( b_entry )
{ {
...@@ -550,8 +563,13 @@ static int Demux( demux_t *p_demux ) ...@@ -550,8 +563,13 @@ static int Demux( demux_t *p_demux )
} }
i_entry_count += 1; i_entry_count += 1;
b_entry = VLC_TRUE; b_entry = VLC_TRUE;
psz_clientskip = strcasestr( psz_parse, "clientskip=\"no\"" );
psz_parse = strcasestr( psz_parse, ">" ); psz_parse = strcasestr( psz_parse, ">" );
/* If clientskip was enabled ... this is an ad */
if( psz_clientskip < psz_parse ) b_skip_entry = VLC_TRUE;
else b_skip_entry = VLC_FALSE;
// init entry details // init entry details
FREENULL(psz_href); FREENULL(psz_href);
psz_href = NULL; psz_href = NULL;
......
...@@ -41,6 +41,10 @@ ...@@ -41,6 +41,10 @@
#define SHOW_ADULT_LONGTEXT N_( "Show NC17 rated video streams when " \ #define SHOW_ADULT_LONGTEXT N_( "Show NC17 rated video streams when " \
"using shoutcast video playlists." ) "using shoutcast video playlists." )
#define SKIP_ADS_TEXT N_( "Skip ads" )
#define SKIP_ADS_LONGTEXT N_( "Use playlist options usually used to prevent " \
"ads skipping to detect ads and prevent adding them to the playlist." )
vlc_module_begin(); vlc_module_begin();
add_shortcut( "playlist" ); add_shortcut( "playlist" );
set_category( CAT_INPUT ); set_category( CAT_INPUT );
...@@ -52,6 +56,9 @@ vlc_module_begin(); ...@@ -52,6 +56,9 @@ vlc_module_begin();
add_integer( "parent-item", 0, NULL, NULL, NULL, VLC_TRUE ); add_integer( "parent-item", 0, NULL, NULL, NULL, VLC_TRUE );
change_internal(); change_internal();
add_bool( "playlist-skip-ads", 1, NULL,
SKIP_ADS_TEXT, SKIP_ADS_LONGTEXT, VLC_FALSE );
set_shortname( _("Playlist") ); set_shortname( _("Playlist") );
set_description( _("Playlist") ); set_description( _("Playlist") );
add_submodule(); add_submodule();
...@@ -116,13 +123,6 @@ vlc_module_begin(); ...@@ -116,13 +123,6 @@ vlc_module_begin();
set_description( _("Dummy ifo demux") ); set_description( _("Dummy ifo demux") );
set_capability( "demux2", 12 ); set_capability( "demux2", 12 );
set_callbacks( E_(Import_IFO), E_(Close_IFO) ); set_callbacks( E_(Import_IFO), E_(Close_IFO) );
#if 0
add_submodule();
set_description( _("Video portal url converter") );
add_shortcut( "videoportal" );
set_capability( "demux2", 10 );
set_callbacks( E_(Import_VideoPortal), E_(Close_VideoPortal) );
#endif
vlc_module_end(); vlc_module_end();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment