SSLTrack::getLength PHP Method

getLength() public method

Pass SSLTrack::TRY_HARD if you would like the file length to be guessed from the file itself, if possible, and don't mind that this is possibly an expensive operation.
public getLength ( $flags )
$flags
    public function getLength($flags = 0)
    {
        if ($flags & self::TRY_HARD) {
            $this->setLengthIfUnknown();
        }
        return $this->length;
    }

Usage Example

    public function notifyNowPlaying(SSLTrack $track = null)
    {
        $nicecastOutput = <<<EOF
Title: {$track->getTitle()}
Artist: {$track->getArtist()}
Album: {$track->getAlbum()}
Time: {$track->getLength()}
EOF;
        file_put_contents($this->getFilename(), $nicecastOutput);
    }