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:
parent
d842ebbb00
commit
4454696f29
45 changed files with 767 additions and 330 deletions
139
albums.php
139
albums.php
|
@ -26,145 +26,6 @@ require_once AmpConfig::get('prefix') . '/templates/header.inc.php';
|
|||
|
||||
/* Switch on 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':
|
||||
// Make sure they are a 'power' user at least
|
||||
if (!Access::check('interface','75')) {
|
||||
|
|
169
arts.php
Normal file
169
arts.php
Normal 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();
|
|
@ -77,14 +77,14 @@ switch ($_REQUEST['action']) {
|
|||
//FIXME: This whole thing is ugly, even though it works.
|
||||
$browse->set_sort('count','ASC');
|
||||
// This one's a doozy
|
||||
$browse_type = isset($_GET['type']) ? $_GET['type'] : 'song';
|
||||
$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();
|
||||
$keys = array_keys($object_ids);
|
||||
Tag::build_cache($keys);
|
||||
UI::show_box_top(T_('Tag Cloud'), 'box box_tag_cloud');
|
||||
$browse2 = new Browse();
|
||||
$browse_type = isset($_GET['type']) ? $_GET['type'] : 'song';
|
||||
$browse2->set_type($browse_type);
|
||||
$browse2->store();
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_tagcloud.inc.php';
|
||||
|
|
37
image.php
37
image.php
|
@ -49,42 +49,7 @@ if (!isset($_GET['object_type'])) {
|
|||
$type = Art::validate_type($_GET['object_type']);
|
||||
|
||||
/* Decide what size this image is */
|
||||
switch ($_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
|
||||
$size = Art::get_thumb_size($_GET['thumb']);
|
||||
|
||||
$image = '';
|
||||
$mime = '';
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
* 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 */
|
||||
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)
|
||||
{
|
||||
|
||||
$trimmed = Catalog::trim_prefix(trim($name));
|
||||
$name = $trimmed['string'];
|
||||
$prefix = $trimmed['prefix'];
|
||||
|
@ -464,6 +463,38 @@ class Album extends database_object
|
|||
|
||||
} // 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
|
||||
* gets a random number, and a random assortment of songs from this album
|
||||
|
|
|
@ -680,6 +680,7 @@ class Art extends database_object
|
|||
foreach ($config as $method) {
|
||||
$method_name = "gather_" . $method;
|
||||
|
||||
$data = array();
|
||||
if (in_array($method, $plugin_names)) {
|
||||
$plugin = new Plugin($method);
|
||||
$installed_version = Plugin::get_plugin_version($plugin->_plugin->name);
|
||||
|
@ -705,16 +706,16 @@ class Art extends database_object
|
|||
$data = $this->{$method_name}($limit);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
debug_event("Art", $method_name . " not defined", 1);
|
||||
}
|
||||
|
||||
// Add the results we got to the current set
|
||||
$results = array_merge($results, (array) $data);
|
||||
$results = array_merge((array) $data, $results);
|
||||
|
||||
if ($limit && count($results) >= $limit) {
|
||||
return array_slice($results, 0, $limit);
|
||||
}
|
||||
} else {
|
||||
debug_event("Art", $method_name . " not defined", 1);
|
||||
}
|
||||
|
||||
} // end foreach
|
||||
|
||||
|
@ -1183,4 +1184,85 @@ class Art extends database_object
|
|||
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
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class Artist extends database_object
|
||||
class Artist extends database_object implements library_item
|
||||
{
|
||||
/* Variables from DB */
|
||||
public $id;
|
||||
|
@ -345,6 +345,31 @@ class Artist extends database_object
|
|||
|
||||
} // 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
|
||||
*
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class Broadcast extends database_object
|
||||
class Broadcast extends database_object implements library_item
|
||||
{
|
||||
public $id;
|
||||
public $started;
|
||||
|
@ -115,6 +115,26 @@ class Broadcast extends database_object
|
|||
$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()
|
||||
{
|
||||
$sql = "SELECT `id` FROM `broadcast` WHERE `started` = '1' ";
|
||||
|
|
|
@ -831,14 +831,16 @@ abstract class Catalog extends database_object
|
|||
$searches['artist'] = array();
|
||||
foreach ($songs as $song_id) {
|
||||
$song = new Song($song_id);
|
||||
if (!in_array($song->album, $albums)) {
|
||||
if ($song->id) {
|
||||
if (!in_array($song->album, $searches['album'])) {
|
||||
$searches['album'][] = $song->album;
|
||||
}
|
||||
if (!in_array($song->artist, $albums)) {
|
||||
if (!in_array($song->artist, $searches['artist'])) {
|
||||
$searches['artist'][] = $song->artist;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($videos == null) {
|
||||
$searches['video'] = $this->get_video_ids();
|
||||
} else {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class Channel extends database_object
|
||||
class Channel extends database_object implements library_item
|
||||
{
|
||||
public $id;
|
||||
public $is_private;
|
||||
|
@ -184,6 +184,26 @@ class Channel extends database_object
|
|||
$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()
|
||||
{
|
||||
$object = null;
|
||||
|
|
|
@ -63,7 +63,7 @@ class Clip extends Video
|
|||
* create
|
||||
* 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`) " .
|
||||
"VALUES (?, ?, ?)";
|
||||
|
@ -111,4 +111,25 @@ class Clip extends Video
|
|||
|
||||
} //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
|
||||
|
|
46
lib/class/library_item.interface.php
Normal file
46
lib/class/library_item.interface.php
Normal 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
|
|
@ -28,13 +28,6 @@
|
|||
*/
|
||||
interface media
|
||||
{
|
||||
/**
|
||||
* format
|
||||
*
|
||||
* Creates the gussied-up member variables for output
|
||||
*/
|
||||
public function format();
|
||||
|
||||
/**
|
||||
* get_stream_types
|
||||
*
|
||||
|
|
|
@ -61,7 +61,7 @@ class Movie extends Video
|
|||
* create
|
||||
* 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`) " .
|
||||
"VALUES (?, ?, ?, ?)";
|
||||
|
|
|
@ -62,7 +62,7 @@ class Personal_Video extends Video
|
|||
* create
|
||||
* 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`) " .
|
||||
"VALUES (?, ?, ?)";
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* 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 */
|
||||
public $genre;
|
||||
|
@ -124,6 +124,35 @@ class Playlist extends playlist_object
|
|||
|
||||
} // 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
|
||||
* Returns the single item on the playlist and all of it's information, restrict
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
* 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 */
|
||||
public $id;
|
||||
|
@ -76,6 +76,26 @@ class Radio extends database_object implements media
|
|||
|
||||
} // 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
|
||||
* This is a static function that takes a key'd array for input
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* Search-related voodoo. Beware tentacles.
|
||||
*/
|
||||
|
||||
class Search extends playlist_object
|
||||
class Search extends playlist_object implements library_item
|
||||
{
|
||||
public $searchtype;
|
||||
public $rules;
|
||||
|
@ -622,6 +622,35 @@ class Search extends playlist_object
|
|||
$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
|
||||
*
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class Song extends database_object implements media
|
||||
class Song extends database_object implements media, library_item
|
||||
{
|
||||
/* Variables from DB */
|
||||
public $id;
|
||||
|
@ -179,7 +179,7 @@ class Song extends database_object implements media
|
|||
'VALUES(?, ?, ?)';
|
||||
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
|
||||
|
||||
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
|
||||
* This returns all of the 'data' fields for this object, we need to filter out some that we don't
|
||||
|
|
|
@ -365,7 +365,7 @@ class Subsonic_Api
|
|||
self::check_version($input, "1.9.0");
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
|
|
|
@ -449,7 +449,7 @@ class Tag extends database_object
|
|||
* 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)
|
||||
*/
|
||||
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');
|
||||
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` " .
|
||||
"FROM `tag_map` " .
|
||||
"LEFT JOIN `tag` ON `tag`.`id`=`tag_map`.`tag_id` " .
|
||||
"WHERE `tag`.`merged_to` IS NULL " .
|
||||
"GROUP BY `tag`.`name` ORDER BY `count` DESC ";
|
||||
"WHERE `tag`.`merged_to` IS NULL ";
|
||||
if (!empty($type)) {
|
||||
$sql .= "AND `tag_map`.`object_type` = '" . scrub_in($type) . "' ";
|
||||
}
|
||||
$sql .="GROUP BY `tag`.`name` ORDER BY `count` DESC ";
|
||||
|
||||
if ($limit > 0) {
|
||||
$sql .= " LIMIT $limit";
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class TVShow extends database_object
|
||||
class TVShow extends database_object implements library_item
|
||||
{
|
||||
/* Variables from DB */
|
||||
public $id;
|
||||
|
@ -184,6 +184,31 @@ class TVShow extends database_object
|
|||
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
|
||||
*
|
||||
|
|
|
@ -66,7 +66,7 @@ class TVShow_Episode extends Video
|
|||
* insert
|
||||
* 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'])) {
|
||||
$data['tvshow'] = T_('Unknown');
|
||||
|
@ -154,7 +154,29 @@ class TVShow_Episode extends Video
|
|||
$this->f_full_title = $this->f_file;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class TVShow_Season extends database_object
|
||||
class TVShow_Season extends database_object implements library_item
|
||||
{
|
||||
/* Variables from DB */
|
||||
public $id;
|
||||
|
@ -143,6 +143,34 @@ class TVShow_Season extends database_object
|
|||
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
|
||||
*
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class Video extends database_object implements media
|
||||
class Video extends database_object implements media, library_item
|
||||
{
|
||||
public $id;
|
||||
public $title;
|
||||
|
@ -114,9 +114,6 @@ class Video extends database_object implements media
|
|||
$this->f_title = scrub_out($this->title);
|
||||
$this->f_full_title = $this->f_title;
|
||||
$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_codec = $this->video_codec . ' / ' . $this->audio_codec;
|
||||
$this->f_resolution = $this->resolution_x . 'x' . $this->resolution_y;
|
||||
|
@ -141,6 +138,31 @@ class Video extends database_object implements media
|
|||
|
||||
} // 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
|
||||
*
|
||||
|
@ -272,13 +294,13 @@ class Video extends database_object implements media
|
|||
$gtype = $gtypes[0];
|
||||
switch ($gtype) {
|
||||
case 'tvshow':
|
||||
return TVShow_Episode::insert($data, $options);
|
||||
return TVShow_Episode::insert($data, $gtypes, $options);
|
||||
case 'movie':
|
||||
return Movie::insert($data, $options);
|
||||
return Movie::insert($data, $gtypes, $options);
|
||||
case 'clip':
|
||||
return Clip::insert($data, $options);
|
||||
return Clip::insert($data, $gtypes, $options);
|
||||
case 'personal_video':
|
||||
return Personal_Video::insert($data, $options);
|
||||
return Personal_Video::insert($data, $gtypes, $options);
|
||||
default:
|
||||
// Do nothing, video entry already created and no additional data for now
|
||||
break;
|
||||
|
|
|
@ -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/playlist_object.abstract.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';
|
||||
|
||||
/* Set up the flip class */
|
||||
|
|
|
@ -97,6 +97,8 @@ class AmpacheTmdb {
|
|||
debug_event('tmdb', 'Not a valid media type, skipped.', '5');
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
$token = new \Tmdb\ApiToken($this->api_key);
|
||||
$client = new \Tmdb\Client($token);
|
||||
$configRepository = new \Tmdb\Repository\ConfigurationRepository($client);
|
||||
|
@ -106,7 +108,6 @@ class AmpacheTmdb {
|
|||
$title = $media_info['original_name'] ?: $media_info['title'];
|
||||
|
||||
$results = array();
|
||||
try {
|
||||
if (in_array('movie', $gather_types)) {
|
||||
if (!empty($title)) {
|
||||
$apires = $client->getSearchApi()->searchMovies($title);
|
||||
|
|
|
@ -36,18 +36,10 @@ $title .= ' - ' . (($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://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 class="album_art">
|
||||
<?php
|
||||
if ($album->name != T_('Unknown (Orphaned)')) {
|
||||
$name = '[' . $album->f_artist . '] ' . scrub_out($album->full_name);
|
||||
|
||||
$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";
|
||||
}
|
||||
Art::display('album', $album->id, $name, 2);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (AmpConfig::get('ratings')) { ?>
|
||||
<div style="display:table-cell;" id="rating_<?php echo $album->id; ?>_album">
|
||||
|
@ -97,16 +89,6 @@ if (AmpConfig::get('show_played_times')) {
|
|||
<?php echo T_('Save Tracks Order'); ?>
|
||||
</a>
|
||||
</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'))) { ?>
|
||||
<li>
|
||||
<a href="<?php echo $web_path; ?>/albums.php?action=update_from_tags&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>
|
||||
|
|
|
@ -33,18 +33,12 @@ $title = scrub_out($album->name) . ' (' . $album->year . ') - ' .
|
|||
<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>
|
||||
</div>
|
||||
<div class="album_art">
|
||||
<?php
|
||||
if ($album->name != T_('Unknown (Orphaned)')) {
|
||||
$name = '[' . $album->f_artist . '] ' . scrub_out($album->full_name);
|
||||
|
||||
$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";
|
||||
Art::display('album', $album->id, $name, 2);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="information_actions">
|
||||
<h3><?php echo T_('Actions'); ?>:</h3>
|
||||
|
@ -69,16 +63,6 @@ $title = scrub_out($album->name) . ' (' . $album->year . ') - ' .
|
|||
<?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_'); ?>
|
||||
</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')) { ?>
|
||||
<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>
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
*/
|
||||
?>
|
||||
|
||||
<div class="album_art">
|
||||
<div class="item_art">
|
||||
<?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>
|
||||
<?php }?>
|
||||
</div>
|
||||
<div id="artist_summary">
|
||||
<div id="item_summary">
|
||||
<?php if ($biography && is_array($biography)) { ?>
|
||||
<?php echo $biography['summary']; ?>
|
||||
<?php }?>
|
||||
|
|
|
@ -25,7 +25,7 @@ $total_images = count($images);
|
|||
$rows = floor($total_images/4);
|
||||
$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">
|
||||
<tr>
|
||||
<?php
|
||||
|
@ -34,11 +34,11 @@ while ($i <= $rows) {
|
|||
while ($j < 4) {
|
||||
$key = $i*4+$j;
|
||||
$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> </td>\n"; } else {
|
||||
?>
|
||||
<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 />
|
||||
<p align="center">
|
||||
<?php if (is_array($dimensions)) { ?>
|
||||
|
@ -46,7 +46,7 @@ while ($i <= $rows) {
|
|||
<?php } else { ?>
|
||||
<span class="error"><?php echo T_('Invalid'); ?></span>
|
||||
<?php } ?>
|
||||
[<a href="<?php echo AmpConfig::get('web_path'); ?>/albums.php?action=select_art&image=<?php echo $key; ?>&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>
|
||||
</td>
|
||||
<?php
|
|
@ -21,24 +21,24 @@
|
|||
*/
|
||||
?>
|
||||
<?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&album_id=<?php echo $album->id; ?>&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;">
|
||||
<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">
|
||||
<?php
|
||||
foreach ($keywords as $key => $word) {
|
||||
if ($key != 'keyword') {
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo T_('Artist'); ?>
|
||||
<?php echo $word['label']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="artist_name" name="artist_name" value="<?php echo scrub_out(unhtmlentities($artistname)); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo T_('Album'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="album_name" name="album_name" value="<?php echo scrub_out(unhtmlentities($albumname)); ?>" />
|
||||
<input type="text" id="option_<?php echo $key; ?>" name="option_<?php echo $key; ?>" value="<?php echo scrub_out(unhtmlentities($word['value'])); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo T_('Direct URL to Image'); ?>
|
||||
|
@ -58,7 +58,8 @@
|
|||
</table>
|
||||
<div class="formValidation">
|
||||
<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="submit" value="<?php echo T_('Get Art'); ?>" />
|
||||
</div>
|
|
@ -28,16 +28,11 @@ $title = scrub_out($song->title);
|
|||
$album = scrub_out($song->f_album_full);
|
||||
$artist = scrub_out($song->f_artist_full);
|
||||
?>
|
||||
<div class="album_art">
|
||||
<?php
|
||||
if ($album->name != T_('Unknown (Orphaned)')) {
|
||||
$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>
|
||||
<?php
|
||||
if ($album != T_('Unknown (Orphaned)')) {
|
||||
Art::display('album', $song->album, $song->f_album_full, 2);
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="np_group">
|
||||
<div class="np_cell cel_song">
|
||||
|
|
|
@ -27,7 +27,7 @@ $title = scrub_out($walbum->name) . ' (' . $walbum->year . ')';
|
|||
$title .= ' - ' . $walbum->f_artist_link;
|
||||
?>
|
||||
<?php UI::show_box_top($title,'info-box missing'); ?>
|
||||
<div class="album_art">
|
||||
<div class="item_art">
|
||||
<?php
|
||||
// Attempt to find the art.
|
||||
$art = new Art($walbum->mbid, 'album');
|
||||
|
|
|
@ -28,7 +28,16 @@ $browse->set_type($object_type);
|
|||
|
||||
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
|
||||
if (AmpConfig::get('ratings')) {
|
||||
?>
|
||||
|
|
|
@ -35,9 +35,7 @@
|
|||
if (Art::is_enabled()) {
|
||||
?>
|
||||
<td class="cel_cover">
|
||||
<a href="<?php echo $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>
|
||||
<?php Art::display('tvshow', $tvshow->id, $tvshow->f_name, 6, $tvshow->link); ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<td class="cel_tvshow"><?php echo $tvshow->f_link; ?></td>
|
||||
|
|
|
@ -28,7 +28,11 @@ $browse->set_type($object_type);
|
|||
|
||||
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
|
||||
if (AmpConfig::get('ratings')) {
|
||||
?>
|
||||
|
|
|
@ -35,9 +35,7 @@
|
|||
if (Art::is_enabled()) {
|
||||
?>
|
||||
<td class="cel_cover">
|
||||
<a href="<?php echo $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>
|
||||
<?php Art::display('tvshow_season', $season->id, $season->f_name, 6, $season->link); ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<td class="cel_season"><?php echo $season->f_link; ?></td>
|
||||
|
|
|
@ -22,8 +22,12 @@
|
|||
|
||||
?>
|
||||
<?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">
|
||||
|
||||
<?php if (AmpConfig::get('ratings')) { ?>
|
||||
<?php $rowparity = UI::flip_class(); ?>
|
||||
<dt class="<?php echo $rowparity; ?>"><?php echo T_('Rating'); ?></dt>
|
||||
|
|
|
@ -542,7 +542,7 @@ a.button{padding:1px 3px;}
|
|||
|
||||
/* Specific to Info Boxes */
|
||||
.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 h3 { font-size:1.2em; margin:0.2em; }
|
||||
|
||||
|
@ -564,7 +564,7 @@ a.button{padding:1px 3px;}
|
|||
opacity: 1;
|
||||
}
|
||||
|
||||
#artist_summary {
|
||||
#item_summary {
|
||||
margin-right: 150px;
|
||||
}
|
||||
|
||||
|
|
|
@ -820,7 +820,7 @@ span.nodata {
|
|||
/* 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;
|
||||
border: 4px double #ccc;
|
||||
|
@ -870,7 +870,7 @@ span.nodata {
|
|||
opacity: 1;
|
||||
}
|
||||
|
||||
#artist_summary {
|
||||
#item_summary {
|
||||
margin-right: 150px;
|
||||
}
|
||||
|
||||
|
|
|
@ -553,7 +553,7 @@ input[type=checkbox] { border:0;background:none; }
|
|||
|
||||
|
||||
/* 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;}
|
||||
#information_actions { }
|
||||
#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;
|
||||
}
|
||||
|
||||
#artist_summary {
|
||||
#item_summary {
|
||||
margin-right: 150px;
|
||||
}
|
||||
|
||||
|
|
|
@ -694,7 +694,7 @@ right: expression(-this.parentNode.offsetWidth%2+"px");
|
|||
float:left;
|
||||
margin-right:10px;
|
||||
}
|
||||
.album_art {
|
||||
.item_art {
|
||||
float:left;
|
||||
margin-right:10px;
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ right: expression(-this.parentNode.offsetWidth%2+"px");
|
|||
opacity: 1;
|
||||
}
|
||||
|
||||
#artist_summary {
|
||||
#item_summary {
|
||||
margin-right: 150px;
|
||||
}
|
||||
|
||||
|
|
|
@ -1386,11 +1386,34 @@ span.fatalerror {
|
|||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
#content .info-box .box-content .album_art {
|
||||
#content .info-box .box-content .item_art {
|
||||
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;
|
||||
-webkit-border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
|
@ -1402,11 +1425,15 @@ span.fatalerror {
|
|||
margin: 2px;
|
||||
}
|
||||
|
||||
#content .info-box .box-content .album_art img:hover {
|
||||
.item_art img:hover {
|
||||
border: 2px solid #ff9d00;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.item_art:hover .item_art_actions {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#information_actions ul li{
|
||||
/*border-bottom:1px solid #ccc;*/
|
||||
color: #999;
|
||||
|
@ -1465,7 +1492,7 @@ span.fatalerror {
|
|||
opacity: 1;
|
||||
}
|
||||
|
||||
#artist_summary {
|
||||
#item_summary {
|
||||
margin-right: 150px;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,12 +27,7 @@ UI::show_header();
|
|||
switch ($_REQUEST['action']) {
|
||||
case 'show_video':
|
||||
default:
|
||||
$type = 'Video';
|
||||
if (isset($_REQUEST['type'])) {
|
||||
$type = Video::validate_type($_REQUEST['type']);
|
||||
}
|
||||
|
||||
$video = new $type($_REQUEST['video_id']);
|
||||
$video = Video::create_from_id($_REQUEST['video_id']);
|
||||
$video->format();
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_video.inc.php';
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue