tunein testing
This commit is contained in:
parent
4451c49c06
commit
c3457ae03f
2 changed files with 18 additions and 4 deletions
|
@ -25,4 +25,6 @@ class Application_Common_TuneIn
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function updateOfflineMetadata()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,11 +50,23 @@ class Application_Form_TuneInPreferences extends Zend_Form_SubForm
|
||||||
// from the station on TuneIn. After that, and if the test request
|
// from the station on TuneIn. After that, and if the test request
|
||||||
// succeeds, we will make another request with the real metadata.
|
// succeeds, we will make another request with the real metadata.
|
||||||
if ($data["enable_tunein"]) {
|
if ($data["enable_tunein"]) {
|
||||||
$qry_str = "?partnerId=".$data["tunein_partner_id"]."&partnerKey=".$data["tunein_partner_key"]."&id=".$data["tunein_station_id"];
|
$credentialsQryStr = "?partnerId=".$data["tunein_partner_id"]."&partnerKey=".$data["tunein_partner_key"]."&id=".$data["tunein_station_id"];
|
||||||
$commercialFlagQryStr = "&commercial=true";
|
$commercialFlagQryStr = "&commercial=true";
|
||||||
|
|
||||||
|
$metadata = Application_Model_Schedule::getCurrentPlayingTrack();
|
||||||
|
|
||||||
|
if (is_null($metadata)) {
|
||||||
|
$qryStr = $credentialsQryStr . $commercialFlagQryStr;
|
||||||
|
} else {
|
||||||
|
$metadata["artist"] = empty($metadata["artist"]) ? "n/a" : $metadata["artist"];
|
||||||
|
$metadata["title"] = empty($metadata["title"]) ? "n/a" : $metadata["title"];
|
||||||
|
$metadataQryStr = "&artist=" . $metadata["artist"] . "&title=" . $metadata["title"];
|
||||||
|
|
||||||
|
$qryStr = $credentialsQryStr . $metadataQryStr;
|
||||||
|
}
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, TUNEIN_API_URL . $qry_str . $commercialFlagQryStr);
|
curl_setopt($ch, CURLOPT_URL, TUNEIN_API_URL . $qryStr);
|
||||||
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
|
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||||
|
@ -80,7 +92,7 @@ class Application_Form_TuneInPreferences extends Zend_Form_SubForm
|
||||||
// Make another request to TuneIn to update the metadata right away
|
// Make another request to TuneIn to update the metadata right away
|
||||||
// and to turn off the commercial flag.
|
// and to turn off the commercial flag.
|
||||||
|
|
||||||
$metadata = Application_Model_Schedule::getCurrentPlayingTrack();
|
/*$metadata = Application_Model_Schedule::getCurrentPlayingTrack();
|
||||||
|
|
||||||
if (!is_null($metadata)) {
|
if (!is_null($metadata)) {
|
||||||
|
|
||||||
|
@ -110,7 +122,7 @@ class Application_Form_TuneInPreferences extends Zend_Form_SubForm
|
||||||
if (!$xmlObj || $xmlObj->head->status != "200") {
|
if (!$xmlObj || $xmlObj->head->status != "200") {
|
||||||
Logging::error("Failed updating metadata on TuneIn");
|
Logging::error("Failed updating metadata on TuneIn");
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue