Commit 4a027876 authored by Antoine Cellerier's avatar Antoine Cellerier

Backport trunk shoutcast changes except Shoutcast TV service discovery submodule.

parent e94d562b
...@@ -9,6 +9,7 @@ SOURCES_playlist = \ ...@@ -9,6 +9,7 @@ SOURCES_playlist = \
podcast.c \ podcast.c \
xspf.c \ xspf.c \
xspf.h \ xspf.h \
shoutcast.c \
$(NULL) $(NULL)
...@@ -38,6 +38,10 @@ ...@@ -38,6 +38,10 @@
#define AUTOSTART_LONGTEXT N_( "Automatically start playing the playlist " \ #define AUTOSTART_LONGTEXT N_( "Automatically start playing the playlist " \
"content once it's loaded.\n" ) "content once it's loaded.\n" )
#define SHOW_ADULT_TEXT N_( "Show shoutcast adult content" )
#define SHOW_ADULT_LONGTEXT N_( "Show NC17 rated video streams when " \
"using shoutcast video playlists." )
vlc_module_begin(); vlc_module_begin();
add_shortcut( "playlist" ); add_shortcut( "playlist" );
set_category( CAT_INPUT ); set_category( CAT_INPUT );
...@@ -90,6 +94,13 @@ vlc_module_begin(); ...@@ -90,6 +94,13 @@ vlc_module_begin();
add_shortcut( "xspf-open" ); add_shortcut( "xspf-open" );
set_capability( "demux2", 10 ); set_capability( "demux2", 10 );
set_callbacks( E_(xspf_import_Activate), NULL ); set_callbacks( E_(xspf_import_Activate), NULL );
add_submodule();
set_description( _("New winamp 5.2 shoutcast import") );
add_shortcut( "shout-winamp" );
set_capability( "demux2", 10 );
set_callbacks( E_(Import_Shoutcast), E_(Close_Shoutcast) );
add_bool( "shoutcast-show-adult", VLC_FALSE, NULL,
SHOW_ADULT_TEXT, SHOW_ADULT_LONGTEXT, VLC_FALSE );
vlc_module_end(); vlc_module_end();
......
...@@ -47,3 +47,6 @@ int E_(Import_podcast) ( vlc_object_t * ); ...@@ -47,3 +47,6 @@ int E_(Import_podcast) ( vlc_object_t * );
void E_(Close_podcast) ( vlc_object_t * ); void E_(Close_podcast) ( vlc_object_t * );
int E_(xspf_import_Activate) ( vlc_object_t * ); int E_(xspf_import_Activate) ( vlc_object_t * );
int E_(Import_Shoutcast) ( vlc_object_t * );
void E_(Close_Shoutcast) ( vlc_object_t * );
This diff is collapsed.
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id$ * $Id$
* *
* Authors: Sigmund Augdal Helberg <dnumgis@videolan.org> * Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
* Antoine Cellerier <dionoea -@T- videolan -d.t- org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -48,7 +49,7 @@ ...@@ -48,7 +49,7 @@
************************************************************************/ ************************************************************************/
#define MAX_LINE_LENGTH 256 #define MAX_LINE_LENGTH 256
#define SHOUTCAST_BASE_URL "http/shout-winamp://www.shoutcast.com/sbin/newxml.phtml"
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
...@@ -58,19 +59,13 @@ ...@@ -58,19 +59,13 @@
static int Open ( vlc_object_t * ); static int Open ( vlc_object_t * );
static void Close( vlc_object_t * ); static void Close( vlc_object_t * );
#define LIMIT_TEXT N_("Number of streams")
/// \bug [String] -which would be listed + to list
#define LIMIT_LONGTEXT N_("Maximum number of Shoutcast radio streams which " \
"would be listed.")
vlc_module_begin(); vlc_module_begin();
set_shortname( "Shoutcast"); set_shortname( "Shoutcast");
set_description( _("Shoutcast radio listings") ); set_description( _("Shoutcast radio listings") );
set_category( CAT_PLAYLIST ); set_category( CAT_PLAYLIST );
set_subcategory( SUBCAT_PLAYLIST_SD ); set_subcategory( SUBCAT_PLAYLIST_SD );
add_integer( "shoutcast-limit", 1000, NULL, LIMIT_TEXT, add_suppressed_integer( "shoutcast-limit" );
LIMIT_LONGTEXT, VLC_TRUE );
set_capability( "services_discovery", 0 ); set_capability( "services_discovery", 0 );
set_callbacks( Open, Close ); set_callbacks( Open, Close );
...@@ -84,10 +79,7 @@ vlc_module_end(); ...@@ -84,10 +79,7 @@ vlc_module_end();
struct services_discovery_sys_t struct services_discovery_sys_t
{ {
/* playlist node */
playlist_item_t *p_node;
playlist_item_t *p_item; playlist_item_t *p_item;
int i_limit;
vlc_bool_t b_dialog; vlc_bool_t b_dialog;
}; };
...@@ -112,9 +104,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -112,9 +104,6 @@ static int Open( vlc_object_t *p_this )
playlist_view_t *p_view; playlist_view_t *p_view;
playlist_item_t *p_item; playlist_item_t *p_item;
char *psz_shoutcast_url;
char *psz_shoutcast_title;
p_sd->pf_run = Run; p_sd->pf_run = Run;
p_sd->p_sys = p_sys; p_sd->p_sys = p_sys;
...@@ -127,32 +116,16 @@ static int Open( vlc_object_t *p_this ) ...@@ -127,32 +116,16 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_sys->i_limit = config_GetInt( p_this->p_libvlc, "shoutcast-limit" );
#define SHOUTCAST_BASE_URL "http/shout-b4s://www.shoutcast.com/sbin/xmllister.phtml?service=vlc&no_compress=1&limit="
psz_shoutcast_url = (char *)malloc( strlen( SHOUTCAST_BASE_URL ) + 20 );
psz_shoutcast_title = (char *)malloc( 6 + 20 );
sprintf( psz_shoutcast_url, SHOUTCAST_BASE_URL "%d", p_sys->i_limit );
sprintf( psz_shoutcast_title, "Top %d", p_sys->i_limit );
p_view = playlist_ViewFind( p_playlist, VIEW_CATEGORY ); p_view = playlist_ViewFind( p_playlist, VIEW_CATEGORY );
p_sys->p_node = playlist_NodeCreate( p_playlist, VIEW_CATEGORY,
_("Shoutcast"), p_view->p_root ); p_sys->p_item =
p_item = playlist_ItemNew( p_playlist, psz_shoutcast_url, p_item = playlist_ItemNew( p_playlist, SHOUTCAST_BASE_URL, _("Shoutcast") );
psz_shoutcast_title ); playlist_NodeAddItem( p_playlist, p_item, p_view->i_id,
free( psz_shoutcast_url ); p_view->p_root, PLAYLIST_APPEND,
free( psz_shoutcast_title );
playlist_NodeAddItem( p_playlist, p_item,
p_sys->p_node->pp_parents[0]->i_view,
p_sys->p_node, PLAYLIST_APPEND,
PLAYLIST_END ); PLAYLIST_END );
/* We need to declare the parents of the node as the same of the p_sys->p_item->i_flags |= PLAYLIST_RO_FLAG;
* parent's ones */
playlist_CopyParents( p_sys->p_node, p_item );
p_sys->p_item = p_item;
p_sys->p_node->i_flags |= PLAYLIST_RO_FLAG;
val.b_bool = VLC_TRUE; val.b_bool = VLC_TRUE;
var_Set( p_playlist, "intf-change", val ); var_Set( p_playlist, "intf-change", val );
...@@ -172,7 +145,7 @@ static void Close( vlc_object_t *p_this ) ...@@ -172,7 +145,7 @@ static void Close( vlc_object_t *p_this )
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist ) if( p_playlist )
{ {
playlist_NodeDelete( p_playlist, p_sys->p_node, VLC_TRUE, VLC_TRUE ); playlist_NodeDelete( p_playlist, p_sys->p_item, VLC_TRUE, VLC_TRUE );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
free( p_sys ); free( p_sys );
...@@ -204,7 +177,7 @@ static void Run( services_discovery_t *p_sd ) ...@@ -204,7 +177,7 @@ static void Run( services_discovery_t *p_sd )
if( i_state == PLAYING_S ) if( i_state == PLAYING_S )
{ {
float f_pos = (float)(p_sys->p_item->i_children)* 2 *100.0 / float f_pos = (float)(p_sys->p_item->i_children)* 2 *100.0 /
(float)(p_sys->i_limit); 260 /* gruiiik FIXME */;
intf_UserProgressUpdate( p_sd, i_dialog_id, "Downloading", intf_UserProgressUpdate( p_sd, i_dialog_id, "Downloading",
f_pos ); f_pos );
} }
......
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