protected function _parseMedia($type, $url, $refresh)
 {
     $urlHash = md5($type . '|' . $url);
     $mediaParseExisting = $this->getMediaParseDao()->findMediaParseByHash($urlHash);
     if ($mediaParseExisting && !$refresh) {
         return json_decode($mediaParseExisting['media'], true);
     }
     $proxy = new ParserProxy();
     if ($type == 'album') {
         $media = $proxy->parseAlbum($url);
     } else {
         $media = $proxy->parseItem($url);
     }
     if ($mediaParseExisting) {
         $mediaParse = array('uuid' => $media['uuid'], 'media' => json_encode($media), 'updatedTime' => time());
         $this->getMediaParseDao()->updateMediaParse($mediaParseExisting['id'], $mediaParse);
     } else {
         $mediaParseExisting = $this->getMediaParseDao()->findMediaParseByUuid($media['uuid']);
         if ($mediaParseExisting) {
             $mediaParse = array('hash' => md5($media['url']), 'media' => json_encode($media), 'updatedTime' => time());
             $this->getMediaParseDao()->updateMediaParse($mediaParseExisting['id'], $mediaParse);
         } else {
             $mediaParse = array('uuid' => $media['uuid'], 'hash' => $urlHash, 'media' => json_encode($media), 'createdTime' => time(), 'updatedTime' => time());
             $this->getMediaParseDao()->addMediaParse($mediaParse);
         }
     }
     return $media;
 }
 public function importAction(Request $request, $id)
 {
     $url = $request->query->get('url');
     $proxy = new ParserProxy();
     $item = $proxy->parseItem($url);
     return $this->createJsonResponse($item);
 }