mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 09:49:30 +02:00
Add beautiful url support on album arts (to fix UPnP album arts)
This commit is contained in:
parent
073899b399
commit
baf244c97c
4 changed files with 23 additions and 14 deletions
|
@ -550,10 +550,17 @@ class Art extends database_object
|
|||
$mime = isset($thumb_mime) ? $thumb_mime : (isset($mime) ? $mime : null);
|
||||
$extension = self::extension($mime);
|
||||
|
||||
$url = AmpConfig::get('web_path') . '/image.php?id=' . scrub_out($uid) . '&object_type=' . scrub_out($type) . '&auth=' . $sid;
|
||||
if (!empty($extension)) {
|
||||
$name = 'art.' . $extension;
|
||||
$url .= '&name=' . $name;
|
||||
if (AmpConfig::get('stream_beautiful_url')) {
|
||||
if (empty($extension)) {
|
||||
$extension = 'jpg';
|
||||
}
|
||||
$url = AmpConfig::get('web_path') . '/play/art/' . $sid . '/' . scrub_out($uid) . '/thumb.' . $extension;
|
||||
} else {
|
||||
$url = AmpConfig::get('web_path') . '/image.php?id=' . scrub_out($uid) . '&object_type=' . scrub_out($type) . '&auth=' . $sid;
|
||||
if (!empty($extension)) {
|
||||
$name = 'art.' . $extension;
|
||||
$url .= '&name=' . $name;
|
||||
}
|
||||
}
|
||||
|
||||
return $url;
|
||||
|
|
|
@ -38,6 +38,8 @@ class Upnp_Api
|
|||
# object.item.textItem
|
||||
# object.container
|
||||
|
||||
const UUIDSTR = '2d8a2e2b-7869-4836-a9ec-76447d620734';
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* This really isn't anything to do here, so it's private
|
||||
|
@ -57,7 +59,6 @@ class Upnp_Api
|
|||
|
||||
public static function sddpSend($delay=15, $host="239.255.255.250", $port=1900)
|
||||
{
|
||||
$uuidStr = '2d8a2e2b-7869-4836-a9ec-76447d620734';
|
||||
$strHeader = 'NOTIFY * HTTP/1.1' . "\r\n";
|
||||
$strHeader .= 'HOST: ' . $host . ':' . $port . "\r\n";
|
||||
$strHeader .= 'LOCATION: http://' . AmpConfig::get('http_host') . ':'. AmpConfig::get('http_port') . AmpConfig::get('raw_web_path') . '/upnp/MediaServerServiceDesc.php' . "\r\n";
|
||||
|
@ -65,28 +66,28 @@ class Upnp_Api
|
|||
$strHeader .= 'CACHE-CONTROL: max-age=1800' . "\r\n";
|
||||
$strHeader .= 'NTS: ssdp:alive' . "\r\n";
|
||||
$rootDevice = 'NT: upnp:rootdevice' . "\r\n";
|
||||
$rootDevice .= 'USN: uuid:' . $uuidStr . '::upnp:rootdevice' . "\r\n". "\r\n";
|
||||
$rootDevice .= 'USN: uuid:' . self::UUIDSTR . '::upnp:rootdevice' . "\r\n". "\r\n";
|
||||
|
||||
$buf = $strHeader . $rootDevice;
|
||||
self::udpSend($buf, $delay, $host, $port);
|
||||
|
||||
$uuid = 'NT: uuid:' . $uuidStr . "\r\n";
|
||||
$uuid .= 'USN: uuid:' . $uuidStr . "\r\n". "\r\n";
|
||||
$uuid = 'NT: uuid:' . self::UUIDSTR . "\r\n";
|
||||
$uuid .= 'USN: uuid:' . self::UUIDSTR . "\r\n". "\r\n";
|
||||
$buf = $strHeader . $uuid;
|
||||
self::udpSend($buf, $delay, $host, $port);
|
||||
|
||||
$deviceType = 'NT: urn:schemas-upnp-org:device:MediaServer:1' . "\r\n";
|
||||
$deviceType .= 'USN: uuid:' . $uuidStr . '::urn:schemas-upnp-org:device:MediaServer:1' . "\r\n". "\r\n";
|
||||
$deviceType .= 'USN: uuid:' . self::UUIDSTR . '::urn:schemas-upnp-org:device:MediaServer:1' . "\r\n". "\r\n";
|
||||
$buf = $strHeader . $deviceType;
|
||||
self::udpSend($buf, $delay, $host, $port);
|
||||
|
||||
$serviceCM = 'NT: urn:schemas-upnp-org:service:ConnectionManager:1' . "\r\n";
|
||||
$serviceCM .= 'USN: uuid:' . $uuidStr . '::urn:schemas-upnp-org:service:ConnectionManager:1' . "\r\n". "\r\n";
|
||||
$serviceCM .= 'USN: uuid:' . self::UUIDSTR . '::urn:schemas-upnp-org:service:ConnectionManager:1' . "\r\n". "\r\n";
|
||||
$buf = $strHeader . $serviceCM;
|
||||
self::udpSend($buf, $delay, $host, $port);
|
||||
|
||||
$serviceCD = 'NT: urn:schemas-upnp-org:service:ContentDirectory:1' . "\r\n";
|
||||
$serviceCD .= 'USN: uuid:' . $uuidStr . '::urn:schemas-upnp-org:service:ContentDirectory:1' . "\r\n". "\r\n";
|
||||
$serviceCD .= 'USN: uuid:' . self::UUIDSTR . '::urn:schemas-upnp-org:service:ContentDirectory:1' . "\r\n". "\r\n";
|
||||
$buf = $strHeader . $serviceCD;
|
||||
self::udpSend($buf, $delay, $host, $port);
|
||||
}
|
||||
|
@ -585,7 +586,7 @@ class Upnp_Api
|
|||
'childCount' => $album->song_count,
|
||||
'dc:title' => $album->f_title,
|
||||
'upnp:class' => 'object.container',
|
||||
//'upnp:album_art'=> $art_url,
|
||||
'upnp:album_art'=> $art_url,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -624,7 +625,7 @@ class Upnp_Api
|
|||
'parentID' => $parent,
|
||||
'dc:title' => $song->f_title,
|
||||
'upnp:class' => (isset($arrFileType['class'])) ? $arrFileType['class'] : 'object.item.unknownItem',
|
||||
//'upnp:album_art'=> $art_url,
|
||||
'upnp:album_art'=> $art_url,
|
||||
'dc:date' => date("c", $song->addition_time),
|
||||
'res' => Song::play_url($song->id),
|
||||
'size' => $song->size,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-s
|
||||
RewriteRule ^art/([^/]+)/([0-9]+)/thumb([0-9]*)\.([a-z]+)$ /image.php?id=$2&sid=$1 [L]
|
||||
RewriteRule ^([^/]+)/([^/]+)(/.*)?$ /play/$3?$1=$2 [N,QSA]
|
||||
RewriteRule ^(/[^/]+|[^/]+/|/?)$ /play/index.php [L,QSA]
|
||||
</IfModule>
|
|
@ -25,7 +25,7 @@ $web_path = AmpConfig::get('raw_web_path');
|
|||
<modelName>Ampache</modelName>
|
||||
<modelNumber><?php echo AmpConfig::get('version'); ?></modelNumber>
|
||||
<modelURL>http://ampache.org</modelURL>
|
||||
<UDN>uuid:2d8a2e2b-7869-4836-a9ec-76447d620734</UDN>
|
||||
<UDN>uuid:<?php echo Upnp_Api::UUIDSTR; ?></UDN>
|
||||
<iconList>
|
||||
<icon>
|
||||
<mimetype>image/png</mimetype>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue