Beispiel #1
0
 public function getCurrentlyPlayedTrack()
 {
     $status = $this->mpd('status');
     $listpos = isset($status['song']) ? $status['song'] : 0;
     $files = $this->mpd('playlist');
     $listlength = $status['playlistlength'];
     if ($listlength > 0) {
         $track = \Slimpd\Track::getInstanceByPath($files[$listpos]);
         // obviously the played track is not imported in slimpd-database...
         // TODO: trigger whole update procedure for this single track
         // for now we simply create a dummy instance
         if ($track === NULL) {
             $track = new \Slimpd\Track();
             $track->setRelativePath($files[$listpos]);
             $track->setRelativePathHash(getFilePathHash($files[$listpos]));
         }
         return $track;
     }
     return NULL;
 }