1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-06 11:59:56 +02:00

Better Video integration in Ampache features

This commit is contained in:
Afterster 2014-07-08 20:00:33 +02:00
parent 7258fdcb63
commit 0254be9982
92 changed files with 1253 additions and 636 deletions

View file

@ -38,64 +38,40 @@ $media_ids = array();
$default_name = "Unknown.zip"; $default_name = "Unknown.zip";
$name = $default_name; $name = $default_name;
switch ($_REQUEST['action']) { if (Core::is_playable_item($_REQUEST['action'])) {
case 'tmp_playlist': $libitem = new $_REQUEST['action']($_REQUEST['id']);
$media_ids = $GLOBALS['user']->playlist->get_items(); $name = $libitem->get_fullname();
$name = $GLOBALS['user']->username . ' - Playlist'; $media_ids = $libitem->get_medias();
break; } else {
case 'playlist': switch ($_REQUEST['action']) {
$playlist = new Playlist($_REQUEST['id']); case 'tmp_playlist':
$media_ids = $playlist->get_songs(); $media_ids = $GLOBALS['user']->playlist->get_items();
$name = $playlist->name; $name = $GLOBALS['user']->username . ' - Playlist';
break; break;
case 'smartplaylist': case 'browse':
$search = new Search($_REQUEST['id'], 'song'); $id = scrub_in($_REQUEST['browse_id']);
$items = $search->get_items(); $browse = new Browse($id);
foreach ($items as $item) { $browse_media_ids = $browse->get_saved();
$media_ids[] = $item['object_id']; foreach ($browse_media_ids as $media_id) {
} switch ($_REQUEST['type']) {
$name = $search->name; case 'album':
break; $album = new Album($media_id);
case 'album': $media_ids = array_merge($media_ids, $album->get_songs());
foreach ($_REQUEST['id'] as $a) { break;
$album = new Album($a); case 'song':
if ($name == $default_name) { $media_ids[] = $media_id;
$name = $album->name; break;
} case 'video':
$asongs = $album->get_songs(); $media_ids[] = array('Video', $media_id);
foreach ($asongs as $song_id) { break;
$media_ids[] = $song_id; } // switch on type
} } // foreach media_id
} $name = 'Batch-' . date("dmY",time());
break; default:
case 'artist': // Rien a faire
$artist = new Artist($_REQUEST['id']); break;
$media_ids = $artist->get_songs(); } // action switch
$name = $artist->name; }
break;
case 'browse':
$id = scrub_in($_REQUEST['browse_id']);
$browse = new Browse($id);
$browse_media_ids = $browse->get_saved();
foreach ($browse_media_ids as $media_id) {
switch ($_REQUEST['type']) {
case 'album':
$album = new Album($media_id);
$media_ids = array_merge($media_ids, $album->get_songs());
break;
case 'song':
$media_ids[] = $media_id;
break;
case 'video':
$media_ids[] = array('Video', $media_id);
break;
} // switch on type
} // foreach media_id
$name = 'Batch-' . date("dmY",time());
default:
// Rien a faire
break;
} // action switch
// Take whatever we've got and send the zip // Take whatever we've got and send the zip
$song_files = get_song_files($media_ids); $song_files = get_song_files($media_ids);

View file

@ -27,9 +27,10 @@ should be implemented as a public method:
get_metadata(Array $metadata) get_metadata(Array $metadata)
The passed array contains the best metadata we've got. The passed array contains the best metadata we've got.
save_rating(Rating $rating, int $new_value) save_rating(Rating $rating, int $new_value)
save_songplay(Song $song) save_mediaplay(Media $media)
get_lyrics(Song $song) get_lyrics(Song $song)
process_wanted(Wanted $wanted) process_wanted(Wanted $wanted)
shortener(string $url) shortener(string $url)
get_photos(string $search) get_photos(string $search)
gather_arts(string $type, array $options, int $limit)

View file

@ -47,7 +47,7 @@ if (!isset($_GET['object_type'])) {
} }
$type = $_GET['object_type']; $type = $_GET['object_type'];
if (!Catalog::is_library_item($type)) if (!Core::is_library_item($type))
exit; exit;
/* Decide what size this image is */ /* Decide what size this image is */

View file

@ -42,8 +42,7 @@ function get_song_files($media_ids)
if ($media->enabled) { if ($media->enabled) {
$total_size += sprintf("%.2f",($media->size/1048576)); $total_size += sprintf("%.2f",($media->size/1048576));
$media->format(); $media->format();
$dirname = $media->f_album_full; $dirname = $media->get_fullname();
//debug_event('batch.lib.php', 'Songs file {'.$media->file.'}...', '5');
if (!array_key_exists($dirname, $media_files)) { if (!array_key_exists($dirname, $media_files)) {
$media_files[$dirname] = array(); $media_files[$dirname] = array();
} }

View file

@ -484,7 +484,7 @@ class Album extends database_object implements library_item
public function get_parent() public function get_parent()
{ {
if ($album->artist_count == 1) { if ($album->artist_count == 1) {
return array('type' => 'artist', 'id' => $album->artist_id); return array('object_type' => 'artist', 'object_id' => $album->artist_id);
} }
return null; return null;
@ -492,7 +492,22 @@ class Album extends database_object implements library_item
public function get_childrens() public function get_childrens()
{ {
return array('song' => $this->get_songs()); return $this->get_medias();
}
public function get_medias($filter_type = null)
{
$medias = array();
if (!$filter_type || $filter_type == 'song') {
$songs = $this->get_songs();
foreach ($songs as $song_id) {
$medias[] = array(
'object_type' => 'song',
'object_id' => $song_id
);
}
}
return $medias;
} }
public function get_user_owner() public function get_user_owner()

View file

@ -51,7 +51,7 @@ class Art extends database_object
*/ */
public function __construct($uid, $type = 'album', $kind = 'default') public function __construct($uid, $type = 'album', $kind = 'default')
{ {
if (!Catalog::is_library_item($type)) if (!Core::is_library_item($type))
return false; return false;
$this->type = $type; $this->type = $type;
$this->uid = $uid; $this->uid = $uid;
@ -519,7 +519,7 @@ class Art extends database_object
public static function url($uid,$type,$sid=false) public static function url($uid,$type,$sid=false)
{ {
$sid = $sid ? scrub_out($sid) : scrub_out(session_id()); $sid = $sid ? scrub_out($sid) : scrub_out(session_id());
if (!Catalog::is_library_item($type)) if (!Core::is_library_item($type))
return null; return null;
$key = $type . $uid; $key = $type . $uid;
@ -1129,28 +1129,21 @@ class Art extends database_object
$meta = $plugin->get_metadata($gtypes, $media_info); $meta = $plugin->get_metadata($gtypes, $media_info);
$images = array(); $images = array();
switch ($type) {
case 'tvshow': if ($meta['art']) {
if ($meta['tvshow_art']) { $url = $meta['art'];
$url = $meta['tvshow_art']; $ures = pathinfo($url);
$ures = pathinfo($url); $images[] = array('url' => $url, 'mime' => 'image/' . $ures['extension'], 'title' => $plugin->name);
$images[] = array('url' => $url, 'mime' => 'image/' . $ures['extension'], 'title' => $plugin->name); }
} if ($meta['tvshow_season_art']) {
break; $url = $meta['tvshow_season_art'];
case 'tvshow_season': $ures = pathinfo($url);
if ($meta['tvshow_season_art']) { $images[] = array('url' => $url, 'mime' => 'image/' . $ures['extension'], 'title' => $plugin->name);
$url = $meta['tvshow_season_art']; }
$ures = pathinfo($url); if ($meta['tvshow_art']) {
$images[] = array('url' => $url, 'mime' => 'image/' . $ures['extension'], 'title' => $plugin->name); $url = $meta['tvshow_art'];
} $ures = pathinfo($url);
break; $images[] = array('url' => $url, 'mime' => 'image/' . $ures['extension'], 'title' => $plugin->name);
default:
if ($meta['art']) {
$url = $meta['art'];
$ures = pathinfo($url);
$images[] = array('url' => $url, 'mime' => 'image/' . $ures['extension'], 'title' => $plugin->name);
}
break;
} }
return $images; return $images;
@ -1160,9 +1153,9 @@ class Art extends database_object
{ {
switch ($thumb) { switch ($thumb) {
case '1': case '1':
/* This is used by the now_playing stuff */ /* This is used by the now_playing / browse stuff */
$size['height'] = '75'; $size['height'] = '100';
$size['width'] = '75'; $size['width'] = '100';
break; break;
case '2': case '2':
$size['height'] = '128'; $size['height'] = '128';
@ -1198,6 +1191,11 @@ class Art extends database_object
$size['height'] = 200; $size['height'] = 200;
$size['width'] = 470; $size['width'] = 470;
break; break;
case '9':
/* Video preview size */
$size['height'] = 100;
$size['width'] = 235;
break;
default: default:
$size['height'] = '275'; $size['height'] = '275';
$size['width'] = '275'; $size['width'] = '275';
@ -1229,7 +1227,7 @@ class Art extends database_object
} }
} }
echo "<div class=\"item_art\">"; echo "<div class=\"item_art\">";
echo "<a href=\"" . $link . "\" alt=\"" . $name . "\""; echo "<a href=\"" . $link . "\" title=\"" . $name . "\"";
if ($prettyPhoto) { if ($prettyPhoto) {
echo " rel=\"prettyPhoto\""; echo " rel=\"prettyPhoto\"";
} }
@ -1240,6 +1238,11 @@ class Art extends database_object
} }
echo "<img src=\"" . $imgurl . "\" alt=\"" . $name . "\" height=\"" . $size['height'] . "\" width=\"" . $size['width'] . "\" />"; echo "<img src=\"" . $imgurl . "\" alt=\"" . $name . "\" height=\"" . $size['height'] . "\" width=\"" . $size['width'] . "\" />";
if ($prettyPhoto) { if ($prettyPhoto) {
if ($size['width'] >= 150) {
echo "<div class=\"item_art_play\">";
echo Ajax::text('?page=stream&action=directplay&object_type=' . $object_type . '&object_id=' . $object_id, '<span class="item_art_play_icon" title="' . T_('Play') . '" />', 'directplay_art_' . $object_type . '_' .$object_id);
echo "</div>";
}
echo "<div class=\"item_art_actions\">"; echo "<div class=\"item_art_actions\">";
$burl = substr($_SERVER['REQUEST_URI'], strlen(AmpConfig::get('raw_web_path')) + 1); $burl = substr($_SERVER['REQUEST_URI'], strlen(AmpConfig::get('raw_web_path')) + 1);
$burl = rawurlencode($burl); $burl = rawurlencode($burl);

View file

@ -367,8 +367,30 @@ class Artist extends database_object implements library_item
public function get_childrens() public function get_childrens()
{ {
$albums = $this->get_albums();
foreach ($albums as $album_id) {
$medias[] = array(
'object_type' => 'album',
'object_id' => $album_id
);
}
return array('album' => $this->get_albums()); return array('album' => $this->get_albums());
} }
public function get_medias($filter_type = null)
{
$medias = array();
if (!$filter_type || $filter_type == 'song') {
$songs = $this->get_songs();
foreach ($songs as $song_id) {
$medias[] = array(
'object_type' => 'song',
'object_id' => $song_id
);
}
}
return $medias;
}
public function get_user_owner() public function get_user_owner()
{ {

View file

@ -137,6 +137,19 @@ class Broadcast extends database_object implements library_item
{ {
return array(); return array();
} }
public function get_medias($filter_type = null)
{
// Not a media, shouldn't be that
$medias = array();
if (!$filter_type || $filter_type == 'broadcast') {
$medias[] = array(
'object_type' => 'broadcast',
'object_id' => $this->id
);
}
return $medias;
}
public function get_user_owner() public function get_user_owner()
{ {

View file

@ -204,6 +204,7 @@ class Browse extends Query
break; break;
case 'video': case 'video':
Video::build_cache($object_ids); Video::build_cache($object_ids);
$video_type = 'video';
$box_title = T_('Videos'); $box_title = T_('Videos');
$box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php'; $box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
break; break;
@ -245,22 +246,22 @@ class Browse extends Query
break; break;
case 'tvshow_episode': case 'tvshow_episode':
$box_title = T_('Episodes'); $box_title = T_('Episodes');
$video_type = 'TVShow_Episode'; $video_type = $type;
$box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php'; $box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
break; break;
case 'movie': case 'movie':
$box_title = T_('Movies'); $box_title = T_('Movies');
$video_type = 'Movie'; $video_type = $type;
$box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php'; $box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
break; break;
case 'clip': case 'clip':
$box_title = T_('Clips'); $box_title = T_('Clips');
$video_type = 'Clip'; $video_type = $type;
$box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php'; $box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
break; break;
case 'personal_video': case 'personal_video':
$box_title = T_('Personal Videos'); $box_title = T_('Personal Videos');
$video_type = 'Personal_Video'; $video_type = $type;
$box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php'; $box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
break; break;
default: default:

View file

@ -836,8 +836,8 @@ abstract class Catalog extends database_object
$parent = $libitem->get_parent(); $parent = $libitem->get_parent();
if ($parent != null) { if ($parent != null) {
if (!Art::has_db($parent['id'], $parent['type'])) { if (!Art::has_db($parent['object_id'], $parent['object_type'])) {
$this->gather_art_item($parent['type'], $parent['id']); $this->gather_art_item($parent['object_type'], $parent['object_id']);
} }
} }
} }
@ -1676,23 +1676,4 @@ abstract class Catalog extends database_object
} // export } // export
private static function is_class_typeof($classname, $typeofname)
{
if (class_exists($classname)) {
return in_array($typeofname, array_map('strtolower', class_implements($classname)));
}
return false;
}
public static function is_library_item($classname)
{
return self::is_class_typeof($classname, 'library_item');
}
public static function is_media($classname)
{
return self::is_class_typeof($classname, 'media');
}
} // end of catalog class } // end of catalog class

View file

@ -20,7 +20,7 @@
* *
*/ */
class Channel extends database_object implements library_item class Channel extends database_object implements media, library_item
{ {
public $id; public $id;
public $is_private; public $is_private;
@ -193,7 +193,7 @@ class Channel extends database_object implements library_item
public function get_fullname() public function get_fullname()
{ {
return $this->f_name; return $this->name;
} }
public function get_parent() public function get_parent()
@ -205,6 +205,18 @@ class Channel extends database_object implements library_item
{ {
return array(); return array();
} }
public function get_medias($filter_type = null)
{
$medias = array();
if (!$filter_type || $filter_type == 'channel') {
$medias[] = array(
'object_type' => 'channel',
'object_id' => $this->id
);
}
return $medias;
}
public function get_user_owner() public function get_user_owner()
{ {
@ -419,4 +431,20 @@ class Channel extends database_object implements library_item
return $channel->get_stream_proxy_url() . '?rt=' . time() . '&filename=' . urlencode($channel->name) . '.' . $channel->stream_type . $additional_params; return $channel->get_stream_proxy_url() . '?rt=' . time() . '&filename=' . urlencode($channel->name) . '.' . $channel->stream_type . $additional_params;
} }
public function get_stream_types()
{
// Transcode is mandatory to keep a consistant stream
return array('transcode');
}
public function get_stream_name()
{
return $this->get_fullname();
}
public function set_played($user, $agent)
{
// Do nothing
}
} // end of channel class } // end of channel class

View file

@ -126,7 +126,7 @@ class Clip extends Video
public function get_parent() public function get_parent()
{ {
if ($this->artist) { if ($this->artist) {
return array('type' => 'artist', 'id' => $this->artist); return array('object_type' => 'artist', 'object_id' => $this->artist);
} }
return null; return null;

View file

@ -246,4 +246,28 @@ class Core
} }
return false; return false;
} }
private static function is_class_typeof($classname, $typeofname)
{
if (class_exists($classname)) {
return in_array($typeofname, array_map('strtolower', class_implements($classname)));
}
return false;
}
public static function is_playable_item($classname)
{
return self::is_class_typeof($classname, 'playable_item');
}
public static function is_library_item($classname)
{
return self::is_class_typeof($classname, 'library_item');
}
public static function is_media($classname)
{
return self::is_class_typeof($classname, 'media');
}
} // Core } // Core

View file

@ -26,23 +26,10 @@
* work, this lists all required functions and the expected * work, this lists all required functions and the expected
* input * input
*/ */
interface library_item interface library_item extends playable_item
{ {
/**
* format
*
* Creates member variables for output
*/
public function format();
public function get_keywords(); public function get_keywords();
public function get_fullname();
public function get_parent();
public function get_childrens();
public function get_user_owner(); public function get_user_owner();
public function get_default_art_kind(); public function get_default_art_kind();

View file

@ -95,6 +95,18 @@ class Live_Stream extends database_object implements media, library_item
{ {
return array(); return array();
} }
public function get_medias($filter_type = null)
{
$medias = array();
if (!$filter_type || $filter_type == 'live_stream') {
$medias[] = array(
'object_type' => 'live_stream',
'object_id' => $this->id
);
}
return $medias;
}
public function get_user_owner() public function get_user_owner()
{ {
@ -251,5 +263,10 @@ class Live_Stream extends database_object implements media, library_item
{ {
} }
public function set_played($user, $agent)
{
// Do nothing
}
} //end of radio class } //end of radio class

View file

@ -59,5 +59,7 @@ interface media
* Get the complete name to display for the stream. * Get the complete name to display for the stream.
*/ */
public function get_stream_name(); public function get_stream_name();
public function set_played($user, $agent);
} // end interface } // end interface

View file

@ -23,7 +23,7 @@
class Movie extends Video class Movie extends Video
{ {
public $original_name; public $original_name;
public $description; public $summary;
public $year; public $year;
public $video; public $video;
@ -63,9 +63,9 @@ class Movie extends Video
*/ */
public static function insert($data, $gtypes = array(), $options = array()) public static function insert($data, $gtypes = array(), $options = array())
{ {
$sql = "INSERT INTO `movie` (`id`,`original_name`,`description`, `year`) " . $sql = "INSERT INTO `movie` (`id`,`original_name`,`summary`, `year`) " .
"VALUES (?, ?, ?, ?)"; "VALUES (?, ?, ?, ?)";
Dba::write($sql, array($data['id'], $data['original_name'], $data['description'], $data['year'])); Dba::write($sql, array($data['id'], $data['original_name'], $data['summary'], $data['year']));
return $data['id']; return $data['id'];
@ -79,8 +79,8 @@ class Movie extends Video
{ {
parent::update($data); parent::update($data);
$sql = "UPDATE `movie` SET `original_name` = ?, `description` = ?, `year` = ? WHERE `id` = ?"; $sql = "UPDATE `movie` SET `original_name` = ?, `summary` = ?, `year` = ? WHERE `id` = ?";
Dba::write($sql, array($data['original_name'], $data['description'], $data['year'], $this->id)); Dba::write($sql, array($data['original_name'], $data['summary'], $data['year'], $this->id));
return $this->id; return $this->id;

View file

@ -23,7 +23,7 @@
class Personal_Video extends Video class Personal_Video extends Video
{ {
public $location; public $location;
public $description; public $summary;
public $video; public $video;
public $f_location; public $f_location;
@ -64,9 +64,9 @@ class Personal_Video extends Video
*/ */
public static function insert($data, $gtypes = array(), $options = array()) public static function insert($data, $gtypes = array(), $options = array())
{ {
$sql = "INSERT INTO `personal_video` (`id`,`location`,`description`) " . $sql = "INSERT INTO `personal_video` (`id`,`location`,`summary`) " .
"VALUES (?, ?, ?)"; "VALUES (?, ?, ?)";
Dba::write($sql, array($data['id'], $data['location'], $data['description'])); Dba::write($sql, array($data['id'], $data['location'], $data['summary']));
return $data['id']; return $data['id'];
@ -80,8 +80,8 @@ class Personal_Video extends Video
{ {
parent::update($data); parent::update($data);
$sql = "UPDATE `personal_video` SET `location` = ?, `description` = ? WHERE `id` = ?"; $sql = "UPDATE `personal_video` SET `location` = ?, `summary` = ? WHERE `id` = ?";
Dba::write($sql, array($data['location'], $data['description'], $this->id)); Dba::write($sql, array($data['location'], $data['summary'], $this->id));
return $this->id; return $this->id;

View file

@ -0,0 +1,66 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* 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.
*/
/**
* playable_item Interface
*
* This defines how the playable item file classes should
* work, this lists all required functions and the expected
* input
*/
interface playable_item
{
/**
* format
*
* Creates member variables for output
*/
public function format();
/**
* get_fullname
*
* Get the item full name.
*/
public function get_fullname();
/**
* get_parent
*
* Get parent. Return parent `object_type`, `object_id` ; null otherwise.
*/
public function get_parent();
/**
* get_childrens
*
* Get direct childrens. Return an array of `object_type`, `object_id` childrens.
*/
public function get_childrens();
/*
* get_medias
*
* Get all medias from all childrens. Return an array of `object_type`, `object_id` medias.
*/
public function get_medias($filter_type = null);
} // end interface

View file

@ -27,7 +27,7 @@
* This class handles playlists in ampache. it references the playlist* tables * This class handles playlists in ampache. it references the playlist* tables
* *
*/ */
class Playlist extends playlist_object implements library_item class Playlist extends playlist_object
{ {
/* Variables from the database */ /* Variables from the database */
public $genre; public $genre;
@ -126,45 +126,6 @@ class Playlist extends playlist_object implements library_item
} // format } // format
public function get_keywords()
{
return array();
}
public function get_fullname()
{
return $this->f_name;
}
public function get_parent()
{
return null;
}
public function get_childrens()
{
$childrens = array();
$items = $this->get_items();
foreach ($items as $item) {
if (!in_array($item['object_type'], $childrens)) {
$childrens[$item['object_type']] = array();
}
$childrens[$item['object_type']][] = $item['object_id'];
}
return $childrens;
}
public function get_user_owner()
{
return $this->user;
}
public function get_default_art_kind()
{
return 'default';
}
/** /**
* get_track * get_track
* Returns the single item on the playlist and all of it's information, restrict * Returns the single item on the playlist and all of it's information, restrict

View file

@ -24,7 +24,7 @@
* playlist_object * playlist_object
* Abstracting out functionality needed by both normal and smart playlists * Abstracting out functionality needed by both normal and smart playlists
*/ */
abstract class playlist_object extends database_object abstract class playlist_object extends database_object implements library_item
{ {
// Database variables // Database variables
public $id; public $id;
@ -35,6 +35,8 @@ abstract class playlist_object extends database_object
public $f_type; public $f_type;
public $f_name; public $f_name;
public $f_user; public $f_user;
public abstract function get_items();
/** /**
* format * format
@ -69,6 +71,59 @@ abstract class playlist_object extends database_object
} }
} // has_access } // has_access
public function get_medias($filter_type = null)
{
$medias = $this->get_items();
if ($filter_type) {
$nmedias = array();
foreach ($medias as $media) {
if ($media['object_type'] == $filter_type) {
$nmedias[] = $media;
}
}
}
return $medias;
}
public function get_keywords()
{
return array();
}
public function get_fullname()
{
return $this->f_name;
}
public function get_parent()
{
return null;
}
public function get_childrens()
{
$childrens = array();
$items = $this->get_items();
foreach ($items as $item) {
if (!in_array($item['object_type'], $childrens)) {
$childrens[$item['object_type']] = array();
}
$childrens[$item['object_type']][] = $item['object_id'];
}
return $this->get_items();
}
public function get_user_owner()
{
return $this->user;
}
public function get_default_art_kind()
{
return 'default';
}
} // end playlist_object } // end playlist_object

View file

@ -25,7 +25,7 @@
* Search-related voodoo. Beware tentacles. * Search-related voodoo. Beware tentacles.
*/ */
class Search extends playlist_object implements library_item class Search extends playlist_object
{ {
public $searchtype; public $searchtype;
public $rules; public $rules;
@ -622,45 +622,6 @@ class Search extends playlist_object implements library_item
$this->f_name_link = '<a href="' . $this->f_link . '">' . $this->f_name . '</a>'; $this->f_name_link = '<a href="' . $this->f_link . '">' . $this->f_name . '</a>';
} }
public function get_keywords()
{
return array();
}
public function get_fullname()
{
return $this->f_name;
}
public function get_parent()
{
return null;
}
public function get_childrens()
{
$childrens = array();
$items = $this->get_items();
foreach ($items as $item) {
if (!in_array($item['object_type'], $childrens)) {
$childrens[$item['object_type']] = array();
}
$childrens[$item['object_type']][] = $item['object_id'];
}
return $childrens;
}
public function get_user_owner()
{
return $this->user;
}
public function get_default_art_kind()
{
return 'default';
}
/** /**
* get_items * get_items
* *

View file

@ -508,16 +508,20 @@ class Song extends database_object implements media, library_item
/** /**
* set_played * set_played
* this checks to see if the current object has been played * this checks to see if the current object has been played
* if not then it sets it to played * if not then it sets it to played. In any case it updates stats.
*/ */
public function set_played() public function set_played($user, $agent)
{ {
Stats::insert('song', $this->id, $user, $agent);
Stats::insert('album', $this->id, $user, $agent);
Stats::insert('artist', $this->id, $user, $agent);
if ($this->played) { if ($this->played) {
return true; return true;
} }
/* If it hasn't been played, set it! */ /* If it hasn't been played, set it! */
self::update_played('1',$this->id); self::update_played('1', $this->id);
return true; return true;
@ -976,13 +980,25 @@ class Song extends database_object implements media, library_item
public function get_parent() public function get_parent()
{ {
return array('type' => 'album', 'id' => $this->album); return array('object_type' => 'album', 'object_id' => $this->album);
} }
public function get_childrens() public function get_childrens()
{ {
return array(); return array();
} }
public function get_medias($filter_type = null)
{
$medias = array();
if (!$filter_type || $filter_type == 'song') {
$medias[] = array(
'object_type' => 'song',
'object_id' => $this->id
);
}
return $medias;
}
public function get_user_owner() public function get_user_owner()
{ {
@ -1263,7 +1279,7 @@ class Song extends database_object implements media, library_item
{ {
$actions = Song::get_custom_play_actions(); $actions = Song::get_custom_play_actions();
foreach ($actions as $action) { foreach ($actions as $action) {
echo Ajax::button('?page=stream&action=directplay&playtype=song&song_id=' . $this->id . '&custom_play_action=' . $action['index'], $action['icon'], T_($action['title']), $action['icon'] . '_song_' . $this->id); echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $this->id . '&custom_play_action=' . $action['index'], $action['icon'], T_($action['title']), $action['icon'] . '_song_' . $this->id);
} }
} }

View file

@ -20,7 +20,7 @@
* *
*/ */
class Song_Preview extends database_object implements media class Song_Preview extends database_object implements media, playable_item
{ {
public $id; public $id;
public $file; public $file;
@ -219,6 +219,34 @@ class Song_Preview extends database_object implements media
return true; return true;
} // format } // format
public function get_fullname()
{
return $this->f_name;
}
public function get_parent()
{
// Wanted album is not part of the library, cannot return it.
return null;
}
public function get_childrens()
{
return array();
}
public function get_medias($filter_type = null)
{
$medias = array();
if (!$filter_type || $filter_type == 'song_preview') {
$medias[] = array(
'object_type' => 'song_preview',
'object_id' => $this>-id
);
}
return $medias;
}
/** /**
* play_url * play_url
@ -259,6 +287,11 @@ class Song_Preview extends database_object implements media
{ {
return $this->title; return $this->title;
} }
public function set_played($user, $agent)
{
// Do nothing
}
public static function get_song_previews($album_mbid) public static function get_song_previews($album_mbid)
{ {

View file

@ -338,9 +338,15 @@ class Stats
public static function get_newest_sql($type, $catalog=0) public static function get_newest_sql($type, $catalog=0)
{ {
$type = self::validate_type($type); $type = self::validate_type($type);
$base_type = 'song';
if ($type == 'video') {
$base_type = $type;
$type = $type . '`.`id';
}
$sql = "SELECT DISTINCT(`$type`) as `id`, MIN(`addition_time`) AS `real_atime` FROM `song` "; $sql = "SELECT DISTINCT(`$type`) as `id`, MIN(`addition_time`) AS `real_atime` FROM `" . $base_type . "` ";
$sql .= "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` "; $sql .= "LEFT JOIN `catalog` ON `catalog`.`id` = `" . $base_type . "`.`catalog` ";
if (AmpConfig::get('catalog_disable')) { if (AmpConfig::get('catalog_disable')) {
$sql .= "WHERE `catalog`.`enabled` = '1' "; $sql .= "WHERE `catalog`.`enabled` = '1' ";
} }
@ -348,6 +354,7 @@ class Stats
$sql .= "AND `catalog` = '" . scrub_in($catalog) ."' "; $sql .= "AND `catalog` = '" . scrub_in($catalog) ."' ";
} }
$sql .= "GROUP BY `$type` ORDER BY `real_atime` DESC "; $sql .= "GROUP BY `$type` ORDER BY `real_atime` DESC ";
return $sql; return $sql;
} }

View file

@ -91,7 +91,7 @@ class Tag extends database_object implements library_item
{ {
if (!is_array($ids) OR !count($ids)) { return false; } if (!is_array($ids) OR !count($ids)) { return false; }
if (!Catalog::is_library_item($type)) if (!Core::is_library_item($type))
return false; return false;
$idlist = '(' . implode(',',$ids) . ')'; $idlist = '(' . implode(',',$ids) . ')';
@ -131,7 +131,7 @@ class Tag extends database_object implements library_item
*/ */
public static function add($type, $id, $value, $user=false) public static function add($type, $id, $value, $user=false)
{ {
if (!Catalog::is_library_item($type)) if (!Core::is_library_item($type))
return false; return false;
if (!is_numeric($id)) { return false; } if (!is_numeric($id)) { return false; }
@ -254,7 +254,7 @@ class Tag extends database_object implements library_item
{ {
$uid = ($user == '') ? intval($GLOBALS['user']->id) : intval($user); $uid = ($user == '') ? intval($GLOBALS['user']->id) : intval($user);
$tag_id = intval($tag_id); $tag_id = intval($tag_id);
if (!Catalog::is_library_item($type)) if (!Core::is_library_item($type))
return false; return false;
$id = intval($object_id); $id = intval($object_id);
@ -361,7 +361,7 @@ class Tag extends database_object implements library_item
*/ */
public static function tag_map_exists($type,$object_id,$tag_id,$user) public static function tag_map_exists($type,$object_id,$tag_id,$user)
{ {
if (!Catalog::is_library_item($type)) if (!Core::is_library_item($type))
return false; return false;
$sql = "SELECT * FROM `tag_map` LEFT JOIN `tag` ON `tag`.`id` = `tag_map`.`tag_id` " . $sql = "SELECT * FROM `tag_map` LEFT JOIN `tag` ON `tag`.`id` = `tag_map`.`tag_id` " .
@ -380,7 +380,7 @@ class Tag extends database_object implements library_item
*/ */
public static function get_top_tags($type, $object_id, $limit = 10) public static function get_top_tags($type, $object_id, $limit = 10)
{ {
if (!Catalog::is_library_item($type)) if (!Core::is_library_item($type))
return false; return false;
$object_id = intval($object_id); $object_id = intval($object_id);
@ -410,7 +410,7 @@ class Tag extends database_object implements library_item
*/ */
public static function get_object_tags($type, $id) public static function get_object_tags($type, $id)
{ {
if (!Catalog::is_library_item($type)) if (!Core::is_library_item($type))
return false; return false;
$sql = "SELECT `tag_map`.`id`, `tag`.`name`, `tag_map`.`user` FROM `tag` " . $sql = "SELECT `tag_map`.`id`, `tag`.`name`, `tag_map`.`user` FROM `tag` " .
@ -433,7 +433,7 @@ class Tag extends database_object implements library_item
*/ */
public static function get_tag_objects($type,$tag_id,$count='',$offset='') public static function get_tag_objects($type,$tag_id,$count='',$offset='')
{ {
if (!Catalog::is_library_item($type)) if (!Core::is_library_item($type))
return false; return false;
$limit_sql = ""; $limit_sql = "";
@ -609,7 +609,7 @@ class Tag extends database_object implements library_item
*/ */
public function remove_map($type,$object_id) public function remove_map($type,$object_id)
{ {
if (!Catalog::is_library_item($type)) if (!Core::is_library_item($type))
return false; return false;
$sql = "DELETE FROM `tag_map` WHERE `tag_id` = ? AND `object_type` = ? AND `object_id` = ? AND `user` = ?"; $sql = "DELETE FROM `tag_map` WHERE `tag_id` = ? AND `object_type` = ? AND `object_id` = ? AND `user` = ?";
@ -648,6 +648,21 @@ class Tag extends database_object implements library_item
{ {
return array(); return array();
} }
public function get_medias($filter_type = null)
{
$medias = array();
if ($filter_type) {
$ids = Tag::get_tag_objects($filter_type, $this->id);
foreach ($ids as $id) {
$medias[] = array(
'object_type' => $filter_type,
'object_id' => $id
);
}
}
return $medias;
}
public function get_user_owner() public function get_user_owner()
{ {

View file

@ -321,6 +321,13 @@ class Tmp_Playlist extends database_object
return true; return true;
} // add_object } // add_object
public function add_medias($medias)
{
foreach ($medias as $media) {
$this->add_object($media['object_id'], $media['object_type']);
}
}
/** /**
* vote_active * vote_active

View file

@ -25,7 +25,7 @@ class TVShow extends database_object implements library_item
/* Variables from DB */ /* Variables from DB */
public $id; public $id;
public $name; public $name;
public $description; public $summary;
public $year; public $year;
public $tags; public $tags;
@ -212,6 +212,21 @@ class TVShow extends database_object implements library_item
{ {
return array('tvshow_season' => $this->get_seasons()); return array('tvshow_season' => $this->get_seasons());
} }
public function get_medias($filter_type = null)
{
$medias = array();
if (!$filter_type || $filter_type == 'video') {
$episodes = $this->get_episodes();
foreach ($episodes as $episode_id) {
$medias[] = array(
'object_type' => 'video',
'object_id' => $episode_id
);
}
}
return $medias;
}
public function get_user_owner() public function get_user_owner()
{ {
@ -301,8 +316,8 @@ class TVShow extends database_object implements library_item
} // end if it changed } // end if it changed
} }
$sql = 'UPDATE `tvshow` SET `name` = ?, `year` = ?, `description` = ? WHERE `id` = ?'; $sql = 'UPDATE `tvshow` SET `name` = ?, `year` = ?, `summary` = ? WHERE `id` = ?';
Dba::write($sql, array($data['name'], $data['year'], $data['description'], $current_id)); Dba::write($sql, array($data['name'], $data['year'], $data['summary'], $current_id));
$override_childs = false; $override_childs = false;
if ($data['apply_childs'] == 'checked') { if ($data['apply_childs'] == 'checked') {

View file

@ -25,7 +25,7 @@ class TVShow_Episode extends Video
public $original_name; public $original_name;
public $season; public $season;
public $episode_number; public $episode_number;
public $description; public $summary;
public $f_link; public $f_link;
public $f_season; public $f_season;
@ -107,9 +107,9 @@ class TVShow_Episode extends Video
*/ */
public static function create($data) public static function create($data)
{ {
$sql = "INSERT INTO `tvshow_episode` (`id`, `original_name`, `season`, `episode_number`, `description`) " . $sql = "INSERT INTO `tvshow_episode` (`id`, `original_name`, `season`, `episode_number`, `summary`) " .
"VALUES (?, ?, ?, ?, ?)"; "VALUES (?, ?, ?, ?, ?)";
Dba::write($sql, array($data['id'], $data['original_name'], $data['tvshow_season'], $data['tvshow_episode'], $data['description'])); Dba::write($sql, array($data['id'], $data['original_name'], $data['tvshow_season'], $data['tvshow_episode'], $data['summary']));
return $data['id']; return $data['id'];
@ -122,9 +122,8 @@ class TVShow_Episode extends Video
public function update($data) public function update($data)
{ {
parent::update($data); parent::update($data);
$sql = "UPDATE `tvshow_episode` SET `original_name` = ?, `season` = ?, `episode_number` = ?, `summary` = ? WHERE `id` = ?";
$sql = "UPDATE `tvshow_episode` SET `original_name` = ?, `season` = ?, `episode_number` = ?, `description` = ? WHERE `id` = ?"; Dba::write($sql, array($data['original_name'], $data['tvshow_season'], $data['tvshow_episode'], $data['summary'], $this->id));
Dba::write($sql, array($data['original_name'], $data['tvshow_season'], $data['tvshow_episode'], $data['description'], $this->id));
return $this->id; return $this->id;
@ -182,7 +181,13 @@ class TVShow_Episode extends Video
public function get_parent() public function get_parent()
{ {
return array('type' => 'tvshow_season', 'id' => $this->season); return array('object_type' => 'tvshow_season', 'object_id' => $this->season);
} }
public function get_release_item_art()
{
return array('object_type' => 'tvshow_season',
'object_id' => $this->season
);
}
} }

View file

@ -167,13 +167,28 @@ class TVShow_Season extends database_object implements library_item
public function get_parent() public function get_parent()
{ {
return array('type' => 'tvshow', 'id' => $this->tvshow); return array('object_type' => 'tvshow', 'object_id' => $this->tvshow);
} }
public function get_childrens() public function get_childrens()
{ {
return array('tvshow_episode' => $this->get_episodes()); return array('tvshow_episode' => $this->get_episodes());
} }
public function get_medias($filter_type = null)
{
$medias = array();
if (!$filter_type || $filter_type == 'video') {
$episodes = $this->get_episodes();
foreach ($episodes as $episode_id) {
$medias[] = array(
'object_type' => 'video',
'object_id' => $episode_id
);
}
}
return $medias;
}
public function get_user_owner() public function get_user_owner()
{ {
@ -246,8 +261,8 @@ class TVShow_Season extends database_object implements library_item
*/ */
public function update($data) public function update($data)
{ {
$sql = 'UPDATE `tvshow_season` SET `season_number` = ? WHERE `id` = ?'; $sql = 'UPDATE `tvshow_season` SET `season_number` = ?, `tvshow` = ? WHERE `id` = ?';
Dba::write($sql, array($data['season_number'], $this->id)); Dba::write($sql, array($data['season_number'], $data['tvshow'], $this->id));
return $this->id; return $this->id;
} // update } // update

View file

@ -2712,13 +2712,14 @@ class Update
*/ */
public static function update_370009() public static function update_370009()
{ {
$sql = "ALTER TABLE `video` ADD `release_date` int(11) unsigned NULL AFTER `enabled`"; $sql = "ALTER TABLE `video` ADD `release_date` int(11) unsigned NULL AFTER `enabled`, " .
"`played` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `enabled`";
Dba::write($sql); Dba::write($sql);
$sql = "CREATE TABLE `tvshow` (" . $sql = "CREATE TABLE `tvshow` (" .
"`id` int(11) unsigned NOT NULL AUTO_INCREMENT," . "`id` int(11) unsigned NOT NULL AUTO_INCREMENT," .
"`name` varchar(80) NOT NULL," . "`name` varchar(80) NOT NULL," .
"`description` varchar(256) NULL," . "`summary` varchar(256) NULL," .
"`year` int(11) unsigned NULL," . "`year` int(11) unsigned NULL," .
"PRIMARY KEY (`id`)) ENGINE = MYISAM"; "PRIMARY KEY (`id`)) ENGINE = MYISAM";
Dba::write($sql); Dba::write($sql);
@ -2735,14 +2736,14 @@ class Update
"`original_name` varchar(80) NULL," . "`original_name` varchar(80) NULL," .
"`season` int(11) unsigned NOT NULL," . "`season` int(11) unsigned NOT NULL," .
"`episode_number` int(11) unsigned NOT NULL," . "`episode_number` int(11) unsigned NOT NULL," .
"`description` varchar(256) NULL," . "`summary` varchar(256) NULL," .
"PRIMARY KEY (`id`)) ENGINE = MYISAM"; "PRIMARY KEY (`id`)) ENGINE = MYISAM";
Dba::write($sql); Dba::write($sql);
$sql = "CREATE TABLE `movie` (" . $sql = "CREATE TABLE `movie` (" .
"`id` int(11) unsigned NOT NULL," . "`id` int(11) unsigned NOT NULL," .
"`original_name` varchar(80) NULL," . "`original_name` varchar(80) NULL," .
"`description` varchar(256) NULL," . "`summary` varchar(256) NULL," .
"`year` int(11) unsigned NULL," . "`year` int(11) unsigned NULL," .
"PRIMARY KEY (`id`)) ENGINE = MYISAM"; "PRIMARY KEY (`id`)) ENGINE = MYISAM";
Dba::write($sql); Dba::write($sql);
@ -2750,7 +2751,7 @@ class Update
$sql = "CREATE TABLE `personal_video` (" . $sql = "CREATE TABLE `personal_video` (" .
"`id` int(11) unsigned NOT NULL," . "`id` int(11) unsigned NOT NULL," .
"`location` varchar(256) NULL," . "`location` varchar(256) NULL," .
"`description` varchar(256) NULL," . "`summary` varchar(256) NULL," .
"PRIMARY KEY (`id`)) ENGINE = MYISAM"; "PRIMARY KEY (`id`)) ENGINE = MYISAM";
Dba::write($sql); Dba::write($sql);

View file

@ -694,46 +694,44 @@ class User extends database_object
* update_user_stats * update_user_stats
* updates the playcount mojo for this specific user * updates the playcount mojo for this specific user
*/ */
public function update_stats($song_id, $agent = '') public function update_stats($media_type, $media_id, $agent = '')
{ {
debug_event('user.class.php', 'Updating stats for {'.$song_id.'} {'.$agent.'}...', '5'); debug_event('user.class.php', 'Updating stats for {'.$media_type.'/'.$media_id.'} {'.$agent.'}...', '5');
$song_info = new Song($song_id); $media = new $media_type($media_id);
$song_info->format(); $media->format();
$user = $this->id; $user = $this->id;
if (!strlen($song_info->file)) { return false; } // We shouldn't test on file only
if (!strlen($media->file)) { return false; }
$this->set_preferences(); $this->set_preferences();
// If pthreads available, we call save_songplay in a new thread to quickly return // If pthreads available, we call save_songplay in a new thread to quickly return
if (class_exists("Thread", false)) { if (class_exists("Thread", false)) {
debug_event('user.class.php', 'Calling save_songplay plugins in a new thread...', '5'); debug_event('user.class.php', 'Calling save_mediaplay plugins in a new thread...', '5');
$thread = new scrobbler_async($GLOBALS['user'], $song_info); $thread = new scrobbler_async($GLOBALS['user'], $media);
if ($thread->start()) { if ($thread->start()) {
//$thread->join(); //$thread->join();
} else { } else {
debug_event('user.class.php', 'Error when starting the thread.', '1'); debug_event('user.class.php', 'Error when starting the thread.', '1');
} }
} else { } else {
User::save_songplay($GLOBALS['user'], $song_info); User::save_mediaplay($GLOBALS['user'], $media);
} }
// Do this last so the 'last played checks are correct' $media->set_played($user, $agent);
Stats::insert('song', $song_id, $user, $agent);
Stats::insert('album', $song_info->album, $user, $agent);
Stats::insert('artist', $song_info->artist, $user, $agent);
return true; return true;
} // update_stats } // update_stats
public static function save_songplay($user, $song_info) public static function save_mediaplay($user, $media)
{ {
foreach (Plugin::get_plugins('save_songplay') as $plugin_name) { foreach (Plugin::get_plugins('save_mediaplay') as $plugin_name) {
try { try {
$plugin = new Plugin($plugin_name); $plugin = new Plugin($plugin_name);
if ($plugin->load($user)) { if ($plugin->load($user)) {
$plugin->_plugin->save_songplay($song_info); $plugin->_plugin->save_mediaplay($media);
} }
} catch (Exception $e) { } catch (Exception $e) {
debug_event('user.class.php', 'Stats plugin error: ' . $e->getMessage(), '1'); debug_event('user.class.php', 'Stats plugin error: ' . $e->getMessage(), '1');

View file

@ -24,6 +24,7 @@ class Video extends database_object implements media, library_item
{ {
public $id; public $id;
public $title; public $title;
public $played;
public $enabled; public $enabled;
public $file; public $file;
public $size; public $size;
@ -162,6 +163,18 @@ class Video extends database_object implements media, library_item
{ {
return array(); return array();
} }
public function get_medias($filter_type = null)
{
$medias = array();
if (!$filter_type || $filter_type == 'video') {
$medias[] = array(
'object_type' => 'video',
'object_id' => $this->id
);
}
return $medias;
}
public function get_user_owner() public function get_user_owner()
{ {
@ -332,12 +345,22 @@ class Video extends database_object implements media, library_item
*/ */
public function update($data) public function update($data)
{ {
$f_release_date = $data['f_release_date'];
$release_date = date_parse_from_format('Y-m-d', $f_release_date);
$sql = "UPDATE `video` SET `title` = ?, `release_date` = ? WHERE `id` = ?"; $sql = "UPDATE `video` SET `title` = ?, `release_date` = ? WHERE `id` = ?";
Dba::write($sql, array($data['title'], $data['release_date'], $this->id)); Dba::write($sql, array($data['title'], $release_date, $this->id));
return $this->id; return $this->id;
} // update } // update
public function get_release_item_art()
{
return array('object_type' => 'video',
'object_id' => $this->id
);
}
/* /*
* generate_preview * generate_preview
@ -352,5 +375,88 @@ class Video extends database_object implements media, library_item
$artp->insert($image, 'image/png'); $artp->insert($image, 'image/png');
} }
} }
/**
* get_random
*
* This returns a number of random videos.
*/
public static function get_random($count = 1)
{
$results = array();
if (!$count) {
$count = 1;
}
$sql = "SELECT DISTINCT(`video`.`id`) FROM `video` ";
$where = "WHERE `video`.`enabled` = '1' ";
if (AmpConfig::get('catalog_disable')) {
$sql .= "LEFT JOIN `catalog` ON `catalog`.`id` = `video`.`catalog` ";
$where .= "AND `catalog`.`enabled` = '1' ";
}
$sql .= $where;
$sql .= "ORDER BY RAND() LIMIT " . intval($count);
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
$results[] = $row['id'];
}
return $results;
}
/**
* set_played
* this checks to see if the current object has been played
* if not then it sets it to played. In any case it updates stats.
*/
public function set_played($user, $agent)
{
Stats::insert('video', $this->id, $user, $agent);
if ($this->played) {
return true;
}
/* If it hasn't been played, set it! */
Video::update_played('1', $this->id);
return true;
} // set_played
/**
* update_played
* sets the played flag
*/
public static function update_played($new_played,$song_id)
{
self::_update_item('played',$new_played,$song_id,'25');
} // update_played
/**
* _update_item
* This is a private function that should only be called from within the video class.
* It takes a field, value video id and level. first and foremost it checks the level
* against $GLOBALS['user'] to make sure they are allowed to update this record
* it then updates it and sets $this->{$field} to the new value
*/
private static function _update_item($field, $value, $song_id, $level)
{
/* Check them Rights! */
if (!Access::check('interface',$level)) { return false; }
/* Can't update to blank */
if (!strlen(trim($value))) { return false; }
$sql = "UPDATE `video` SET `$field` = ? WHERE `id` = ?";
Dba::write($sql, array($value, $song_id));
return true;
} // _update_item
} // end Video class } // end Video class

View file

@ -85,7 +85,7 @@ class WebPlayer
$media = null; $media = null;
$urlinfo = Stream_URL::parse($item->url); $urlinfo = Stream_URL::parse($item->url);
if ($urlinfo['id'] && Catalog::is_media($urlinfo['type'])) { if ($urlinfo['id'] && Core::is_media($urlinfo['type'])) {
$media = new $urlinfo['type']($urlinfo['id']); $media = new $urlinfo['type']($urlinfo['id']);
} else if ($urlinfo['id'] && $urlinfo['type'] == 'song_preview') { } else if ($urlinfo['id'] && $urlinfo['type'] == 'song_preview') {
$media = new Song_Preview($urlinfo['id']); $media = new Song_Preview($urlinfo['id']);

View file

@ -79,9 +79,10 @@ require_once $prefix . '/lib/batch.lib.php';
require_once $prefix . '/lib/themes.php'; require_once $prefix . '/lib/themes.php';
require_once $prefix . '/lib/class/localplay_controller.abstract.php'; require_once $prefix . '/lib/class/localplay_controller.abstract.php';
require_once $prefix . '/lib/class/database_object.abstract.php'; require_once $prefix . '/lib/class/database_object.abstract.php';
require_once $prefix . '/lib/class/playlist_object.abstract.php';
require_once $prefix . '/lib/class/media.interface.php'; require_once $prefix . '/lib/class/media.interface.php';
require_once $prefix . '/lib/class/playable_item.interface.php';
require_once $prefix . '/lib/class/library_item.interface.php'; require_once $prefix . '/lib/class/library_item.interface.php';
require_once $prefix . '/lib/class/playlist_object.abstract.php';
require_once $prefix . '/modules/horde/Browser.php'; require_once $prefix . '/modules/horde/Browser.php';
/* Set up the flip class */ /* Set up the flip class */

View file

@ -274,12 +274,12 @@ function show_artist_select($name='artist', $artist_id=0, $allow_add=false, $son
* This is the same as show_album_select except it's *gasp* for tvshows! How * This is the same as show_album_select except it's *gasp* for tvshows! How
* inventive! * inventive!
*/ */
function show_tvshow_select($name='tvshow', $tvshow_id=0, $allow_add=false, $tvshow_id=0, $allow_none=false) function show_tvshow_select($name='tvshow', $tvshow_id=0, $allow_add=false, $season_id=0, $allow_none=false)
{ {
static $tvshow_id_cnt = 0; static $tvshow_id_cnt = 0;
// Generate key to use for HTML element ID // Generate key to use for HTML element ID
if ($tvshow_id) { if ($season_id) {
$key = $name . "_select_" . $tvshow_id; $key = $name . "_select_" . $season_id;
} else { } else {
$key = $name . "_select_c" . ++$tvshow_id_cnt; $key = $name . "_select_c" . ++$tvshow_id_cnt;
} }
@ -312,6 +312,48 @@ function show_tvshow_select($name='tvshow', $tvshow_id=0, $allow_add=false, $tvs
} // show_tvshow_select } // show_tvshow_select
function show_tvshow_season_select($name='tvshow_season', $season_id, $allow_add=false, $video_id=0, $allow_none=false)
{
if (!$season_id)
return false;
$season = new TVShow_Season($season_id);
static $season_id_cnt = 0;
// Generate key to use for HTML element ID
if ($video_id) {
$key = $name . "_select_" . $video_id;
} else {
$key = $name . "_select_c" . ++$season_id_cnt;
}
echo "<select name=\"$name\" id=\"$key\">\n";
if ($allow_none) {
echo "\t<option value=\"-2\"></option>\n";
}
$sql = "SELECT `id`, `season_number` FROM `tvshow_season` WHERE `tvshow` = ? ORDER BY `season_number`";
$db_results = Dba::read($sql, array($season->tvshow));
while ($r = Dba::fetch_assoc($db_results)) {
$selected = '';
if ($r['id'] == $season_id) {
$selected = "selected=\"selected\"";
}
echo "\t<option value=\"" . $r['id'] . "\" $selected>" . scrub_out($r['season_number']) . "</option>\n";
} // end while
if ($allow_add) {
// Append additional option to the end with value=-1
echo "\t<option value=\"-1\">Add New...</option>\n";
}
echo "</select>\n";
}
/** /**
* show_catalog_select * show_catalog_select
* Yet another one of these buggers. this shows a drop down of all of your * Yet another one of these buggers. this shows a drop down of all of your
@ -653,6 +695,7 @@ function show_now_playing()
$web_path = AmpConfig::get('web_path'); $web_path = AmpConfig::get('web_path');
$results = Stream::get_now_playing(); $results = Stream::get_now_playing();
debug_event('aa',print_r($results, true), 5);
require_once AmpConfig::get('prefix') . '/templates/show_now_playing.inc.php'; require_once AmpConfig::get('prefix') . '/templates/show_now_playing.inc.php';
} // show_now_playing } // show_now_playing

View file

@ -91,8 +91,11 @@ class Ampachegrowl {
* save_songplay * save_songplay
* This takes care of queueing and then submitting the tracks. * This takes care of queueing and then submitting the tracks.
*/ */
public function save_songplay($song) { public function save_mediaplay($song) {
// Only support songs
if (strtolower(get_class($song)) != 'song') return false;
// Before we start let's pull the last song submitted by this user // Before we start let's pull the last song submitted by this user
$previous = Stats::get_last_song($this->user_id); $previous = Stats::get_last_song($this->user_id);
$user = new User($this->user_id); $user = new User($this->user_id);

View file

@ -102,8 +102,10 @@ class AmpacheLastfm {
* save_songplay * save_songplay
* This takes care of queueing and then submitting the tracks. * This takes care of queueing and then submitting the tracks.
*/ */
public function save_songplay($song) { public function save_mediaplay($song) {
// Only support songs
if (strtolower(get_class($song)) != 'song') return false;
// Let's pull the last song submitted by this user // Let's pull the last song submitted by this user
$previous = Stats::get_last_song($this->user_id); $previous = Stats::get_last_song($this->user_id);

View file

@ -102,8 +102,11 @@ class Ampachelibrefm {
* save_songplay * save_songplay
* This takes care of queueing and then submitting the tracks. * This takes care of queueing and then submitting the tracks.
*/ */
public function save_songplay($song) { public function save_mediaplay($song) {
// Only support songs
if (strtolower(get_class($song)) != 'song') return false;
// Before we start let's pull the last song submitted by this user // Before we start let's pull the last song submitted by this user
$previous = Stats::get_last_song($this->user_id); $previous = Stats::get_last_song($this->user_id);

View file

@ -405,10 +405,7 @@ if (!is_resource($fp)) {
} }
header('ETag: ' . $media->id); header('ETag: ' . $media->id);
// Put this song in the now_playing table only if it's a song for now... Stream::insert_now_playing($media->id, $uid, $media->time, $sid, get_class($media));
if ($type == 'song') {
Stream::insert_now_playing($media->id, $uid, $media->time, $sid, get_class($media));
}
// Handle Content-Range // Handle Content-Range
@ -444,6 +441,21 @@ if ($range_values > 0 && ($start > 0 || $end > 0)) {
debug_event('play','Starting stream of ' . $media->file . ' with size ' . $media->size, 5); debug_event('play','Starting stream of ' . $media->file . ' with size ' . $media->size, 5);
} }
// Stats registering must be done before play. Do not move it.
// It can be slow because of scrobbler plugins (lastfm, ...)
if ($start > 0) {
debug_event('play', 'Content-Range doesn\'t start from 0, stats should already be registered previously; not collecting stats', 5);
} else {
if (empty($share_id)) {
if ($_SERVER['REQUEST_METHOD'] != 'HEAD') {
debug_event('play', 'Registering stats for {'.$media->get_stream_name() .'}...', '5');
$sessionkey = Stream::$session;
$agent = Session::agent($sessionkey);
$GLOBALS['user']->update_stats($type, $media->id, $agent);
}
}
}
if ($transcode || $demo_id) { if ($transcode || $demo_id) {
header('Accept-Ranges: none'); header('Accept-Ranges: none');
} else { } else {
@ -476,23 +488,6 @@ if ($bytes_streamed < $stream_size && (connection_status() == 0)) {
$bytes_streamed = $stream_size; $bytes_streamed = $stream_size;
} }
if ($start > 0) {
debug_event('play', 'Content-Range doesn\'t start from 0, stats should already be registered previously; not collecting stats', 5);
} else if ($real_bytes_streamed > 0) {
// FIXME: support other media types
if ($type == 'song' && empty($share_id)) {
if ($_SERVER['REQUEST_METHOD'] != 'HEAD') {
debug_event('play', 'Registering stats for {'.$media->title.'}...', '5');
$sessionkey = Stream::$session;
//debug_event('play', 'Current session key {'.$sessionkey.'}', '5');
$agent = Session::agent($sessionkey);
//debug_event('play', 'Current session agent {'.$agent.'}', '5');
$GLOBALS['user']->update_stats($media->id, $agent);
$media->set_played();
}
}
}
// If this is a democratic playlist remove the entry. // If this is a democratic playlist remove the entry.
// We do this regardless of play amount. // We do this regardless of play amount.
if ($demo_id && isset($democratic)) { $democratic->delete_from_oid($oid, $type); } if ($demo_id && isset($democratic)) { $democratic->delete_from_oid($oid, $type); }

View file

@ -94,102 +94,60 @@ switch ($_REQUEST['action']) {
break; break;
// Handle the users basketcases... // Handle the users basketcases...
case 'basket': case 'basket':
switch ($_REQUEST['type']) { $object_type = $_REQUEST['type'];
case 'album': $object_id = $_REQUEST['id'];
foreach ($_REQUEST['id'] as $i) {
$object = new $_REQUEST['type']($i); if (Core::is_playable_item($object_type)) {
$songs = $object->get_songs(); if (!is_array($object_id)) {
foreach ($songs as $song_id) { $object_id = array($object_id);
$GLOBALS['user']->playlist->add_object($song_id, 'song'); }
foreach ($object_id as $id) {
$item = new $object_type($id);
$medias = $item->get_medias();
$GLOBALS['user']->playlist->add_medias($medias);
}
} else {
switch ($_REQUEST['type']) {
case 'browse_set':
$browse = new Browse($_REQUEST['browse_id']);
$objects = $browse->get_saved();
foreach ($objects as $object_id) {
$GLOBALS['user']->playlist->add_object($object_id, 'song');
} }
} break;
break; case 'album_random':
case 'artist': $data = explode('_',$_REQUEST['type']);
case 'tag': $type = $data['0'];
$object = new $_REQUEST['type']($_REQUEST['id']); foreach ($_REQUEST['id'] as $i) {
$songs = $object->get_songs(); $object = new $type($i);
foreach ($songs as $song_id) { $songs = $object->get_random_songs();
$GLOBALS['user']->playlist->add_object($song_id,'song'); foreach ($songs as $song_id) {
} $GLOBALS['user']->playlist->add_object($song_id, 'song');
break; }
case 'browse_set': }
$browse = new Browse($_REQUEST['browse_id']); break;
$objects = $browse->get_saved(); case 'artist_random':
foreach ($objects as $object_id) { case 'tag_random':
$GLOBALS['user']->playlist->add_object($object_id,'song'); $data = explode('_',$_REQUEST['type']);
} $type = $data['0'];
break; $object = new $type($_REQUEST['id']);
case 'album_random':
$data = explode('_',$_REQUEST['type']);
$type = $data['0'];
foreach ($_REQUEST['id'] as $i) {
$object = new $type($i);
$songs = $object->get_random_songs(); $songs = $object->get_random_songs();
foreach ($songs as $song_id) { foreach ($songs as $song_id) {
$GLOBALS['user']->playlist->add_object($song_id, 'song'); $GLOBALS['user']->playlist->add_object($song_id,'song');
} }
} break;
break; case 'playlist_random':
case 'artist_random': $playlist = new Playlist($_REQUEST['id']);
case 'tag_random': $items = $playlist->get_random_items();
$data = explode('_',$_REQUEST['type']); foreach ($items as $item) {
$type = $data['0']; $GLOBALS['user']->playlist->add_object($item['object_id'], $item['object_type']);
$object = new $type($_REQUEST['id']);
$songs = $object->get_random_songs();
foreach ($songs as $song_id) {
$GLOBALS['user']->playlist->add_object($song_id,'song');
}
break;
case 'playlist':
$playlist = new Playlist($_REQUEST['id']);
$items = $playlist->get_items();
foreach ($items as $item) {
$GLOBALS['user']->playlist->add_object($item['object_id'], $item['object_type']);
}
break;
case 'playlist_random':
$playlist = new Playlist($_REQUEST['id']);
$items = $playlist->get_random_items();
foreach ($items as $item) {
$GLOBALS['user']->playlist->add_object($item['object_id'], $item['object_type']);
}
break;
case 'smartplaylist':
$playlist = new Search($_REQUEST['id'], 'song');
$items = $playlist->get_items();
foreach ($items as $item) {
$GLOBALS['user']->playlist->add_object($item['object_id'],$item['object_type']);
}
break;
case 'clear_all':
$GLOBALS['user']->playlist->clear();
break;
case 'live_stream':
$object = new Live_Stream($_REQUEST['id']);
// Confirm its a valid ID
if ($object->name) {
$GLOBALS['user']->playlist->add_object($object->id, 'live_stream');
}
break;
case 'video':
$GLOBALS['user']->playlist->add_object($_REQUEST['id'],'video');
break;
case 'album_preview':
$songs = Song_preview::get_song_previews($_REQUEST['mbid']);
foreach ($songs as $song) {
if (!empty($song->file)) {
$GLOBALS['user']->playlist->add_object($song->id, 'song_preview');
} }
} break;
break; case 'clear_all':
case 'song_preview': $GLOBALS['user']->playlist->clear();
$GLOBALS['user']->playlist->add_object($_REQUEST['id'],'song_preview'); break;
break; }
case 'song': }
default:
$GLOBALS['user']->playlist->add_object($_REQUEST['id'],'song');
break;
} // end switch
$results['rightbar'] = UI::ajax_include('rightbar.inc.php'); $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
break; break;

View file

@ -33,7 +33,11 @@ $results = '';
debug_event('edit.server.php', 'Called for action: {'.$_REQUEST['action'].'}', '5'); debug_event('edit.server.php', 'Called for action: {'.$_REQUEST['action'].'}', '5');
$type = $_GET['type']; // Post first
$type = $_POST['type'];
if (empty($type)) {
$type = $_GET['type'];
}
$object_id = $_GET['id']; $object_id = $_GET['id'];
if (empty($type)) { if (empty($type)) {
@ -42,7 +46,7 @@ if (empty($type)) {
$object_type = implode('_', explode('_', $type, -1)); $object_type = implode('_', explode('_', $type, -1));
} }
if (!Catalog::is_library_item($object_type)) { if (!Core::is_library_item($object_type)) {
debug_event('edit.server.php', 'Type `' . $type . '` is not based on an item library.', '3'); debug_event('edit.server.php', 'Type `' . $type . '` is not based on an item library.', '3');
exit(); exit();
} }

View file

@ -37,6 +37,16 @@ switch ($_REQUEST['action']) {
$results['random_selection'] = '<!-- None found -->'; $results['random_selection'] = '<!-- None found -->';
} }
break; break;
case 'random_videos':
$videos = Video::get_random(6, true);
if (count($videos) AND is_array($videos)) {
ob_start();
require_once AmpConfig::get('prefix') . '/templates/show_random_videos.inc.php';
$results['random_video_selection'] = ob_get_clean();
} else {
$results['random_video_selection'] = '<!-- None found -->';
}
break;
case 'artist_info': case 'artist_info':
if (AmpConfig::get('lastfm_api_key') && (isset($_REQUEST['artist']) || isset($_REQUEST['fullname']))) { if (AmpConfig::get('lastfm_api_key') && (isset($_REQUEST['artist']) || isset($_REQUEST['fullname']))) {
if ($_REQUEST['artist']) { if ($_REQUEST['artist']) {

View file

@ -82,14 +82,6 @@ switch ($_REQUEST['action']) {
$songs[] = $item['object_id']; $songs[] = $item['object_id'];
} }
break; break;
case 'album_preview':
$preview_songs = Song_preview::get_song_previews($item_id);
foreach ($preview_songs as $song) {
if (!empty($song->file)) {
$songs[] = $song->id;
}
}
break;
case 'album': case 'album':
debug_event('playlist', 'Adding all songs of album(s) {'.$item_id.'}...', '5'); debug_event('playlist', 'Adding all songs of album(s) {'.$item_id.'}...', '5');
$albums_array = explode(',', $item_id); $albums_array = explode(',', $item_id);

View file

@ -74,48 +74,22 @@ switch ($_REQUEST['action']) {
case 'directplay': case 'directplay':
debug_event('stream.ajax.php', 'Play type {'.$_REQUEST['playtype'].'}', 5); debug_event('stream.ajax.php', 'Play type {'.$_REQUEST['playtype'].'}', 5);
switch ($_REQUEST['playtype']) { $object_type = $_REQUEST['object_type'];
case 'album': $object_id = $_REQUEST['object_id'];
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=album&album_id='.implode(',', $_REQUEST['album_id']); if (is_array($object_id)) {
break; $object_id = implode(',', $object_id);
case 'artist':
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=artist&artist_id='.$_REQUEST['artist_id'];
break;
case 'song':
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=single_song&song_id='.$_REQUEST['song_id'];
if ($_REQUEST['custom_play_action']) {
$_SESSION['iframe']['target'] .= '&custom_play_action=' . $_REQUEST['custom_play_action'];
}
break;
case 'video':
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=single_video&video_id='.$_REQUEST['video_id'];
break;
case 'playlist':
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=playlist&playlist_id='.$_REQUEST['playlist_id'];
break;
case 'smartplaylist':
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=smartplaylist&playlist_id='.$_REQUEST['playlist_id'];
break;
case 'live_stream':
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=live_stream&stream_id='.$_REQUEST['stream_id'];
break;
case 'album_preview':
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=album_preview&mbid='.$_REQUEST['mbid'];
break;
case 'song_preview':
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=song_preview&id='.$_REQUEST['id'];
break;
case 'channel':
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=channel&channel_id='.$_REQUEST['channel_id'];
break;
case 'broadcast':
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=broadcast&broadcast_id='.$_REQUEST['broadcast_id'];
break;
} }
if (!empty($_REQUEST['append'])) {
$_SESSION['iframe']['target'] .= '&append=true'; if (Core::is_playable_item($object_type)) {
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=play_item&object_type=' . $object_type . '&object_id=' . $object_id;
if ($_REQUEST['custom_play_action']) {
$_SESSION['iframe']['target'] .= '&custom_play_action=' . $_REQUEST['custom_play_action'];
}
if (!empty($_REQUEST['append'])) {
$_SESSION['iframe']['target'] .= '&append=true';
}
$results['rfc3514'] = '<script type="text/javascript">reloadUtil(\''. AmpConfig::get('web_path') . '/util.php\');</script>';
} }
$results['rfc3514'] = '<script type="text/javascript">reloadUtil(\''. AmpConfig::get('web_path') . '/util.php\');</script>';
break; break;
case 'basket': case 'basket':
// Go ahead and see if we should clear the playlist here or not, // Go ahead and see if we should clear the playlist here or not,

View file

@ -76,26 +76,21 @@ switch ($_REQUEST['action']) {
break; break;
} // end switch on type } // end switch on type
break; break;
case 'single_song': case 'play_item':
$media_ids[] = array( $object_type = $_REQUEST['object_type'];
'object_type' => 'song', $object_id = $_REQUEST['object_id'];
'object_id' => scrub_in($_REQUEST['song_id']),
'custom_play_action' => $_REQUEST['custom_play_action'] if (Core::is_playable_item($object_type)) {
); $item = new $object_type($object_id);
break; $media_ids = array_merge($media_ids, $item->get_medias());
case 'single_video':
$media_ids[] = array( if ($_REQUEST['custom_play_action']) {
'object_type' => 'video', foreach ($media_ids as $media_id) {
'object_id' => scrub_in($_REQUEST['video_id']) if (is_array($media_id)) {
); $media_id['custom_play_action'] = $_REQUEST['custom_play_action'];
break; }
case 'artist': }
$artist = new Artist($_REQUEST['artist_id']); }
$songs = $artist->get_songs();
foreach ($songs as $song) {
$media_ids[] = array(
'object_type' => 'song',
'object_id' => $song);
} }
break; break;
case 'artist_random': case 'artist_random':
@ -106,38 +101,6 @@ switch ($_REQUEST['action']) {
$album = new Album($_REQUEST['album_id']); $album = new Album($_REQUEST['album_id']);
$media_ids = $album->get_random_songs(); $media_ids = $album->get_random_songs();
break; break;
case 'album':
debug_event('stream.php', 'Playing/Adding all songs of album(s) {'.$_REQUEST['album_id'].'}...', '5');
$albums_array = explode(',', $_REQUEST['album_id']);
foreach ($albums_array as $a) {
$album = new Album($a);
$songs = $album->get_songs();
foreach ($songs as $song) {
$media_ids[] = array(
'object_type' => 'song',
'object_id' => $song);
}
}
break;
case 'playlist':
$playlist = new Playlist($_REQUEST['playlist_id']);
$songs = $playlist->get_songs();
foreach ($songs as $song) {
$media_ids[] = array(
'object_type' => 'song',
'object_id' => $song);
}
break;
case 'smartplaylist':
$playlist = new Search($_REQUEST['playlist_id'], 'song');
$items = $playlist->get_items();
foreach ($items as $item) {
$media_ids[] = array(
'object_type' => $item['object_type'],
'object_id' => $item['object_id']);
}
break;
case 'playlist_random': case 'playlist_random':
$playlist = new Playlist($_REQUEST['playlist_id']); $playlist = new Playlist($_REQUEST['playlist_id']);
$media_ids = $playlist->get_random_items(); $media_ids = $playlist->get_random_items();
@ -171,43 +134,6 @@ switch ($_REQUEST['action']) {
); );
} }
break; break;
case 'live_stream':
$object = new Live_Stream($_REQUEST['stream_id']);
if ($object->name) {
$media_ids[] = array(
'object_type' => 'live_stream',
'object_id' => scrub_in($_REQUEST['stream_id'])
);
}
break;
case 'album_preview':
$songs = Song_preview::get_song_previews($_REQUEST['mbid']);
foreach ($songs as $song) {
if (!empty($song->file)) {
$media_ids[] = array(
'object_type' => 'song_preview',
'object_id' => $song->id);
}
}
break;
case 'song_preview':
$media_ids[] = array(
'object_type' => 'song_preview',
'object_id' => scrub_in($_REQUEST['id'])
);
break;
case 'channel':
$media_ids[] = array(
'object_type' => 'channel',
'object_id' => scrub_in($_REQUEST['channel_id'])
);
break;
case 'broadcast':
$media_ids[] = array(
'object_type' => 'broadcast',
'object_id' => scrub_in($_REQUEST['broadcast_id'])
);
break;
default: default:
break; break;
} // end action switch } // end action switch

View file

@ -64,14 +64,14 @@ if (AmpConfig::get('show_played_times')) {
<ul> <ul>
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<li> <li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id'),'play', T_('Play'),'directplay_full_' . $album->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id'),'play', T_('Play'),'directplay_full_' . $album->id); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id'), T_('Play'),'directplay_full_text_' . $album->id); ?> <?php echo Ajax::text('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id'), T_('Play'),'directplay_full_text_' . $album->id); ?>
</li> </li>
<?php } ?> <?php } ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<li> <li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id') . '&append=true','play_add', T_('Play last'),'addplay_album_' . $album->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id') . '&append=true','play_add', T_('Play last'),'addplay_album_' . $album->id); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id') . '&append=true', T_('Play last'),'addplay_album_text_' . $album->id); ?> <?php echo Ajax::text('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id') . '&append=true', T_('Play last'),'addplay_album_text_' . $album->id); ?>
</li> </li>
<?php } ?> <?php } ?>
<li> <li>

View file

@ -45,14 +45,14 @@ $title = scrub_out($album->name) . '&nbsp;(' . $album->year . ')&nbsp;-&nbsp;' .
<ul> <ul>
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<li> <li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id'), 'play', T_('Play'), 'directplay_full_'); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id'), 'play', T_('Play'), 'directplay_full_'); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id'), T_('Play'), 'directplay_full_text_'); ?> <?php echo Ajax::text('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id'), T_('Play'), 'directplay_full_text_'); ?>
</li> </li>
<?php } ?> <?php } ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<li> <li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id') . '&append=true', 'play_add', T_('Play last'), 'addplay_album_'); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id') . '&append=true', 'play_add', T_('Play last'), 'addplay_album_'); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id') . '&append=true', T_('Play last'), 'addplay_album_text_'); ?> <?php echo Ajax::text('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id') . '&append=true', T_('Play last'), 'addplay_album_text_'); ?>
</li> </li>
<?php } ?> <?php } ?>
<li> <li>

View file

@ -24,9 +24,9 @@
<span class="cel_play_content">&nbsp;</span> <span class="cel_play_content">&nbsp;</span>
<div class="cel_play_hover"> <div class="cel_play_hover">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&' . $libitem->get_http_album_query_ids('album_id'), 'play', T_('Play'), 'play_album_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $libitem->get_http_album_query_ids('object_id'), 'play', T_('Play'), 'play_album_' . $libitem->id); ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&' . $libitem->get_http_album_query_ids('album_id') . '&append=true', 'play_add', T_('Play last'), 'addplay_album_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $libitem->get_http_album_query_ids('object_id') . '&append=true', 'play_add', T_('Play last'), 'addplay_album_' . $libitem->id); ?>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</div> </div>
@ -36,9 +36,9 @@ if (Art::is_enabled()) {
$name = '[' . $libitem->f_artist . '] ' . scrub_out($libitem->full_name); $name = '[' . $libitem->f_artist . '] ' . scrub_out($libitem->full_name);
?> ?>
<td class="cel_cover"> <td class="cel_cover">
<a href="<?php echo AmpConfig::get('web_path'); ?>/albums.php?action=show&album=<?php echo $libitem->id; ?>"> <?php
<img height="75" width="75" alt="<?php echo($name) ?>" title="<?php echo($name) ?>" src="<?php echo AmpConfig::get('web_path'); ?>/image.php?object_type=album&object_id=<?php echo $libitem->id; ?>&thumb=1" /> Art::display('album', $libitem->id, $name, 1, AmpConfig::get('web_path') . '/albums.php?action=show&album=' . $libitem->id);
</a> ?>
</td> </td>
<?php } ?> <?php } ?>
<td class="cel_album"><?php echo $libitem->f_name_link; ?></td> <td class="cel_album"><?php echo $libitem->f_name_link; ?></td>

View file

@ -83,14 +83,14 @@ if (AmpConfig::get('show_played_times')) {
</li> </li>
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<li> <li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=artist&artist_id=' . $artist->id,'play', T_('Play all'),'directplay_full_' . $artist->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=artist&object_id=' . $artist->id,'play', T_('Play all'),'directplay_full_' . $artist->id); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=artist&artist_id=' . $artist->id, T_('Play all'),'directplay_full_text_' . $artist->id); ?> <?php echo Ajax::text('?page=stream&action=directplay&object_type=artist&object_id=' . $artist->id, T_('Play all'),'directplay_full_text_' . $artist->id); ?>
</li> </li>
<?php } ?> <?php } ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<li> <li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=artist&artist_id=' . $artist->id . '&append=true','play_add', T_('Play all last'),'addplay_artist_' . $artist->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=artist&object_id=' . $artist->id . '&append=true','play_add', T_('Play all last'),'addplay_artist_' . $artist->id); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=artist&artist_id=' . $artist->id . '&append=true', T_('Play all last'),'addplay_artist_text_' . $artist->id); ?> <?php echo Ajax::text('?page=stream&action=directplay&object_type=artist&object_id=' . $artist->id . '&append=true', T_('Play all last'),'addplay_artist_text_' . $artist->id); ?>
</li> </li>
<?php } ?> <?php } ?>
<li> <li>

View file

@ -24,9 +24,9 @@
<span class="cel_play_content">&nbsp;</span> <span class="cel_play_content">&nbsp;</span>
<div class="cel_play_hover"> <div class="cel_play_hover">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=artist&artist_id=' . $libitem->id,'play', T_('Play'),'play_artist_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=artist&object_id=' . $libitem->id,'play', T_('Play'),'play_artist_' . $libitem->id); ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=artist&artist_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_artist_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=artist&object_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_artist_' . $libitem->id); ?>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</div> </div>

View file

@ -24,7 +24,7 @@
<span class="cel_play_content">&nbsp;</span> <span class="cel_play_content">&nbsp;</span>
<div class="cel_play_hover"> <div class="cel_play_hover">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=broadcast&broadcast_id=' . $libitem->id,'play', T_('Play'),'play_broadcast_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=broadcast&object_id=' . $libitem->id,'play', T_('Play'),'play_broadcast_' . $libitem->id); ?>
<?php } ?> <?php } ?>
</div> </div>
</td> </td>

View file

@ -24,7 +24,7 @@
<span class="cel_play_content">&nbsp;</span> <span class="cel_play_content">&nbsp;</span>
<div class="cel_play_hover"> <div class="cel_play_hover">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=channel&channel_id=' . $libitem->id,'play', T_('Play'),'play_channel_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=channel&object_id=' . $libitem->id,'play', T_('Play'),'play_channel_' . $libitem->id); ?>
<?php } ?> <?php } ?>
</div> </div>
</td> </td>

View file

@ -28,8 +28,8 @@
<td><input type="text" name="name" value="<?php echo scrub_out($libitem->name); ?>" /></td> <td><input type="text" name="name" value="<?php echo scrub_out($libitem->name); ?>" /></td>
</tr> </tr>
<tr> <tr>
<td class="edit_dialog_content_header"><?php echo T_('Description') ?></td> <td class="edit_dialog_content_header"><?php echo T_('Summary') ?></td>
<td><textarea name="description" cols="44" rows="4" value="<?php echo scrub_out($libitem->description); ?>"></textarea></td> <td><textarea name="summary" cols="44" rows="4"><?php echo scrub_out($libitem->summary); ?></textarea></td>
</tr> </tr>
<tr> <tr>
<td class="edit_dialog_content_header"><?php echo T_('Year') ?></td> <td class="edit_dialog_content_header"><?php echo T_('Year') ?></td>

View file

@ -0,0 +1,53 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* 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.
*
*/
$libitem = Video::create_from_id($libitem->id);
$libitem->format();
$video_type = strtolower(get_class($libitem));
?>
<div>
<form method="post" id="edit_video_<?php echo $libitem->id; ?>" class="edit_dialog_content">
<table class="tabledata" cellspacing="0" cellpadding="0">
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Title') ?></td>
<td><input type="text" name="title" value="<?php echo scrub_out($libitem->title); ?>" /></td>
</tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Release Date') ?></td>
<td><input type="text" name="release_date" value="<?php echo $libitem->f_release_date; ?>" /></td>
</tr>
<?php
if ($video_type != 'video') {
require AmpConfig::get('prefix') . '/templates/show_partial_edit_' . $video_type . '_row.inc.php';
}
?>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Tags') ?></td>
<td>
<input type="text" name="edit_tags" id="edit_tags" value="<?php echo Tag::get_display($libitem->tags); ?>" />
</td>
</tr>
</table>
<input type="hidden" name="id" value="<?php echo $libitem->id; ?>" />
<input type="hidden" name="type" value="<?php echo $video_type; ?>_row" />
</form>
</div>

View file

@ -26,11 +26,19 @@
<!-- Randomly selected albums of the moment --> <!-- Randomly selected albums of the moment -->
<?php <?php
if (Art::is_enabled()) { if (Art::is_enabled()) {
echo Ajax::observe('window','load',Ajax::action('?page=index&action=random_albums','random_albums')); echo Ajax::observe('window', 'load', Ajax::action('?page=index&action=random_albums', 'random_albums'));
?> ?>
<div id="random_selection"> <div id="random_selection" class="random_selection">
<?php UI::show_box_top(T_('Albums of the Moment')); echo T_('Loading...'); UI::show_box_bottom(); ?> <?php UI::show_box_top(T_('Albums of the Moment')); echo T_('Loading...'); UI::show_box_bottom(); ?>
</div> </div>
<?php
if (AmpConfig::get('allow_video')) {
echo Ajax::observe('window', 'load', Ajax::action('?page=index&action=random_videos', 'random_videos'));
?>
<div id="random_video_selection" class="random_selection">
<?php UI::show_box_top(T_('Videos of the Moment')); echo T_('Loading...'); UI::show_box_bottom(); ?>
</div>
<?php } ?>
<?php } ?> <?php } ?>
<!-- Recently Played --> <!-- Recently Played -->
<div id="recently_played"> <div id="recently_played">

View file

@ -24,7 +24,7 @@
<span class="cel_play_content">&nbsp;</span> <span class="cel_play_content">&nbsp;</span>
<div class="cel_play_hover"> <div class="cel_play_hover">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=live_stream&stream_id=' . $libitem->id, 'play', T_('Play live stream'),'play_live_stream_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=live_stream&object_id=' . $libitem->id, 'play', T_('Play live stream'),'play_live_stream_' . $libitem->id); ?>
<?php } ?> <?php } ?>
</div> </div>
</td> </td>

View file

@ -37,7 +37,7 @@ if ($album != T_('Unknown (Orphaned)')) {
<div class="np_group"> <div class="np_group">
<div class="np_cell cel_song"> <div class="np_cell cel_song">
<label><?php echo T_('Song'); ?>:</label> <label><?php echo T_('Song'); ?>:</label>
<a title="<?php echo scrub_out($song->title); ?>" href="<?php echo $web_path; ?>/stream.php?action=single_song&amp;song_id=<?php echo $song->id; ?>"> <a title="<?php echo scrub_out($song->title); ?>" href="<?php echo $web_path; ?>/stream.php?action=play_item&object_type=song&object_id=<?php echo $song->id; ?>">
<?php echo $title; ?> <?php echo $title; ?>
</a> </a>
</div> </div>

View file

@ -50,24 +50,6 @@ if (count($images) > 0 && !empty($images[0]['url'])) {
<div id="information_actions"> <div id="information_actions">
<h3><?php echo T_('Actions'); ?>:</h3> <h3><?php echo T_('Actions'); ?>:</h3>
<ul> <ul>
<?php if (AmpConfig::get('echonest_api_key')) { ?>
<?php if (AmpConfig::get('directplay')) { ?>
<li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album_preview&mbid=' . $walbum->mbid,'play_preview', T_('Play'),'directplay_full_' . $walbum->mbid); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=album_preview&mbid=' . $walbum->mbid, T_('Play'),'directplay_full_text_' . $walbum->mbid); ?>
</li>
<?php } ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?>
<li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album_preview&mbid=' . $walbum->mbid . '&append=true','play_add_preview', T_('Play last'),'addplay_album_' . $walbum->mbid); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=album_preview&mbid=' . $walbum->mbid . '&append=true', T_('Play last'),'addplay_album_text_' . $walbum->mbid); ?>
</li>
<?php } ?>
<li>
<?php echo Ajax::button('?action=basket&type=album_preview&mbid=' . $walbum->mbid,'add', T_('Add to temporary playlist'),'play_full_' . $walbum->mbid); ?>
<?php echo Ajax::text('?action=basket&type=album_preview&mbid=' . $walbum->mbid, T_('Add to temporary playlist'), 'play_full_text_' . $walbum->mbid); ?>
</li>
<?php } ?>
<li> <li>
<?php echo T_('Wanted actions'); ?>: <?php echo T_('Wanted actions'); ?>:
<div id="wanted_action_<?php echo $walbum->mbid; ?>"> <div id="wanted_action_<?php echo $walbum->mbid; ?>">

View file

@ -43,7 +43,13 @@ foreach ($results as $item) {
if (!$np_user->fullname) { $np_user->fullname = "Ampache User"; } if (!$np_user->fullname) { $np_user->fullname = "Ampache User"; }
?> ?>
<div class="np_row"> <div class="np_row">
<?php require AmpConfig::get('prefix') . '/templates/show_now_playing_row.inc.php'; ?> <?php
if (strtolower(get_class($media)) == 'song') {
require AmpConfig::get('prefix') . '/templates/show_now_playing_row.inc.php';
} else {
require AmpConfig::get('prefix') . '/templates/show_now_playing_video_row.inc.php';
}
?>
</div> </div>
<?php <?php
} // end foreach } // end foreach

View file

@ -23,7 +23,7 @@
<div class="np_group" id="np_group_1"> <div class="np_group" id="np_group_1">
<div class="np_cell cel_username"> <div class="np_cell cel_username">
<label><?php echo T_('Username'); ?></label> <label><?php echo T_('Username'); ?></label>
<a title="<?php echo scrub_out($agent); ?>" href="<?php echo $web_path; ?>/stats.php?action=show_user&amp;user_id=<?php echo $np_user->id; ?>"> <a title="<?php echo scrub_out($agent); ?>" href="<?php echo $web_path; ?>/stats.php?action=show_user&user_id=<?php echo $np_user->id; ?>">
<?php echo scrub_out($np_user->fullname); ?> <?php echo scrub_out($np_user->fullname); ?>
<?php <?php
if ($np_user->f_avatar_medium) { if ($np_user->f_avatar_medium) {
@ -56,9 +56,7 @@
<?php if (Art::is_enabled()) { ?> <?php if (Art::is_enabled()) { ?>
<div class="np_group" id="np_group_3"> <div class="np_group" id="np_group_3">
<div class="np_cell cel_albumart"> <div class="np_cell cel_albumart">
<a href="<?php echo $web_path; ?>/image.php?object_id=<?php echo $media->album; ?>&object_type=album" rel="prettyPhoto"> <?php Art::display('album', $media->album, $media->get_fullname(), 1, AmpConfig::get('web_path') . '/albums.php?action=show&album=' . $media->album); ?>
<img align="middle" src="<?php echo $web_path; ?>/image.php?object_id=<?php echo $media->album; ?>&object_type=album&thumb=1" alt="<?php echo scrub_out($media->f_album_full); ?>" title="<?php echo scrub_out($media->f_album_full); ?>" height="80" width="80" />
</a>
</div> </div>
</div> </div>
<?php } ?> <?php } ?>

View file

@ -0,0 +1,72 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* 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 echo $np_user->id; ?>">
<?php echo scrub_out($np_user->fullname); ?>
<?php
if ($np_user->f_avatar_medium) {
echo '<div>' . $np_user->f_avatar_medium . '</div>';
}
?>
</a>
</div>
</div>
<div class="np_group" id="np_group_2">
<div class="np_cell cel_video">
<label><?php echo T_('Video'); ?></label>
<?php echo $media->f_link; ?>
</div>
</div>
<?php if (Art::is_enabled()) { ?>
<div class="np_group" id="np_group_3">
<div class="np_cell cel_albumart">
<?php
$release_art = $media->get_release_item_art();
Art::display($release_art['object_type'], $release_art['object_id'], $media->get_fullname(), 6, $media->link);
?>
</div>
</div>
<?php } ?>
<div class="np_group" id="np_group_4">
<?php if (AmpConfig::get('ratings')) { ?>
<div class="np_cell cel_rating">
<label><?php echo T_('Rating'); ?></label>
<div id="rating_<?php echo $media->id; ?>_video">
<?php Rating::show($media->id, 'video'); ?>
</div>
</div>
<div class="np_cell cel_userflag">
<label><?php echo T_('Fav.'); ?></label>
<div id="userflag_<?php echo $media->id; ?>_video">
<?php Userflag::show($media->id,'video'); ?>
</div>
</div>
<?php } ?>
</div>

View file

@ -0,0 +1,28 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* 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.
*
*/
?>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Artist') ?></td>
<td>
<?php show_artist_select('artist', $libitem->artist); ?>
</td>
</tr>

View file

@ -0,0 +1,34 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* 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.
*
*/
?>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Original Name') ?></td>
<td><input type="text" name="original_name" value="<?php echo scrub_out($libitem->original_name); ?>" /></td>
</tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Summary') ?></td>
<td><textarea name="summary" cols="44" rows="4"><?php echo scrub_out($libitem->summary); ?></textarea></td>
</tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Year') ?></td>
<td><input type="number" name="year" value="<?php echo scrub_out($libitem->year); ?>" /></td>
</tr>

View file

@ -0,0 +1,30 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* 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.
*
*/
?>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Location') ?></td>
<td><input type="text" name="location" value="<?php echo scrub_out($libitem->location); ?>" /></td>
</tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Summary') ?></td>
<td><textarea name="summary" cols="44" rows="4"><?php echo scrub_out($libitem->summary); ?></textarea></td>
</tr>

View file

@ -0,0 +1,40 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* 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.
*
*/
?>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('TVShow Season') ?></td>
<td>
<?php show_tvshow_season_select('tvshow_season', $libitem->season); ?>
</td>
</tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Original Name') ?></td>
<td><input type="text" name="original_name" value="<?php echo scrub_out($libitem->original_name); ?>" /></td>
</tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Summary') ?></td>
<td><textarea name="summary" cols="44" rows="4"><?php echo scrub_out($libitem->summary); ?></textarea></td>
</tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Episode Number') ?></td>
<td><input type="number" name="tvshow_episode" value="<?php echo scrub_out($libitem->episode_number); ?>" /></td>
</tr>

View file

@ -21,4 +21,4 @@
*/ */
$videoprops[gettext_noop('Location')] = $video->f_location; $videoprops[gettext_noop('Location')] = $video->f_location;
$videoprops[gettext_noop('Description')] = scrub_out($video->description); $videoprops[gettext_noop('Summary')] = scrub_out($video->summary);

View file

@ -23,4 +23,4 @@
$videoprops[gettext_noop('TV Show')] = $video->f_tvshow_link; $videoprops[gettext_noop('TV Show')] = $video->f_tvshow_link;
$videoprops[gettext_noop('Season')] = $video->f_season_link; $videoprops[gettext_noop('Season')] = $video->f_season_link;
$videoprops[gettext_noop('Episode')] = $video->episode_number; $videoprops[gettext_noop('Episode')] = $video->episode_number;
$videoprops[gettext_noop('Summary')] = $video->description; $videoprops[gettext_noop('Summary')] = $video->summary;

View file

@ -56,14 +56,14 @@ UI::show_box_top('<div id="playlist_row_' . $playlist->id . '">' . $title . '</d
<?php } ?> <?php } ?>
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<li> <li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=playlist&playlist_id=' . $playlist->id,'play', T_('Play all'),'directplay_full_' . $playlist->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=playlist&object_id=' . $playlist->id,'play', T_('Play all'),'directplay_full_' . $playlist->id); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=playlist&playlist_id=' . $playlist->id, T_('Play all'),'directplay_full_text_' . $playlist->id); ?> <?php echo Ajax::text('?page=stream&action=directplay&object_type=playlist&object_id=' . $playlist->id, T_('Play all'),'directplay_full_text_' . $playlist->id); ?>
</li> </li>
<?php } ?> <?php } ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<li> <li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=playlist&playlist_id=' . $playlist->id . '&append=true','play_add', T_('Play all last'),'addplay_playlist_' . $playlist->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=playlist&object_id=' . $playlist->id . '&append=true','play_add', T_('Play all last'),'addplay_playlist_' . $playlist->id); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=playlist&playlist_id=' . $playlist->id . '&append=true', T_('Play all last'),'addplay_playlist_text_' . $playlist->id); ?> <?php echo Ajax::text('?page=stream&action=directplay&object_type=playlist&object_id=' . $playlist->id . '&append=true', T_('Play all last'),'addplay_playlist_text_' . $playlist->id); ?>
</li> </li>
<?php } ?> <?php } ?>
<li> <li>

View file

@ -24,9 +24,9 @@
<span class="cel_play_content">&nbsp;</span> <span class="cel_play_content">&nbsp;</span>
<div class="cel_play_hover"> <div class="cel_play_hover">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=playlist&playlist_id=' . $libitem->id,'play', T_('Play'),'play_playlist_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=playlist&object_id=' . $libitem->id,'play', T_('Play'),'play_playlist_' . $libitem->id); ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=playlist&playlist_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_playlist_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=playlist&object_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_playlist_' . $libitem->id); ?>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</div> </div>

View file

@ -24,9 +24,9 @@
<span class="cel_play_content"><?php echo '<b>'.$playlist_track.'</b>'; ?></span> <span class="cel_play_content"><?php echo '<b>'.$playlist_track.'</b>'; ?></span>
<div class="cel_play_hover"> <div class="cel_play_hover">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=song&song_id=' . $libitem->id, 'play', T_('Play'),'play_playlist_song_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $libitem->id, 'play', T_('Play'),'play_playlist_song_' . $libitem->id); ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=song&song_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_song_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_song_' . $libitem->id); ?>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</div> </div>

View file

@ -43,4 +43,13 @@ $browse->set_simple_browse(true);
$browse->show_objects(); $browse->show_objects();
$browse->store(); $browse->store();
if (AmpConfig::get('allow_video')) {
$sql = Stats::get_top_sql('video');
$browse = new Browse();
$browse->set_type('video', $sql);
$browse->set_simple_browse(true);
$browse->show_objects();
$browse->store();
}
UI::show_box_bottom(); UI::show_box_bottom();

View file

@ -43,9 +43,9 @@ if ($albums) {
</div> </div>
<div class="play_album"> <div class="play_album">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id'),'play', T_('Play'),'play_album_' . $album->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id'),'play', T_('Play'),'play_album_' . $album->id); ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id') . '&append=true','play_add', T_('Play last'),'addplay_album_' . $album->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=album&' . $album->get_http_album_query_ids('object_id') . '&append=true','play_add', T_('Play last'),'addplay_album_' . $album->id); ?>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
<?php echo Ajax::button('?action=basket&type=album&' . $album->get_http_album_query_ids('id'),'add', T_('Add to temporary playlist'),'play_full_' . $album->id); ?> <?php echo Ajax::button('?action=basket&type=album&' . $album->get_http_album_query_ids('id'),'add', T_('Add to temporary playlist'),'play_full_' . $album->id); ?>

View file

@ -0,0 +1,61 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* 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 = AmpConfig::get('web_path');
$button = Ajax::button('?page=index&action=random_videos','random', T_('Refresh'),'random_video_refresh');
?>
<?php UI::show_box_top(T_('Videos of the Moment') . ' ' . $button, 'box box_random_videos'); ?>
<?php
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 } ?>
</div>
<div class="play_video">
<?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&object_type=video&object_id=' . $video->id,'play', T_('Play'),'play_album_' . $video->id); ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&object_type=video&object_id=' . $video->id . '&append=true','play_add', T_('Play last'),'addplay_video_' . $video->id); ?>
<?php } ?>
<?php } ?>
</div>
<?php
if (AmpConfig::get('ratings')) {
echo "<div id=\"rating_" . $video->id . "_video\">";
show_rating($video->id, 'video');
echo "</div>";
}
?>
</div>
<?php } ?>
<?php } ?>
<?php UI::show_box_bottom(); ?>

View file

@ -95,9 +95,9 @@ foreach ($data as $row) {
<span class="cel_play_content">&nbsp;</span> <span class="cel_play_content">&nbsp;</span>
<div class="cel_play_hover"> <div class="cel_play_hover">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=song&song_id=' . $song->id,'play', T_('Play'),'play_song_' . $nb . '_' . $song->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $song->id,'play', T_('Play'),'play_song_' . $nb . '_' . $song->id); ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=song&song_id=' . $song->id . '&append=true','play_add', T_('Play last'),'addplay_song_' . $nb . '_' . $song->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $song->id . '&append=true','play_add', T_('Play last'),'addplay_song_' . $nb . '_' . $song->id); ?>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</div> </div>

View file

@ -24,9 +24,9 @@
<span class="cel_play_content">&nbsp;</span> <span class="cel_play_content">&nbsp;</span>
<div class="cel_play_hover"> <div class="cel_play_hover">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=smartplaylist&playlist_id=' . $libitem->id,'play', T_('Play'),'play_playlist_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=search&object_id=' . $libitem->id,'play', T_('Play'),'play_playlist_' . $libitem->id); ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=smartplaylist&playlist_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_playlist_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=search&object_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_playlist_' . $libitem->id); ?>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</div> </div>
@ -34,8 +34,8 @@
<td class="cel_playlist"><?php echo $libitem->f_name_link; ?></td> <td class="cel_playlist"><?php echo $libitem->f_name_link; ?></td>
<td class="cel_add"> <td class="cel_add">
<span class="cel_item_add"> <span class="cel_item_add">
<?php echo Ajax::button('?action=basket&type=smartplaylist&id=' . $libitem->id,'add', T_('Add to temporary playlist'),'add_playlist_' . $libitem->id); ?> <?php echo Ajax::button('?action=basket&type=search&id=' . $libitem->id,'add', T_('Add to temporary playlist'),'add_playlist_' . $libitem->id); ?>
<a id="<?php echo 'add_playlist_'.$libitem->id ?>" onclick="showPlaylistDialog(event, 'smartplaylist', '<?php echo $libitem->id ?>')"> <a id="<?php echo 'add_playlist_'.$libitem->id ?>" onclick="showPlaylistDialog(event, 'search', '<?php echo $libitem->id ?>')">
<?php echo UI::get_icon('playlist_add', T_('Add to existing playlist')); ?> <?php echo UI::get_icon('playlist_add', T_('Add to existing playlist')); ?>
</a> </a>
</span> </span>
@ -46,7 +46,7 @@
<td class="cel_owner"><?php echo scrub_out($libitem->f_user); ?></td> <td class="cel_owner"><?php echo scrub_out($libitem->f_user); ?></td>
<td class="cel_action"> <td class="cel_action">
<?php if (Access::check_function('batch_download')) { ?> <?php if (Access::check_function('batch_download')) { ?>
<a href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=smartplaylist&amp;id=<?php echo $libitem->id; ?>"> <a href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=search&amp;id=<?php echo $libitem->id; ?>">
<?php echo UI::get_icon('batch_download', T_('Batch Download')); ?> <?php echo UI::get_icon('batch_download', T_('Batch Download')); ?>
</a> </a>
<?php } ?> <?php } ?>

View file

@ -56,9 +56,9 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
<dt class="<?php echo $rowparity; ?>"><?php echo T_('Action'); ?></dt> <dt class="<?php echo $rowparity; ?>"><?php echo T_('Action'); ?></dt>
<dd class="<?php echo $rowparity; ?>"> <dd class="<?php echo $rowparity; ?>">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=song&song_id=' . $song->id, 'play', T_('Play'),'play_song_' . $song->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $song->id, 'play', T_('Play'),'play_song_' . $song->id); ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=song&song_id=' . $song->id . '&append=true','play_add', T_('Play last'),'addplay_song_' . $song->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $song->id . '&append=true','play_add', T_('Play last'),'addplay_song_' . $song->id); ?>
<?php } ?> <?php } ?>
<?php echo $song->show_custom_play_actions(); ?> <?php echo $song->show_custom_play_actions(); ?>
<?php } ?> <?php } ?>

View file

@ -23,9 +23,9 @@
<?php if (AmpConfig::get('echonest_api_key')) { ?> <?php if (AmpConfig::get('echonest_api_key')) { ?>
<td class="cel_play"> <td class="cel_play">
<?php if (AmpConfig::get('directplay') && !empty($libitem->file)) { ?> <?php if (AmpConfig::get('directplay') && !empty($libitem->file)) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=song_preview&id=' . $libitem->id,'play_preview', T_('Play'),'play_song_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=song_preview&object_id=' . $libitem->id,'play_preview', T_('Play'),'play_song_' . $libitem->id); ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=song_preview&id=' . $libitem->id . '&append=true','play_add_preview', T_('Play last'),'addplay_song_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=song_preview&object_id=' . $libitem->id . '&append=true','play_add_preview', T_('Play last'),'addplay_song_' . $libitem->id); ?>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</td> </td>

View file

@ -24,9 +24,9 @@
<span class="cel_play_content"><?php if (isset($argument) && $argument) { echo '<b>'.$libitem->f_track.'</b>'; } ?></span> <span class="cel_play_content"><?php if (isset($argument) && $argument) { echo '<b>'.$libitem->f_track.'</b>'; } ?></span>
<div class="cel_play_hover"> <div class="cel_play_hover">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=song&song_id=' . $libitem->id, 'play', T_('Play'), 'play_song_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $libitem->id, 'play', T_('Play'), 'play_song_' . $libitem->id); ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=song&song_id=' . $libitem->id . '&append=true', 'play_add', T_('Play last'), 'addplay_song_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $libitem->id . '&append=true', 'play_add', T_('Play last'), 'addplay_song_' . $libitem->id); ?>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</div> </div>

View file

@ -40,3 +40,12 @@ $browse->set_type('artist', $sql);
$browse->set_simple_browse(true); $browse->set_simple_browse(true);
$browse->show_objects(); $browse->show_objects();
$browse->store(); $browse->store();
if (AmpConfig::get('allow_video')) {
$sql = Rating::get_highest_sql('video');
$browse = new Browse();
$browse->set_type('video', $sql);
$browse->set_simple_browse(true);
$browse->show_objects();
$browse->store();
}

View file

@ -33,3 +33,12 @@ $browse->set_type('artist', $sql);
$browse->set_simple_browse(true); $browse->set_simple_browse(true);
$browse->show_objects(); $browse->show_objects();
$browse->store(); $browse->store();
if (AmpConfig::get('allow_video')) {
$sql = Stats::get_newest_sql('video');
$browse = new Browse();
$browse->set_type('video', $sql);
$browse->set_simple_browse(true);
$browse->show_objects();
$browse->store();
}

View file

@ -34,5 +34,13 @@ UI::show_box_top('','info-box box_popular_artists');
require AmpConfig::get('prefix') . '/templates/show_objects.inc.php'; require AmpConfig::get('prefix') . '/templates/show_objects.inc.php';
UI::show_box_bottom(); UI::show_box_bottom();
if (AmpConfig::get('allow_video')) {
$objects = Stats::get_top('video');
$headers = array('f_name_link' => T_('Most Popular Videos'));
UI::show_box_top('','info-box box_popular_videos');
require AmpConfig::get('prefix') . '/templates/show_objects.inc.php';
UI::show_box_bottom();
}
?> ?>
</div> </div>

View file

@ -40,3 +40,12 @@ $browse->set_type('song', $sql);
$browse->set_simple_browse(true); $browse->set_simple_browse(true);
$browse->show_objects(); $browse->show_objects();
$browse->store(); $browse->store();
if (AmpConfig::get('allow_video')) {
$sql = Stats::get_recent_sql('video', $user_id);
$browse = new Browse();
$browse->set_type('video', $sql);
$browse->set_simple_browse(true);
$browse->show_objects();
$browse->store();
}

View file

@ -40,3 +40,12 @@ $browse->set_type('artist', $sql);
$browse->set_simple_browse(true); $browse->set_simple_browse(true);
$browse->show_objects(); $browse->show_objects();
$browse->store(); $browse->store();
if (AmpConfig::get('allow_video')) {
$sql = Userflag::get_latest_sql('video');
$browse = new Browse();
$browse->set_type('video', $sql);
$browse->set_simple_browse(true);
$browse->show_objects();
$browse->store();
}

View file

@ -32,9 +32,9 @@ UI::show_box_top($tvshow->f_name, 'info-box');
<?php <?php
Art::display('tvshow', $tvshow->id, $tvshow->f_name, 6); Art::display('tvshow', $tvshow->id, $tvshow->f_name, 6);
?> ?>
<?php if ($tvshow->description) { ?> <?php if ($tvshow->summary) { ?>
<div id="item_summary"> <div id="item_summary">
<?php echo $tvshow->description; ?> <?php echo $tvshow->summary; ?>
</div> </div>
<?php } ?> <?php } ?>
</div> </div>
@ -55,14 +55,14 @@ if (AmpConfig::get('ratings')) {
<ul> <ul>
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<li> <li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=tvshow&tvshow_id=' . $tvshow->id,'play', T_('Play all'),'directplay_full_' . $tvshow->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=tvshow&object_id=' . $tvshow->id,'play', T_('Play all'),'directplay_full_' . $tvshow->id); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=tvshow&tvshow_id=' . $tvshow->id, T_('Play all'),'directplay_full_text_' . $tvshow->id); ?> <?php echo Ajax::text('?page=stream&action=directplay&object_type=tvshow&object_id=' . $tvshow->id, T_('Play all'),'directplay_full_text_' . $tvshow->id); ?>
</li> </li>
<?php } ?> <?php } ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<li> <li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=tvshow&tvshow_id=' . $tvshow->id . '&append=true','play_add', T_('Play all last'),'addplay_tvshow_' . $tvshow->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=tvshow&object_id=' . $tvshow->id . '&append=true','play_add', T_('Play all last'),'addplay_tvshow_' . $tvshow->id); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=tvshow&tvshow_id=' . $tvshow->id . '&append=true', T_('Play all last'),'addplay_tvshow_text_' . $tvshow->id); ?> <?php echo Ajax::text('?page=stream&action=directplay&object_type=tvshow&object_id=' . $tvshow->id . '&append=true', T_('Play all last'),'addplay_tvshow_text_' . $tvshow->id); ?>
</li> </li>
<?php } ?> <?php } ?>
<?php if (Access::check('interface','50')) { ?> <?php if (Access::check('interface','50')) { ?>

View file

@ -24,9 +24,9 @@
<span class="cel_play_content">&nbsp;</span> <span class="cel_play_content">&nbsp;</span>
<div class="cel_play_hover"> <div class="cel_play_hover">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=tvshow&tvshow_id=' . $libitem->id,'play', T_('Play'),'play_tvshow_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=tvshow&object_id=' . $libitem->id,'play', T_('Play'),'play_tvshow_' . $libitem->id); ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=tvshow&tvshow_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_tvshow_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=tvshow&object_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_tvshow_' . $libitem->id); ?>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</div> </div>

View file

@ -50,14 +50,14 @@ if (AmpConfig::get('ratings')) {
<ul> <ul>
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<li> <li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=tvshow_season&season_id=' . $season->id,'play', T_('Play all'),'directplay_full_' . $season->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=tvshow_season&object_id=' . $season->id,'play', T_('Play all'),'directplay_full_' . $season->id); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=tvshow_season&season_id=' . $season->id, T_('Play all'),'directplay_full_text_' . $season->id); ?> <?php echo Ajax::text('?page=stream&action=directplay&object_type=tvshow_season&object_id=' . $season->id, T_('Play all'),'directplay_full_text_' . $season->id); ?>
</li> </li>
<?php } ?> <?php } ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<li> <li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=season&season_id=' . $season->id . '&append=true','play_add', T_('Play all last'),'addplay_season_' . $season->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=season&object_id=' . $season->id . '&append=true','play_add', T_('Play all last'),'addplay_season_' . $season->id); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=season&season_id=' . $season->id . '&append=true', T_('Play all last'),'addplay_season_text_' . $season->id); ?> <?php echo Ajax::text('?page=stream&action=directplay&object_type=season&object_id=' . $season->id . '&append=true', T_('Play all last'),'addplay_season_text_' . $season->id); ?>
</li> </li>
<?php } ?> <?php } ?>
<?php if (Access::check('interface','50')) { ?> <?php if (Access::check('interface','50')) { ?>

View file

@ -24,9 +24,9 @@
<span class="cel_play_content">&nbsp;</span> <span class="cel_play_content">&nbsp;</span>
<div class="cel_play_hover"> <div class="cel_play_hover">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=tvshow_season&season_id=' . $libitem->id,'play', T_('Play'),'play_season_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=tvshow_season&object_id=' . $libitem->id,'play', T_('Play'),'play_season_' . $libitem->id); ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=tvshow_season&season_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_season_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=tvshow_season&object_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_season_' . $libitem->id); ?>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</div> </div>
@ -35,7 +35,7 @@
if (Art::is_enabled()) { if (Art::is_enabled()) {
?> ?>
<td class="cel_cover"> <td class="cel_cover">
<?php Art::display('tvshow_season', $libitem->id, $$libitem->f_name, 6, $libitem->link); ?> <?php Art::display('tvshow_season', $libitem->id, $libitem->f_name, 6, $libitem->link); ?>
</td> </td>
<?php } ?> <?php } ?>
<td class="cel_season"><?php echo $libitem->f_link; ?></td> <td class="cel_season"><?php echo $libitem->f_link; ?></td>

View file

@ -51,9 +51,9 @@ if (!Art::display('video', $video->id, $video->f_title, 7, null, false)) {
<dt class="<?php echo $rowparity; ?>"><?php echo T_('Action'); ?></dt> <dt class="<?php echo $rowparity; ?>"><?php echo T_('Action'); ?></dt>
<dd class="<?php echo $rowparity; ?>"> <dd class="<?php echo $rowparity; ?>">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=video&video_id=' . $video->id, 'play', T_('Play'),'play_video_' . $video->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=video&object_id=' . $video->id, 'play', T_('Play'),'play_video_' . $video->id); ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=video&video_id=' . $video->id . '&append=true','play_add', T_('Play last'),'addplay_video_' . $video->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=video&object_id=' . $video->id . '&append=true','play_add', T_('Play last'),'addplay_video_' . $video->id); ?>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
<?php if (AmpConfig::get('sociable')) { ?> <?php if (AmpConfig::get('sociable')) { ?>

View file

@ -19,14 +19,19 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 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"> <td class="cel_play">
<span class="cel_play_content">&nbsp;</span> <span class="cel_play_content">&nbsp;</span>
<div class="cel_play_hover"> <div class="cel_play_hover">
<?php if (AmpConfig::get('directplay')) { ?> <?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=video&video_id=' . $libitem->id,'play', T_('Play'),'play_video_' . $libitem->id); ?> <?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()) { ?> <?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=video&video_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_video_' . $libitem->id); ?> <?php echo Ajax::button('?page=stream&action=directplay&object_type=video&object_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_video_' . $libitem->id); ?>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</div> </div>
@ -35,14 +40,20 @@
if (Art::is_enabled()) { if (Art::is_enabled()) {
?> ?>
<td class="cel_cover"> <td class="cel_cover">
<a href="<?php echo $libitem->link; ?>"> <?php
<img height="150" width="100" alt="<?php echo $libitem->f_title; ?>" title="<?php echo $libitem->f_title; ?>" src="<?php echo AmpConfig::get('web_path'); ?>/image.php?object_type=video&object_id=<?php echo $libitem->id; ?>&thumb=6" /> $art_showed = false;
</a> if ($libitem->get_default_art_kind() == 'preview') {
$art_showed = Art::display('video', $libitem->id, $libitem->f_title, 9, $libitem->link, false, 'preview');
}
if (!$art_showed) {
Art::display('video', $libitem->id, $libitem->f_title, 6, $libitem->link);
}
?>
</td> </td>
<?php } ?> <?php } ?>
<td class="cel_title"><?php echo $libitem->f_link; ?></td> <td class="cel_title"><?php echo $libitem->f_link; ?></td>
<?php <?php
if (isset($video_type)) { if ($video_type != 'video') {
require AmpConfig::get('prefix') . '/templates/show_partial_' . $video_type . '_row.inc.php'; require AmpConfig::get('prefix') . '/templates/show_partial_' . $video_type . '_row.inc.php';
} }
?> ?>

View file

@ -32,7 +32,7 @@ if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/l
<?php } ?> <?php } ?>
<th class="cel_title essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=title', T_('Title'),'sort_video_title'); ?></th> <th class="cel_title essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=title', T_('Title'),'sort_video_title'); ?></th>
<?php <?php
if (isset($video_type)) { if (isset($video_type) && $video_type != 'video') {
require AmpConfig::get('prefix') . '/templates/show_partial_' . $video_type . 's.inc.php'; require AmpConfig::get('prefix') . '/templates/show_partial_' . $video_type . 's.inc.php';
} }
?> ?>
@ -78,7 +78,7 @@ if (isset($video_type)) {
<?php } ?> <?php } ?>
<th class="cel_title"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=title', T_('Title'),'sort_video_title'); ?></th> <th class="cel_title"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=title', T_('Title'),'sort_video_title'); ?></th>
<?php <?php
if (isset($video_type)) { if (isset($video_type) && $video_type != 'video') {
require AmpConfig::get('prefix') . '/templates/show_partial_' . $video_type . 's.inc.php'; require AmpConfig::get('prefix') . '/templates/show_partial_' . $video_type . 's.inc.php';
} }
?> ?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB