public function updateFileItemAction()
 {
     $request = $this->getRequest();
     $params = $request->getPost();
     Logging::info($params);
     $historyService = new Application_Service_HistoryService();
     $json = $historyService->editPlayedFile($params);
     $this->_helper->json->sendJson($json);
 }
 public function notifyWebstreamDataAction()
 {
     $request = $this->getRequest();
     $data = $request->getParam("data");
     $media_id = intval($request->getParam("media_id"));
     $data_arr = json_decode($data);
     //$media_id is -1 sometimes when a stream has stopped playing
     if (!is_null($media_id) && $media_id > 0) {
         if (isset($data_arr->title)) {
             $data_title = substr($data_arr->title, 0, 1024);
             $previous_metadata = CcWebstreamMetadataQuery::create()->orderByDbStartTime('desc')->filterByDbInstanceId($media_id)->findOne();
             $do_insert = true;
             if ($previous_metadata) {
                 if ($previous_metadata->getDbLiquidsoapData() == $data_title) {
                     Logging::debug("Duplicate found: " . $data_title);
                     $do_insert = false;
                 }
             }
             if ($do_insert) {
                 $startDT = new DateTime("now", new DateTimeZone("UTC"));
                 $webstream_metadata = new CcWebstreamMetadata();
                 $webstream_metadata->setDbInstanceId($media_id);
                 $webstream_metadata->setDbStartTime($startDT);
                 $webstream_metadata->setDbLiquidsoapData($data_title);
                 $webstream_metadata->save();
                 $historyService = new Application_Service_HistoryService();
                 $historyService->insertWebstreamMetadata($media_id, $startDT, $data_arr);
             }
         }
     }
     $this->view->response = $data;
     $this->view->media_id = $media_id;
 }
 public function deleteTemplateAction()
 {
     $templateId = $this->_getParam('id');
     try {
         $historyService = new Application_Service_HistoryService();
         $historyService->deleteTemplate($templateId);
     } catch (Exception $e) {
         Logging::info($e);
         Logging::info($e->getMessage());
     }
 }