From 4f08d69b0c7a4ed247e3c1b52af905f770626f3f Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Wed, 1 Oct 2008 22:44:59 +1300 Subject: [PATCH] Mostly working now - as long as I use hacked xmms2 --- inc/xmms2Player.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/inc/xmms2Player.php b/inc/xmms2Player.php index 943aaf9..6149e5f 100644 --- a/inc/xmms2Player.php +++ b/inc/xmms2Player.php @@ -1,5 +1,7 @@ daemon_type ); class xmms2Connection { var $active; // Once it actually is... @@ -49,6 +51,8 @@ class xmms2Connection { list( $key, $value ) = preg_split( '/ = /', $v, 2); $this->status[$key] = $value; } + $status = $this->Daemon( "state" ); + $this->status['state'] = $status[0]; } @@ -61,7 +65,12 @@ class xmms2Connection { $this->UpdateStatus(); $this->Daemon("add $track"); - $this->Daemon("play"); + if ( $this->status['state'] == 'Stopped' ) { + $this->Daemon("next"); + $this->Daemon("play"); + } + else + $this->Daemon("play"); } @@ -76,6 +85,7 @@ class xmms2Connection { $songnow->started = date( 'Y-m-d H:i:s', $this->status['[server] laststarted'] ); $songnow->track = str_replace( 'file://', '', $this->status['[server] url'] ); + return $songnow; } /** @@ -93,13 +103,17 @@ class xmms2Connection { $playlist = $this->Daemon( "list" ); foreach( $playlist AS $k => $v ) { - if ( substr( $v, 0, 2) == '->' ) $pos = 0; if ( $pos >= 0 ) { $filename = preg_replace( '#^( |->)\[\d+/\d+\] #', '', $v ); - $filename = preg_replace( '#^file://#', '', $filename ); - $filename = urldecode( $filename ); - $this->queue[$pos++] = $filename; + if ( substr($filename,0,7) == 'file://' ) { + $filename = substr( $filename, 7 ); + $filename = urldecode( $filename ); + $this->queue[$pos++] = $filename; + } + } + else if ( $pos < 0 && substr( $v, 0, 2) == '->' ) { + $pos = 0; } } -- 2.11.4.GIT