# HG changeset patch # User nenolod # Date 1166199831 28800 # Node ID 63af5b9c502615b469def7affe983e053843c895 # Parent dba25b0e98c8da4362e6c2d01d986db73e3eea04 [svn] - add playlist_select_playlist() to select a literal playlist - add xmms_remote_playlist_enqueue_to_temp() - add controlsocket handler for enqueue to temp - add commandline parsing for enqueue to temp diff -r dba25b0e98c8 -r 63af5b9c5026 ChangeLog --- a/ChangeLog Fri Dec 15 07:52:09 2006 -0800 +++ b/ChangeLog Fri Dec 15 08:23:51 2006 -0800 @@ -1,3 +1,11 @@ +2006-12-15 15:52:09 +0000 William Pitcock + revision [3257] + - use playlist_get_active() at the top of each thread. + + trunk/audacious/playlist.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + + 2006-12-15 15:40:18 +0000 William Pitcock revision [3255] - ip_data.stop shouldn't be handled here, but should be handled by the callee of playlist_clear(). diff -r dba25b0e98c8 -r 63af5b9c5026 audacious/controlsocket.c --- a/audacious/controlsocket.c Fri Dec 15 07:52:09 2006 -0800 +++ b/audacious/controlsocket.c Fri Dec 15 08:23:51 2006 -0800 @@ -502,6 +502,18 @@ } ctrl_ack_packet(pkt); break; + case CMD_PLAYLIST_ENQUEUE_TO_TEMP: + { + Playlist *new_pl = playlist_new(); + + GDK_THREADS_ENTER(); + playlist_select_playlist(new_pl); + playlist_add_url(new_pl, pkt->data); + GDK_THREADS_LEAVE(); + + ctrl_ack_packet(pkt); + } + break; case CMD_PLAYLIST_ADD_URL_STRING: GDK_THREADS_ENTER(); playlist_add_url(playlist_get_active(), pkt->data); diff -r dba25b0e98c8 -r 63af5b9c5026 audacious/controlsocket.h --- a/audacious/controlsocket.h Fri Dec 15 07:52:09 2006 -0800 +++ b/audacious/controlsocket.h Fri Dec 15 08:23:51 2006 -0800 @@ -49,7 +49,8 @@ CMD_TOGGLE_ADVANCE, CMD_IS_ADVANCE, CMD_ACTIVATE, CMD_SHOW_JTF_BOX, CMD_PLAYQUEUE_CLEAR, CMD_PLAYQUEUE_IS_QUEUED, - CMD_PLAYQUEUE_GET_POS, CMD_PLAYQUEUE_GET_QPOS + CMD_PLAYQUEUE_GET_POS, CMD_PLAYQUEUE_GET_QPOS, + CMD_PLAYLIST_ENQUEUE_TO_TEMP }; diff -r dba25b0e98c8 -r 63af5b9c5026 audacious/main.c --- a/audacious/main.c Fri Dec 15 07:52:09 2006 -0800 +++ b/audacious/main.c Fri Dec 15 08:23:51 2006 -0800 @@ -91,6 +91,7 @@ gboolean load_skins; gboolean headless; gboolean no_log; + gboolean enqueue_to_temp; gchar *previous_session_id; }; @@ -795,6 +796,7 @@ {"fwd", 0, NULL, 'f'}, {"show-jump-box", 0, NULL, 'j'}, {"enqueue", 0, NULL, 'e'}, + {"enqueue-to-temp", 0, NULL, 'E'}, {"show-main-window", 0, NULL, 'm'}, {"activate", 0, NULL, 'a'}, {"version", 0, NULL, 'v'}, @@ -811,7 +813,7 @@ memset(options, 0, sizeof(BmpCmdLineOpt)); options->session = -1; - while ((c = getopt_long(argc, argv, "chn:HrpusfemavtLSj", long_options, + while ((c = getopt_long(argc, argv, "chn:HrpusfemavtLSjE", long_options, NULL)) != -1) { switch (c) { case 'h': @@ -850,6 +852,9 @@ case 'a': options->activate = TRUE; break; + case 'E': + options->enqueue_to_temp = TRUE; + break; case 'e': options->enqueue = TRUE; break; @@ -910,6 +915,9 @@ skin_install_skin(filenames->data); } else { + if (options->enqueue_to_temp) + xmms_remote_playlist_enqueue_to_temp(session, filenames->data); + if (options->enqueue && options->play) pos = xmms_remote_get_playlist_length(session); diff -r dba25b0e98c8 -r 63af5b9c5026 audacious/playlist.c --- a/audacious/playlist.c Fri Dec 15 07:52:09 2006 -0800 +++ b/audacious/playlist.c Fri Dec 15 08:23:51 2006 -0800 @@ -275,6 +275,20 @@ playlistwin_update_list(); } +void +playlist_select_playlist(Playlist *playlist) +{ + if (playlists_iter == NULL) + playlists_iter = playlists; + + playlists_iter = g_list_find(playlists, playlist); + + if (playlists_iter == NULL) + playlists_iter = playlists; + + playlistwin_update_list(); +} + /* *********************** playlist code ********************** */ const gchar * diff -r dba25b0e98c8 -r 63af5b9c5026 audacious/playlist.h --- a/audacious/playlist.h Fri Dec 15 07:52:09 2006 -0800 +++ b/audacious/playlist.h Fri Dec 15 08:23:51 2006 -0800 @@ -97,6 +97,8 @@ void playlist_init(void); void playlist_add_playlist(Playlist *); void playlist_remove_playlist(Playlist *); + +void playlist_select_playlist(Playlist *); void playlist_select_next(void); void playlist_select_prev(void); diff -r dba25b0e98c8 -r 63af5b9c5026 libaudacious/beepctrl.c --- a/libaudacious/beepctrl.c Fri Dec 15 07:52:09 2006 -0800 +++ b/libaudacious/beepctrl.c Fri Dec 15 08:23:51 2006 -0800 @@ -1250,6 +1250,20 @@ } /** + * xmms_remote_playlist_enqueue_to_temp: + * @session: Legacy XMMS-style session identifier. + * @string: The URI to enqueue to a temporary playlist. + * + * Tells audacious to add an URI to a temporary playlist. + **/ +void +xmms_remote_playlist_enqueue_to_temp(gint session, gchar * string) +{ + g_return_if_fail(string != NULL); + remote_send_string(session, CMD_PLAYLIST_ENQUEUE_TO_TEMP, string); +} + +/** * xmms_remote_playlist_ins_url_string: * @session: Legacy XMMS-style session identifier. * @string: The URI to add. diff -r dba25b0e98c8 -r 63af5b9c5026 libaudacious/beepctrl.h --- a/libaudacious/beepctrl.h Fri Dec 15 07:52:09 2006 -0800 +++ b/libaudacious/beepctrl.h Fri Dec 15 08:23:51 2006 -0800 @@ -75,6 +75,7 @@ void xmms_remote_playlist_prev(gint session); void xmms_remote_playlist_next(gint session); void xmms_remote_playlist_add_url_string(gint session, gchar * string); + void xmms_remote_playlist_enqueue_to_temp(gint session, gchar * string); gboolean xmms_remote_is_running(gint session); void xmms_remote_toggle_repeat(gint session); void xmms_remote_toggle_shuffle(gint session);