本文整理汇总了PHP中Video::create_from_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Video::create_from_id方法的具体用法?PHP Video::create_from_id怎么用?PHP Video::create_from_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Video
的用法示例。
在下文中一共展示了Video::create_from_id方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strtolower
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
if (!isset($video_type)) {
$libitem = Video::create_from_id($libitem->id);
$libitem->format();
$video_type = strtolower(get_class($libitem));
}
?>
<td class="cel_play">
<span class="cel_play_content"> </span>
<div class="cel_play_hover">
<?php
if (AmpConfig::get('directplay')) {
?>
<?php
echo Ajax::button('?page=stream&action=directplay&object_type=video&object_id=' . $libitem->id, 'play', T_('Play'), 'play_video_' . $libitem->id);
?>
<?php
if (Stream_Playlist::check_autoplay_append()) {
示例2: gather_art_item
/**
*
* @param string $type
* @param int $id
*/
public function gather_art_item($type, $id)
{
debug_event('gather_art', 'Gathering art for ' . $type . '/' . $id . '...', 5);
// Should be more generic !
if ($type == 'video') {
$libitem = Video::create_from_id($id);
} else {
$libitem = new $type($id);
}
$options = array();
$libitem->format();
if ($libitem->id) {
if (count($options) == 0) {
// Only search on items with default art kind as `default`.
if ($libitem->get_default_art_kind() == 'default') {
$keywords = $libitem->get_keywords();
$keyword = '';
foreach ($keywords as $key => $word) {
$options[$key] = $word['value'];
if ($word['important']) {
if (!empty($word['value'])) {
$keyword .= ' ' . $word['value'];
}
}
}
$options['keyword'] = $keyword;
}
$parent = $libitem->get_parent();
if ($parent != null) {
if (!Art::has_db($parent['object_id'], $parent['object_type'])) {
$this->gather_art_item($parent['object_type'], $parent['object_id']);
}
}
}
}
$art = new Art($id, $type);
$results = $art->gather($options, 1);
if (count($results)) {
// Pull the string representation from the source
$image = Art::get_from_source($results[0], $type);
if (strlen($image) > '5') {
$art->insert($image, $results[0]['mime']);
// If they've enabled resizing of images generate a thumbnail
if (AmpConfig::get('resize_images')) {
$size = array('width' => 275, 'height' => 275);
$thumb = $art->generate_thumb($image, $size, $results[0]['mime']);
if (is_array($thumb)) {
$art->save_thumb($thumb['thumb'], $thumb['thumb_mime'], $size);
}
}
} else {
debug_event('gather_art', 'Image less than 5 chars, not inserting', 3);
}
}
if ($type == 'video' && AmpConfig::get('generate_video_preview')) {
Video::generate_preview($id);
}
if (UI::check_ticker()) {
UI::update_text('read_art_' . $this->id, $libitem->get_fullname());
}
}
示例3: library_metadata
public static function library_metadata($params)
{
$r = Plex_XML_Data::createLibContainer();
$n = count($params);
$litem = null;
$createMode = $_SERVER['REQUEST_METHOD'] == 'POST';
$editMode = $_SERVER['REQUEST_METHOD'] == 'PUT';
if ($n > 0) {
$key = $params[0];
$id = Plex_XML_Data::getAmpacheId($key);
if ($editMode) {
self::check_access(50);
}
if ($n == 1) {
// Should we check that files still exists here?
$checkFiles = $_REQUEST['checkFiles'];
$extra = $_REQUEST['includeExtra'];
if (Plex_XML_Data::isArtist($key)) {
$litem = new Artist($id);
$litem->format();
if ($editMode) {
$dmap = array('title' => 'name', 'summary' => null);
$litem->update(self::get_data_from_map($dmap));
}
Plex_XML_Data::addArtist($r, $litem);
} elseif (Plex_XML_Data::isAlbum($key)) {
$litem = new Album($id);
$litem->format();
if ($editMode) {
$dmap = array('title' => 'name', 'year' => null);
$litem->update(self::get_data_from_map($dmap));
}
Plex_XML_Data::addAlbum($r, $litem);
} elseif (Plex_XML_Data::isTrack($key)) {
$litem = new Song($id);
$litem->format();
if ($editMode) {
$dmap = array('title' => null);
$litem->update(self::get_data_from_map($dmap));
}
Plex_XML_Data::addSong($r, $litem);
} elseif (Plex_XML_Data::isTVShow($key)) {
$litem = new TVShow($id);
$litem->format();
if ($editMode) {
$dmap = array('title' => 'name', 'year' => null, 'summary' => null);
$litem->update(self::get_data_from_map($dmap));
}
Plex_XML_Data::addTVShow($r, $litem);
} elseif (Plex_XML_Data::isTVShowSeason($key)) {
$litem = new TVShow_Season($id);
$litem->format();
Plex_XML_Data::addTVShowSeason($r, $litem);
} elseif (Plex_XML_Data::isVideo($key)) {
$litem = Video::create_from_id($id);
if ($editMode) {
$dmap = array('title' => null, 'year' => null, 'originallyAvailableAt' => 'release_date', 'originalTitle' => 'original_name', 'summary' => null);
$litem->update(self::get_data_from_map($dmap));
}
$litem->format();
$subtype = strtolower(get_class($litem));
if ($subtype == 'tvshow_episode') {
Plex_XML_Data::addEpisode($r, $litem, true);
} elseif ($subtype == 'movie') {
Plex_XML_Data::addMovie($r, $litem, true);
}
} elseif (Plex_XML_Data::isPlaylist($key)) {
$litem = new Playlist($id);
$litem->format();
if ($editMode) {
$dmap = array('title' => 'name');
$litem->update(self::get_data_from_map($dmap));
}
Plex_XML_Data::addPlaylist($r, $litem);
}
} else {
$subact = $params[1];
if ($subact == "children") {
if (Plex_XML_Data::isArtist($key)) {
$litem = new Artist($id);
$litem->format();
Plex_XML_Data::setArtistRoot($r, $litem);
} else {
if (Plex_XML_Data::isAlbum($key)) {
$litem = new Album($id);
$litem->format();
Plex_XML_Data::setAlbumRoot($r, $litem);
} else {
if (Plex_XML_Data::isTVShow($key)) {
$litem = new TVShow($id);
$litem->format();
Plex_XML_Data::setTVShowRoot($r, $litem);
} else {
if (Plex_XML_Data::isTVShowSeason($key)) {
$litem = new TVShow_Season($id);
$litem->format();
Plex_XML_Data::setTVShowSeasonRoot($r, $litem);
}
}
}
//.........这里部分代码省略.........
示例4: remove_from_disk
public function remove_from_disk()
{
$deleted = true;
$video_ids = $this->get_episodes();
foreach ($video_ids as $id) {
$video = Video::create_from_id($id);
$deleted = $video->remove_from_disk();
if (!$deleted) {
debug_event('tvshow_season', 'Error when deleting the video `' . $id . '`.', 1);
break;
}
}
if ($deleted) {
$sql = "DELETE FROM `tvshow_season` WHERE `id` = ?";
$deleted = Dba::write($sql, array($this->id));
if ($deleted) {
Art::gc('tvshow_season', $this->id);
Userflag::gc('tvshow_season', $this->id);
Rating::gc('tvshow_season', $this->id);
Shoutbox::gc('tvshow_season', $this->id);
}
}
return $deleted;
}
示例5: T_
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
$media = Video::create_from_id($media->id);
$media->format();
?>
<div class="np_group" id="np_group_1">
<div class="np_cell cel_username">
<label><?php
echo T_('Username');
?>
</label>
<a title="<?php
echo scrub_out($agent);
?>
" href="<?php
echo $web_path;
?>
/stats.php?action=show_user&user_id=<?php
示例6: createLibraryItem
public static function createLibraryItem($id)
{
$item = null;
$oid = self::getAmpacheId($id);
$type = self::getLibraryItemType($id);
if ($type) {
if ($type == 'video') {
$item = Video::create_from_id($oid);
} else {
$item = new $type($oid);
}
}
if ($item != null) {
if ($item->id) {
$item->format();
} else {
$item = null;
}
}
return $item;
}
示例7: T_
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
$web_path = AmpConfig::get('web_path');
$button = Ajax::button('?page=index&action=random_videos', 'random', T_('Refresh'), 'random_video_refresh');
UI::show_box_top(T_('Videos of the Moment') . ' ' . $button, 'box box_random_videos');
if ($videos) {
foreach ($videos as $video_id) {
$video = Video::create_from_id($video_id);
$video->format();
?>
<div class="random_video">
<div class="art_album">
<?php
if (Art::is_enabled()) {
$release_art = $video->get_release_item_art();
Art::display($release_art['object_type'], $release_art['object_id'], $video->get_fullname(), 6, $video->link);
} else {
?>
<?php
echo $video->get_fullname();
?>
<?php
}
示例8: scrub_in
case 'delete':
if (AmpConfig::get('demo_mode')) {
break;
}
$video_id = scrub_in($_REQUEST['video_id']);
show_confirmation(T_('Video Deletion'), T_('Are you sure you want to permanently delete this video?'), AmpConfig::get('web_path') . "/video.php?action=confirm_delete&video_id=" . $video_id, 1, 'delete_video');
break;
case 'confirm_delete':
if (AmpConfig::get('demo_mode')) {
break;
}
$video = Video::create_from_id($_REQUEST['video_id']);
if (!Catalog::can_remove($video)) {
debug_event('video', 'Unauthorized to remove the video `.' . $video->id . '`.', 1);
UI::access_denied();
exit;
}
if ($video->remove_from_disk()) {
show_confirmation(T_('Video Deletion'), T_('Video has been deleted.'), AmpConfig::get('web_path'));
} else {
show_confirmation(T_('Video Deletion'), T_('Cannot delete this video.'), AmpConfig::get('web_path'));
}
break;
case 'show_video':
default:
$video = Video::create_from_id($_REQUEST['video_id']);
$video->format();
require_once AmpConfig::get('prefix') . '/templates/show_video.inc.php';
break;
}
UI::show_footer();