CC-2129 : Retry automatic upload to Soundcloud if Internet connection problem

static retries/wait time right now.
This commit is contained in:
Naomi 2011-03-29 19:36:36 -04:00
parent fe97a25e28
commit a9d288385b
2 changed files with 24 additions and 20 deletions

View File

@ -268,11 +268,25 @@ class ApiController extends Zend_Controller_Action
if(Application_Model_Preference::GetDoSoundCloudUpload()) if(Application_Model_Preference::GetDoSoundCloudUpload())
{ {
$show = new Show($show_inst->getShowId()); for($i=0; $i<3; $i++) {
$description = $show->getDescription();
$soundcloud = new ATSoundcloud(); $show = new Show($show_inst->getShowId());
$soundcloud->uploadTrack($file->getRealFilePath(), $file->getName(), $description); $description = $show->getDescription();
try {
$soundcloud = new ATSoundcloud();
$soundcloud->uploadTrack($file->getRealFilePath(), $file->getName(), $description);
break;
}
catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
$code = $e->getHttpCode();
if($code != 0) {
break;
}
}
sleep(60);
}
} }
$this->view->id = $file->getId(); $this->view->id = $file->getId();

View File

@ -48,22 +48,12 @@ class ATSoundcloud {
'track[description]' => $description 'track[description]' => $description
); );
try {
$response = json_decode( $response = json_decode(
$this->_soundcloud->post('tracks', $track_data), $this->_soundcloud->post('tracks', $track_data),
true true
); );
}
echo var_dump($response);
}
catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
echo $e->getMessage();
}
}
else
{
echo "could not get soundcloud token";
}
} }
} }