当前位置: 首页>>代码示例>>PHP>>正文


PHP Art::insert_url方法代码示例

本文整理汇总了PHP中Art::insert_url方法的典型用法代码示例。如果您正苦于以下问题:PHP Art::insert_url方法的具体用法?PHP Art::insert_url怎么用?PHP Art::insert_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Art的用法示例。


在下文中一共展示了Art::insert_url方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: insert

 /**
  * insert
  * Insert a new tv show episode and related entities.
  */
 public static function insert(array $data, $gtypes = array(), $options = array())
 {
     if (empty($data['tvshow'])) {
         $data['tvshow'] = T_('Unknown');
     }
     $tags = $data['genre'];
     $tvshow = TVShow::check($data['tvshow'], $data['year']);
     if ($options['gather_art'] && $tvshow && $data['tvshow_art'] && !Art::has_db($tvshow, 'tvshow')) {
         $art = new Art($tvshow, 'tvshow');
         $art->insert_url($data['tvshow_art']);
     }
     $tvshow_season = TVShow_Season::check($tvshow, $data['tvshow_season']);
     if ($options['gather_art'] && $tvshow_season && $data['tvshow_season_art'] && !Art::has_db($tvshow_season, 'tvshow_season')) {
         $art = new Art($tvshow_season, 'tvshow_season');
         $art->insert_url($data['tvshow_season_art']);
     }
     if (is_array($tags)) {
         foreach ($tags as $tag) {
             $tag = trim($tag);
             if (!empty($tag)) {
                 Tag::add('tvshow_season', $tvshow_season, $tag, false);
                 Tag::add('tvshow', $tvshow, $tag, false);
             }
         }
     }
     $sdata = $data;
     // Replace relation name with db ids
     $sdata['tvshow'] = $tvshow;
     $sdata['tvshow_season'] = $tvshow_season;
     return self::create($sdata);
 }
开发者ID:nioc,项目名称:ampache,代码行数:35,代码来源:tvshow_episode.class.php

示例2: create

 public static function create(array $data)
 {
     $feed = $data['feed'];
     // Feed must be http/https
     if (strpos($feed, "http://") !== 0 && strpos($feed, "https://") !== 0) {
         AmpError::add('feed', T_('Wrong feed url'));
     }
     $catalog_id = intval($data['catalog']);
     if ($catalog_id <= 0) {
         AmpError::add('catalog', T_('Target catalog required'));
     } else {
         $catalog = Catalog::create_from_id($catalog_id);
         if ($catalog->gather_types !== "podcast") {
             AmpError::add('catalog', T_('Wrong target catalog type'));
         }
     }
     if (AmpError::occurred()) {
         return false;
     }
     $title = T_('Unknown');
     $website = null;
     $description = null;
     $language = null;
     $copyright = null;
     $generator = null;
     $lastbuilddate = 0;
     $episodes = array();
     $arturl = '';
     $xmlstr = file_get_contents($feed);
     if ($xmlstr === false) {
         AmpError::add('feed', T_('Cannot access the feed.'));
     } else {
         $xml = simplexml_load_string($xmlstr);
         if ($xml === false) {
             AmpError::add('feed', T_('Cannot read the feed.'));
         } else {
             $title = html_entity_decode($xml->channel->title);
             $website = $xml->channel->link;
             $description = html_entity_decode($xml->channel->description);
             $language = $xml->channel->language;
             $copyright = html_entity_decode($xml->channel->copyright);
             $generator = html_entity_decode($xml->channel->generator);
             $lastbuilddatestr = $xml->channel->lastBuildDate;
             if ($lastbuilddatestr) {
                 $lastbuilddate = strtotime($lastbuilddatestr);
             }
             if ($xml->channel->image) {
                 $arturl = $xml->channel->image->url;
             }
             $episodes = $xml->channel->item;
         }
     }
     if (AmpError::occurred()) {
         return false;
     }
     $sql = "INSERT INTO `podcast` (`feed`, `catalog`, `title`, `website`, `description`, `language`, `copyright`, `generator`, `lastbuilddate`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
     $db_results = Dba::write($sql, array($feed, $catalog_id, $title, $website, $description, $language, $copyright, $generator, $lastbuilddate));
     if ($db_results) {
         $id = Dba::insert_id();
         $podcast = new Podcast($id);
         $dirpath = $podcast->get_root_path();
         if (!is_dir($dirpath)) {
             if (mkdir($dirpath) === false) {
                 debug_event('podcast', 'Cannot create directory ' . $dirpath, 1);
             }
         }
         if (!empty($arturl)) {
             $art = new Art($id, 'podcast');
             $art->insert_url($arturl);
         }
         if (count($episodes) > 0) {
             $podcast->add_episodes($episodes);
         }
     }
     return $db_results;
 }
