Fix bug in podcast download
This commit is contained in:
parent
5eaf74bbd9
commit
eff7cd2f07
|
@ -329,8 +329,6 @@ class BandwidthLimitTask implements AirtimeTask {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the task
|
* Run the task
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function run() {
|
public function run() {
|
||||||
Application_Model_Preference::resetStationPodcastDownloadCounter();
|
Application_Model_Preference::resetStationPodcastDownloadCounter();
|
||||||
|
@ -362,27 +360,21 @@ class TaskFactory {
|
||||||
*
|
*
|
||||||
* @return array all classes implementing the AirtimeTask interface
|
* @return array all classes implementing the AirtimeTask interface
|
||||||
*/
|
*/
|
||||||
private static function _getTaskClasses() {
|
public static function getTasks() {
|
||||||
return array_filter(get_declared_classes(), array(__CLASS__, "_isTask"));
|
return array_filter(get_declared_classes(), array(__CLASS__, "_isTask"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* Get an AirtimeTask based on class name
|
||||||
*/
|
|
||||||
public static function getTasks() {
|
|
||||||
return self::_getTaskClasses();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an AirtimeTask based on a task type
|
|
||||||
*
|
*
|
||||||
* @param $task string the task type; uses AirtimeTask constants as an ENUM
|
* @param $task string name of the class implementing AirtimeTask to construct
|
||||||
*
|
*
|
||||||
* @return AirtimeTask|null return a task of the given type or null if no corresponding
|
* @return AirtimeTask|null return a task of the given type or null if no corresponding task exists
|
||||||
* task exists or is implemented
|
|
||||||
*/
|
*/
|
||||||
public static function getTask($task) {
|
public static function getTask($task) {
|
||||||
return new $task();
|
// Try to get a valid class name from the given string
|
||||||
|
if (!class_exists($task)) $task = str_replace(' ', '', ucwords($task)) . "Task";
|
||||||
|
return class_exists($task) ? new $task() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
'callback_url' => $stationUrl . 'rest/media',
|
'callback_url' => $stationUrl . 'rest/media',
|
||||||
'api_key' => $apiKey = $CC_CONFIG["apiKey"][0],
|
'api_key' => $CC_CONFIG["apiKey"][0],
|
||||||
);
|
);
|
||||||
$task = $this->_executeTask(static::$_CELERY_TASKS[self::DOWNLOAD], $data);
|
$task = $this->_executeTask(static::$_CELERY_TASKS[self::DOWNLOAD], $data);
|
||||||
// Get the created ThirdPartyTaskReference and set the episode ID so
|
// Get the created ThirdPartyTaskReference and set the episode ID so
|
||||||
|
@ -251,7 +251,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
|
||||||
public static function getStuckPendingImports() {
|
public static function getStuckPendingImports() {
|
||||||
$timeout = gmdate(DEFAULT_TIMESTAMP_FORMAT, (microtime(true) - self::PENDING_EPISODE_TIMEOUT_SECONDS));
|
$timeout = gmdate(DEFAULT_TIMESTAMP_FORMAT, (microtime(true) - self::PENDING_EPISODE_TIMEOUT_SECONDS));
|
||||||
$episodes = PodcastEpisodesQuery::create()
|
$episodes = PodcastEpisodesQuery::create()
|
||||||
->filterByDbFileId(null, Criteria::ISNULL)
|
->filterByDbFileId()
|
||||||
->find();
|
->find();
|
||||||
$stuckImports = array();
|
$stuckImports = array();
|
||||||
foreach ($episodes as $episode) {
|
foreach ($episodes as $episode) {
|
||||||
|
|
Loading…
Reference in New Issue