]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - playlist_selector.c
new codename, reset version to git
[paraslash.git] / playlist_selector.c
index 8d1d45165983b494ab4db26acd91ccf05c99c943..632e2a2a972c6aa386ff0a67417f554a62354bac 100644 (file)
@@ -1,25 +1,13 @@
 /*
  * Copyright (C) 2006-2007 Andre Noll <maan@systemlinux.org>
  *
- *     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
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
- *
- *     This program is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- *     You should have received a copy of the GNU General Public License
- *     along with this program; if not, write to the Free Software
- *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Licensed under the GPL v2. For licencing details see COPYING.
  */
 
 /** \file playlist_selector.c The playlist audio file selector of paraslash  */
 
 #include "server.h"
-#include "db.h"
+#include "afs_common.h"
 #include "error.h"
 #include "net.h"
 #include "string.h"
@@ -154,7 +142,7 @@ int com_ppl(int fd, __a_unused int argc, __a_unused char *argv[])
        unsigned i;
 
        PARA_DEBUG_LOG("sending playlist to client (%d entries)\n", playlist_len);
-       for (i = 0; i < playlist_len; i++) {
+       for (i = 1; i <= playlist_len; i++) {
                int ret = send_va_buffer(fd, "%s\n", playlist[
                        (i + current_playlist_entry) % playlist_len]);
                if (ret < 0)
@@ -229,6 +217,7 @@ static void pls_post_select(__a_unused fd_set *rfds, __a_unused fd_set *wfds)
        PARA_NOTICE_LOG("new playlist (%d entries)\n", playlist_len);
        sprintf(mmd->selector_info, "dbinfo1:new playlist: %d files\n"
                "dbinfo2:\ndbinfo3:\n", playlist_len);
+       current_playlist_entry = playlist_len - 1;
        pcd->retval = 1;
        pcd->size = 0;
        mutex_unlock(pcd->mutex);