开发者ID:bl00m,项目名称:ampache,代码行数:76,代码来源:podcast.class.php

示例3: insert_local_video

 /**
  * insert_local_video
  * This inserts a video file into the video file table the tag
  * information we can get is super sketchy so it's kind of a crap shoot
  * here
  */
 public function insert_local_video($file, $options = array())
 {
     /* Create the vainfo object and get info */
     $gtypes = $this->get_gather_types('video');
     $vainfo = new vainfo($file, $gtypes, '', '', '', $this->sort_pattern, $this->rename_pattern);
     $vainfo->get_info();
     $tag_name = vainfo::get_tag_type($vainfo->tags, 'metadata_order_video');
     $results = vainfo::clean_tag_info($vainfo->tags, $tag_name, $file);
     $results['catalog'] = $this->id;
     $id = Video::insert($results, $gtypes, $options);
     if ($results['art']) {
         $art = new Art($id, 'video');
         $art->insert_url($results['art']);
         if (AmpConfig::get('generate_video_preview')) {
             Video::generate_preview($id);
         }
     } else {
         $this->added_videos_to_gather[] = $id;
     }
     $this->_filecache[strtolower($file)] = 'v_' . $id;
     return $id;
 }
开发者ID:cheese1,项目名称:ampache,代码行数:28,代码来源:local.catalog.php

示例4: insert

 /**
  * Insert new video.
  * @param array $data
  * @param array $gtypes
  * @param array $options
  * @return int
  */
 public static function insert(array $data, $gtypes = array(), $options = array())
 {
     $bitrate = intval($data['bitrate']);
     $mode = $data['mode'];
     $rezx = intval($data['resolution_x']);
     $rezy = intval($data['resolution_y']);
     $release_date = intval($data['release_date']);
     // No release date, then release date = production year
     if (!$release_date && $data['year']) {
         $release_date = strtotime(strval($data['year']) . '-01-01');
     }
     $tags = $data['genre'];
     $channels = intval($data['channels']);
     $disx = intval($data['display_x']);
     $disy = intval($data['display_y']);
     $frame_rate = floatval($data['frame_rate']);
     $video_bitrate = intval($data['video_bitrate']);
     $sql = "INSERT INTO `video` (`file`,`catalog`,`title`,`video_codec`,`audio_codec`,`resolution_x`,`resolution_y`,`size`,`time`,`mime`,`release_date`,`addition_time`, `bitrate`, `mode`, `channels`, `display_x`, `display_y`, `frame_rate`, `video_bitrate`) " . " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
     $params = array($data['file'], $data['catalog'], $data['title'], $data['video_codec'], $data['audio_codec'], $rezx, $rezy, $data['size'], $data['time'], $data['mime'], $release_date, time(), $bitrate, $mode, $channels, $disx, $disy, $frame_rate, $video_bitrate);
     Dba::write($sql, $params);
     $vid = Dba::insert_id();
     if (is_array($tags)) {
         foreach ($tags as $tag) {
             $tag = trim($tag);
             if (!empty($tag)) {
                 Tag::add('video', $vid, $tag, false);
             }
         }
     }
     if ($data['art'] && $options['gather_art']) {
         $art = new Art($vid, 'video');
         $art->insert_url($data['art']);
     }
     $data['id'] = $vid;
     return self::insert_video_type($data, $gtypes, $options);
 }
开发者ID:ivan801,项目名称:ampache,代码行数:43,代码来源:video.class.php


注:本文中的Art::insert_url方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。