char *psz_data;
int64_t i_data_len;
vlc_bool_t b_utf8;
+ vlc_bool_t b_skip_ads;
};
/*****************************************************************************
p_demux->p_sys->psz_data = NULL;
p_demux->p_sys->i_data_len = -1;
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;
}
char *psz_moreinfo_entry = NULL;
char *psz_abstract_entry = NULL;
int i_entry_count = 0;
+ vlc_bool_t b_skip_entry = VLC_FALSE;
char *psz_href = NULL;
int i_starttime = 0;
continue;
}
- if( i_starttime || i_duration )
+ if( p_sys->b_skip_ads && b_skip_entry )
{
- if( i_starttime ) {
- asprintf(ppsz_options+i_options, ":start-time=%d", i_starttime);
- ++i_options;
- }
- if( i_duration ) {
- asprintf(ppsz_options+i_options, ":stop-time=%d", i_starttime + i_duration);
- ++i_options;
- }
+ 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 ) {
+ asprintf(ppsz_options+i_options, ":start-time=%d", i_starttime);
+ ++i_options;
+ }
+ if( i_duration ) {
+ asprintf(ppsz_options+i_options, ":stop-time=%d", i_starttime + i_duration);
+ ++i_options;
+ }
+ }
- /* create the new entry */
- asprintf( &psz_name, "%d %s", i_entry_count, ( psz_title_entry ? psz_title_entry : p_current->p_input->psz_name ) );
+ /* create the new entry */
+ asprintf( &psz_name, "%d %s", i_entry_count, ( psz_title_entry ? psz_title_entry : p_current->p_input->psz_name ) );
- p_entry = input_ItemNewExt( p_playlist, psz_href, psz_name, i_options, (const char * const *)ppsz_options, -1 );
- FREENULL( psz_name );
- input_ItemCopyOptions( p_current->p_input, p_entry );
- while( i_options )
- {
- psz_name = ppsz_options[--i_options];
- FREENULL(psz_name);
+ p_entry = input_ItemNewExt( p_playlist, psz_href, psz_name, i_options, (const char * const *)ppsz_options, -1 );
+ FREENULL( psz_name );
+ input_ItemCopyOptions( p_current->p_input, p_entry );
+ while( i_options )
+ {
+ psz_name = ppsz_options[--i_options];
+ FREENULL(psz_name);
+ }
+
+ p_entry->p_meta = vlc_meta_New();
+ if( psz_title_entry ) vlc_meta_SetTitle( p_entry->p_meta, psz_title_entry );
+ if( psz_artist_entry ) vlc_meta_SetArtist( p_entry->p_meta, psz_artist_entry );
+ if( psz_copyright_entry ) vlc_meta_SetCopyright( p_entry->p_meta, psz_copyright_entry );
+ if( psz_moreinfo_entry ) vlc_meta_SetURL( p_entry->p_meta, psz_moreinfo_entry );
+ if( psz_abstract_entry ) vlc_meta_SetDescription( p_entry->p_meta, psz_abstract_entry );
+ playlist_BothAddInput( p_playlist, p_entry,
+ p_item_in_category,
+ PLAYLIST_APPEND | PLAYLIST_SPREPARSE
+ , PLAYLIST_END, NULL, NULL,
+ VLC_FALSE );
}
- p_entry->p_meta = vlc_meta_New();
- if( psz_title_entry ) vlc_meta_SetTitle( p_entry->p_meta, psz_title_entry );
- if( psz_artist_entry ) vlc_meta_SetArtist( p_entry->p_meta, psz_artist_entry );
- if( psz_copyright_entry ) vlc_meta_SetCopyright( p_entry->p_meta, psz_copyright_entry );
- if( psz_moreinfo_entry ) vlc_meta_SetURL( p_entry->p_meta, psz_moreinfo_entry );
- if( psz_abstract_entry ) vlc_meta_SetDescription( p_entry->p_meta, psz_abstract_entry );
- playlist_BothAddInput( p_playlist, p_entry,
- p_item_in_category,
- PLAYLIST_APPEND | PLAYLIST_SPREPARSE
- , PLAYLIST_END, NULL, NULL,
- VLC_FALSE );
/* cleanup entry */
FREENULL( psz_href )
FREENULL( psz_title_entry )
}
else if( !strncasecmp( psz_parse, "<Entry", 6 ) )
{
+ char *psz_clientskip;
psz_parse+=6;
if( b_entry )
{
}
i_entry_count += 1;
b_entry = VLC_TRUE;
+ psz_clientskip = strcasestr( psz_parse, "clientskip=\"no\"" );
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
FREENULL(psz_href);
psz_href = NULL;
#define SHOW_ADULT_LONGTEXT N_( "Show NC17 rated video streams when " \
"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();
add_shortcut( "playlist" );
set_category( CAT_INPUT );
add_integer( "parent-item", 0, NULL, NULL, NULL, VLC_TRUE );
change_internal();
+ add_bool( "playlist-skip-ads", 1, NULL,
+ SKIP_ADS_TEXT, SKIP_ADS_LONGTEXT, VLC_FALSE );
+
set_shortname( _("Playlist") );
set_description( _("Playlist") );
add_submodule();
set_description( _("Dummy ifo demux") );
set_capability( "demux2", 12 );
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();