public static function getNowPlaying(Module_Slaytags $module) { # Only once on fresh install! if (false === ($stid = GWF_Settings::getSetting(self::NP_KEY, false))) { return self::querySlay($module); } # Live show? if ($stid === '0') { if (self::timedOut()) { echo "Timed out<br/>\n"; return self::querySlay($module); } else { return self::dummySong($module, self::LIVE_ERROR, self::getTimeLeft()); } } # DB Error should not happen if (false === ($np = Slay_Song::getByID($stid))) { return self::querySlay($module); # Simply query again } if (self::timedOut()) { Slay_PlayHistory::insertPlayed($np, self::getEndTime()); return self::querySlay($module); } return $np; }
private function templateMain() { $left = Slay_PNow::getTimeLeft(); $now = Slay_PNow::getNowPlaying($this->module); // var_dump($left); GWF_Website::addJavascriptOnload("slayInitRedirect(" . max($left + 2, 5) . ");"); $tVars = array('href_history' => $this->module->getMethodURL('History', '&page=' . Slay_PlayHistory::getNumPages()), 'history' => Slay_PlayHistory::getLastPlayed(1), 'now' => $now, 'left' => $left); return $this->module->template('main.tpl', $tVars); }