Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
1d245ed79d
16 changed files with 257 additions and 31 deletions
|
@ -941,6 +941,29 @@ Logging::log("getting media! - 2");
|
|||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/* Gets number of tracks uploaded to
|
||||
* Soundcloud in the last 24 hours
|
||||
*/
|
||||
public static function getSoundCloudUploads()
|
||||
{
|
||||
try {
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$sql = "SELECT soundcloud_id as id, soundcloud_upload_time"
|
||||
." FROM CC_FILES"
|
||||
." WHERE (id != -2 and id != -3) and"
|
||||
." (soundcloud_upload_time >= (now() - (INTERVAL '1 day')))";
|
||||
|
||||
$rows = $con->query($sql)->fetchAll();
|
||||
return count($rows);
|
||||
} catch (Exception $e) {
|
||||
header('HTTP/1.0 503 Service Unavailable');
|
||||
Logging::log("Could not connect to database.");
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function setSoundCloudLinkToFile($link_to_file)
|
||||
{
|
||||
|
@ -984,6 +1007,10 @@ Logging::log("getting media! - 2");
|
|||
$this->_file->setDbFileExists($flag)
|
||||
->save();
|
||||
}
|
||||
public function setSoundCloudUploadTime($time){
|
||||
$this->_file->setDbSoundCloundUploadTime($time)
|
||||
->save();
|
||||
}
|
||||
|
||||
public function getFileExistsFlag(){
|
||||
return $this->_file->getDbFileExists();
|
||||
|
@ -1009,6 +1036,7 @@ Logging::log("getting media! - 2");
|
|||
$soundcloud_res = $soundcloud->uploadTrack($this->getFilePath(), $this->getName(), $description, $tag, $release, $genre);
|
||||
$this->setSoundCloudFileId($soundcloud_res['id']);
|
||||
$this->setSoundCloudLinkToFile($soundcloud_res['permalink_url']);
|
||||
$this->setSoundCloudUploadTime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||
break;
|
||||
}
|
||||
catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue