summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-02-02 04:25:25 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-02-02 04:25:25 +0000
commit00effbf55451016e5863e27de93344dfb4a50216 (patch)
treefe1300051d65f14fd34dd53bc7148a47c8e3d5a6
parent0a2b41b143419e85b968a675c8b83a1c15615399 (diff)
downloadampache-00effbf55451016e5863e27de93344dfb4a50216.tar.gz
ampache-00effbf55451016e5863e27de93344dfb4a50216.tar.bz2
ampache-00effbf55451016e5863e27de93344dfb4a50216.zip
Add very basic buggy as crap video support, fix a few other minor bugs with playlists and random elements
-rw-r--r--bin/print_tags.inc4
-rw-r--r--browse.php6
-rwxr-xr-xdocs/CHANGELOG2
-rw-r--r--lib/class/browse.class.php20
-rw-r--r--lib/class/catalog.class.php44
-rw-r--r--lib/class/random.class.php18
-rw-r--r--lib/class/song.class.php4
-rw-r--r--lib/class/stream.class.php28
-rw-r--r--lib/class/update.class.php26
-rw-r--r--lib/class/vainfo.class.php60
-rw-r--r--lib/class/video.class.php86
-rw-r--r--lib/init.php12
-rw-r--r--play/index.php21
-rw-r--r--playlist.php1
-rw-r--r--server/ajax.server.php3
-rw-r--r--server/playlist.ajax.php1
-rw-r--r--stream.php10
-rw-r--r--templates/rightbar.inc.php4
-rw-r--r--templates/show_debug.inc.php12
-rw-r--r--templates/show_video_row.inc.php25
-rw-r--r--templates/show_videos.inc.php54
-rw-r--r--templates/sidebar_home.inc.php1
22 files changed, 379 insertions, 63 deletions
diff --git a/bin/print_tags.inc b/bin/print_tags.inc
index d5e4a279..4a6c37e9 100644
--- a/bin/print_tags.inc
+++ b/bin/print_tags.inc
@@ -44,8 +44,8 @@ echo "Using: $catalog->sort_pattern AND $catalog->rename_pattern for file patter
$info->get_info();
$results = $info->tags;
$results['file'] = $filename;
-$key = get_tag_type($results);
-$ampache_results = clean_tag_info($results,$key,$filename);
+$key = vainfo::get_tag_type($results);
+$ampache_results = vainfo::clean_tag_info($results,$key,$filename);
if ($send_mail) {
$getid3_results = print_r($info,1);
diff --git a/browse.php b/browse.php
index 684ae8c3..15ad94e8 100644
--- a/browse.php
+++ b/browse.php
@@ -40,6 +40,7 @@ switch ($_REQUEST['action']) {
case 'artist':
case 'playlist':
case 'live_stream':
+ case 'video':
case 'song':
Browse::set_type($_REQUEST['action']);
Browse::reset();
@@ -90,6 +91,11 @@ switch($_REQUEST['action']) {
$playlist_ids = Browse::get_objects();
Browse::show_objects();
break;
+ case 'video':
+ Browse::set_sort('title','ASC');
+ $video_ids = Browse::get_objects();
+ Browse::show_objects();
+ break;
default:
break;
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 53b56d7a..2ce34653 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,8 @@
--------------------------------------------------------------------------
v.3-5-Alpha2
+ - Added Video support
+ - Fixed normalize tracks not re-displaying playlist correctly
- Fixed now playing now showing currently playing song
- Fixed now playing clear all not correctly refreshing screen
- Fixed adding object to playlist so that it correctly shows the
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php
index 60eea3d1..60e4a876 100644
--- a/lib/class/browse.class.php
+++ b/lib/class/browse.class.php
@@ -287,6 +287,7 @@ class Browse {
switch($type) {
case 'user':
+ case 'video':
case 'playlist':
case 'playlist_song':
case 'song':
@@ -347,6 +348,9 @@ class Browse {
case 'live_stream':
$valid_array = array('name','call_sign','frequency');
break;
+ case 'video':
+ $valid_array = array('title','video_codec','audio_codec');
+ break;
case 'user':
$valid_array = array('fullname','username','last_seen','create_date');
break;
@@ -605,6 +609,10 @@ class Browse {
self::set_select("`user_shout`.`id`");
$sql = "SELECT %%SELECT%% FROM `user_shout` ";
break;
+ case 'video':
+ self::set_select("`video`.`id`");
+ $sql = "SELECT %%SELECT%% FROM `video` ";
+ break;
case 'tag':
self::set_select("`tag`.`id`");
self::set_join('left','tag_map','`tag_map`.`tag_id`','`tag`.`id`',1);
@@ -1022,6 +1030,13 @@ class Browse {
break;
} // end switch
break;
+ case 'video':
+ switch ($field) {
+ case 'title':
+ $sql = "`video`.`title`";
+ break;
+ }
+ break;
default:
// Rien a faire
break;
@@ -1142,6 +1157,11 @@ class Browse {
require_once Config::get('prefix') . '/templates/show_tagcloud.inc.php';
show_box_bottom();
break;
+ case 'video':
+ show_box_top(_('Videos'),$class);
+ require_once Config::get('prefix') . '/templates/show_videos.inc.php';
+ show_box_bottom();
+ break;
default:
// Rien a faire
break;
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index f0de8f34..1cdddba3 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -95,14 +95,23 @@ class Catalog {
$catalog_id = Dba::escape($this->id);
// Get _EVERYTHING_
$sql = "SELECT `id`,`file` FROM `song` WHERE `catalog`='$catalog_id'";
- $db_results = Dba::query($sql);
+ $db_results = Dba::read($sql);
// Populate the filecache
while ($results = Dba::fetch_assoc($db_results)) {
$this->_filecache[strtolower($results['file'])] = $results['id'];
}
+
+ $sql = "SELECT `id`,`file` FROM `video` WHERE `catalog`='$catalog_id'";
+ $db_results = Dba::read($sql);
+
+ while ($results = Dba::fetch_assoc($db_results)) {
+ $this->_filecache[strtolower($results['file'])] = 'v_' . $results['id'];
+ }
} // end if empty filecache
+ return true;
+
} // _create_filecache
/**
@@ -504,7 +513,7 @@ class Catalog {
// Define the Video file pattern
if (!$is_audio_file AND Config::get('catalog_video_pattern')) {
- $video_pattern = "/\.(" . Config::get('catalog_video_pattern') . "$/i";
+ $video_pattern = "/\.(" . Config::get('catalog_video_pattern') . ")$/i";
$is_video_file = preg_match($video_pattern,$file);
}
@@ -1401,7 +1410,7 @@ class Catalog {
* @package XMLRPC
* @catagory Client
*/
- function update_remote_catalog($data,$root_path) {
+ public function update_remote_catalog($data,$root_path) {
/*
We need to check the incomming songs
@@ -1438,7 +1447,7 @@ class Catalog {
* @package XMLRPC
* @catagory Client
*/
- function update_remote_album_images($data, $remote_server, $auth) {
+ public function update_remote_album_images($data, $remote_server, $auth) {
$label = "catalog.class.php::update_remote_album_images";
$total_updated = 0;
@@ -1904,12 +1913,12 @@ class Catalog {
$sql = "OPTIMIZE TABLE `song_data`,`song`,`rating`,`catalog`,`session`,`object_count`,`album`,`album_data`" .
",`artist`,`ip_history`,`flagged`,`now_playing`,`user_preference`,`tag`,`tag_map`,`tmp_playlist`" .
- ",`tmp_playlist_data`,`playlist`,`playlist_data`";
+ ",`tmp_playlist_data`,`playlist`,`playlist_data`,`session_stream`";
$db_results = Dba::query($sql);
$sql = "ANALYZE TABLE `song_data`,`song`,`rating`,`catalog`,`session`,`object_count`,`album`,`album_data`" .
",`artist`,`ip_history`,`flagged`,`now_playing`,`user_preference`,`tag`,`tag_map`,`tmp_playlist`" .
- ",`tmp_playlist_data`,`playlist`,`playlist_data`";
+ ",`tmp_playlist_data`,`playlist`,`playlist_data`,`session_stream`";
$db_results = Dba::query($sql);
} // optimize_tables;
@@ -2202,6 +2211,29 @@ class Catalog {
$vainfo = new vainfo($file,'','','',$this->sort_pattern,$this->rename_pattern);
$vainfo->get_info();
+ $tag_name = vainfo::get_tag_type($vainfo->tags);
+ $results = vainfo::clean_tag_info($vainfo->tags,$tag_name,$file);
+
+ $file = Dba::escape($file);
+ $catalog_id = Dba::escape($this->id);
+ $title = Dba::escape(basename($file));
+ $vcodec = $results['video_codec'];
+ $acodec = $results['audio_codec'];
+ $rezx = $results['resolution_x'];
+ $rezy = $results['resolution_y'];
+ $filesize = Dba::escape($filesize);
+ $time = Dba::escape($results['time']);
+ $mime = Dba::escape($results['mime']);
+ // UNUSED CURRENTLY
+ $comment = Dba::escape($results['comment']);
+ $year = Dba::escape($results['year']);
+ $disk = Dba::escape($results['disk']);
+
+ $sql = "INSERT INTO `video` (`file`,`catalog`,`title`,`video_codec`,`audio_codec`,`resolution_x`,`resolution_y`,`size`,`time`,`mime`) " .
+ " VALUES ('$file','$catalog_id','$title','$vcodec','$acodec','$rezx','$rezy','$filesize','$time','$mime')";
+ $db_results = Dba::write($sql);
+
+ return true;
} // insert_local_video
diff --git a/lib/class/random.class.php b/lib/class/random.class.php
index 0865f23f..8c8a55e7 100644
--- a/lib/class/random.class.php
+++ b/lib/class/random.class.php
@@ -97,25 +97,9 @@ class Random {
return false;
}
- if (Config::get('require_session')) {
- $session_string = '&sid=' . Stream::get_session();
- }
-
- $web_path = Config::get('web_path');
-
- if (Config::get('force_http_play') OR !empty($force_http)) {
- $port = Config::get('http_port');
- if (preg_match("/:\d+/",$web_path)) {
- $web_path = str_replace("https://", "http://",$web_path);
- }
- else {
- $web_path = str_replace("https://", "http://",$web_path);
- }
- }
-
$uid = $GLOBALS['user']->id;
- $url = $web_path . "/play/index.php?random=1&type=$type&uid=$uid$session_string";
+ $url = Stream::get_base_url() . "random=1&type=$type&uid=$uid$session_string";
return $url;
diff --git a/lib/class/song.class.php b/lib/class/song.class.php
index 36722b47..66a36d16 100644
--- a/lib/class/song.class.php
+++ b/lib/class/song.class.php
@@ -859,13 +859,13 @@ class Song extends database_object {
$web_path = Config::get('web_path');
-
+ //FIXME: REPLACE WITH Stream::get_base_url
if (Config::get('force_http_play') OR !empty($force_http)) {
$port = Config::get('http_port') ? ':' . Config::get('http_port') : '';
$web_path = str_replace("https://" . $_SERVER['HTTP_HOST'], "http://" . $_SERVER['SERVER_NAME'] . $port,$web_path);
}
- $url = $web_path . "/play/index.php?song=$song_id&uid=$user_id$session_string$ds_string&name=/$song_name";
+ $url = $web_path . "/play/index.php?oid=$song_id&uid=$user_id$session_string$ds_string&name=/$song_name";
return $url;
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php
index 61a91abc..9de66510 100644
--- a/lib/class/stream.class.php
+++ b/lib/class/stream.class.php
@@ -751,6 +751,34 @@ class Stream {
} // run_playlist_method
+ /**
+ * get_base_url
+ * This returns the base requirements for a stream URL this does not include anything after the index.php?sid=????
+ */
+ public static function get_base_url($session_id='',$force_http='') {
+
+ if (Config::get('require_session')) {
+ $session_string = 'sid=' . Stream::get_session() . '&';
+ }
+
+ $web_path = Config::get('web_path');
+
+ if (Config::get('force_http_play') OR !empty($force_http)) {
+ $port = Config::get('http_port');
+ if (preg_match("/:\d+/",$web_path)) {
+ $web_path = str_replace("https://", "http://",$web_path);
+ }
+ else {
+ $web_path = str_replace("https://", "http://",$web_path);
+ }
+ }
+
+ $url = $web_path . "/play/index.php?$session_string";
+
+ return $url;
+
+ } // get_base_url
+
} //end of stream class
?>
diff --git a/lib/class/update.class.php b/lib/class/update.class.php
index 80ba9f2b..abc8036e 100644
--- a/lib/class/update.class.php
+++ b/lib/class/update.class.php
@@ -299,6 +299,10 @@ class Update {
$version[] = array('version'=>'350004','description'=>$update_string);
+ $update_string = "- Add table for Video files<br />";
+
+ $version[] = array('version'=>'350005','description'=>$update_string);
+
return $version;
} // populate_version
@@ -1437,7 +1441,6 @@ class Update {
} // update_350003
-
/**
* update_350004
* This update makes some changes to the ACL table so that it can support IPv6 entries as well as some other feature
@@ -1543,6 +1546,8 @@ class Update {
self::set_version('db_version','350004');
+ return true;
+
} // update_350004
/**
@@ -1562,10 +1567,27 @@ class Update {
"`resolution_y` MEDIUMINT UNSIGNED NOT NULL ," .
"`time` INT( 11 ) UNSIGNED NOT NULL ," .
"`size` BIGINT UNSIGNED NOT NULL," .
- "`mime` VARCHAR( 255 ) NOT NULL" .
+ "`mime` VARCHAR( 255 ) NOT NULL," .
+ "`enabled` TINYINT( 1) NOT NULL DEFAULT '1'" .
") ENGINE = MYISAM ";
$db_results = Dba::write($sql);
+ $sql = "ALTER TABLE `access_list` ADD INDEX ( `enabled` )";
+ $db_results = Dba::write($sql);
+
+ $sql = "ALTER TABLE `video` ADD INDEX ( `file` )";
+ $db_results = Dba::write($sql);
+
+ $sql = "ALTER TABLE `video` ADD INDEX ( `enabled` )";
+ $db_results = Dba::write($sql);
+
+ $sql = "ALTER TABLE `video` ADD INDEX ( `title` )";
+ $db_results = Dba::write($sql);
+
+ self::set_version('db_version','350005');
+
+ return true;
+
} // update_350005
} // end update class
diff --git a/lib/class/vainfo.class.php b/lib/class/vainfo.class.php
index f6e2c66e..8e78bb97 100644
--- a/lib/class/vainfo.class.php
+++ b/lib/class/vainfo.class.php
@@ -212,11 +212,8 @@ class vainfo {
$info['file'] = $filename;
$info['title'] = stripslashes(trim($results[$key]['title']));
$info['year'] = intval($results[$key]['year']);
- $info['track'] = intval($results[$key]['track']);
$info['disk'] = intval($results[$key]['disk']);
$info['comment'] = Dba::escape(str_replace($clean_array,$wipe_array,$results[$key]['comment']));
- $info['language'] = Dba::escape($results[$key]['language']);
- $info['lyrics'] = Dba::escape($results[$key]['lyricist']);
/* This are pulled from the info array */
$info['bitrate'] = intval($results['info']['bitrate']);
@@ -234,10 +231,22 @@ class vainfo {
$info['time'] = intval($results['info']['playing_time']);
$info['channels'] = intval($results['info']['channels']);
- /* These are used to generate the correct ID's later */
- $info['artist'] = trim($results[$key]['artist']);
- $info['album'] = trim($results[$key]['album']);
- $info['genre'] = trim($results[$key]['genre']);
+ // Specific Audio Flags
+ if (!$results[$key]['video_codec']) {
+ /* These are used to generate the correct ID's later */
+ $info['artist'] = trim($results[$key]['artist']);
+ $info['album'] = trim($results[$key]['album']);
+ $info['genre'] = trim($results[$key]['genre']);
+ $info['language'] = Dba::escape($results[$key]['language']);
+ $info['lyrics'] = Dba::escape($results[$key]['lyrics']);
+ $info['track'] = intval($results[$key]['track']);
+ }
+ else {
+ $info['resolution_x'] = intval($results[$key]['resolution_x']);
+ $info['resolution_y'] = intval($results[$key]['resolution_y']);
+ $info['audio_codec'] = Dba::escape($results[$key]['audio_codec']);
+ $info['video_codec'] = Dba::escape($results[$key]['video_codec']);
+ }
return $info;
@@ -255,6 +264,12 @@ class vainfo {
* come from, in the end we trust the encoding
* type
*/
+ if ($type = $this->_raw['video']['dataformat']) {
+ // Manually set the tag information
+ $this->_raw['tags']['avi'] = array();
+ $this->_clean_type($type);
+ return $type;
+ }
if ($type = $this->_raw['audio']['streams']['0']['dataformat']) {
$this->_clean_type($type);
return $type;
@@ -283,8 +298,6 @@ class vainfo {
$results = array();
- /* Gather Tag information from the filenames */
- $results['file'] = $this->_parse_filename($this->filename);
/* Return false if we don't have
* any tags to look at
@@ -317,6 +330,9 @@ class vainfo {
case 'riff':
$results[$key] = $this->_parse_riff($tag_array);
break;
+ case 'avi':
+ $results[$key] = $this->_parse_avi($this->_raw2);
+ break;
default:
debug_event('vainfo','Error: Unable to determine tag type of ' . $key . ' for file ' . $this->filename . ' Assuming id3v2','5');
$results[$key] = $this->_parse_id3v2($this->_raw['id3v2']['comments']);
@@ -325,6 +341,9 @@ class vainfo {
} // end foreach
+ /* Gather Tag information from the filenames */
+ $results['file'] = $this->_parse_filename($this->filename);
+
return $results;
} // _get_tags
@@ -389,6 +408,9 @@ class vainfo {
case 'vorbis':
return 'ogg';
break;
+ case 'avi':
+ return 'avi';
+ break;
default:
/* Log the fact that we couldn't figure it out */
debug_event('vainfo','Unable to determine file type from ' . $type . ' on file ' . $this->filename,'5');
@@ -578,6 +600,26 @@ class vainfo {
} // _parse_quicktime
/**
+ * _parse_avi
+ * This attempts to parse our the information on an avi file and present it in some
+ * kind of sane format, this is a little hard as these files don't have tags
+ */
+ private function _parse_avi($tags) {
+
+ $array = array();
+
+ $array['video_codec'] = $tags['video']['fourcc'];
+ $array['audio_codec'] = $tags['audio']['dataformat'];
+ $array['resolution_x'] = $tags['video']['resolution_x'];
+ $array['resolution_y'] = $tags['video']['resolution_y'];
+ $array['mime'] = $tags['mime_type'];
+ $array['comment'] = $tags['video']['codec'];
+
+ return $array;
+
+ } // _parse_avi
+
+ /**
* _parse_filename
* This function uses the passed file and dir patterns
* To pull out extra tag information and populate it into
diff --git a/lib/class/video.class.php b/lib/class/video.class.php
new file mode 100644
index 00000000..a19558b1
--- /dev/null
+++ b/lib/class/video.class.php
@@ -0,0 +1,86 @@
+<?php
+/*
+
+ Copyright (c) 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.
+
+*/
+
+class Video extends database_object {
+
+ public $id;
+ public $title;
+ public $file;
+
+ /**
+ * 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
+
+ /**
+ * 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);
+
+ } // format
+
+ /**
+ * native_stream
+ * This returns true or false on the downsampling mojo
+ */
+ public function native_stream() {
+
+ return true;
+
+ } // 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($id) {
+
+ $video = new Video($id);
+
+ 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
+
+} // end Video class
diff --git a/lib/init.php b/lib/init.php
index c4e13b6d..a6dd443b 100644
--- a/lib/init.php
+++ b/lib/init.php
@@ -18,9 +18,6 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-/***
- * DO NOT EDIT THIS FILE
- ***/
// SVN Fluf
$svn_version = 'Subversion ' . trim('$Rev$','$ ');
@@ -35,8 +32,6 @@ if (strcmp('5.0.0',phpversion()) > 0) {
exit;
}
-// Set the Error level manualy... I'm to lazy to fix notices
-//error_reporting(E_ALL|E_STRICT); // use this only for development purposes
error_reporting(E_ERROR); // Only show fatal errors in production
// This makes this file nolonger need customization
@@ -268,10 +263,9 @@ if (!preg_match('/update\.php/', $_SERVER['PHP_SELF'])) {
// For the XMLRPC stuff
$GLOBALS['xmlrpc_internalencoding'] = Config::get('site_charset');
-// If don't use Debug, no error report
-if (Config::get('debug') == 'false' || Config::get('debug') == NULL) {
- error_reporting(0);
-} else {
+// If debug is on GIMMIE DA ERRORS
+if (Config::get('debug')) {
error_reporting(E_ALL);
}
+
?>
diff --git a/play/index.php b/play/index.php
index f8d0dd6a..93ea49bf 100644
--- a/play/index.php
+++ b/play/index.php
@@ -32,9 +32,10 @@ ob_end_clean();
/* These parameters had better come in on the url. */
$uid = scrub_in($_REQUEST['uid']);
-$song_id = scrub_in($_REQUEST['song']);
+$song_id = $_REQUEST['song'] ? scrub_in($_REQUEST['song']) : scrub_in($_REQUEST['oid']);
$sid = scrub_in($_REQUEST['sid']);
$xml_rpc = scrub_in($_REQUEST['xml_rpc']);
+$video = make_bool($_REQUEST['video']);
/* This is specifically for tmp playlist requests */
$demo_id = scrub_in($_REQUEST['demo_id']);
@@ -151,9 +152,16 @@ if ($random) {
}
} // if random
-/* Base Checks passed create the song object */
-$song = new Song($song_id);
-$song->format();
+if (!$video) {
+ /* Base Checks passed create the song object */
+ $song = new Song($song_id);
+ $song->format();
+}
+else {
+ $song = new Video($song_id);
+ $song->format();
+}
+
$catalog = new Catalog($song->catalog);
/* If the song is disabled */
@@ -162,9 +170,6 @@ if (!make_bool($song->enabled)) {
exit;
}
-
-
-
// If we are running in Legalize mode, don't play songs already playing
if (Config::get('lock_songs')) {
if (!check_lock_songs($song->id)) {
@@ -303,7 +308,7 @@ if ((Config::get('transcode') == 'always' || !$song->native_stream() || $not_loc
else {
// Send file, possible at a byte offset
$fp = fopen($song->file, 'rb');
-
+
if (!is_resource($fp)) {
debug_event('file_read_error',"Error: Unable to open $song->file for reading",'2');
cleanup_and_exit($lastid);
diff --git a/playlist.php b/playlist.php
index adf600ab..77bb8634 100644
--- a/playlist.php
+++ b/playlist.php
@@ -129,6 +129,7 @@ switch ($_REQUEST['action']) {
/* Normalize the tracks */
$playlist->normalize_tracks();
+ $object_ids = $playlist->get_items();
default:
require_once Config::get('prefix') . '/templates/show_playlist.inc.php';
break;
diff --git a/server/ajax.server.php b/server/ajax.server.php
index 5c51a2c8..801ed330 100644
--- a/server/ajax.server.php
+++ b/server/ajax.server.php
@@ -286,6 +286,9 @@ switch ($_REQUEST['action']) {
$random_type = Random::validate_type($_REQUEST['random_type']);
$GLOBALS['user']->playlist->add_object('0',$random_type);
break;
+ case 'video':
+ $GLOBALS['user']->playlist->add_object($_REQUEST['id'],'video');
+ break;
default:
case 'song':
$GLOBALS['user']->playlist->add_object($_REQUEST['id'],'song');
diff --git a/server/playlist.ajax.php b/server/playlist.ajax.php
index 5614b337..032ffb22 100644
--- a/server/playlist.ajax.php
+++ b/server/playlist.ajax.php
@@ -127,6 +127,7 @@ switch ($_REQUEST['action']) {
// Add our new songs
$playlist->add_songs($songs);
$playlist->format();
+ $object_ids = $playlist->get_items();
ob_start();
require_once Config::get('prefix') . '/templates/show_playlist.inc.php';
$results['content'] = ob_get_contents();
diff --git a/stream.php b/stream.php
index d6eada38..9b0bac03 100644
--- a/stream.php
+++ b/stream.php
@@ -44,18 +44,18 @@ switch ($_REQUEST['action']) {
case 'radio':
$radio = new Radio($object_data['0']);
$urls[] = $radio->url;
- $song_ids[] = '-1';
break;
case 'song':
$song_ids[] = $object_data['0'];
break;
+ case 'video':
+ $video_url = Video::play_url($object_data['0']);
+ if ($video_url) { $urls[] = $video_url; }
+ break;
default:
$random_url = Random::play_url($object_data['1']);
// If there's something to actually add
- if ($random_url) {
- $urls[] = $random_url;
- $song_ids[] = '-1';
- }
+ if ($random_url) { $urls[] = $random_url; }
break;
} // end switch on type
} // end foreach
diff --git a/templates/rightbar.inc.php b/templates/rightbar.inc.php
index 0ee60c87..990d4f20 100644
--- a/templates/rightbar.inc.php
+++ b/templates/rightbar.inc.php
@@ -88,8 +88,10 @@
$objects = array_slice($objects,0,100);
}
+ $normal_array = array('radio','song','video');
+
foreach ($objects as $uid=>$object_data) {
- if ($object_data['1'] == 'radio' || $object_data['1'] == 'song') {
+ if (in_array($object_data['1'],$normal_array)) {
$object = new $object_data['1']($object_data['0']);
$object->format();
}
diff --git a/templates/show_debug.inc.php b/templates/show_debug.inc.php
index f8a9a71d..afe81f6e 100644
--- a/templates/show_debug.inc.php
+++ b/templates/show_debug.inc.php
@@ -21,10 +21,18 @@
*/
?>
<?php show_box_top(_('Debug Tools')); ?>
+<div id="information_actions">
<ul>
- <li><a href="<?php echo Config::get('web_path'); ?>/admin/system.php?action=generate_config"><?php echo _('Generate Configuration'); ?></a></li>
- <li><a href="<?php echo Config::get('web_path'); ?>/admin/system.php?action=reset_db_charset"><?php echo _('Set Database Charset'); ?></a></li>
+<li>
+ <a href="<?php echo Config::get('web_path'); ?>/admin/system.php?action=generate_config"><?php echo get_user_icon('cog'); ?></a>
+ <?php echo _('Generate Configuration'); ?>
+</li>
+<li>
+ <a href="<?php echo Config::get('web_path'); ?>/admin/system.php?action=reset_db_charset"><?php echo get_user_icon('server_lightning'); ?></a>
+ <?php echo _('Set Database Charset'); ?>
+</li>
</ul>
+</div>
<?php show_box_bottom(); ?>
<?php show_box_top(_('PHP Settings')); ?>
<table class="tabledata" cellpadding="0" cellspacing="0">
diff --git a/templates/show_video_row.inc.php b/templates/show_video_row.inc.php
new file mode 100644
index 00000000..16fed284
--- /dev/null
+++ b/templates/show_video_row.inc.php
@@ -0,0 +1,25 @@
+<?php
+/*
+
+ Copyright (c) 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.
+
+*/
+?>
+<td class="cel_add">
+ <?php echo Ajax::button('?action=basket&type=video&id=' . $video->id,'add',_('Add'),'add_video_' . $video->id); ?>
+</td>
+<td class="cel_title"><?php echo $video->f_title; ?></td>
diff --git a/templates/show_videos.inc.php b/templates/show_videos.inc.php
new file mode 100644
index 00000000..cad7ea19
--- /dev/null
+++ b/templates/show_videos.inc.php
@@ -0,0 +1,54 @@
+<?php
+/*
+
+ Copyright (c) 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.
+*/
+
+$web_path = Config::get('web_path');
+
+?>
+<?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?>
+<table class="tabledata" cellpadding="0" cellspacing="0">
+<colgroup>
+ <col id="col_add" />
+ <col id="col_title" />
+</colgroup>
+<tr class="th-top">
+ <th class="cel_add"><?php echo _('Add'); ?></th>
+ <th class="cel_title"><?php echo _('Title'); ?></th>
+</tr>
+<?php
+/* Foreach through every artist that has been passed to us */
+foreach ($object_ids as $video_id) {
+ $video = new Video($video_id);
+ $video->format();
+?>
+<tr id="video_<?php echo $video->id; ?>" class="<?php echo flip_class(); ?>">
+ <?php require Config::get('prefix') . '/templates/show_video_row.inc.php'; ?>
+</tr>
+<?php } //end foreach ?>
+<?php if (!count($object_ids)) { ?>
+<tr class="<?php echo flip_class(); ?>">
+ <td colspan="5"><span class="fatalerror"><?php echo _('Not Enough Data'); ?></span></td>
+</tr>
+<?php } ?>
+<tr class="th-bottom">
+ <th class="cel_add"><?php echo _('Add'); ?></th>
+ <th class="cel_title"><?php echo _('Title'); ?></th>
+</tr>
+</table>
+<?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?>
diff --git a/templates/sidebar_home.inc.php b/templates/sidebar_home.inc.php
index 01c7d076..dc84f2b5 100644
--- a/templates/sidebar_home.inc.php
+++ b/templates/sidebar_home.inc.php
@@ -35,6 +35,7 @@ $ajax_info = Config::get('ajax_url'); $web_path = Config::get('web_path');
<!-- <li id="sb_browse_bb_Tags"><a href="<?php echo $web_path; ?>/browse.php?action=tag"><?php echo _('Tag Cloud'); ?></a></li> -->
<li id="sb_browse_bb_Playlist"><a href="<?php echo $web_path; ?>/browse.php?action=playlist"><?php echo _('Playlist'); ?></a></li>
<li id="sb_browse_bb_RadioStation"><a href="<?php echo $web_path; ?>/browse.php?action=live_stream"><?php echo _('Radio Stations'); ?></a></li>
+ <li id="sb_browse_bb_Video"><a href="<?php echo $web_path; ?>/browse.php?action=video"><?php echo _('Video'); ?></a></li>
</ul>
</li>
<?php if (count($allowed_filters)) { ?>