public function DVRUI_HDHRjson() { $storageURL = "??"; $myip = getHostByName(getHostName()); $hdhr_data = getJsonFromUrl($this->myhdhrurl); for ($i = 0; $i < count($hdhr_data); $i++) { $hdhr = $hdhr_data[$i]; $hdhr_base = $hdhr[$this->hdhrkey_baseURL]; $hdhr_ip = $hdhr[$this->hdhrkey_localIP]; if (!array_key_exists($this->hdhrkey_discoverURL, $hdhr)) { // Skip this HDHR - it doesn't support the newer HTTP interface // for DVR continue; } $hdhr_info = getJsonFromUrl($hdhr[$this->hdhrkey_discoverURL]); if (array_key_exists($this->hdhrkey_storageURL, $hdhr)) { // this is a record engine! // Need to confirm it's a valid one - After restart of // engine it updates my.hdhomerun.com but sometimes the // old engine config is left behind. $rEngine = getJsonFromUrl($hdhr[$this->hdhrkey_discoverURL]); if (strcmp($rEngine[$this->hdhrkey_storageID], $hdhr[$this->hdhrkey_storageID]) != 0) { //skip, this is not a valid engine continue; } //get the IP address of record engine. $hdhr_ip = $hdhr[$this->hdhrkey_localIP]; // Split IP and port if (preg_match('/^(\\d[\\d.]+):(\\d+)\\b/', $hdhr_ip, $matches)) { $ip = $matches[1]; $port = $matches[2]; // if IP of record engine matches the IP of this server // return storageURL if ($ip == $myip) { $this->storageURL = $hdhr[$this->hdhrkey_storageURL]; continue; } } } // ELSE we have a tuner $tuners = 'unknown'; if (array_key_exists($this->hdhrkey_tuners, $hdhr_info)) { $tuners = $hdhr_info[$this->hdhrkey_tuners]; } $legacy = 'No'; if (array_key_exists($this->hdhrkey_legacy, $hdhr_info)) { $legacy = $hdhr_info[$this->hdhrkey_legacy]; } $hdhr_lineup = getJsonFromUrl($hdhr_info[$this->hdhrkey_lineupURL]); $this->hdhrlist[] = array($this->hdhrkey_devID => $hdhr[$this->hdhrkey_devID], $this->hdhrkey_modelNum => $hdhr_info[$this->hdhrkey_modelNum], $this->hdhrlist_key_channelcount => count($hdhr_lineup), $this->hdhrkey_baseURL => $hdhr_base, $this->hdhrkey_lineupURL => $hdhr_info[$this->hdhrkey_lineupURL], $this->hdhrkey_modelName => $hdhr_info[$this->hdhrkey_modelName], $this->hdhrkey_auth => $hdhr_info[$this->hdhrkey_auth], $this->hdhrkey_fwVer => $hdhr_info[$this->hdhrkey_fwVer], $this->hdhrkey_tuners => $tuners, $this->hdhrkey_legacy => $legacy, $this->hdhrkey_fwName => $hdhr_info[$this->hdhrkey_fwName]); } }
public function deleteRecording($id, $rerecord) { $url = $this->getCmdFromID($id); if ($rerecord == 'true') { $url .= $this->recording_cmd_rerecord; } else { $url .= $this->recording_cmd_delete; } $response = getJsonFromUrl($url); $this->removeID($id); /* ignore the response at this tie */ echo 'Removed ' . $id . ' : ' . $response; }