mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-04 03:27:21 -05:00 
			
		
		
		
	dlna fixes
This commit is contained in:
		
							parent
							
								
									6eeb5f25f4
								
							
						
					
					
						commit
						54c5e88b87
					
				@ -18,25 +18,31 @@ namespace MediaBrowser.Api.Dlna
 | 
			
		||||
        public string UuId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [Route("/Dlna/contentdirectory/contentdirectory.xml", "GET", Summary = "Gets dlna content directory xml")]
 | 
			
		||||
    [Route("/Dlna/contentdirectory/contentdirectory", "GET", Summary = "Gets dlna content directory xml")]
 | 
			
		||||
    [Route("/Dlna/{UuId}/contentdirectory/contentdirectory.xml", "GET", Summary = "Gets dlna content directory xml")]
 | 
			
		||||
    [Route("/Dlna/{UuId}/contentdirectory/contentdirectory", "GET", Summary = "Gets dlna content directory xml")]
 | 
			
		||||
    public class GetContentDirectory
 | 
			
		||||
    {
 | 
			
		||||
        [ApiMember(Name = "UuId", Description = "Server UuId", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
 | 
			
		||||
        public string UuId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [Route("/Dlna/connectionmanager/connectionmanager.xml", "GET", Summary = "Gets dlna connection manager xml")]
 | 
			
		||||
    [Route("/Dlna/connectionmanager/connectionmanager", "GET", Summary = "Gets dlna connection manager xml")]
 | 
			
		||||
    [Route("/Dlna/{UuId}/connectionmanager/connectionmanager.xml", "GET", Summary = "Gets dlna connection manager xml")]
 | 
			
		||||
    [Route("/Dlna/{UuId}/connectionmanager/connectionmanager", "GET", Summary = "Gets dlna connection manager xml")]
 | 
			
		||||
    public class GetConnnectionManager
 | 
			
		||||
    {
 | 
			
		||||
        [ApiMember(Name = "UuId", Description = "Server UuId", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
 | 
			
		||||
        public string UuId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [Route("/Dlna/mediareceiverregistrar/mediareceiverregistrar.xml", "GET", Summary = "Gets dlna mediareceiverregistrar xml")]
 | 
			
		||||
    [Route("/Dlna/mediareceiverregistrar/mediareceiverregistrar", "GET", Summary = "Gets dlna mediareceiverregistrar xml")]
 | 
			
		||||
    [Route("/Dlna/{UuId}/mediareceiverregistrar/mediareceiverregistrar.xml", "GET", Summary = "Gets dlna mediareceiverregistrar xml")]
 | 
			
		||||
    [Route("/Dlna/{UuId}/mediareceiverregistrar/mediareceiverregistrar", "GET", Summary = "Gets dlna mediareceiverregistrar xml")]
 | 
			
		||||
    public class GetMediaReceiverRegistrar
 | 
			
		||||
    {
 | 
			
		||||
        [ApiMember(Name = "UuId", Description = "Server UuId", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
 | 
			
		||||
        public string UuId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [Route("/Dlna/contentdirectory/{UuId}/control", "POST", Summary = "Processes a control request")]
 | 
			
		||||
    [Route("/Dlna/{UuId}/contentdirectory/control", "POST", Summary = "Processes a control request")]
 | 
			
		||||
    public class ProcessContentDirectoryControlRequest : IRequiresRequestStream
 | 
			
		||||
    {
 | 
			
		||||
        [ApiMember(Name = "UuId", Description = "Server UuId", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
 | 
			
		||||
@ -45,7 +51,7 @@ namespace MediaBrowser.Api.Dlna
 | 
			
		||||
        public Stream RequestStream { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [Route("/Dlna/connectionmanager/{UuId}/control", "POST", Summary = "Processes a control request")]
 | 
			
		||||
    [Route("/Dlna/{UuId}/connectionmanager/control", "POST", Summary = "Processes a control request")]
 | 
			
		||||
    public class ProcessConnectionManagerControlRequest : IRequiresRequestStream
 | 
			
		||||
    {
 | 
			
		||||
        [ApiMember(Name = "UuId", Description = "Server UuId", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
 | 
			
		||||
@ -54,7 +60,7 @@ namespace MediaBrowser.Api.Dlna
 | 
			
		||||
        public Stream RequestStream { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [Route("/Dlna/mediareceiverregistrar/{UuId}/control", "POST", Summary = "Processes a control request")]
 | 
			
		||||
    [Route("/Dlna/{UuId}/mediareceiverregistrar/control", "POST", Summary = "Processes a control request")]
 | 
			
		||||
    public class ProcessMediaReceiverRegistrarControlRequest : IRequiresRequestStream
 | 
			
		||||
    {
 | 
			
		||||
        [ApiMember(Name = "UuId", Description = "Server UuId", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
 | 
			
		||||
@ -63,30 +69,34 @@ namespace MediaBrowser.Api.Dlna
 | 
			
		||||
        public Stream RequestStream { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [Route("/Dlna/mediareceiverregistrar/{UuId}/events", Summary = "Processes an event subscription request")]
 | 
			
		||||
    [Route("/Dlna/{UuId}/mediareceiverregistrar/events", Summary = "Processes an event subscription request")]
 | 
			
		||||
    public class ProcessMediaReceiverRegistrarEventRequest
 | 
			
		||||
    {
 | 
			
		||||
        [ApiMember(Name = "UuId", Description = "Server UuId", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
 | 
			
		||||
        public string UuId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [Route("/Dlna/contentdirectory/{UuId}/events", Summary = "Processes an event subscription request")]
 | 
			
		||||
    [Route("/Dlna/{UuId}/contentdirectory/events", Summary = "Processes an event subscription request")]
 | 
			
		||||
    public class ProcessContentDirectoryEventRequest
 | 
			
		||||
    {
 | 
			
		||||
        [ApiMember(Name = "UuId", Description = "Server UuId", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
 | 
			
		||||
        public string UuId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [Route("/Dlna/connectionmanager/{UuId}/events", Summary = "Processes an event subscription request")]
 | 
			
		||||
    [Route("/Dlna/{UuId}/connectionmanager/events", Summary = "Processes an event subscription request")]
 | 
			
		||||
    public class ProcessConnectionManagerEventRequest
 | 
			
		||||
    {
 | 
			
		||||
        [ApiMember(Name = "UuId", Description = "Server UuId", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
 | 
			
		||||
        public string UuId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [Route("/Dlna/{UuId}/icons/{Filename}", "GET", Summary = "Gets a server icon")]
 | 
			
		||||
    [Route("/Dlna/icons/{Filename}", "GET", Summary = "Gets a server icon")]
 | 
			
		||||
    public class GetIcon
 | 
			
		||||
    {
 | 
			
		||||
        [ApiMember(Name = "UuId", Description = "Server UuId", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
 | 
			
		||||
        public string UuId { get; set; }
 | 
			
		||||
        
 | 
			
		||||
        [ApiMember(Name = "Filename", Description = "The icon filename", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
 | 
			
		||||
        public string Filename { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
@ -108,7 +118,9 @@ namespace MediaBrowser.Api.Dlna
 | 
			
		||||
 | 
			
		||||
        public object Get(GetDescriptionXml request)
 | 
			
		||||
        {
 | 
			
		||||
            var xml = _dlnaManager.GetServerDescriptionXml(GetRequestHeaders(), request.UuId);
 | 
			
		||||
            var url = Request.AbsoluteUri;
 | 
			
		||||
            var serverAddress = url.Substring(0, url.IndexOf("/dlna/", StringComparison.OrdinalIgnoreCase));
 | 
			
		||||
            var xml = _dlnaManager.GetServerDescriptionXml(GetRequestHeaders(), request.UuId, serverAddress);
 | 
			
		||||
 | 
			
		||||
            return ResultFactory.GetResult(xml, "text/xml");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -62,8 +62,9 @@ namespace MediaBrowser.Controller.Dlna
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="headers">The headers.</param>
 | 
			
		||||
        /// <param name="serverUuId">The server uu identifier.</param>
 | 
			
		||||
        /// <param name="serverAddress">The server address.</param>
 | 
			
		||||
        /// <returns>System.String.</returns>
 | 
			
		||||
        string GetServerDescriptionXml(IDictionary<string, string> headers, string serverUuId);
 | 
			
		||||
        string GetServerDescriptionXml(IDictionary<string, string> headers, string serverUuId, string serverAddress);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets the icon.
 | 
			
		||||
 | 
			
		||||
@ -475,12 +475,12 @@ namespace MediaBrowser.Dlna
 | 
			
		||||
            internal string Path { get; set; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string GetServerDescriptionXml(IDictionary<string, string> headers, string serverUuId)
 | 
			
		||||
        public string GetServerDescriptionXml(IDictionary<string, string> headers, string serverUuId, string serverAddress)
 | 
			
		||||
        {
 | 
			
		||||
            var profile = GetProfile(headers) ??
 | 
			
		||||
                          GetDefaultProfile();
 | 
			
		||||
 | 
			
		||||
            return new DescriptionXmlBuilder(profile, serverUuId, "").GetXml();
 | 
			
		||||
            return new DescriptionXmlBuilder(profile, serverUuId, serverAddress).GetXml();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public ImageStream GetIcon(string filename)
 | 
			
		||||
 | 
			
		||||
@ -11,11 +11,11 @@ namespace MediaBrowser.Dlna.MediaReceiverRegistrar
 | 
			
		||||
            {
 | 
			
		||||
                GetIsValidated(),
 | 
			
		||||
                GetIsAuthorized(),
 | 
			
		||||
                //GetRegisterDevice(),
 | 
			
		||||
                //GetGetAuthorizationDeniedUpdateID(),
 | 
			
		||||
                //GetGetAuthorizationGrantedUpdateID(),
 | 
			
		||||
                //GetGetValidationRevokedUpdateID(),
 | 
			
		||||
                //GetGetValidationSucceededUpdateID()
 | 
			
		||||
                GetRegisterDevice(),
 | 
			
		||||
                GetGetAuthorizationDeniedUpdateID(),
 | 
			
		||||
                GetGetAuthorizationGrantedUpdateID(),
 | 
			
		||||
                GetGetValidationRevokedUpdateID(),
 | 
			
		||||
                GetGetValidationSucceededUpdateID()
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            return list;
 | 
			
		||||
 | 
			
		||||
@ -23,6 +23,11 @@ namespace MediaBrowser.Dlna.Server
 | 
			
		||||
                throw new ArgumentNullException("serverUdn");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (string.IsNullOrWhiteSpace(serverAddress))
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentNullException("serverAddress");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            _profile = profile;
 | 
			
		||||
            _serverUdn = serverUdn;
 | 
			
		||||
            _serverAddress = serverAddress;
 | 
			
		||||
@ -81,7 +86,7 @@ namespace MediaBrowser.Dlna.Server
 | 
			
		||||
            builder.Append("<modelURL>" + SecurityElement.Escape(_profile.ModelUrl ?? string.Empty) + "</modelURL>");
 | 
			
		||||
            builder.Append("<serialNumber>" + SecurityElement.Escape(_profile.SerialNumber ?? string.Empty) + "</serialNumber>");
 | 
			
		||||
 | 
			
		||||
            //builder.Append("<URLBase>" + SecurityElement.Escape(_serverAddress) + "</URLBase>");
 | 
			
		||||
            builder.Append("<URLBase>" + SecurityElement.Escape(_serverAddress) + "</URLBase>");
 | 
			
		||||
 | 
			
		||||
            if (!string.IsNullOrWhiteSpace(_profile.SonyAggregationFlags))
 | 
			
		||||
            {
 | 
			
		||||
@ -101,7 +106,7 @@ namespace MediaBrowser.Dlna.Server
 | 
			
		||||
                builder.Append("<width>" + SecurityElement.Escape(icon.Width.ToString(_usCulture)) + "</width>");
 | 
			
		||||
                builder.Append("<height>" + SecurityElement.Escape(icon.Height.ToString(_usCulture)) + "</height>");
 | 
			
		||||
                builder.Append("<depth>" + SecurityElement.Escape(icon.Depth ?? string.Empty) + "</depth>");
 | 
			
		||||
                builder.Append("<url>" + SecurityElement.Escape(icon.Url ?? string.Empty) + "</url>");
 | 
			
		||||
                builder.Append("<url>" + BuildUrl(icon.Url) + "</url>");
 | 
			
		||||
 | 
			
		||||
                builder.Append("</icon>");
 | 
			
		||||
            }
 | 
			
		||||
@ -119,9 +124,9 @@ namespace MediaBrowser.Dlna.Server
 | 
			
		||||
 | 
			
		||||
                builder.Append("<serviceType>" + SecurityElement.Escape(service.ServiceType ?? string.Empty) + "</serviceType>");
 | 
			
		||||
                builder.Append("<serviceId>" + SecurityElement.Escape(service.ServiceId ?? string.Empty) + "</serviceId>");
 | 
			
		||||
                builder.Append("<SCPDURL>" + SecurityElement.Escape(service.ScpdUrl ?? string.Empty) + "</SCPDURL>");
 | 
			
		||||
                builder.Append("<controlURL>" + SecurityElement.Escape(service.ControlUrl ?? string.Empty) + "</controlURL>");
 | 
			
		||||
                builder.Append("<eventSubURL>" + SecurityElement.Escape(service.EventSubUrl ?? string.Empty) + "</eventSubURL>");
 | 
			
		||||
                builder.Append("<SCPDURL>" + BuildUrl(service.ScpdUrl) + "</SCPDURL>");
 | 
			
		||||
                builder.Append("<controlURL>" + BuildUrl(service.ControlUrl) + "</controlURL>");
 | 
			
		||||
                builder.Append("<eventSubURL>" + BuildUrl(service.EventSubUrl) + "</eventSubURL>");
 | 
			
		||||
 | 
			
		||||
                builder.Append("</service>");
 | 
			
		||||
            }
 | 
			
		||||
@ -129,6 +134,21 @@ namespace MediaBrowser.Dlna.Server
 | 
			
		||||
            builder.Append("</serviceList>");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private string BuildUrl(string url)
 | 
			
		||||
        {
 | 
			
		||||
            if (string.IsNullOrWhiteSpace(url))
 | 
			
		||||
            {
 | 
			
		||||
                return string.Empty;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            url = url.TrimStart('/');
 | 
			
		||||
 | 
			
		||||
            url = "/dlna/" + _serverUdn + "/" + url;
 | 
			
		||||
            //url = _serverAddress.TrimEnd('/') + url;
 | 
			
		||||
 | 
			
		||||
            return SecurityElement.Escape(url);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private IEnumerable<DeviceIcon> GetIcons()
 | 
			
		||||
        {
 | 
			
		||||
            var list = new List<DeviceIcon>();
 | 
			
		||||
@ -139,7 +159,7 @@ namespace MediaBrowser.Dlna.Server
 | 
			
		||||
                Depth = "24",
 | 
			
		||||
                Width = 240,
 | 
			
		||||
                Height = 240,
 | 
			
		||||
                Url = "/dlna/icons/logo240.png"
 | 
			
		||||
                Url = "icons/logo240.png"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            list.Add(new DeviceIcon
 | 
			
		||||
@ -148,7 +168,7 @@ namespace MediaBrowser.Dlna.Server
 | 
			
		||||
                Depth = "24",
 | 
			
		||||
                Width = 240,
 | 
			
		||||
                Height = 240,
 | 
			
		||||
                Url = "/dlna/icons/logo240.jpg"
 | 
			
		||||
                Url = "icons/logo240.jpg"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            list.Add(new DeviceIcon
 | 
			
		||||
@ -157,7 +177,7 @@ namespace MediaBrowser.Dlna.Server
 | 
			
		||||
                Depth = "24",
 | 
			
		||||
                Width = 120,
 | 
			
		||||
                Height = 120,
 | 
			
		||||
                Url = "/dlna/icons/logo120.png"
 | 
			
		||||
                Url = "icons/logo120.png"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            list.Add(new DeviceIcon
 | 
			
		||||
@ -166,7 +186,7 @@ namespace MediaBrowser.Dlna.Server
 | 
			
		||||
                Depth = "24",
 | 
			
		||||
                Width = 120,
 | 
			
		||||
                Height = 120,
 | 
			
		||||
                Url = "/dlna/icons/logo120.jpg"
 | 
			
		||||
                Url = "icons/logo120.jpg"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            list.Add(new DeviceIcon
 | 
			
		||||
@ -175,7 +195,7 @@ namespace MediaBrowser.Dlna.Server
 | 
			
		||||
                Depth = "24",
 | 
			
		||||
                Width = 48,
 | 
			
		||||
                Height = 48,
 | 
			
		||||
                Url = "/dlna/icons/logo48.png"
 | 
			
		||||
                Url = "icons/logo48.png"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            list.Add(new DeviceIcon
 | 
			
		||||
@ -184,7 +204,7 @@ namespace MediaBrowser.Dlna.Server
 | 
			
		||||
                Depth = "24",
 | 
			
		||||
                Width = 48,
 | 
			
		||||
                Height = 48,
 | 
			
		||||
                Url = "/dlna/icons/logo48.jpg"
 | 
			
		||||
                Url = "icons/logo48.jpg"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            return list;
 | 
			
		||||
@ -198,27 +218,27 @@ namespace MediaBrowser.Dlna.Server
 | 
			
		||||
            {
 | 
			
		||||
                ServiceType = "urn:schemas-upnp-org:service:ContentDirectory:1",
 | 
			
		||||
                ServiceId = "urn:upnp-org:serviceId:ContentDirectory",
 | 
			
		||||
                ScpdUrl = "/dlna/contentdirectory/contentdirectory.xml",
 | 
			
		||||
                ControlUrl = "/dlna/contentdirectory/" + _serverUdn + "/control",
 | 
			
		||||
                EventSubUrl = "/dlna/contentdirectory/" + _serverUdn + "/events"
 | 
			
		||||
                ScpdUrl = "contentdirectory/contentdirectory.xml",
 | 
			
		||||
                ControlUrl = "contentdirectory/control",
 | 
			
		||||
                EventSubUrl = "contentdirectory/events"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            list.Add(new DeviceService
 | 
			
		||||
            {
 | 
			
		||||
                ServiceType = "urn:schemas-upnp-org:service:ConnectionManager:1",
 | 
			
		||||
                ServiceId = "urn:upnp-org:serviceId:ConnectionManager",
 | 
			
		||||
                ScpdUrl = "/dlna/connectionmanager/connectionmanager.xml",
 | 
			
		||||
                ControlUrl = "/dlna/connectionmanager/" + _serverUdn + "/control",
 | 
			
		||||
                EventSubUrl = "/dlna/connectionmanager/" + _serverUdn + "/events"
 | 
			
		||||
                ScpdUrl = "connectionmanager/connectionmanager.xml",
 | 
			
		||||
                ControlUrl = "connectionmanager/control",
 | 
			
		||||
                EventSubUrl = "connectionmanager/events"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            list.Add(new DeviceService
 | 
			
		||||
            {
 | 
			
		||||
                ServiceType = "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1",
 | 
			
		||||
                ServiceId = "urn:microsoft.com:serviceId:X_MS_MediaReceiverRegistrar",
 | 
			
		||||
                ScpdUrl = "/dlna/mediareceiverregistrar/mediareceiverregistrar.xml",
 | 
			
		||||
                ControlUrl = "/dlna/mediareceiverregistrar/" + _serverUdn + "/control",
 | 
			
		||||
                EventSubUrl = "/dlna/mediareceiverregistrar/" + _serverUdn + "/events"
 | 
			
		||||
                ScpdUrl = "mediareceiverregistrar/mediareceiverregistrar.xml",
 | 
			
		||||
                ControlUrl = "mediareceiverregistrar/control",
 | 
			
		||||
                EventSubUrl = "mediareceiverregistrar/events"
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            return list;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user