1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
<?php
/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */
/**
* Video Class
*
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright (c) 2001 - 2011 Ampache.org All Rights Reserved
*
* 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.
*
* @package Ampache
* @copyright 2001 - 2011 Ampache.org
* @license http://opensource.org/licenses/gpl-2.0 GPLv2
* @link http://www.ampache.org/
*/
/**
* Video Class
*
* Description here...
*
* @package Ampache
* @copyright 2001 - 2011 Ampache.org
* @license http://opensource.org/licenses/gpl-2.0 GPLv2
* @link http://www.ampache.org/
*/
class Video extends database_object implements media {
public $id;
public $title;
public $enabled;
public $file;
public $size;
/**
* Constructor
* This pulls the shoutbox information from the database and returns
* a constructed object, uses user_shout table
*/
public function __construct($id) {
// Load the data from the database
$info = $this->get_info($id);
foreach ($info as $key=>$value) {
$this->$key = $value;
}
return true;
} // Constructor
/**
* build_cache
* Build a cache based on the array of ids passed, saves lots of little queries
*/
public static function build_cache($ids=array()) {
if (!is_array($ids) OR !count($ids)) { return false; }
$idlist = '(' . implode(',',$ids) . ')';
$sql = "SELECT * FROM `video` WHERE `video`.`id` IN $idlist";
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
parent::add_to_cache('video',$row['id'],$row);
}
} // build_cache
/**
* format
* This formats a video object so that it is human readable
*/
public function format() {
$this->f_title = scrub_out($this->title);
$this->f_link = scrub_out($this->title);
$this->f_codec = $this->video_codec . ' / ' . $this->audio_codec;
$this->f_resolution = $this->resolution_x . 'x' . $this->resolution_y;
$this->f_tags = '';
$this->f_length = floor($this->time/60) . ' ' . T_('minutes');
} // format
public function get_stream_types() {
return array('native');
} // native_stream
/**
* play_url
* This returns a "PLAY" url for the video in question here, this currently feels a little
* like a hack, might need to adjust it in the future
*/
public static function play_url($oid,$sid='',$force_http='') {
$video = new Video($oid);
if (!$video->id) { return false; }
$uid = intval($GLOBALS['user']->id);
$oid = intval($video->id);
$url = Stream::get_base_url() . "video=true&uid=$uid&oid=$oid";
return $url;
} // play_url
/**
* get_transcode_settings
*
* FIXME: Video transcoding is not implemented
*/
public function get_transcode_settings($target = null) {
return false;
}
/**
* has_flag
* returns true if the video has been flagged and we shouldn't try to re-read
* the meta data
*/
public function has_flag() {
} // has_flag
} // end Video class
|