1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 09:49:30 +02:00

Use arts in a more generic way

Add library_item interface
This commit is contained in:
Afterster 2014-07-07 01:40:14 +02:00
parent d842ebbb00
commit 4454696f29
45 changed files with 767 additions and 330 deletions

View file

@ -26,145 +26,6 @@ require_once AmpConfig::get('prefix') . '/templates/header.inc.php';
/* Switch on Action */ /* Switch on Action */
switch ($_REQUEST['action']) { switch ($_REQUEST['action']) {
case 'clear_art':
if (!$GLOBALS['user']->has_access('75')) { UI::access_denied(); }
$art = new Art($_GET['album_id'],'album');
$art->reset();
show_confirmation(T_('Album Art Cleared'), T_('Album Art information has been removed from the database'),"/albums.php?action=show&album=" . $art->uid);
break;
// Upload album art
case 'upload_art':
// we didn't find anything
if (empty($_FILES['file']['tmp_name'])) {
show_confirmation(T_('Album Art Not Located'), T_('Album Art could not be located at this time. This may be due to write access error, or the file is not received correctly.'),"/albums.php?action=show&album=" . $_REQUEST['album_id']);
break;
}
$album = new Album($_REQUEST['album_id']);
// Pull the image information
$data = array('file'=>$_FILES['file']['tmp_name']);
$image_data = Art::get_from_source($data, 'album');
// If we got something back insert it
if ($image_data) {
$art = new Art($album->id,'album');
$art->insert($image_data,$_FILES['file']['type']);
show_confirmation(T_('Album Art Inserted'),'',"/albums.php?action=show&album=" . $album->id);
}
// Else it failed
else {
show_confirmation(T_('Album Art Not Located'), T_('Album Art could not be located at this time. This may be due to write access error, or the file is not received correctly.'),"/albums.php?action=show&album=" . $album->id);
}
break;
case 'find_art':
// If not a user then kick em out
if (!Access::check('interface','25')) { UI::access_denied(); exit; }
// Prevent the script from timing out
set_time_limit(0);
// get the Album information
$album = new Album($_GET['album_id']);
$album->format();
$art = new Art($album->id,'album');
$images = array();
$cover_url = array();
// If we've got an upload ignore the rest and just insert it
if (!empty($_FILES['file']['tmp_name'])) {
$path_info = pathinfo($_FILES['file']['name']);
$upload['file'] = $_FILES['file']['tmp_name'];
$upload['mime'] = 'image/' . $path_info['extension'];
$image_data = Art::get_from_source($upload, 'album');
if ($image_data) {
$art->insert($image_data,$upload['0']['mime']);
show_confirmation(T_('Album Art Inserted'),'',"/albums.php?action=show&album=" . $_REQUEST['album_id']);
break;
} // if image data
} // if it's an upload
// Build the options for our search
if (isset($_REQUEST['artist_name'])) {
$artist = scrub_in($_REQUEST['artist_name']);
} elseif ($album->artist_count == '1') {
$artist = $album->f_artist_name;
} else {
$artist = "";
}
if (isset($_REQUEST['album_name'])) {
$album_name = scrub_in($_REQUEST['album_name']);
} else {
$album_name = $album->full_name;
}
$options['artist'] = $artist;
$options['album_name'] = $album_name;
$options['keyword'] = trim($artist . " " . $album_name);
// Attempt to find the art.
$images = $art->gather($options);
if (!empty($_REQUEST['cover'])) {
$path_info = pathinfo($_REQUEST['cover']);
$cover_url[0]['url'] = scrub_in($_REQUEST['cover']);
$cover_url[0]['mime'] = 'image/' . $path_info['extension'];
}
$images = array_merge($cover_url,$images);
// If we've found anything then go for it!
if (count($images)) {
// We don't want to store raw's in here so we need to strip them out into a separate array
foreach ($images as $index=>$image) {
if ($image['raw']) {
unset($images[$index]['raw']);
}
} // end foreach
// Store the results for further use
$_SESSION['form']['images'] = $images;
require_once AmpConfig::get('prefix') . '/templates/show_album_art.inc.php';
}
// Else nothing
else {
show_confirmation(T_('Album Art Not Located'), T_('Album Art could not be located at this time. This may be due to write access error, or the file is not received correctly.'),"/albums.php?action=show&album=" . $album->id);
}
$albumname = $album->name;
$artistname = $artist;
// Remember the last typed entry, if there was one
if (!empty($_REQUEST['album_name'])) { $albumname = scrub_in($_REQUEST['album_name']); }
if (!empty($_REQUEST['artist_name'])) { $artistname = scrub_in($_REQUEST['artist_name']); }
require_once AmpConfig::get('prefix') . '/templates/show_get_albumart.inc.php';
break;
case 'select_art':
/* Check to see if we have the image url still */
$image_id = $_REQUEST['image'];
$album_id = $_REQUEST['album_id'];
// Prevent the script from timing out
set_time_limit(0);
$album = new Album($album_id);
$album_groups = $album->get_group_disks_ids();
$image = Art::get_from_source($_SESSION['form']['images'][$image_id], 'album');
$mime = $_SESSION['form']['images'][$image_id]['mime'];
foreach ($album_groups as $a_id) {
$art = new Art($a_id, 'album');
$art->insert($image, $mime);
}
header("Location:" . AmpConfig::get('web_path') . "/albums.php?action=show&album=" . $album_id);
break;
case 'update_from_tags': case 'update_from_tags':
// Make sure they are a 'power' user at least // Make sure they are a 'power' user at least
if (!Access::check('interface','75')) { if (!Access::check('interface','75')) {

169
arts.php Normal file
View file

@ -0,0 +1,169 @@
<?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.
*
*/
require_once 'lib/init.php';
require_once AmpConfig::get('prefix') . '/templates/header.inc.php';
$object_type = $_GET['object_type'];
$object_id = $_GET['object_id'];
$burl = '';
if (isset($_GET['burl'])) {
$burl = rawurldecode($_GET['burl']);
}
/* Switch on Action */
switch ($_REQUEST['action']) {
case 'clear_art':
if (!$GLOBALS['user']->has_access('75')) { UI::access_denied(); }
$art = new Art($object_id, $object_type);
$art->reset();
show_confirmation(T_('Art Cleared'), T_('Art information has been removed from the database'), $burl);
break;
// Upload art
case 'upload_art':
// we didn't find anything
if (empty($_FILES['file']['tmp_name'])) {
show_confirmation(T_('Art Not Located'), T_('Art could not be located at this time. This may be due to write access error, or the file is not received correctly.'), $burl);
break;
}
// Pull the image information
$data = array('file'=>$_FILES['file']['tmp_name']);
$image_data = Art::get_from_source($data, $object_type);
// If we got something back insert it
if ($image_data) {
$art = new Art($object_id, $object_type);
$art->insert($image_data,$_FILES['file']['type']);
show_confirmation(T_('Art Inserted'), '', $burl);
}
// Else it failed
else {
show_confirmation(T_('Art Not Located'), T_('Art could not be located at this time. This may be due to write access error, or the file is not received correctly.'), $burl);
}
break;
case 'find_art':
// If not a user then kick em out
if (!Access::check('interface','25')) { UI::access_denied(); exit; }
// Prevent the script from timing out
set_time_limit(0);
$item = new $object_type($object_id);
$item->format();
$art = new Art($object_id, $object_type);
$images = array();
$cover_url = array();
// If we've got an upload ignore the rest and just insert it
if (!empty($_FILES['file']['tmp_name'])) {
$path_info = pathinfo($_FILES['file']['name']);
$upload['file'] = $_FILES['file']['tmp_name'];
$upload['mime'] = 'image/' . $path_info['extension'];
$image_data = Art::get_from_source($upload, $object_type);
if ($image_data) {
$art->insert($image_data,$upload['0']['mime']);
show_confirmation(T_('Art Inserted'), '', $burl);
break;
} // if image data
} // if it's an upload
$keywords = $item->get_keywords();
$keyword = '';
$options = array();
foreach ($keywords as $key => $word) {
if (isset($_REQUEST['option_' . $key])) {
$word['value'] = $_REQUEST['option_' . $key];
}
$options[$key] = $word['value'];
if ($word['important']) {
if (!empty($word['value'])) {
$keyword .= ' ' . $word['value'];
}
}
}
$options['keyword'] = trim($keyword);
// Attempt to find the art.
$images = $art->gather($options);
if (!empty($_REQUEST['cover'])) {
$path_info = pathinfo($_REQUEST['cover']);
$cover_url[0]['url'] = scrub_in($_REQUEST['cover']);
$cover_url[0]['mime'] = 'image/' . $path_info['extension'];
}
$images = array_merge($cover_url, $images);
// If we've found anything then go for it!
if (count($images)) {
// We don't want to store raw's in here so we need to strip them out into a separate array
foreach ($images as $index=>$image) {
if ($image['raw']) {
unset($images[$index]['raw']);
}
} // end foreach
// Store the results for further use
$_SESSION['form']['images'] = $images;
require_once AmpConfig::get('prefix') . '/templates/show_arts.inc.php';
}
// Else nothing
else {
show_confirmation(T_('Art Not Located'), T_('Art could not be located at this time. This may be due to write access error, or the file is not received correctly.'), $burl);
}
require_once AmpConfig::get('prefix') . '/templates/show_get_art.inc.php';
break;
case 'select_art':
/* Check to see if we have the image url still */
$image_id = $_REQUEST['image'];
// Prevent the script from timing out
set_time_limit(0);
$image = Art::get_from_source($_SESSION['form']['images'][$image_id], 'album');
$mime = $_SESSION['form']['images'][$image_id]['mime'];
// Special case for albums, I'm not sure if we should keep it, remove it or find a generic way
if ($object_type == 'album') {
$album = new $object_type($object_id);
$album_groups = $album->get_group_disks_ids();
foreach ($album_groups as $a_id) {
$art = new Art($a_id, $object_type);
$art->insert($image, $mime);
}
} else {
$art = new Art($object_id, $object_type);
$art->insert($image, $mime);
}
header("Location:" . $burl);
break;
}
UI::show_footer();

View file

@ -77,14 +77,14 @@ switch ($_REQUEST['action']) {
//FIXME: This whole thing is ugly, even though it works. //FIXME: This whole thing is ugly, even though it works.
$browse->set_sort('count','ASC'); $browse->set_sort('count','ASC');
// This one's a doozy // This one's a doozy
$browse_type = isset($_GET['type']) ? $_GET['type'] : 'song';
$browse->set_simple_browse(false); $browse->set_simple_browse(false);
$browse->save_objects(Tag::get_tags(/*AmpConfig::get('offset_limit')*/)); // Should add a pager? $browse->save_objects(Tag::get_tags($browse_type /*, AmpConfig::get('offset_limit')*/)); // Should add a pager?
$object_ids = $browse->get_saved(); $object_ids = $browse->get_saved();
$keys = array_keys($object_ids); $keys = array_keys($object_ids);
Tag::build_cache($keys); Tag::build_cache($keys);
UI::show_box_top(T_('Tag Cloud'), 'box box_tag_cloud'); UI::show_box_top(T_('Tag Cloud'), 'box box_tag_cloud');
$browse2 = new Browse(); $browse2 = new Browse();
$browse_type = isset($_GET['type']) ? $_GET['type'] : 'song';
$browse2->set_type($browse_type); $browse2->set_type($browse_type);
$browse2->store(); $browse2->store();
require_once AmpConfig::get('prefix') . '/templates/show_tagcloud.inc.php'; require_once AmpConfig::get('prefix') . '/templates/show_tagcloud.inc.php';

View file

@ -49,42 +49,7 @@ if (!isset($_GET['object_type'])) {
$type = Art::validate_type($_GET['object_type']); $type = Art::validate_type($_GET['object_type']);
/* Decide what size this image is */ /* Decide what size this image is */
switch ($_GET['thumb']) { $size = Art::get_thumb_size($_GET['thumb']);
case '1':
/* This is used by the now_playing stuff */
$size['height'] = '75';
$size['width'] = '75';
break;
case '2':
$size['height'] = '128';
$size['width'] = '128';
break;
case '3':
/* This is used by the flash player */
$size['height'] = '80';
$size['width'] = '80';
break;
case '4':
/* Web Player size */
$size['height'] = 200;
$size['width'] = 200; // 200px width, set via CSS
break;
case '5':
/* Web Player size */
$size['height'] = 32;
$size['width'] = 32;
break;
case '6':
/* Video browsing size */
$size['height'] = 150;
$size['width'] = 100;
break;
default:
$size['height'] = '275';
$size['width'] = '275';
if (!isset($_GET['thumb'])) { $return_raw = true; }
break;
} // define size based on thumbnail
$image = ''; $image = '';
$mime = ''; $mime = '';

View file

@ -28,7 +28,7 @@
* it is related to the album table in the database. * it is related to the album table in the database.
* *
*/ */
class Album extends database_object class Album extends database_object implements library_item
{ {
/* Variables from DB */ /* Variables from DB */
public $id; public $id;
@ -224,7 +224,6 @@ class Album extends database_object
*/ */
public static function check($name, $year = 0, $disk = 0, $mbid = null, $album_artist = null, $readonly = false) public static function check($name, $year = 0, $disk = 0, $mbid = null, $album_artist = null, $readonly = false)
{ {
$trimmed = Catalog::trim_prefix(trim($name)); $trimmed = Catalog::trim_prefix(trim($name));
$name = $trimmed['string']; $name = $trimmed['string'];
$prefix = $trimmed['prefix']; $prefix = $trimmed['prefix'];
@ -464,6 +463,38 @@ class Album extends database_object
} // format } // format
public function get_keywords()
{
$keywords = array();
$keywords['artist'] = array('important' => true,
'label' => T_('Artist'),
'value' => (($album->artist_count == 1) ? $this->f_artist_name : ''));
$keywords['album'] = array('important' => true,
'label' => T_('Album'),
'value' => $this->f_full_name);
return $keywords;
}
public function get_fullname()
{
return $this->f_name;
}
public function get_parent()
{
if ($album->artist_count == 1) {
return array('artist', $album->artist_id);
}
return null;
}
public function get_childrens()
{
return array('song' => $this->get_songs());
}
/** /**
* get_random_songs * get_random_songs
* gets a random number, and a random assortment of songs from this album * gets a random number, and a random assortment of songs from this album

View file

@ -680,6 +680,7 @@ class Art extends database_object
foreach ($config as $method) { foreach ($config as $method) {
$method_name = "gather_" . $method; $method_name = "gather_" . $method;
$data = array();
if (in_array($method, $plugin_names)) { if (in_array($method, $plugin_names)) {
$plugin = new Plugin($method); $plugin = new Plugin($method);
$installed_version = Plugin::get_plugin_version($plugin->_plugin->name); $installed_version = Plugin::get_plugin_version($plugin->_plugin->name);
@ -705,17 +706,17 @@ class Art extends database_object
$data = $this->{$method_name}($limit); $data = $this->{$method_name}($limit);
break; break;
} }
// Add the results we got to the current set
$results = array_merge($results, (array) $data);
if ($limit && count($results) >= $limit) {
return array_slice($results, 0, $limit);
}
} else { } else {
debug_event("Art", $method_name . " not defined", 1); debug_event("Art", $method_name . " not defined", 1);
} }
// Add the results we got to the current set
$results = array_merge((array) $data, $results);
if ($limit && count($results) >= $limit) {
return array_slice($results, 0, $limit);
}
} // end foreach } // end foreach
return $results; return $results;
@ -1183,4 +1184,85 @@ class Art extends database_object
return $images; return $images;
} }
public static function get_thumb_size($thumb)
{
switch ($thumb) {
case '1':
/* This is used by the now_playing stuff */
$size['height'] = '75';
$size['width'] = '75';
break;
case '2':
$size['height'] = '128';
$size['width'] = '128';
break;
case '3':
/* This is used by the flash player */
$size['height'] = '80';
$size['width'] = '80';
break;
case '4':
/* Web Player size */
$size['height'] = 200;
$size['width'] = 200; // 200px width, set via CSS
break;
case '5':
/* Web Player size */
$size['height'] = 32;
$size['width'] = 32;
break;
case '6':
/* Video browsing size */
$size['height'] = 150;
$size['width'] = 100;
break;
case '7':
/* Video page size */
$size['height'] = 300;
$size['width'] = 200;
break;
default:
$size['height'] = '275';
$size['width'] = '275';
break;
}
return $size;
}
public static function display($object_type, $object_id, $name, $thumb, $link = null)
{
$size = self::get_thumb_size($thumb);
$prettyPhoto = ($link == null);
if ($link == null) {
$link = AmpConfig::get('web_path') . "/image.php?object_id=" . $object_id . "&object_type=" . $object_type . "&auth=" . session_id();
}
echo "<div class=\"item_art\">";
echo "<a href=\"" . $link . "\" alt=\"" . $name . "\"";
if ($prettyPhoto) {
echo " rel=\"prettyPhoto\"";
}
echo ">";
$imgurl = AmpConfig::get('web_path') . "/image.php?object_id=" . $object_id . "&object_type=" . $object_type . "&thumb=" . $thumb;
echo "<img src=\"" . $imgurl . "\" alt=\"" . $name . "\" height=\"" . $size['height'] . "\" width=\"" . $size['width'] . "\" />";
if ($prettyPhoto) {
echo "<div class=\"item_art_actions\">";
$burl = substr($_SERVER['REQUEST_URI'], strlen(AmpConfig::get('raw_web_path')) + 1);
$burl = rawurlencode($burl);
if ($GLOBALS['user']->has_access('25')) {
echo "<a href=\"" . AmpConfig::get('web_path') . "/arts.php?action=find_art&object_type=" . $object_type . "&object_id=" . $object_id . "&burl=" . $burl . "\">";
echo UI::get_icon('edit', T_('Edit/Find Art'));
echo "</a>";
}
if ($GLOBALS['user']->has_access('75')) {
echo "<a href=\"" . AmpConfig::get('web_path') . "/arts.php?action=clear_art&object_type=" . $object_type . "&object_id=" . $object_id . "&burl=" . $burl . "\" onclick=\"return confirm('" . T_('Do you really want to reset art?') . "');\">";
echo UI::get_icon('delete', T_('Reset Art'));
echo "</a>";
}
echo"</div>";
}
echo "</a>\n";
echo "</div>";
}
} // Art } // Art

View file

@ -20,7 +20,7 @@
* *
*/ */
class Artist extends database_object class Artist extends database_object implements library_item
{ {
/* Variables from DB */ /* Variables from DB */
public $id; public $id;
@ -345,6 +345,31 @@ class Artist extends database_object
} // format } // format
public function get_keywords()
{
$keywords = array();
$keywords['artist'] = array('important' => true,
'label' => T_('Artist'),
'value' => $this->f_full_name);
return $keywords;
}
public function get_fullname()
{
return $this->f_full_name;
}
public function get_parent()
{
return null;
}
public function get_childrens()
{
return array('album' => $this->get_albums());
}
/** /**
* check * check
* *

View file

@ -20,7 +20,7 @@
* *
*/ */
class Broadcast extends database_object class Broadcast extends database_object implements library_item
{ {
public $id; public $id;
public $started; public $started;
@ -115,6 +115,26 @@ class Broadcast extends database_object
$this->f_tags = Tag::get_display($this->tags, true, 'broadcast'); $this->f_tags = Tag::get_display($this->tags, true, 'broadcast');
} }
public function get_keywords()
{
return array();
}
public function get_fullname()
{
return $this->f_name;
}
public function get_parent()
{
return null;
}
public function get_childrens()
{
return array();
}
public static function get_broadcast_list_sql() public static function get_broadcast_list_sql()
{ {
$sql = "SELECT `id` FROM `broadcast` WHERE `started` = '1' "; $sql = "SELECT `id` FROM `broadcast` WHERE `started` = '1' ";

View file

@ -831,11 +831,13 @@ abstract class Catalog extends database_object
$searches['artist'] = array(); $searches['artist'] = array();
foreach ($songs as $song_id) { foreach ($songs as $song_id) {
$song = new Song($song_id); $song = new Song($song_id);
if (!in_array($song->album, $albums)) { if ($song->id) {
$searches['album'][] = $song->album; if (!in_array($song->album, $searches['album'])) {
} $searches['album'][] = $song->album;
if (!in_array($song->artist, $albums)) { }
$searches['artist'][] = $song->artist; if (!in_array($song->artist, $searches['artist'])) {
$searches['artist'][] = $song->artist;
}
} }
} }
} }

View file

@ -20,7 +20,7 @@
* *
*/ */
class Channel extends database_object class Channel extends database_object implements library_item
{ {
public $id; public $id;
public $is_private; public $is_private;
@ -184,6 +184,26 @@ class Channel extends database_object
$this->f_tags = Tag::get_display($this->tags, true, 'channel'); $this->f_tags = Tag::get_display($this->tags, true, 'channel');
} }
public function get_keywords()
{
return array();
}
public function get_fullname()
{
return $this->f_name;
}
public function get_parent()
{
return null;
}
public function get_childrens()
{
return array();
}
public function get_target_object() public function get_target_object()
{ {
$object = null; $object = null;

View file

@ -63,7 +63,7 @@ class Clip extends Video
* create * create
* This takes a key'd array of data as input and inserts a new clip entry, it returns the record id * This takes a key'd array of data as input and inserts a new clip entry, it returns the record id
*/ */
public static function insert($data, $options = array()) public static function insert($data, $gtypes = array(), $options = array())
{ {
$sql = "INSERT INTO `clip` (`id`,`artist`,`song`) " . $sql = "INSERT INTO `clip` (`id`,`artist`,`song`) " .
"VALUES (?, ?, ?)"; "VALUES (?, ?, ?)";
@ -111,4 +111,25 @@ class Clip extends Video
} //format } //format
public function get_keywords()
{
$keywords = parent::get_keywords();
if ($this->artist) {
$keywords['artist'] = array('important' => true,
'label' => T_('Artist'),
'value' => $this->f_artist);
}
return $keywords;
}
public function get_parent()
{
if ($this->artist) {
return array('artist', $this->artist);
}
return null;
}
} // Clip class } // Clip class

View file

@ -0,0 +1,46 @@
<?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.
*/
/**
* library_item Interface
*
* This defines how the media file classes should
* work, this lists all required functions and the expected
* input
*/
interface library_item
{
/**
* format
*
* Creates member variables for output
*/
public function format();
public function get_keywords();
public function get_fullname();
public function get_parent();
public function get_childrens();
} // end interface

View file

@ -28,13 +28,6 @@
*/ */
interface media interface media
{ {
/**
* format
*
* Creates the gussied-up member variables for output
*/
public function format();
/** /**
* get_stream_types * get_stream_types
* *

View file

@ -61,7 +61,7 @@ class Movie extends Video
* create * create
* This takes a key'd array of data as input and inserts a new movie entry, it returns the record id * This takes a key'd array of data as input and inserts a new movie entry, it returns the record id
*/ */
public static function insert($data, $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`,`description`, `year`) " .
"VALUES (?, ?, ?, ?)"; "VALUES (?, ?, ?, ?)";

View file

@ -62,7 +62,7 @@ class Personal_Video extends Video
* create * create
* This takes a key'd array of data as input and inserts a new personal video entry, it returns the record id * This takes a key'd array of data as input and inserts a new personal video entry, it returns the record id
*/ */
public static function insert($data, $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`,`description`) " .
"VALUES (?, ?, ?)"; "VALUES (?, ?, ?)";

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 class Playlist extends playlist_object implements library_item
{ {
/* Variables from the database */ /* Variables from the database */
public $genre; public $genre;
@ -124,6 +124,35 @@ class Playlist extends playlist_object
} // 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;
}
/** /**
* 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

@ -28,7 +28,7 @@
* this can include podcasts or what-have-you * this can include podcasts or what-have-you
* *
*/ */
class Radio extends database_object implements media class Radio extends database_object implements media, library_item
{ {
/* DB based variables */ /* DB based variables */
public $id; public $id;
@ -76,6 +76,26 @@ class Radio extends database_object implements media
} // 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()
{
return array();
}
/** /**
* update * update
* This is a static function that takes a key'd array for input * This is a static function that takes a key'd array for input

View file

@ -25,7 +25,7 @@
* Search-related voodoo. Beware tentacles. * Search-related voodoo. Beware tentacles.
*/ */
class Search extends playlist_object class Search extends playlist_object implements library_item
{ {
public $searchtype; public $searchtype;
public $rules; public $rules;
@ -622,6 +622,35 @@ class Search extends playlist_object
$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;
}
/** /**
* get_items * get_items
* *

View file

@ -20,7 +20,7 @@
* *
*/ */
class Song extends database_object implements media class Song extends database_object implements media, library_item
{ {
/* Variables from DB */ /* Variables from DB */
public $id; public $id;
@ -179,7 +179,7 @@ class Song extends database_object implements media
'VALUES(?, ?, ?)'; 'VALUES(?, ?, ?)';
Dba::write($sql, array($song_id, $comment, $lyrics)); Dba::write($sql, array($song_id, $comment, $lyrics));
return true; return $song_id;
} }
/** /**
@ -959,6 +959,31 @@ class Song extends database_object implements media
} // format } // format
public function get_keywords()
{
$keywords = array();
$keywords['title'] = array('important' => true,
'label' => T_('Title'),
'value' => $this->f_title);
return $keywords;
}
public function get_fullname()
{
return $this->f_title;
}
public function get_parent()
{
return array('album', $this->album);
}
public function get_childrens()
{
return array();
}
/** /**
* get_fields * get_fields
* This returns all of the 'data' fields for this object, we need to filter out some that we don't * This returns all of the 'data' fields for this object, we need to filter out some that we don't

View file

@ -365,7 +365,7 @@ class Subsonic_Api
self::check_version($input, "1.9.0"); self::check_version($input, "1.9.0");
$r = Subsonic_XML_Data::createSuccessResponse(); $r = Subsonic_XML_Data::createSuccessResponse();
Subsonic_XML_Data::addGenres($r, Tag::get_tags()); Subsonic_XML_Data::addGenres($r, Tag::get_tags('song'));
self::apiOutput($input, $r); self::apiOutput($input, $r);
} }

View file

@ -449,7 +449,7 @@ class Tag extends database_object
* This is a non-object non type dependent function that just returns tags * This is a non-object non type dependent function that just returns tags
* we've got, it can take filters (this is used by the tag cloud) * we've got, it can take filters (this is used by the tag cloud)
*/ */
public static function get_tags($limit = 0) public static function get_tags($type = '', $limit = 0)
{ {
//debug_event('tag.class.php', 'Get tags list called...', '5'); //debug_event('tag.class.php', 'Get tags list called...', '5');
if (parent::is_cached('tags_list', 'no_name')) { if (parent::is_cached('tags_list', 'no_name')) {
@ -462,8 +462,11 @@ class Tag extends database_object
$sql = "SELECT `tag_map`.`tag_id`, `tag`.`name`, COUNT(`tag_map`.`object_id`) AS `count` " . $sql = "SELECT `tag_map`.`tag_id`, `tag`.`name`, COUNT(`tag_map`.`object_id`) AS `count` " .
"FROM `tag_map` " . "FROM `tag_map` " .
"LEFT JOIN `tag` ON `tag`.`id`=`tag_map`.`tag_id` " . "LEFT JOIN `tag` ON `tag`.`id`=`tag_map`.`tag_id` " .
"WHERE `tag`.`merged_to` IS NULL " . "WHERE `tag`.`merged_to` IS NULL ";
"GROUP BY `tag`.`name` ORDER BY `count` DESC "; if (!empty($type)) {
$sql .= "AND `tag_map`.`object_type` = '" . scrub_in($type) . "' ";
}
$sql .="GROUP BY `tag`.`name` ORDER BY `count` DESC ";
if ($limit > 0) { if ($limit > 0) {
$sql .= " LIMIT $limit"; $sql .= " LIMIT $limit";

View file

@ -20,7 +20,7 @@
* *
*/ */
class TVShow extends database_object class TVShow extends database_object implements library_item
{ {
/* Variables from DB */ /* Variables from DB */
public $id; public $id;
@ -184,6 +184,31 @@ class TVShow extends database_object
return true; return true;
} }
public function get_keywords()
{
$keywords = array();
$keywords['tvshow'] = array('important' => true,
'label' => T_('TV Show'),
'value' => $this->f_name);
return $keywords;
}
public function get_fullname()
{
return $this->f_name;
}
public function get_parent()
{
return null;
}
public function get_childrens()
{
return array('tvshow_season' => $this->get_seasons());
}
/** /**
* check * check
* *

View file

@ -66,7 +66,7 @@ class TVShow_Episode extends Video
* insert * insert
* Insert a new tv show episode and related entities. * Insert a new tv show episode and related entities.
*/ */
public static function insert($data, $options = array()) public static function insert($data, $gtypes = array(), $options = array())
{ {
if (empty($data['tvshow'])) { if (empty($data['tvshow'])) {
$data['tvshow'] = T_('Unknown'); $data['tvshow'] = T_('Unknown');
@ -154,7 +154,29 @@ class TVShow_Episode extends Video
$this->f_full_title = $this->f_file; $this->f_full_title = $this->f_file;
return true; return true;
}
public function get_keywords()
{
$keywords = parent::get_keywords();
$keywords['tvshow'] = array('important' => true,
'label' => T_('TV Show'),
'value' => $this->f_tvshow);
$keywords['tvshow_season'] = array('important' => false,
'label' => T_('Season'),
'value' => $this->f_season);
if ($this->episode_number) {
$keywords['tvshow_episode'] = array('important' => false,
'label' => T_('Episode'),
'value' => $this->episode_number);
}
return $keywords;
}
public function get_parent()
{
return array('tvshow_season', $this->season);
} }
} }

View file

@ -20,7 +20,7 @@
* *
*/ */
class TVShow_Season extends database_object class TVShow_Season extends database_object implements library_item
{ {
/* Variables from DB */ /* Variables from DB */
public $id; public $id;
@ -143,6 +143,34 @@ class TVShow_Season extends database_object
return true; return true;
} }
public function get_keywords()
{
$keywords = array();
$keywords['tvshow'] = array('important' => true,
'label' => T_('TV Show'),
'value' => $this->f_tvshow);
$keywords['tvshow_season'] = array('important' => false,
'label' => T_('Season'),
'value' => $this->season_number);
return $keywords;
}
public function get_fullname()
{
return $this->f_name;
}
public function get_parent()
{
return array('tvshow', $this->tvshow);
}
public function get_childrens()
{
return array('tvshow_episode' => $this->get_episodes());
}
/** /**
* check * check
* *

View file

@ -20,7 +20,7 @@
* *
*/ */
class Video extends database_object implements media class Video extends database_object implements media, library_item
{ {
public $id; public $id;
public $title; public $title;
@ -114,9 +114,6 @@ class Video extends database_object implements media
$this->f_title = scrub_out($this->title); $this->f_title = scrub_out($this->title);
$this->f_full_title = $this->f_title; $this->f_full_title = $this->f_title;
$this->link = AmpConfig::get('web_path') . "/video.php?action=show_video&video_id=" . $this->id; $this->link = AmpConfig::get('web_path') . "/video.php?action=show_video&video_id=" . $this->id;
if (strtolower(get_class($this)) != 'video') {
$this->link .= '&type=' . get_class($this);
}
$this->f_link = "<a href=\"" . $this->link . "\" title=\"" . scrub_out($this->f_title) . "\"> " . scrub_out($this->f_title) . "</a>"; $this->f_link = "<a href=\"" . $this->link . "\" title=\"" . scrub_out($this->f_title) . "\"> " . scrub_out($this->f_title) . "</a>";
$this->f_codec = $this->video_codec . ' / ' . $this->audio_codec; $this->f_codec = $this->video_codec . ' / ' . $this->audio_codec;
$this->f_resolution = $this->resolution_x . 'x' . $this->resolution_y; $this->f_resolution = $this->resolution_x . 'x' . $this->resolution_y;
@ -141,6 +138,31 @@ class Video extends database_object implements media
} // format } // format
public function get_keywords()
{
$keywords = array();
$keywords['title'] = array('important' => true,
'label' => T_('Title'),
'value' => $this->f_title);
return $keywords;
}
public function get_fullname()
{
return $this->f_title;
}
public function get_parent()
{
return null;
}
public function get_childrens()
{
return array();
}
/** /**
* gc * gc
* *
@ -272,13 +294,13 @@ class Video extends database_object implements media
$gtype = $gtypes[0]; $gtype = $gtypes[0];
switch ($gtype) { switch ($gtype) {
case 'tvshow': case 'tvshow':
return TVShow_Episode::insert($data, $options); return TVShow_Episode::insert($data, $gtypes, $options);
case 'movie': case 'movie':
return Movie::insert($data, $options); return Movie::insert($data, $gtypes, $options);
case 'clip': case 'clip':
return Clip::insert($data, $options); return Clip::insert($data, $gtypes, $options);
case 'personal_video': case 'personal_video':
return Personal_Video::insert($data, $options); return Personal_Video::insert($data, $gtypes, $options);
default: default:
// Do nothing, video entry already created and no additional data for now // Do nothing, video entry already created and no additional data for now
break; break;

View file

@ -81,6 +81,7 @@ 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/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/library_item.interface.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

@ -97,16 +97,17 @@ class AmpacheTmdb {
debug_event('tmdb', 'Not a valid media type, skipped.', '5'); debug_event('tmdb', 'Not a valid media type, skipped.', '5');
return null; return null;
} }
$token = new \Tmdb\ApiToken($this->api_key);
$client = new \Tmdb\Client($token);
$configRepository = new \Tmdb\Repository\ConfigurationRepository($client);
$config = $configRepository->load();
$imageHelper = new \Tmdb\Helper\ImageHelper($config);
$title = $media_info['original_name'] ?: $media_info['title'];
$results = array();
try { try {
$token = new \Tmdb\ApiToken($this->api_key);
$client = new \Tmdb\Client($token);
$configRepository = new \Tmdb\Repository\ConfigurationRepository($client);
$config = $configRepository->load();
$imageHelper = new \Tmdb\Helper\ImageHelper($config);
$title = $media_info['original_name'] ?: $media_info['title'];
$results = array();
if (in_array('movie', $gather_types)) { if (in_array('movie', $gather_types)) {
if (!empty($title)) { if (!empty($title)) {
$apires = $client->getSearchApi()->searchMovies($title); $apires = $client->getSearchApi()->searchMovies($title);

View file

@ -36,18 +36,10 @@ $title .= '&nbsp;-&nbsp;' . (($album->f_album_artist_link) ? $album->f_album_art
<a href="http://en.wikipedia.org/wiki/Special:Search?search=%22<?php echo rawurlencode($album->f_name); ?>%22&go=Go" target="_blank"><?php echo UI::get_icon('wikipedia', T_('Search on Wikipedia ...')); ?></a> <a href="http://en.wikipedia.org/wiki/Special:Search?search=%22<?php echo rawurlencode($album->f_name); ?>%22&go=Go" target="_blank"><?php echo UI::get_icon('wikipedia', T_('Search on Wikipedia ...')); ?></a>
<a href="http://www.last.fm/search?q=%22<?php echo rawurlencode($album->f_artist); ?>%22+%22<?php echo rawurlencode($album->f_name); ?>%22&type=album" target="_blank"><?php echo UI::get_icon('lastfm', T_('Search on Last.fm ...')); ?></a> <a href="http://www.last.fm/search?q=%22<?php echo rawurlencode($album->f_artist); ?>%22+%22<?php echo rawurlencode($album->f_name); ?>%22&type=album" target="_blank"><?php echo UI::get_icon('lastfm', T_('Search on Last.fm ...')); ?></a>
</div> </div>
<div class="album_art">
<?php <?php
if ($album->name != T_('Unknown (Orphaned)')) {
$name = '[' . $album->f_artist . '] ' . scrub_out($album->full_name); $name = '[' . $album->f_artist . '] ' . scrub_out($album->full_name);
Art::display('album', $album->id, $name, 2);
$aa_url = $web_path . "/image.php?object_id=" . $album->id . "&object_type=album&auth=" . session_id();
echo "<a href=\"" . $aa_url . "\" rel=\"prettyPhoto\">";
echo "<img src=\"" . $web_path . "/image.php?object_id=" . $album->id . "&object_type=album&thumb=2\" alt=\"".$name."\" alt=\"".$name."\" height=\"128\" width=\"128\" />";
echo "</a>\n";
}
?> ?>
</div>
</div> </div>
<?php if (AmpConfig::get('ratings')) { ?> <?php if (AmpConfig::get('ratings')) { ?>
<div style="display:table-cell;" id="rating_<?php echo $album->id; ?>_album"> <div style="display:table-cell;" id="rating_<?php echo $album->id; ?>_album">
@ -97,16 +89,6 @@ if (AmpConfig::get('show_played_times')) {
&nbsp;&nbsp;<?php echo T_('Save Tracks Order'); ?> &nbsp;&nbsp;<?php echo T_('Save Tracks Order'); ?>
</a> </a>
</li> </li>
<?php if (Access::check('interface','75')) { ?>
<li>
<a href="<?php echo $web_path; ?>/albums.php?action=clear_art&album_id=<?php echo $album->id; ?>" onclick="return confirm('<?php echo T_('Do you really want to reset album art?'); ?>');"><?php echo UI::get_icon('delete', T_('Reset Album Art')); ?></a>
<a href="<?php echo $web_path; ?>/albums.php?action=clear_art&album_id=<?php echo $album->id; ?>" onclick="return confirm('<?php echo T_('Do you really want to reset album art?'); ?>');"><?php echo T_('Reset Album Art'); ?></a>
</li>
<?php } ?>
<li>
<a href="<?php echo $web_path; ?>/albums.php?action=find_art&album_id=<?php echo $album->id; ?>"><?php echo UI::get_icon('view', T_('Find Album Art')); ?></a>
<a href="<?php echo $web_path; ?>/albums.php?action=find_art&album_id=<?php echo $album->id; ?>"><?php echo T_('Find Album Art'); ?></a>
</li>
<!--<?php if ((Access::check('interface','50'))) { ?> <!--<?php if ((Access::check('interface','50'))) { ?>
<li> <li>
<a href="<?php echo $web_path; ?>/albums.php?action=update_from_tags&amp;album_id=<?php echo $album->id; ?>" onclick="return confirm('<?php echo T_('Do you really want to update from tags?'); ?>');"><?php echo UI::get_icon('cog', T_('Update from tags')); ?></a> <a href="<?php echo $web_path; ?>/albums.php?action=update_from_tags&amp;album_id=<?php echo $album->id; ?>" onclick="return confirm('<?php echo T_('Do you really want to update from tags?'); ?>');"><?php echo UI::get_icon('cog', T_('Update from tags')); ?></a>

View file

@ -33,18 +33,12 @@ $title = scrub_out($album->name) . '&nbsp;(' . $album->year . ')&nbsp;-&nbsp;' .
<a href="http://en.wikipedia.org/wiki/Special:Search?search=%22<?php echo rawurlencode($album->f_name); ?>%22&go=Go" target="_blank"><?php echo UI::get_icon('wikipedia', T_('Search on Wikipedia ...')); ?></a> <a href="http://en.wikipedia.org/wiki/Special:Search?search=%22<?php echo rawurlencode($album->f_name); ?>%22&go=Go" target="_blank"><?php echo UI::get_icon('wikipedia', T_('Search on Wikipedia ...')); ?></a>
<a href="http://www.last.fm/search?q=%22<?php echo rawurlencode($album->f_artist); ?>%22+%22<?php echo rawurlencode($album->f_name); ?>%22&type=album" target="_blank"><?php echo UI::get_icon('lastfm', T_('Search on Last.fm ...')); ?></a> <a href="http://www.last.fm/search?q=%22<?php echo rawurlencode($album->f_artist); ?>%22+%22<?php echo rawurlencode($album->f_name); ?>%22&type=album" target="_blank"><?php echo UI::get_icon('lastfm', T_('Search on Last.fm ...')); ?></a>
</div> </div>
<div class="album_art">
<?php <?php
if ($album->name != T_('Unknown (Orphaned)')) { if ($album->name != T_('Unknown (Orphaned)')) {
$name = '[' . $album->f_artist . '] ' . scrub_out($album->full_name); $name = '[' . $album->f_artist . '] ' . scrub_out($album->full_name);
Art::display('album', $album->id, $name, 2);
$aa_url = $web_path . "/image.php?object_id=" . $album->id . "&object_type=album&auth=" . session_id();
echo "<a href=\"" . $aa_url . "\" rel=\"prettyPhoto\">";
echo "<img src=\"" . $web_path . "/image.php?object_id=" . $album->id . "&object_type=album&thumb=2\" alt=\"".$name."\" alt=\"".$name."\" height=\"128\" width=\"128\" />";
echo "</a>\n";
} }
?> ?>
</div>
</div> </div>
<div id="information_actions"> <div id="information_actions">
<h3><?php echo T_('Actions'); ?>:</h3> <h3><?php echo T_('Actions'); ?>:</h3>
@ -69,16 +63,6 @@ $title = scrub_out($album->name) . '&nbsp;(' . $album->year . ')&nbsp;-&nbsp;' .
<?php echo Ajax::button('?action=basket&type=album_random&' . $album->get_http_album_query_ids('id'), 'random', T_('Random to temporary playlist'), 'play_random_'); ?> <?php echo Ajax::button('?action=basket&type=album_random&' . $album->get_http_album_query_ids('id'), 'random', T_('Random to temporary playlist'), 'play_random_'); ?>
<?php echo Ajax::text('?action=basket&type=album_random&' . $album->get_http_album_query_ids('id'), T_('Random to temporary playlist'), 'play_random_text_'); ?> <?php echo Ajax::text('?action=basket&type=album_random&' . $album->get_http_album_query_ids('id'), T_('Random to temporary playlist'), 'play_random_text_'); ?>
</li> </li>
<?php if (Access::check('interface','75')) { ?>
<li>
<a href="<?php echo $web_path; ?>/albums.php?action=clear_art&album_id=<?php echo $album->id; ?>" onclick="return confirm('<?php echo T_('Do you really want to reset album art?'); ?>');"><?php echo UI::get_icon('delete', T_('Reset Album Art')); ?></a>
<a href="<?php echo $web_path; ?>/albums.php?action=clear_art&album_id=<?php echo $album->id; ?>" onclick="return confirm('<?php echo T_('Do you really want to reset album art?'); ?>');"><?php echo T_('Reset Album Art'); ?></a>
</li>
<?php } ?>
<li>
<a href="<?php echo $web_path; ?>/albums.php?action=find_art&album_id=<?php echo $album->id; ?>"><?php echo UI::get_icon('view', T_('Find Album Art')); ?></a>
<a href="<?php echo $web_path; ?>/albums.php?action=find_art&album_id=<?php echo $album->id; ?>"><?php echo T_('Find Album Art'); ?></a>
</li>
<?php if (Access::check_function('batch_download')) { ?> <?php if (Access::check_function('batch_download')) { ?>
<li> <li>
<a href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $album->get_http_album_query_ids('id'); ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a> <a href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $album->get_http_album_query_ids('id'); ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a>

View file

@ -21,12 +21,12 @@
*/ */
?> ?>
<div class="album_art"> <div class="item_art">
<?php if ($biography && is_array($biography)) { ?> <?php if ($biography && is_array($biography)) { ?>
<a href="<?php echo $biography['megaphoto']; ?>" rel="prettyPhoto"><img src="<?php echo $biography['largephoto']; ?>" alt="<?php echo $artist->f_name; ?>" width="128"></a> <a href="<?php echo $biography['megaphoto']; ?>" rel="prettyPhoto"><img src="<?php echo $biography['largephoto']; ?>" alt="<?php echo $artist->f_name; ?>" width="128"></a>
<?php }?> <?php }?>
</div> </div>
<div id="artist_summary"> <div id="item_summary">
<?php if ($biography && is_array($biography)) { ?> <?php if ($biography && is_array($biography)) { ?>
<?php echo $biography['summary']; ?> <?php echo $biography['summary']; ?>
<?php }?> <?php }?>

View file

@ -25,7 +25,7 @@ $total_images = count($images);
$rows = floor($total_images/4); $rows = floor($total_images/4);
$i = 0; $i = 0;
?> ?>
<?php UI::show_box_top(T_('Select New Album Art'), 'box box_album_art'); ?> <?php UI::show_box_top(T_('Select New Art'), 'box box_album_art'); ?>
<table class="table-data"> <table class="table-data">
<tr> <tr>
<?php <?php
@ -34,11 +34,11 @@ while ($i <= $rows) {
while ($j < 4) { while ($j < 4) {
$key = $i*4+$j; $key = $i*4+$j;
$image_url = AmpConfig::get('web_path') . '/image.php?type=session&image_index=' . $key; $image_url = AmpConfig::get('web_path') . '/image.php?type=session&image_index=' . $key;
$dimensions = Core::image_dimensions(Art::get_from_source($_SESSION['form']['images'][$key], 'album')); $dimensions = Core::image_dimensions(Art::get_from_source($_SESSION['form']['images'][$key], $object_type));
if (!isset($images[$key])) { echo "<td>&nbsp;</td>\n"; } else { if (!isset($images[$key])) { echo "<td>&nbsp;</td>\n"; } else {
?> ?>
<td align="center"> <td align="center">
<a href="<?php echo $image_url; ?>" rel="prettyPhoto" target="_blank"><img src="<?php echo $image_url; ?>" alt="<?php echo T_('Album Art'); ?>" border="0" height="175" width="175" /></a> <a href="<?php echo $image_url; ?>" rel="prettyPhoto" target="_blank"><img src="<?php echo $image_url; ?>" alt="<?php echo T_('Art'); ?>" border="0" height="175" width="175" /></a>
<br /> <br />
<p align="center"> <p align="center">
<?php if (is_array($dimensions)) { ?> <?php if (is_array($dimensions)) { ?>
@ -46,7 +46,7 @@ while ($i <= $rows) {
<?php } else { ?> <?php } else { ?>
<span class="error"><?php echo T_('Invalid'); ?></span> <span class="error"><?php echo T_('Invalid'); ?></span>
<?php } ?> <?php } ?>
[<a href="<?php echo AmpConfig::get('web_path'); ?>/albums.php?action=select_art&amp;image=<?php echo $key; ?>&amp;album_id=<?php echo intval($_REQUEST['album_id']); ?>"><?php echo T_('Select'); ?></a>] [<a href="<?php echo AmpConfig::get('web_path'); ?>/arts.php?action=select_art&image=<?php echo $key; ?>&object_type=<?php echo $object_type; ?>&object_id=<?php echo $object_id; ?>&burl=<?php echo rawurlencode($burl); ?>"><?php echo T_('Select'); ?></a>]
</p> </p>
</td> </td>
<?php <?php

View file

@ -21,24 +21,24 @@
*/ */
?> ?>
<?php UI::show_box_top(T_('Customize Search'), 'box box_get_albumart'); ?> <?php UI::show_box_top(T_('Customize Search'), 'box box_get_albumart'); ?>
<form enctype="multipart/form-data" name="coverart" method="post" action="<?php echo AmpConfig::get('web_path'); ?>/albums.php?action=find_art&amp;album_id=<?php echo $album->id; ?>&amp;artist_name=<?php echo urlencode($_REQUEST['artist_name']);?>&amp;album_name=<?php echo urlencode($_REQUEST['album_name']); ?>&amp;cover=<?php echo urlencode($_REQUEST['cover']); ?>" style="Display:inline;"> <form enctype="multipart/form-data" name="coverart" method="post" action="<?php echo AmpConfig::get('web_path'); ?>/arts.php?action=find_art&object_type=<?php echo $object_type; ?>&object_id=<?php echo $object_id; ?>&burl=<?php echo rawurlencode($burl); ?>&artist_name=<?php echo urlencode($_REQUEST['artist_name']);?>&album_name=<?php echo urlencode($_REQUEST['album_name']); ?>&cover=<?php echo urlencode($_REQUEST['cover']); ?>" style="Display:inline;">
<table class="tabledata" cellspacing="0" cellpadding="0"> <table class="tabledata" cellspacing="0" cellpadding="0">
<tr> <?php
<td> foreach ($keywords as $key => $word) {
<?php echo T_('Artist'); ?>&nbsp; if ($key != 'keyword') {
</td> ?>
<td> <tr>
<input type="text" id="artist_name" name="artist_name" value="<?php echo scrub_out(unhtmlentities($artistname)); ?>" /> <td>
</td> <?php echo $word['label']; ?>&nbsp;
</tr> </td>
<tr> <td>
<td> <input type="text" id="option_<?php echo $key; ?>" name="option_<?php echo $key; ?>" value="<?php echo scrub_out(unhtmlentities($word['value'])); ?>" />
<?php echo T_('Album'); ?>&nbsp; </td>
</td> </tr>
<td> <?php
<input type="text" id="album_name" name="album_name" value="<?php echo scrub_out(unhtmlentities($albumname)); ?>" /> }
</td> }
</tr> ?>
<tr> <tr>
<td> <td>
<?php echo T_('Direct URL to Image'); ?> <?php echo T_('Direct URL to Image'); ?>
@ -58,7 +58,8 @@
</table> </table>
<div class="formValidation"> <div class="formValidation">
<input type="hidden" name="action" value="find_art" /> <input type="hidden" name="action" value="find_art" />
<input type="hidden" name="album_id" value="<?php echo $album->id; ?>" /> <input type="hidden" name="object_type" value="<?php echo $object_type; ?>" />
<input type="hidden" name="object_id" value="<?php echo $object_id; ?>" />
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo AmpConfig::get('max_upload_size'); ?>" /> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo AmpConfig::get('max_upload_size'); ?>" />
<input type="submit" value="<?php echo T_('Get Art'); ?>" /> <input type="submit" value="<?php echo T_('Get Art'); ?>" />
</div> </div>

View file

@ -28,16 +28,11 @@ $title = scrub_out($song->title);
$album = scrub_out($song->f_album_full); $album = scrub_out($song->f_album_full);
$artist = scrub_out($song->f_artist_full); $artist = scrub_out($song->f_artist_full);
?> ?>
<div class="album_art"> <?php
<?php if ($album != T_('Unknown (Orphaned)')) {
if ($album->name != T_('Unknown (Orphaned)')) { Art::display('album', $song->album, $song->f_album_full, 2);
$aa_url = $web_path . "/image.php?object_id=" . $song->album . "&object_type=album&auth=" . session_id(); }
echo "<a href=\"" . $aa_url . "\" rel=\"prettyPhoto\">"; ?>
echo "<img src=\"" . $web_path . "/image.php?object_id=" . $song->album . "&object_type=album&thumb=2\" alt=\"".$song->f_album_full."\" alt=\"".$song->f_album_full."\" height=\"128\" width=\"128\" />";
echo "</a>\n";
}
?>
</div>
<div class="np_group"> <div class="np_group">
<div class="np_cell cel_song"> <div class="np_cell cel_song">

View file

@ -27,7 +27,7 @@ $title = scrub_out($walbum->name) . '&nbsp;(' . $walbum->year . ')';
$title .= '&nbsp;-&nbsp;' . $walbum->f_artist_link; $title .= '&nbsp;-&nbsp;' . $walbum->f_artist_link;
?> ?>
<?php UI::show_box_top($title,'info-box missing'); ?> <?php UI::show_box_top($title,'info-box missing'); ?>
<div class="album_art"> <div class="item_art">
<?php <?php
// Attempt to find the art. // Attempt to find the art.
$art = new Art($walbum->mbid, 'album'); $art = new Art($walbum->mbid, 'album');

View file

@ -28,7 +28,16 @@ $browse->set_type($object_type);
UI::show_box_top($tvshow->f_name, 'info-box'); UI::show_box_top($tvshow->f_name, 'info-box');
?> ?>
<div class="item_right_info">
<?php
Art::display('tvshow', $tvshow->id, $tvshow->f_name, 6);
?>
<?php if ($tvshow->description) { ?>
<div id="item_summary">
<?php echo $tvshow->description; ?>
</div>
<?php } ?>
</div>
<?php <?php
if (AmpConfig::get('ratings')) { if (AmpConfig::get('ratings')) {
?> ?>

View file

@ -35,9 +35,7 @@
if (Art::is_enabled()) { if (Art::is_enabled()) {
?> ?>
<td class="cel_cover"> <td class="cel_cover">
<a href="<?php echo $tvshow->link; ?>"> <?php Art::display('tvshow', $tvshow->id, $tvshow->f_name, 6, $tvshow->link); ?>
<img height="150" width="100" alt="<?php echo $tvshow->f_name; ?>" title="<?php echo $tvshow->f_name; ?>" src="<?php echo AmpConfig::get('web_path'); ?>/image.php?object_type=tvshow&object_id=<?php echo $tvshow->id; ?>&thumb=6" />
</a>
</td> </td>
<?php } ?> <?php } ?>
<td class="cel_tvshow"><?php echo $tvshow->f_link; ?></td> <td class="cel_tvshow"><?php echo $tvshow->f_link; ?></td>

View file

@ -28,7 +28,11 @@ $browse->set_type($object_type);
UI::show_box_top($season->f_name . ' - ' . $season->f_tvshow_link, 'info-box'); UI::show_box_top($season->f_name . ' - ' . $season->f_tvshow_link, 'info-box');
?> ?>
<div class="item_right_info">
<?php
Art::display('tvshow_season', $season->id, $season->f_name, 6);
?>
</div>
<?php <?php
if (AmpConfig::get('ratings')) { if (AmpConfig::get('ratings')) {
?> ?>

View file

@ -35,9 +35,7 @@
if (Art::is_enabled()) { if (Art::is_enabled()) {
?> ?>
<td class="cel_cover"> <td class="cel_cover">
<a href="<?php echo $season->link; ?>"> <?php Art::display('tvshow_season', $season->id, $season->f_name, 6, $season->link); ?>
<img height="150" width="100" alt="<?php echo $season->f_name; ?>" title="<?php echo $season->f_name; ?>" src="<?php echo AmpConfig::get('web_path'); ?>/image.php?object_type=tvshow_season&object_id=<?php echo $season->id; ?>&thumb=6" />
</a>
</td> </td>
<?php } ?> <?php } ?>
<td class="cel_season"><?php echo $season->f_link; ?></td> <td class="cel_season"><?php echo $season->f_link; ?></td>

View file

@ -22,8 +22,12 @@
?> ?>
<?php UI::show_box_top($video->f_title . ' ' . T_('Details'), 'box box_video_details'); ?> <?php UI::show_box_top($video->f_title . ' ' . T_('Details'), 'box box_video_details'); ?>
<div class="item_right_info">
<?php
Art::display('video', $video->id, $video->f_title, 7);
?>
</div>
<dl class="media_details"> <dl class="media_details">
<?php if (AmpConfig::get('ratings')) { ?> <?php if (AmpConfig::get('ratings')) { ?>
<?php $rowparity = UI::flip_class(); ?> <?php $rowparity = UI::flip_class(); ?>
<dt class="<?php echo $rowparity; ?>"><?php echo T_('Rating'); ?></dt> <dt class="<?php echo $rowparity; ?>"><?php echo T_('Rating'); ?></dt>

View file

@ -542,7 +542,7 @@ a.button{padding:1px 3px;}
/* Specific to Info Boxes */ /* Specific to Info Boxes */
.info-box { float:left;margin-right:10px; } .info-box { float:left;margin-right:10px; }
.album_art { float:left; margin-right:10px; } .item_art { float:left; margin-right:10px; }
#information_actions { margin-left:5px; font-size:0.7em; float:left; } #information_actions { margin-left:5px; font-size:0.7em; float:left; }
#information_actions h3 { font-size:1.2em; margin:0.2em; } #information_actions h3 { font-size:1.2em; margin:0.2em; }
@ -564,7 +564,7 @@ a.button{padding:1px 3px;}
opacity: 1; opacity: 1;
} }
#artist_summary { #item_summary {
margin-right: 150px; margin-right: 150px;
} }

View file

@ -820,7 +820,7 @@ span.nodata {
/* only showing up in album view, so strange..bug*/ /* only showing up in album view, so strange..bug*/
} }
#content .info-box .box-content .album_art #content .info-box .box-content .item_art
{ {
float: right; float: right;
border: 4px double #ccc; border: 4px double #ccc;
@ -870,7 +870,7 @@ span.nodata {
opacity: 1; opacity: 1;
} }
#artist_summary { #item_summary {
margin-right: 150px; margin-right: 150px;
} }

View file

@ -553,7 +553,7 @@ input[type=checkbox] { border:0;background:none; }
/* Specific to Info Boxes */ /* Specific to Info Boxes */
.info-box .album_art {float:left;margin-right:10px;} .info-box .item_art {float:left;margin-right:10px;}
.info-box th {color:#8b3e38;} .info-box th {color:#8b3e38;}
#information_actions { } #information_actions { }
#information_actions h3 { color:#8b3e38; font-size:1.2em; margin:0.2em; } #information_actions h3 { color:#8b3e38; font-size:1.2em; margin:0.2em; }
@ -576,7 +576,7 @@ input[type=checkbox] { border:0;background:none; }
opacity: 1; opacity: 1;
} }
#artist_summary { #item_summary {
margin-right: 150px; margin-right: 150px;
} }

View file

@ -694,7 +694,7 @@ right: expression(-this.parentNode.offsetWidth%2+"px");
float:left; float:left;
margin-right:10px; margin-right:10px;
} }
.album_art { .item_art {
float:left; float:left;
margin-right:10px; margin-right:10px;
} }
@ -730,7 +730,7 @@ right: expression(-this.parentNode.offsetWidth%2+"px");
opacity: 1; opacity: 1;
} }
#artist_summary { #item_summary {
margin-right: 150px; margin-right: 150px;
} }

View file

@ -1386,11 +1386,34 @@ span.fatalerror {
margin-bottom: 30px; margin-bottom: 30px;
} }
#content .info-box .box-content .album_art { #content .info-box .box-content .item_art {
float: right; float: right;
} }
#content .info-box .box-content .album_art img { .item_art {
display: inline-block;
position: relative;
}
.item_art .item_art_actions {
display: none;
position: absolute;
float: right;
bottom: 0px;
right: 0px;
padding-bottom: 10px;
padding-top: 5px;
width: 100%;
height: 16px;
text-align: right;
background-color: rgba(0, 0, 0, 0.6);
}
.item_art .item_art_actions span {
padding-right: 6px;
}
.item_art img {
vertical-align: middle; vertical-align: middle;
-webkit-border-radius: 2px; -webkit-border-radius: 2px;
-moz-border-radius: 2px; -moz-border-radius: 2px;
@ -1402,11 +1425,15 @@ span.fatalerror {
margin: 2px; margin: 2px;
} }
#content .info-box .box-content .album_art img:hover { .item_art img:hover {
border: 2px solid #ff9d00; border: 2px solid #ff9d00;
margin: 0px; margin: 0px;
} }
.item_art:hover .item_art_actions {
display: block;
}
#information_actions ul li{ #information_actions ul li{
/*border-bottom:1px solid #ccc;*/ /*border-bottom:1px solid #ccc;*/
color: #999; color: #999;
@ -1465,7 +1492,7 @@ span.fatalerror {
opacity: 1; opacity: 1;
} }
#artist_summary { #item_summary {
margin-right: 150px; margin-right: 150px;
} }

View file

@ -27,12 +27,7 @@ UI::show_header();
switch ($_REQUEST['action']) { switch ($_REQUEST['action']) {
case 'show_video': case 'show_video':
default: default:
$type = 'Video'; $video = Video::create_from_id($_REQUEST['video_id']);
if (isset($_REQUEST['type'])) {
$type = Video::validate_type($_REQUEST['type']);
}
$video = new $type($_REQUEST['video_id']);
$video->format(); $video->format();
require_once AmpConfig::get('prefix') . '/templates/show_video.inc.php'; require_once AmpConfig::get('prefix') . '/templates/show_video.inc.php';
break; break;