mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-04 02:09:23 +02:00
Fix code style
This commit is contained in:
parent
3eea65ad1d
commit
3d13df9e0c
9 changed files with 89 additions and 89 deletions
|
@ -396,7 +396,7 @@ class Album extends database_object
|
||||||
$mbid = $data['mbid'];
|
$mbid = $data['mbid'];
|
||||||
|
|
||||||
$current_id = $this->id;
|
$current_id = $this->id;
|
||||||
|
|
||||||
if ($artist != $this->artist_id AND $artist) {
|
if ($artist != $this->artist_id AND $artist) {
|
||||||
// Update every song
|
// Update every song
|
||||||
$songs = $this->get_songs();
|
$songs = $this->get_songs();
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once Config::get('prefix') . '/modules/plugins/helper.php';
|
require_once Config::get('prefix') . '/modules/plugins/helper.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,9 +45,9 @@ class Plex_Api
|
||||||
header("HTTP/1.0 200 OK", true, 200);
|
header("HTTP/1.0 200 OK", true, 200);
|
||||||
header("Connection: close", true);
|
header("Connection: close", true);
|
||||||
header("X-Plex-Protocol: 1.0");
|
header("X-Plex-Protocol: 1.0");
|
||||||
|
|
||||||
header_remove("x-powered-by");
|
header_remove("x-powered-by");
|
||||||
|
|
||||||
if (strtolower($f) == "xml") {
|
if (strtolower($f) == "xml") {
|
||||||
header("Cache-Control: no-cache", true);
|
header("Cache-Control: no-cache", true);
|
||||||
header("Content-type: text/xml; charset=" . Config::get('site_charset'), true);
|
header("Content-type: text/xml; charset=" . Config::get('site_charset'), true);
|
||||||
|
@ -58,33 +58,32 @@ class Plex_Api
|
||||||
header("Content-type: " . $f, true);
|
header("Content-type: " . $f, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function apiOutput($string)
|
public static function apiOutput($string)
|
||||||
{
|
{
|
||||||
ob_start('ob_gzhandler');
|
ob_start('ob_gzhandler');
|
||||||
echo $string;
|
echo $string;
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
header("X-Plex-Compressed-Content-Length: " . ob_get_length());
|
header("X-Plex-Compressed-Content-Length: " . ob_get_length());
|
||||||
header("X-Plex-Original-Content-Length: " . strlen($string));
|
header("X-Plex-Original-Content-Length: " . strlen($string));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createError($code)
|
public static function createError($code)
|
||||||
{
|
{
|
||||||
$error = "";
|
$error = "";
|
||||||
switch ($code)
|
switch ($code) {
|
||||||
{
|
|
||||||
case 404:
|
case 404:
|
||||||
$error = "Not Found";
|
$error = "Not Found";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
header("Content-type: text/html", true);
|
header("Content-type: text/html", true);
|
||||||
header("HTTP/1.0 ". $code . " " . $error, true, $code);
|
header("HTTP/1.0 ". $code . " " . $error, true, $code);
|
||||||
|
|
||||||
$html = "<html><head><title>" . $error . "</title></head><body><h1>" . $code . " " . $error . "</h1></body></html>";
|
$html = "<html><head><title>" . $error . "</title></head><body><h1>" . $code . " " . $error . "</h1></body></html>";
|
||||||
self::apiOutput($html);
|
self::apiOutput($html);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function root()
|
public static function root()
|
||||||
{
|
{
|
||||||
$r = Plex_XML_Data::createContainer();
|
$r = Plex_XML_Data::createContainer();
|
||||||
|
@ -92,7 +91,7 @@ class Plex_Api
|
||||||
Plex_XML_Data::setContainerSize($r);
|
Plex_XML_Data::setContainerSize($r);
|
||||||
self::apiOutput($r->asXML());
|
self::apiOutput($r->asXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function library($params)
|
public static function library($params)
|
||||||
{
|
{
|
||||||
$r = Plex_XML_Data::createLibContainer();
|
$r = Plex_XML_Data::createLibContainer();
|
||||||
|
@ -100,7 +99,7 @@ class Plex_Api
|
||||||
Plex_XML_Data::setContainerSize($r);
|
Plex_XML_Data::setContainerSize($r);
|
||||||
self::apiOutput($r->asXML());
|
self::apiOutput($r->asXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function system($params)
|
public static function system($params)
|
||||||
{
|
{
|
||||||
$r = Plex_XML_Data::createSysContainer();
|
$r = Plex_XML_Data::createSysContainer();
|
||||||
|
@ -108,37 +107,37 @@ class Plex_Api
|
||||||
Plex_XML_Data::setContainerSize($r);
|
Plex_XML_Data::setContainerSize($r);
|
||||||
self::apiOutput($r->asXML());
|
self::apiOutput($r->asXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function clients($params)
|
public static function clients($params)
|
||||||
{
|
{
|
||||||
$r = Plex_XML_Data::createContainer();
|
$r = Plex_XML_Data::createContainer();
|
||||||
Plex_XML_Data::setContainerSize($r);
|
Plex_XML_Data::setContainerSize($r);
|
||||||
self::apiOutput($r->asXML());
|
self::apiOutput($r->asXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function channels($params)
|
public static function channels($params)
|
||||||
{
|
{
|
||||||
$r = Plex_XML_Data::createContainer();
|
$r = Plex_XML_Data::createContainer();
|
||||||
Plex_XML_Data::setContainerSize($r);
|
Plex_XML_Data::setContainerSize($r);
|
||||||
self::apiOutput($r->asXML());
|
self::apiOutput($r->asXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function photos($params)
|
public static function photos($params)
|
||||||
{
|
{
|
||||||
$r = Plex_XML_Data::createPluginContainer();
|
$r = Plex_XML_Data::createPluginContainer();
|
||||||
Plex_XML_Data::setContainerSize($r);
|
Plex_XML_Data::setContainerSize($r);
|
||||||
self::apiOutput($r->asXML());
|
self::apiOutput($r->asXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function photo($params)
|
public static function photo($params)
|
||||||
{
|
{
|
||||||
if (count($params) == 2) {
|
if (count($params) == 2) {
|
||||||
if ($params[0] == ':' && $params[1] == 'transcode') {
|
if ($params[0] == ':' && $params[1] == 'transcode') {
|
||||||
|
|
||||||
$width = $_REQUEST['width'];
|
$width = $_REQUEST['width'];
|
||||||
$height = $_REQUEST['height'];
|
$height = $_REQUEST['height'];
|
||||||
$url = $_REQUEST['url'];
|
$url = $_REQUEST['url'];
|
||||||
|
|
||||||
if ($width && $height && $url) {
|
if ($width && $height && $url) {
|
||||||
$response = PluginHelper::wsGet($url);
|
$response = PluginHelper::wsGet($url);
|
||||||
if ($response['status'] == 200) {
|
if ($response['status'] == 200) {
|
||||||
|
@ -154,28 +153,28 @@ class Plex_Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function music($params)
|
public static function music($params)
|
||||||
{
|
{
|
||||||
$r = Plex_XML_Data::createPluginContainer();
|
$r = Plex_XML_Data::createPluginContainer();
|
||||||
Plex_XML_Data::setContainerSize($r);
|
Plex_XML_Data::setContainerSize($r);
|
||||||
self::apiOutput($r->asXML());
|
self::apiOutput($r->asXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function video($params)
|
public static function video($params)
|
||||||
{
|
{
|
||||||
$r = Plex_XML_Data::createPluginContainer();
|
$r = Plex_XML_Data::createPluginContainer();
|
||||||
Plex_XML_Data::setContainerSize($r);
|
Plex_XML_Data::setContainerSize($r);
|
||||||
self::apiOutput($r->asXML());
|
self::apiOutput($r->asXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function applications($params)
|
public static function applications($params)
|
||||||
{
|
{
|
||||||
$r = Plex_XML_Data::createPluginContainer();
|
$r = Plex_XML_Data::createPluginContainer();
|
||||||
Plex_XML_Data::setContainerSize($r);
|
Plex_XML_Data::setContainerSize($r);
|
||||||
self::apiOutput($r->asXML());
|
self::apiOutput($r->asXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function library_sections($params)
|
public static function library_sections($params)
|
||||||
{
|
{
|
||||||
$r = Plex_XML_Data::createLibContainer();
|
$r = Plex_XML_Data::createLibContainer();
|
||||||
|
@ -199,20 +198,20 @@ class Plex_Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Plex_XML_Data::setContainerSize($r);
|
Plex_XML_Data::setContainerSize($r);
|
||||||
self::apiOutput($r->asXML());
|
self::apiOutput($r->asXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function library_metadata($params)
|
public static function library_metadata($params)
|
||||||
{
|
{
|
||||||
$r = Plex_XML_Data::createLibContainer();
|
$r = Plex_XML_Data::createLibContainer();
|
||||||
$n = count($params);
|
$n = count($params);
|
||||||
if ($n > 0) {
|
if ($n > 0) {
|
||||||
$key = $params[0];
|
$key = $params[0];
|
||||||
|
|
||||||
$id = Plex_XML_Data::getAmpacheId($key);
|
$id = Plex_XML_Data::getAmpacheId($key);
|
||||||
|
|
||||||
if ($n == 1) {
|
if ($n == 1) {
|
||||||
if (Plex_XML_Data::isArtist($key)) {
|
if (Plex_XML_Data::isArtist($key)) {
|
||||||
$artist = new Artist($id);
|
$artist = new Artist($id);
|
||||||
|
@ -225,7 +224,7 @@ class Plex_Api
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$subact = $params[1];
|
$subact = $params[1];
|
||||||
if($subact == "children") {
|
if ($subact == "children") {
|
||||||
if (Plex_XML_Data::isArtist($key)) {
|
if (Plex_XML_Data::isArtist($key)) {
|
||||||
$artist = new Artist($id);
|
$artist = new Artist($id);
|
||||||
$artist->format();
|
$artist->format();
|
||||||
|
@ -253,7 +252,7 @@ class Plex_Api
|
||||||
|
|
||||||
if ($art != null) {
|
if ($art != null) {
|
||||||
$art->get_db();
|
$art->get_db();
|
||||||
|
|
||||||
if (!$size) {
|
if (!$size) {
|
||||||
self::setHeader($art->raw_mime);
|
self::setHeader($art->raw_mime);
|
||||||
echo $art->raw;
|
echo $art->raw;
|
||||||
|
@ -274,15 +273,15 @@ class Plex_Api
|
||||||
Plex_XML_Data::setContainerSize($r);
|
Plex_XML_Data::setContainerSize($r);
|
||||||
self::apiOutput($r->asXML());
|
self::apiOutput($r->asXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function library_parts($params)
|
public static function library_parts($params)
|
||||||
{
|
{
|
||||||
$n = count($params);
|
$n = count($params);
|
||||||
|
|
||||||
if ($n == 2) {
|
if ($n == 2) {
|
||||||
$key = $params[0];
|
$key = $params[0];
|
||||||
$file = $params[1];
|
$file = $params[1];
|
||||||
|
|
||||||
$id = Plex_XML_Data::getAmpacheId($key);
|
$id = Plex_XML_Data::getAmpacheId($key);
|
||||||
$song = new Song($id);
|
$song = new Song($id);
|
||||||
if ($song->id) {
|
if ($song->id) {
|
||||||
|
|
|
@ -60,12 +60,12 @@ class Plex_XML_Data
|
||||||
{
|
{
|
||||||
return $id + Plex_XML_Data::AMPACHEID_TRACK;
|
return $id + Plex_XML_Data::AMPACHEID_TRACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getMediaId($id)
|
public static function getMediaId($id)
|
||||||
{
|
{
|
||||||
return $id + Plex_XML_Data::AMPACHEID_MEDIA;
|
return $id + Plex_XML_Data::AMPACHEID_MEDIA;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPartId($id)
|
public static function getPartId($id)
|
||||||
{
|
{
|
||||||
return $id + Plex_XML_Data::AMPACHEID_PART;
|
return $id + Plex_XML_Data::AMPACHEID_PART;
|
||||||
|
@ -99,12 +99,12 @@ class Plex_XML_Data
|
||||||
{
|
{
|
||||||
return ($id >= Plex_XML_Data::AMPACHEID_TRACK && $id < Plex_XML_Data::AMPACHEID_MEDIA);
|
return ($id >= Plex_XML_Data::AMPACHEID_TRACK && $id < Plex_XML_Data::AMPACHEID_MEDIA);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isMedia($id)
|
public static function isMedia($id)
|
||||||
{
|
{
|
||||||
return ($id >= Plex_XML_Data::AMPACHEID_MEDIA && $id < Plex_XML_Data::AMPACHEID_PART);
|
return ($id >= Plex_XML_Data::AMPACHEID_MEDIA && $id < Plex_XML_Data::AMPACHEID_PART);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isPart($id)
|
public static function isPart($id)
|
||||||
{
|
{
|
||||||
return ($id >= Plex_XML_Data::AMPACHEID_PART);
|
return ($id >= Plex_XML_Data::AMPACHEID_PART);
|
||||||
|
@ -123,7 +123,7 @@ class Plex_XML_Data
|
||||||
$response->addAttribute('status', 'ok');
|
$response->addAttribute('status', 'ok');
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createContainer()
|
public static function createContainer()
|
||||||
{
|
{
|
||||||
$response = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><MediaContainer/>');
|
$response = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><MediaContainer/>');
|
||||||
|
@ -138,14 +138,14 @@ class Plex_XML_Data
|
||||||
$response->addAttribute('mediaTagVersion', '1365384731');
|
$response->addAttribute('mediaTagVersion', '1365384731');
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createPluginContainer()
|
public static function createPluginContainer()
|
||||||
{
|
{
|
||||||
$response = self::createContainer();
|
$response = self::createContainer();
|
||||||
$response->addAttribute('content', 'plugins');
|
$response->addAttribute('content', 'plugins');
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createSysContainer()
|
public static function createSysContainer()
|
||||||
{
|
{
|
||||||
$response = self::createContainer();
|
$response = self::createContainer();
|
||||||
|
@ -159,32 +159,32 @@ class Plex_XML_Data
|
||||||
{
|
{
|
||||||
$container->addAttribute('size', $container->count());
|
$container->addAttribute('size', $container->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setContainerTitle($container, $title)
|
public static function setContainerTitle($container, $title)
|
||||||
{
|
{
|
||||||
$container->addAttribute('title1', $title);
|
$container->addAttribute('title1', $title);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getResourceUri($resource)
|
public static function getResourceUri($resource)
|
||||||
{
|
{
|
||||||
return '/resources/' . $resource;
|
return '/resources/' . $resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getMetadataUri($key)
|
public static function getMetadataUri($key)
|
||||||
{
|
{
|
||||||
return '/library/metadata/' . $key;
|
return '/library/metadata/' . $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPartUri($key, $type)
|
public static function getPartUri($key, $type)
|
||||||
{
|
{
|
||||||
return '/library/parts/' . $key . '/file.' . $type;
|
return '/library/parts/' . $key . '/file.' . $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function uuidFromKey($key)
|
public static function uuidFromKey($key)
|
||||||
{
|
{
|
||||||
return hash('sha1', $key);
|
return hash('sha1', $key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setRootContent($xml, $catalogs)
|
public static function setRootContent($xml, $catalogs)
|
||||||
{
|
{
|
||||||
$xml->addAttribute('friendlyName', 'Ampache');
|
$xml->addAttribute('friendlyName', 'Ampache');
|
||||||
|
@ -199,7 +199,7 @@ class Plex_XML_Data
|
||||||
$xml->addAttribute('transcoderVideo', '0');
|
$xml->addAttribute('transcoderVideo', '0');
|
||||||
$xml->addAttribute('updatedAt', self::getLastUpdate($catalogs));
|
$xml->addAttribute('updatedAt', self::getLastUpdate($catalogs));
|
||||||
$xml->addAttribute('version', '0.9.8.10.215-020456b');
|
$xml->addAttribute('version', '0.9.8.10.215-020456b');
|
||||||
|
|
||||||
$dir = $xml->addChild('Directory');
|
$dir = $xml->addChild('Directory');
|
||||||
$dir->addAttribute('count', '1');
|
$dir->addAttribute('count', '1');
|
||||||
$dir->addAttribute('key', 'channels');
|
$dir->addAttribute('key', 'channels');
|
||||||
|
@ -237,7 +237,7 @@ class Plex_XML_Data
|
||||||
$dir->addAttribute('key', 'transcode');
|
$dir->addAttribute('key', 'transcode');
|
||||||
$dir->addAttribute('title', 'transcode');
|
$dir->addAttribute('title', 'transcode');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getLastUpdate($catalogs)
|
public static function getLastUpdate($catalogs)
|
||||||
{
|
{
|
||||||
$last_update = 0;
|
$last_update = 0;
|
||||||
|
@ -253,12 +253,12 @@ class Plex_XML_Data
|
||||||
$last_update = $catalog->last_clean;
|
$last_update = $catalog->last_clean;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $last_update;
|
return $last_update;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setSections($xml, $catalogs)
|
public static function setSections($xml, $catalogs)
|
||||||
{
|
{
|
||||||
foreach ($catalogs as $id) {
|
foreach ($catalogs as $id) {
|
||||||
$catalog = Catalog::create_from_id($id);
|
$catalog = Catalog::create_from_id($id);
|
||||||
$catalog->format();
|
$catalog->format();
|
||||||
|
@ -274,16 +274,16 @@ class Plex_XML_Data
|
||||||
self::setSectionXContent($dir, $catalog, 'title');
|
self::setSectionXContent($dir, $catalog, 'title');
|
||||||
//$date = new DateTime("2013-01-01");
|
//$date = new DateTime("2013-01-01");
|
||||||
//$dir->addAttribute('createdAt', $date->getTimestamp());
|
//$dir->addAttribute('createdAt', $date->getTimestamp());
|
||||||
|
|
||||||
$location = $dir->addChild('Location');
|
$location = $dir->addChild('Location');
|
||||||
$location->addAttribute('id', $id);
|
$location->addAttribute('id', $id);
|
||||||
$location->addAttribute('path', $catalog->f_full_info);
|
$location->addAttribute('path', $catalog->f_full_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
$xml->addAttribute('allowSync', '0');
|
$xml->addAttribute('allowSync', '0');
|
||||||
self::setContainerTitle($xml, 'Plex Library');
|
self::setContainerTitle($xml, 'Plex Library');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setLibraryContent($xml)
|
public static function setLibraryContent($xml)
|
||||||
{
|
{
|
||||||
$dir = $xml->addChild('Directory');
|
$dir = $xml->addChild('Directory');
|
||||||
|
@ -295,11 +295,11 @@ class Plex_XML_Data
|
||||||
$dir = $xml->addChild('Directory');
|
$dir = $xml->addChild('Directory');
|
||||||
$dir->addAttribute('key', 'onDeck');
|
$dir->addAttribute('key', 'onDeck');
|
||||||
$dir->addAttribute('title', 'On Deck Content');
|
$dir->addAttribute('title', 'On Deck Content');
|
||||||
|
|
||||||
$xml->addAttribute('allowSync', '0');
|
$xml->addAttribute('allowSync', '0');
|
||||||
self::setContainerTitle($xml, 'Plex Library');
|
self::setContainerTitle($xml, 'Plex Library');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setSectionContent($xml, $catalog)
|
public static function setSectionContent($xml, $catalog)
|
||||||
{
|
{
|
||||||
$dir = $xml->addChild('Directory');
|
$dir = $xml->addChild('Directory');
|
||||||
|
@ -315,7 +315,7 @@ class Plex_XML_Data
|
||||||
$dir = $xml->addChild('Directory');
|
$dir = $xml->addChild('Directory');
|
||||||
$dir->addAttribute('key', 'recentlyAdded');
|
$dir->addAttribute('key', 'recentlyAdded');
|
||||||
$dir->addAttribute('title', 'Recently Added');
|
$dir->addAttribute('title', 'Recently Added');
|
||||||
|
|
||||||
$dir = $xml->addChild('Directory');
|
$dir = $xml->addChild('Directory');
|
||||||
$dir->addAttribute('key', 'search?type=8');
|
$dir->addAttribute('key', 'search?type=8');
|
||||||
$dir->addAttribute('prompt', 'Search for Artists');
|
$dir->addAttribute('prompt', 'Search for Artists');
|
||||||
|
@ -331,7 +331,7 @@ class Plex_XML_Data
|
||||||
$dir->addAttribute('prompt', 'Search for Tracks');
|
$dir->addAttribute('prompt', 'Search for Tracks');
|
||||||
$dir->addAttribute('search', '1');
|
$dir->addAttribute('search', '1');
|
||||||
$dir->addAttribute('title', 'Search Tracks...');
|
$dir->addAttribute('title', 'Search Tracks...');
|
||||||
|
|
||||||
$xml->addAttribute('allowSync', '0');
|
$xml->addAttribute('allowSync', '0');
|
||||||
$xml->addAttribute('content', 'secondary');
|
$xml->addAttribute('content', 'secondary');
|
||||||
$xml->addAttribute('nocache', '1');
|
$xml->addAttribute('nocache', '1');
|
||||||
|
@ -339,14 +339,14 @@ class Plex_XML_Data
|
||||||
$xml->addAttribute('viewMode', '65592');
|
$xml->addAttribute('viewMode', '65592');
|
||||||
self::setSectionXContent($xml, $catalog);
|
self::setSectionXContent($xml, $catalog);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setSectionXContent($xml, $catalog, $title = 'title1')
|
public static function setSectionXContent($xml, $catalog, $title = 'title1')
|
||||||
{
|
{
|
||||||
$xml->addAttribute('art', self::getResourceUri('artist-fanart.jpg'));
|
$xml->addAttribute('art', self::getResourceUri('artist-fanart.jpg'));
|
||||||
$xml->addAttribute('thumb', self::getResourceUri('artist.png'));
|
$xml->addAttribute('thumb', self::getResourceUri('artist.png'));
|
||||||
$xml->addAttribute($title, $catalog->name);
|
$xml->addAttribute($title, $catalog->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setSystemContent($xml)
|
public static function setSystemContent($xml)
|
||||||
{
|
{
|
||||||
$dir = $xml->addChild('Directory');
|
$dir = $xml->addChild('Directory');
|
||||||
|
@ -366,11 +366,11 @@ class Plex_XML_Data
|
||||||
$dir->addAttribute('title', 'Plug-ins');
|
$dir->addAttribute('title', 'Plug-ins');
|
||||||
$dir->addAttribute('name', 'Plug-ins');
|
$dir->addAttribute('name', 'Plug-ins');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setSectionAll($xml, $catalog)
|
public static function setSectionAll($xml, $catalog)
|
||||||
{
|
{
|
||||||
$artists = Catalog::get_artists(array($catalog->id));
|
$artists = Catalog::get_artists(array($catalog->id));
|
||||||
|
|
||||||
$xml->addAttribute('allowSync', '1');
|
$xml->addAttribute('allowSync', '1');
|
||||||
self::setSectionXContent($xml, $catalog);
|
self::setSectionXContent($xml, $catalog);
|
||||||
$xml->addAttribute('title2', 'All Artists');
|
$xml->addAttribute('title2', 'All Artists');
|
||||||
|
@ -379,16 +379,16 @@ class Plex_XML_Data
|
||||||
$xml->addAttribute('viewMode', '65592');
|
$xml->addAttribute('viewMode', '65592');
|
||||||
$xml->addAttribute('librarySectionID', $catalog->id);
|
$xml->addAttribute('librarySectionID', $catalog->id);
|
||||||
$xml->addAttribute('librarySectionUUID', self::uuidFromKey($catalog->id));
|
$xml->addAttribute('librarySectionUUID', self::uuidFromKey($catalog->id));
|
||||||
|
|
||||||
foreach($artists as $artist) {
|
foreach ($artists as $artist) {
|
||||||
self::addArtist($xml, $artist);
|
self::addArtist($xml, $artist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setSectionAlbums($xml, $catalog)
|
public static function setSectionAlbums($xml, $catalog)
|
||||||
{
|
{
|
||||||
$albums = $catalog->get_album_ids();
|
$albums = $catalog->get_album_ids();
|
||||||
|
|
||||||
$xml->addAttribute('allowSync', '0');
|
$xml->addAttribute('allowSync', '0');
|
||||||
self::setSectionXContent($xml, $catalog);
|
self::setSectionXContent($xml, $catalog);
|
||||||
$xml->addAttribute('title2', 'By Album');
|
$xml->addAttribute('title2', 'By Album');
|
||||||
|
@ -396,8 +396,8 @@ class Plex_XML_Data
|
||||||
$xml->addAttribute('nocache', '1');
|
$xml->addAttribute('nocache', '1');
|
||||||
$xml->addAttribute('viewGroup', 'album');
|
$xml->addAttribute('viewGroup', 'album');
|
||||||
$xml->addAttribute('viewMode', '65592');
|
$xml->addAttribute('viewMode', '65592');
|
||||||
|
|
||||||
foreach($albums as $id) {
|
foreach ($albums as $id) {
|
||||||
$album = new Album($id);
|
$album = new Album($id);
|
||||||
$album->format();
|
$album->format();
|
||||||
self::addAlbum($xml, $album);
|
self::addAlbum($xml, $album);
|
||||||
|
@ -413,7 +413,7 @@ class Plex_XML_Data
|
||||||
$xdir->addAttribute('addedAt', '');
|
$xdir->addAttribute('addedAt', '');
|
||||||
$xdir->addAttribute('updatedAt', '');
|
$xdir->addAttribute('updatedAt', '');
|
||||||
self::addArtistMeta($xdir, $artist);
|
self::addArtistMeta($xdir, $artist);
|
||||||
|
|
||||||
$tags = Tag::get_top_tags('artist', $artist->id);
|
$tags = Tag::get_top_tags('artist', $artist->id);
|
||||||
foreach ($tags as $tag_id=>$value) {
|
foreach ($tags as $tag_id=>$value) {
|
||||||
$tag = new Tag($tag_id);
|
$tag = new Tag($tag_id);
|
||||||
|
@ -421,7 +421,7 @@ class Plex_XML_Data
|
||||||
$xgenre->addAttribute('tag', $tag->name);
|
$xgenre->addAttribute('tag', $tag->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addArtistMeta($xml, $artist)
|
public static function addArtistMeta($xml, $artist)
|
||||||
{
|
{
|
||||||
$id = self::getArtistId($artist->id);
|
$id = self::getArtistId($artist->id);
|
||||||
|
@ -430,7 +430,7 @@ class Plex_XML_Data
|
||||||
$xml->addAttribute('summary', '');
|
$xml->addAttribute('summary', '');
|
||||||
$xml->addAttribute('thumb', '');
|
$xml->addAttribute('thumb', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addAlbum($xml, $album)
|
public static function addAlbum($xml, $album)
|
||||||
{
|
{
|
||||||
$xdir = $xml->addChild('Directory');
|
$xdir = $xml->addChild('Directory');
|
||||||
|
@ -444,7 +444,7 @@ class Plex_XML_Data
|
||||||
if ($album->year != 0 && $album->year != 'N/A') {
|
if ($album->year != 0 && $album->year != 'N/A') {
|
||||||
$xdir->addAttribute('year', $album->year);
|
$xdir->addAttribute('year', $album->year);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tags = Tag::get_top_tags('album', $album->id);
|
$tags = Tag::get_top_tags('album', $album->id);
|
||||||
foreach ($tags as $tag_id=>$value) {
|
foreach ($tags as $tag_id=>$value) {
|
||||||
$tag = new Tag($tag_id);
|
$tag = new Tag($tag_id);
|
||||||
|
@ -452,7 +452,7 @@ class Plex_XML_Data
|
||||||
$xgenre->addAttribute('tag', $tag->name);
|
$xgenre->addAttribute('tag', $tag->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addAlbumMeta($xml, $album)
|
public static function addAlbumMeta($xml, $album)
|
||||||
{
|
{
|
||||||
$id = self::getAlbumId($album->id);
|
$id = self::getAlbumId($album->id);
|
||||||
|
@ -475,7 +475,7 @@ class Plex_XML_Data
|
||||||
$xml->addAttribute('addedAt', '');
|
$xml->addAttribute('addedAt', '');
|
||||||
$xml->addAttribute('updatedAt', '');
|
$xml->addAttribute('updatedAt', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setArtistRoot($xml, $artist)
|
public static function setArtistRoot($xml, $artist)
|
||||||
{
|
{
|
||||||
self::addArtistMeta($xml, $artist);
|
self::addArtistMeta($xml, $artist);
|
||||||
|
@ -487,7 +487,7 @@ class Plex_XML_Data
|
||||||
$xml->addAttribute('title2', $artist->name);
|
$xml->addAttribute('title2', $artist->name);
|
||||||
$xml->addAttribute('viewGroup', 'album');
|
$xml->addAttribute('viewGroup', 'album');
|
||||||
$xml->addAttribute('viewMode', '65592');
|
$xml->addAttribute('viewMode', '65592');
|
||||||
|
|
||||||
$allalbums = $artist->get_albums();
|
$allalbums = $artist->get_albums();
|
||||||
foreach ($allalbums as $id) {
|
foreach ($allalbums as $id) {
|
||||||
$album = new Album($id);
|
$album = new Album($id);
|
||||||
|
@ -511,7 +511,7 @@ class Plex_XML_Data
|
||||||
}
|
}
|
||||||
$xml->addAttribute('viewGroup', 'track');
|
$xml->addAttribute('viewGroup', 'track');
|
||||||
$xml->addAttribute('viewMode', '65593');
|
$xml->addAttribute('viewMode', '65593');
|
||||||
|
|
||||||
$allsongs = $album->get_songs();
|
$allsongs = $album->get_songs();
|
||||||
foreach ($allsongs as $id) {
|
foreach ($allsongs as $id) {
|
||||||
$song = new Song($id);
|
$song = new Song($id);
|
||||||
|
@ -534,7 +534,7 @@ class Plex_XML_Data
|
||||||
$xdir->addAttribute('type', 'track');
|
$xdir->addAttribute('type', 'track');
|
||||||
$xdir->addAttribute('addedAt', '');
|
$xdir->addAttribute('addedAt', '');
|
||||||
$xdir->addAttribute('updatedAt', '');
|
$xdir->addAttribute('updatedAt', '');
|
||||||
|
|
||||||
$xmedia = $xdir->addChild('Media');
|
$xmedia = $xdir->addChild('Media');
|
||||||
$mediaid = self::getMediaId($song->id);
|
$mediaid = self::getMediaId($song->id);
|
||||||
$xmedia->addAttribute('id', $mediaid);
|
$xmedia->addAttribute('id', $mediaid);
|
||||||
|
@ -544,7 +544,7 @@ class Plex_XML_Data
|
||||||
// Type != Codec != Container, but that's how Ampache works today...
|
// Type != Codec != Container, but that's how Ampache works today...
|
||||||
$xmedia->addAttribute('audioCodec', $song->type);
|
$xmedia->addAttribute('audioCodec', $song->type);
|
||||||
$xmedia->addAttribute('container', $song->type);
|
$xmedia->addAttribute('container', $song->type);
|
||||||
|
|
||||||
$xpart = $xmedia->addChild('Part');
|
$xpart = $xmedia->addChild('Part');
|
||||||
$partid = self::getPartId($song->id);
|
$partid = self::getPartId($song->id);
|
||||||
$xpart->addAttribute('id', $partid);
|
$xpart->addAttribute('id', $partid);
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Radio extends database_object implements media
|
||||||
public function __construct($id = null)
|
public function __construct($id = null)
|
||||||
{
|
{
|
||||||
if (!$id) { return false; }
|
if (!$id) { return false; }
|
||||||
|
|
||||||
$info = $this->get_info($id, 'live_stream');
|
$info = $this->get_info($id, 'live_stream');
|
||||||
|
|
||||||
// Set the vars
|
// Set the vars
|
||||||
|
|
|
@ -555,7 +555,7 @@ class Song extends database_object implements media
|
||||||
{
|
{
|
||||||
foreach ($data as $key=>$value) {
|
foreach ($data as $key=>$value) {
|
||||||
debug_event('song.class.php', $key.'='.$value, '5');
|
debug_event('song.class.php', $key.'='.$value, '5');
|
||||||
|
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
case 'artist_name':
|
case 'artist_name':
|
||||||
// Need to create new artist according the name
|
// Need to create new artist according the name
|
||||||
|
@ -895,7 +895,7 @@ class Song extends database_object implements media
|
||||||
|
|
||||||
// Format the size
|
// Format the size
|
||||||
$this->f_size = UI::format_bytes($this->size);
|
$this->f_size = UI::format_bytes($this->size);
|
||||||
|
|
||||||
$this->f_lyrics = "<a title=\"" . scrub_out($this->title) . "\" href=\"" . Config::get('web_path') . "/song.php?action=show_lyrics&song_id=" . $this->id . "\">" . T_('Show Lyrics') . "</a>";
|
$this->f_lyrics = "<a title=\"" . scrub_out($this->title) . "\" href=\"" . Config::get('web_path') . "/song.php?action=show_lyrics&song_id=" . $this->id . "\">" . T_('Show Lyrics') . "</a>";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1106,12 +1106,13 @@ class Song extends database_object implements media
|
||||||
return array('format' => $target,
|
return array('format' => $target,
|
||||||
'command' => $cmd . ' ' . $args);
|
'command' => $cmd . ' ' . $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_lyrics() {
|
public function get_lyrics()
|
||||||
|
{
|
||||||
if ($this->lyrics) {
|
if ($this->lyrics) {
|
||||||
return array('text' => $this->lyrics);
|
return array('text' => $this->lyrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Plugin::get_plugins('get_lyrics') as $plugin_name) {
|
foreach (Plugin::get_plugins('get_lyrics') as $plugin_name) {
|
||||||
$plugin = new Plugin($plugin_name);
|
$plugin = new Plugin($plugin_name);
|
||||||
if ($plugin->load()) {
|
if ($plugin->load()) {
|
||||||
|
|
|
@ -313,7 +313,7 @@ class Update
|
||||||
|
|
||||||
$update_string = '- Remove unused live_stream fields and add codec field.<br />';
|
$update_string = '- Remove unused live_stream fields and add codec field.<br />';
|
||||||
$version[] = array('version' => '360022', 'description' => $update_string);
|
$version[] = array('version' => '360022', 'description' => $update_string);
|
||||||
|
|
||||||
$update_string = '- Enable/Disable SubSonic and Plex backend.<br />';
|
$update_string = '- Enable/Disable SubSonic and Plex backend.<br />';
|
||||||
$version[] = array('version' => '360023', 'description' => $update_string);
|
$version[] = array('version' => '360023', 'description' => $update_string);
|
||||||
|
|
||||||
|
@ -1717,7 +1717,7 @@ class Update
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* update_360023
|
* update_360023
|
||||||
*
|
*
|
||||||
|
@ -1733,7 +1733,7 @@ class Update
|
||||||
|
|
||||||
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'0')";
|
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'0')";
|
||||||
Dba::write($sql, array($id));
|
Dba::write($sql, array($id));
|
||||||
|
|
||||||
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
|
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
|
||||||
"VALUES ('plex_backend','0','Use Plex backend',25,'boolean','system')";
|
"VALUES ('plex_backend','0','Use Plex backend',25,'boolean','system')";
|
||||||
Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
|
@ -42,7 +42,7 @@ switch ($_REQUEST['action']) {
|
||||||
$browse->save_objects($object_ids);
|
$browse->save_objects($object_ids);
|
||||||
$browse->show_objects($object_ids);
|
$browse->show_objects($object_ids);
|
||||||
$browse->store();
|
$browse->store();
|
||||||
|
|
||||||
$results['browse_content'] = ob_get_clean();
|
$results['browse_content'] = ob_get_clean();
|
||||||
break;
|
break;
|
||||||
case 'create':
|
case 'create':
|
||||||
|
|
|
@ -74,7 +74,7 @@ function forceIframe()
|
||||||
var jsAjaxShowEditUrl = "<?php echo Config::get('ajax_show_edit_url') ?>";
|
var jsAjaxShowEditUrl = "<?php echo Config::get('ajax_show_edit_url') ?>";
|
||||||
var jsSaveTitle = "<?php echo T_('Save') ?>";
|
var jsSaveTitle = "<?php echo T_('Save') ?>";
|
||||||
var jsCancelTitle = "<?php echo T_('Cancel') ?>";
|
var jsCancelTitle = "<?php echo T_('Cancel') ?>";
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body <?php echo (Config::get('iframes')) ? "onLoad='forceIframe();'" : ""; ?>>
|
<body <?php echo (Config::get('iframes')) ? "onLoad='forceIframe();'" : ""; ?>>
|
||||||
|
|
|
@ -81,7 +81,7 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
||||||
if (Config::get('show_played_times')) {
|
if (Config::get('show_played_times')) {
|
||||||
$songprops[gettext_noop('# Played')] = scrub_out($song->object_cnt);
|
$songprops[gettext_noop('# Played')] = scrub_out($song->object_cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config::get('show_lyrics')) {
|
if (Config::get('show_lyrics')) {
|
||||||
$songprops[gettext_noop('Lyrics')] = $song->f_lyrics;
|
$songprops[gettext_noop('Lyrics')] = $song->f_lyrics;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue