added button to generate smartblock and playlist for podcast
This commit is contained in:
parent
cb62cff277
commit
6cd5550721
|
@ -21,6 +21,17 @@ class Rest_Bootstrap extends Zend_Application_Module_Bootstrap
|
|||
);
|
||||
$router->addRoute('podcast-bulk', $podcastBulkRoute);
|
||||
|
||||
|
||||
$smartblockPodcastRoute = new Zend_Controller_Router_Route(
|
||||
'rest/podcast/smartblock',
|
||||
array(
|
||||
'controller' => 'podcast',
|
||||
'action' => 'smartblock',
|
||||
'module' => 'rest'
|
||||
)
|
||||
);
|
||||
$router->addRoute('podcast-smartblock', $smartblockPodcastRoute);
|
||||
|
||||
$stationPodcastRoute = new Zend_Controller_Router_Route(
|
||||
'rest/podcast/station',
|
||||
array(
|
||||
|
|
|
@ -191,6 +191,25 @@ class Rest_PodcastController extends Zend_Rest_Controller
|
|||
$this->_helper->json->sendJson($responseBody);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Endpoint for triggering the generation of a smartblock and playlist to match the podcast name
|
||||
*/
|
||||
|
||||
public function smartblockAction() {
|
||||
|
||||
$id = $this->_getParam('id', []);
|
||||
if (!$id) {
|
||||
return;
|
||||
}
|
||||
$podcast = Application_Service_PodcastService::getPodcastById($id);
|
||||
|
||||
logging::info($podcast);
|
||||
Application_Service_PodcastService::createPodcastSmartblockAndPlaylist($podcast);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @throws PodcastNotFoundException
|
||||
*
|
||||
|
|
|
@ -167,6 +167,12 @@ class Application_Service_PodcastService
|
|||
|
||||
public static function createPodcastSmartblockAndPlaylist($podcast)
|
||||
{
|
||||
if (is_array($podcast)) {
|
||||
$newpodcast = new Podcast();
|
||||
$newpodcast->fromArray($podcast, BasePeer::TYPE_FIELDNAME);
|
||||
$podcast = $newpodcast;
|
||||
}
|
||||
// Base class
|
||||
$newBl = new Application_Model_Block();
|
||||
$newBl->setCreator(Application_Model_User::getCurrentUser()->getId());
|
||||
$newBl->setName($podcast->getDbTitle());
|
||||
|
|
|
@ -25,6 +25,11 @@
|
|||
<label for="podcast_album_override"><input name="podcast_album_override" ng-model="podcast.album_override" type="checkbox" class="no-float"/></label>
|
||||
<span class="podcast-metadata-field"><?php echo _("Override album name with podcast name during ingest."); ?></span>
|
||||
</div>
|
||||
<div style="padding-top: 0.1em;">
|
||||
<button ng-click="createSmartblock()" class="btn" type="button" name="smartblock">
|
||||
<?php echo _("Generate Smartblock and Playlist for Podcast") ?>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -49,6 +49,14 @@ var AIRTIME = (function (AIRTIME) {
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Generate a smartblock and playlist for this smartblock.
|
||||
*/
|
||||
$scope.createSmartblock = function () {
|
||||
console.log($scope.podcast.id);
|
||||
$.post(endpoint + "smartblock", {csrf_token: $("#csrf").val(), id: $scope.podcast.id}, callback);
|
||||
|
||||
/**
|
||||
* Close the tab and discard any changes made to the podcast data.
|
||||
*/
|
||||
|
@ -64,6 +72,9 @@ var AIRTIME = (function (AIRTIME) {
|
|||
return self;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the controller.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue