SAAS-772: Send metadata to Tunein
Made Improvement so Airtime always makes a request to TuneIn every 4 minutes so TuneIn does not turn metadata off
This commit is contained in:
parent
fc02de4920
commit
532bd1ea85
7 changed files with 59 additions and 26 deletions
|
@ -17,12 +17,20 @@ class Application_Common_TuneIn
|
|||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
|
||||
curl_exec($ch);
|
||||
$xmlResponse = curl_exec($ch);
|
||||
if (curl_error($ch)) {
|
||||
Logging::error("Failed to reach TuneIn: ". curl_errno($ch)." - ". curl_error($ch) . " - " . curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));
|
||||
}
|
||||
curl_close($ch);
|
||||
|
||||
$xmlObj = new SimpleXMLElement($xmlResponse);
|
||||
if (!$xmlObj || $xmlObj->head->status != "200") {
|
||||
Logging::info("Error occurred pushing metadata to TuneIn:");
|
||||
Logging::info($xmlResponse);
|
||||
} else if ($xmlObj->head->status == "200") {
|
||||
Application_Model_Preference::setLastTuneinMetadataUpdate(time());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static function getCredentialsQueryString() {
|
||||
|
@ -33,20 +41,4 @@ class Application_Common_TuneIn
|
|||
return "?partnerId=".$tuneInPartnerID."&partnerKey=".$tuneInPartnerKey."&id=".$tuneInStationID;
|
||||
}
|
||||
|
||||
public static function updateOfflineMetadata() {
|
||||
$credQryStr = self::getCredentialsQueryString();
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, TUNEIN_API_URL . $credQryStr . "&commercial=true");
|
||||
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
|
||||
curl_exec($ch);
|
||||
if (curl_error($ch)) {
|
||||
Logging::error("Failed to reach TuneIn: ". curl_errno($ch)." - ". curl_error($ch) . " - " . curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));
|
||||
}
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue