changeset 2127:63af5b9c5026 trunk

[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
author nenolod
date Fri, 15 Dec 2006 08:23:51 -0800
parents dba25b0e98c8
children a414866b32bc
files ChangeLog audacious/controlsocket.c audacious/controlsocket.h audacious/main.c audacious/playlist.c audacious/playlist.h libaudacious/beepctrl.c libaudacious/beepctrl.h
diffstat 8 files changed, 62 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 <nenolod@nenolod.net>
+  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 <nenolod@nenolod.net>
   revision [3255]
   - ip_data.stop shouldn't be handled here, but should be handled by the callee of playlist_clear().
--- 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);
--- 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
 };
 
 
--- 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);
 
--- 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 *
--- 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);
 
--- 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.
--- 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);