1<?php 2 3declare(strict_types=0); 4 5/* 6 * vim:set softtabstop=4 shiftwidth=4 expandtab: 7 * 8 * LICENSE: GNU Affero General Public License, version 3 (AGPL-3.0-or-later) 9 * Copyright 2001 - 2020 Ampache.org 10 * 11 * This program is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Affero General Public License as published by 13 * the Free Software Foundation, either version 3 of the License, or 14 * (at your option) any later version. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Affero General Public License for more details. 20 * 21 * You should have received a copy of the GNU Affero General Public License 22 * along with this program. If not, see <https://www.gnu.org/licenses/>. 23 * 24 */ 25 26namespace Ampache\Application\Api\Upnp; 27 28use Ampache\Application\ApplicationInterface; 29use Ampache\Config\AmpConfig; 30use Ampache\Module\Api\Upnp_Api; 31 32final class MediaServiceDescriptionApplication implements ApplicationInterface 33{ 34 public function run(): void 35 { 36 if (!AmpConfig::get('upnp_backend')) { 37 echo T_("Disabled"); 38 39 return; 40 } 41 42 header("Content-Type:text/xml"); 43 $web_path = AmpConfig::get('local_web_path'); 44 45 echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> 46 <root xmlns="urn:schemas-upnp-org:device-1-0"> 47 <specVersion> 48 <major>1</major> 49 <minor>0</minor> 50 </specVersion> 51 <device> 52 <deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType> 53 <friendlyName><?php echo scrub_out(AmpConfig::get('site_title')); ?></friendlyName> 54 <manufacturer>ampache.org</manufacturer> 55 <manufacturerURL>http://ampache.org</manufacturerURL> 56 <modelDescription>A web based audio/video streaming application and file manager allowing you to access your music and videos from anywhere, using almost any Internet enabled device.</modelDescription> 57 <modelName>Ampache</modelName> 58 <modelNumber><?php echo AmpConfig::get('version'); ?></modelNumber> 59 <modelURL>http://ampache.org</modelURL> 60 <UDN>uuid:<?php echo Upnp_Api::get_uuidStr(); ?></UDN> 61 <iconList> 62 <icon> 63 <mimetype>image/png</mimetype> 64 <width>32</width> 65 <height>32</height> 66 <depth>24</depth> 67 <url><?php echo $web_path; ?>/upnp/images/icon32.png</url> 68 </icon> 69 <icon> 70 <mimetype>image/png</mimetype> 71 <width>48</width> 72 <height>48</height> 73 <depth>24</depth> 74 <url><?php echo $web_path; ?>/upnp/images/icon48.png</url> 75 </icon> 76 <icon> 77 <mimetype>image/png</mimetype> 78 <width>120</width> 79 <height>120</height> 80 <depth>24</depth> 81 <url><?php echo $web_path; ?>/upnp/images/icon120.png</url> 82 </icon> 83 <icon> 84 <mimetype>image/jpeg</mimetype> 85 <width>32</width> 86 <height>32</height> 87 <depth>24</depth> 88 <url><?php echo $web_path; ?>/upnp/images/icon32.jpg</url> 89 </icon> 90 <icon> 91 <mimetype>image/jpeg</mimetype> 92 <width>48</width> 93 <height>48</height> 94 <depth>24</depth> 95 <url><?php echo $web_path; ?>/upnp/images/icon48.jpg</url> 96 </icon> 97 <icon> 98 <mimetype>image/jpeg</mimetype> 99 <width>120</width> 100 <height>120</height> 101 <depth>24</depth> 102 <url><?php echo $web_path; ?>/upnp/images/icon120.jpg</url> 103 </icon> 104 </iconList> 105 <serviceList> 106 <service> 107 <serviceType>urn:schemas-upnp-org:service:ContentDirectory:1</serviceType> 108 <serviceId>urn:upnp-org:serviceId:ContentDirectory</serviceId> 109 <controlURL><?php echo $web_path; ?>/upnp/control-reply.php</controlURL> 110 <eventSubURL><?php echo $web_path; ?>/upnp/event-reply.php</eventSubURL> 111 <SCPDURL><?php echo $web_path; ?>/upnp/MediaServerContentDirectory.xml</SCPDURL> 112 </service> 113 <service> 114 <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType> 115 <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId> 116 <controlURL><?php echo $web_path; ?>/upnp/cm-control-reply.php</controlURL> 117 <eventSubURL><?php echo $web_path; ?>/upnp/cm-event-reply.php</eventSubURL> 118 <SCPDURL><?php echo $web_path; ?>/upnp/MediaServerConnectionManager.xml</SCPDURL> 119 </service> 120 </serviceList> 121 </device> 122 </root><?php 123 } 124} 125