Hello there,
I have a class (didn't want to paste in the whole class, so I just put
in the relevant part) it works fine except for one problem.
The function that I have here has a minor problem, it doesn't parse out
all the data correctly, the Current file doesn't come up all the time.
It is becoming a problem now that it is manifesting itself. I had this
script running a lot but I had to remove it from the production server
because of the problems that it caused. Could someone please shed some
light on this for me?

Class parseme(){
                $this->debug = debug;
                $this->fp = Fopen($file,"r");
        function getinformation($string){
                print "entering while loop!\n";
            while (trim($string) != "+OK"){
                if($string == "+OK"){
                        print trim("String is '$string'");
                $string = fgets($this->fp,200);
                    print "String  is *". trim($string)."*\n";
                    print "substr(\$string,0,1) = *".
substr($string,0,1) ."*\n";
                if($i == 4){
                    if(substr($string,0,1) == "M"){
                        $this->status = trim(substr($string,10));
                            print trim("Got Status of
*{$this->status}*") ."\n";
                    if(trim(substr($string,0,1)) == "C"){ // <-- This
line is where I have problems
                            print "Trackname detected....\n";
                        $this->TrackName =
                    if(substr($string,0,1) == "S"){
                        // test of explode and such//
                        list($junk, $this->samplerate) = explode(":
                        list($junk, $this->bitrate) = explode(":
                        list($junk, $this->channels) = explode(":
                            print "Samplerate : $this->samplerate\n";
                            print "Bitrate : $this->bitrate\n";
                            print "Channels : $this->channels\n";
$some = new parseme("status.txt",true);
// status.txt contents
System status:
Shuffle: Disabled
Repeat: Enabled
Music is: PLAYING

Current song: 01. DJ Encore - I See Right Through To You
Samplerate: 44kHz, Bitrate: 160kbps, Channels: 2

// end file contents
// output of the script running
entering while loop!
String  is *Shuffle: Disabled*
substr($string,0,1) = *S*
Samplerate : Disabled

Bitrate : 
Channels : 
String  is *Repeat: Enabled*
substr($string,0,1) = *R*
String  is *Music is: PAUSED*
substr($string,0,1) = *M*
Got Status of *PAUSED*
String  is **
substr($string,0,1) = *
String  is *Current song: 01. DJ Encore - I See Right Through To You*
substr($string,0,1) = *C*
String  is *Samplerate: 44kHz, Bitrate: 160kbps, Channels: 2*
substr($string,0,1) = *S*
Samplerate : 44kHz
Bitrate : 160kbps
Channels : 2

String  is **
substr($string,0,1) = *
String  is *+OK*
substr($string,0,1) = *+*

If I wasn't good at explaining myself please tell me.

Thank You,

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to