Commit 0702b8f8 authored by Clément Stenac's avatar Clément Stenac

Add --play-and-exit option to quit after no more items are in playlist.

To be backported, but will need some manual merging (diff in vlc-devel should apply pristine to 0.8.5).
Thanks to Georgi Chorbadzhiyski for the patch
parent 1aa4230a
...@@ -954,6 +954,10 @@ static char *ppsz_clock_descriptions[] = ...@@ -954,6 +954,10 @@ static char *ppsz_clock_descriptions[] =
#define PAS_LONGTEXT N_( \ #define PAS_LONGTEXT N_( \
"Stop the playlist after each played playlist item." ) "Stop the playlist after each played playlist item." )
#define PAE_TEXT N_("Play and exit")
#define PAE_LONGTEXT N_( \
"Exit if there are no more items in the playlist." )
#define ML_TEXT N_("Use media library") #define ML_TEXT N_("Use media library")
#define ML_LONGTEXT N_( \ #define ML_LONGTEXT N_( \
"The media library is automatically saved and reloaded each time you " \ "The media library is automatically saved and reloaded each time you " \
...@@ -1618,6 +1622,7 @@ vlc_module_begin(); ...@@ -1618,6 +1622,7 @@ vlc_module_begin();
change_short('L'); change_short('L');
add_bool( "repeat", 0, NULL, REPEAT_TEXT, REPEAT_LONGTEXT, VLC_FALSE ); add_bool( "repeat", 0, NULL, REPEAT_TEXT, REPEAT_LONGTEXT, VLC_FALSE );
change_short('R'); change_short('R');
add_bool( "play-and-exit", 0, NULL, PAE_TEXT, PAE_LONGTEXT, VLC_FALSE );
add_bool( "play-and-stop", 0, NULL, PAS_TEXT, PAS_LONGTEXT, VLC_FALSE ); add_bool( "play-and-stop", 0, NULL, PAS_TEXT, PAS_LONGTEXT, VLC_FALSE );
add_bool( "media-library", 1, NULL, ML_TEXT, ML_LONGTEXT, VLC_FALSE ); add_bool( "media-library", 1, NULL, ML_TEXT, ML_LONGTEXT, VLC_FALSE );
add_integer( "playlist-tree", 0, NULL, PLTREE_TEXT, PLTREE_LONGTEXT, add_integer( "playlist-tree", 0, NULL, PLTREE_TEXT, PLTREE_LONGTEXT,
......
...@@ -143,6 +143,7 @@ void playlist_Destroy( playlist_t *p_playlist ) ...@@ -143,6 +143,7 @@ void playlist_Destroy( playlist_t *p_playlist )
var_Destroy( p_playlist, "intf-popmenu" ); var_Destroy( p_playlist, "intf-popmenu" );
var_Destroy( p_playlist, "intf-show" ); var_Destroy( p_playlist, "intf-show" );
var_Destroy( p_playlist, "play-and-stop" ); var_Destroy( p_playlist, "play-and-stop" );
var_Destroy( p_playlist, "play-and-exit" );
var_Destroy( p_playlist, "random" ); var_Destroy( p_playlist, "random" );
var_Destroy( p_playlist, "repeat" ); var_Destroy( p_playlist, "repeat" );
var_Destroy( p_playlist, "loop" ); var_Destroy( p_playlist, "loop" );
...@@ -209,8 +210,7 @@ static mtime_t ObjectGarbageCollector( playlist_t *p_playlist, int i_type, ...@@ -209,8 +210,7 @@ static mtime_t ObjectGarbageCollector( playlist_t *p_playlist, int i_type,
void playlist_MainLoop( playlist_t *p_playlist ) void playlist_MainLoop( playlist_t *p_playlist )
{ {
playlist_item_t *p_item = NULL; playlist_item_t *p_item = NULL;
vlc_bool_t b_playexit = var_GetBool( p_playlist, "play-and-exit" );
PL_LOCK PL_LOCK
/* First, check if we have something to do */ /* First, check if we have something to do */
...@@ -321,6 +321,11 @@ void playlist_MainLoop( playlist_t *p_playlist ) ...@@ -321,6 +321,11 @@ void playlist_MainLoop( playlist_t *p_playlist )
if( p_item == NULL ) if( p_item == NULL )
{ {
msg_Dbg( p_playlist, "nothing to play" ); msg_Dbg( p_playlist, "nothing to play" );
if( b_playexit == VLC_TRUE )
{
msg_Info( p_playlist, "end of playlist, exiting" );
p_playlist->p_vlc->b_die = VLC_TRUE;
}
p_playlist->status.i_status = PLAYLIST_STOPPED; p_playlist->status.i_status = PLAYLIST_STOPPED;
PL_UNLOCK PL_UNLOCK
return; return;
...@@ -510,6 +515,7 @@ static void VariablesInit( playlist_t *p_playlist ) ...@@ -510,6 +515,7 @@ static void VariablesInit( playlist_t *p_playlist )
/* Variables to control playback */ /* Variables to control playback */
var_CreateGetBool( p_playlist, "play-and-stop" ); var_CreateGetBool( p_playlist, "play-and-stop" );
var_CreateGetBool( p_playlist, "play-and-exit" );
var_CreateGetBool( p_playlist, "random" ); var_CreateGetBool( p_playlist, "random" );
var_CreateGetBool( p_playlist, "repeat" ); var_CreateGetBool( p_playlist, "repeat" );
var_CreateGetBool( p_playlist, "loop" ); var_CreateGetBool( p_playlist, "loop" );
......
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