mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-03 19:17:24 -05:00 
			
		
		
		
	update satip discovery
This commit is contained in:
		
							parent
							
								
									3c2cb7701f
								
							
						
					
					
						commit
						d2e62c5ba8
					
				@ -10,7 +10,6 @@ using MediaBrowser.Controller.Providers;
 | 
				
			|||||||
using MediaBrowser.Controller.Security;
 | 
					using MediaBrowser.Controller.Security;
 | 
				
			||||||
using MediaBrowser.Model.Connect;
 | 
					using MediaBrowser.Model.Connect;
 | 
				
			||||||
using MediaBrowser.Model.Entities;
 | 
					using MediaBrowser.Model.Entities;
 | 
				
			||||||
using MediaBrowser.Model.Events;
 | 
					 | 
				
			||||||
using MediaBrowser.Model.Logging;
 | 
					using MediaBrowser.Model.Logging;
 | 
				
			||||||
using MediaBrowser.Model.Net;
 | 
					using MediaBrowser.Model.Net;
 | 
				
			||||||
using MediaBrowser.Model.Serialization;
 | 
					using MediaBrowser.Model.Serialization;
 | 
				
			||||||
@ -24,7 +23,6 @@ using System.Text;
 | 
				
			|||||||
using System.Threading;
 | 
					using System.Threading;
 | 
				
			||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
using CommonIO;
 | 
					using CommonIO;
 | 
				
			||||||
using MediaBrowser.Common.IO;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace MediaBrowser.Server.Implementations.Connect
 | 
					namespace MediaBrowser.Server.Implementations.Connect
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -121,7 +119,6 @@ namespace MediaBrowser.Server.Implementations.Connect
 | 
				
			|||||||
            _securityManager = securityManager;
 | 
					            _securityManager = securityManager;
 | 
				
			||||||
            _fileSystem = fileSystem;
 | 
					            _fileSystem = fileSystem;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            _userManager.UserConfigurationUpdated += _userManager_UserConfigurationUpdated;
 | 
					 | 
				
			||||||
            _config.ConfigurationUpdated += _config_ConfigurationUpdated;
 | 
					            _config.ConfigurationUpdated += _config_ConfigurationUpdated;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            LoadCachedData();
 | 
					            LoadCachedData();
 | 
				
			||||||
@ -1102,64 +1099,6 @@ namespace MediaBrowser.Server.Implementations.Connect
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        async void _userManager_UserConfigurationUpdated(object sender, GenericEventArgs<User> e)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            //var user = e.Argument;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //await TryUploadUserPreferences(user, CancellationToken.None).ConfigureAwait(false);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        private async Task TryUploadUserPreferences(User user, CancellationToken cancellationToken)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            if (user == null)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                throw new ArgumentNullException("user");
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (string.IsNullOrEmpty(user.ConnectUserId))
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                return;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            if (string.IsNullOrEmpty(ConnectAccessKey))
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                return;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            var url = GetConnectUrl("user/preferences");
 | 
					 | 
				
			||||||
            url += "?userId=" + user.ConnectUserId;
 | 
					 | 
				
			||||||
            url += "&key=userpreferences";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            var options = new HttpRequestOptions
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                Url = url,
 | 
					 | 
				
			||||||
                CancellationToken = cancellationToken
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            var postData = new Dictionary<string, string>();
 | 
					 | 
				
			||||||
            postData["data"] = _json.SerializeToString(ConnectUserPreferences.FromUserConfiguration(user.Configuration));
 | 
					 | 
				
			||||||
            options.SetPostData(postData);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SetServerAccessToken(options);
 | 
					 | 
				
			||||||
            SetApplicationHeader(options);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            try
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                // No need to examine the response
 | 
					 | 
				
			||||||
                using (var stream = (await _httpClient.SendAsync(options, "POST").ConfigureAwait(false)).Content)
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            catch (Exception ex)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                _logger.ErrorException("Error uploading user preferences", ex);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        private async Task DownloadUserPreferences(User user, CancellationToken cancellationToken)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public async Task<User> GetLocalUser(string connectUserId)
 | 
					        public async Task<User> GetLocalUser(string connectUserId)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var user = _userManager.Users
 | 
					            var user = _userManager.Users
 | 
				
			||||||
 | 
				
			|||||||
@ -45,7 +45,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            var auth = GetAuthorizationDictionary(httpReq);
 | 
					            var auth = GetAuthorizationDictionary(httpReq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            string userId = null;
 | 
					 | 
				
			||||||
            string deviceId = null;
 | 
					            string deviceId = null;
 | 
				
			||||||
            string device = null;
 | 
					            string device = null;
 | 
				
			||||||
            string client = null;
 | 
					            string client = null;
 | 
				
			||||||
@ -53,9 +52,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if (auth != null)
 | 
					            if (auth != null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                // TODO: Remove this 
 | 
					 | 
				
			||||||
                auth.TryGetValue("UserId", out userId);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                auth.TryGetValue("DeviceId", out deviceId);
 | 
					                auth.TryGetValue("DeviceId", out deviceId);
 | 
				
			||||||
                auth.TryGetValue("Device", out device);
 | 
					                auth.TryGetValue("Device", out device);
 | 
				
			||||||
                auth.TryGetValue("Client", out client);
 | 
					                auth.TryGetValue("Client", out client);
 | 
				
			||||||
@ -78,7 +74,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
 | 
				
			|||||||
                Client = client,
 | 
					                Client = client,
 | 
				
			||||||
                Device = device,
 | 
					                Device = device,
 | 
				
			||||||
                DeviceId = deviceId,
 | 
					                DeviceId = deviceId,
 | 
				
			||||||
                UserId = userId,
 | 
					 | 
				
			||||||
                Version = version,
 | 
					                Version = version,
 | 
				
			||||||
                Token = token
 | 
					                Token = token
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
 | 
				
			|||||||
@ -162,12 +162,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
 | 
				
			|||||||
                throw new NotImplementedException();
 | 
					                throw new NotImplementedException();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Device hasn't implemented an m3u list
 | 
				
			||||||
            if (string.IsNullOrWhiteSpace(result.M3UUrl))
 | 
					            if (string.IsNullOrWhiteSpace(result.M3UUrl))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                throw new NotImplementedException();
 | 
					                result.IsEnabled = false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!result.M3UUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase))
 | 
					            else if (!result.M3UUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                var fullM3uUrl = url.Substring(0, url.LastIndexOf('/'));
 | 
					                var fullM3uUrl = url.Substring(0, url.LastIndexOf('/'));
 | 
				
			||||||
                result.M3UUrl = fullM3uUrl + "/" + result.M3UUrl.TrimStart('/');
 | 
					                result.M3UUrl = fullM3uUrl + "/" + result.M3UUrl.TrimStart('/');
 | 
				
			||||||
@ -194,6 +195,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
 | 
				
			|||||||
                                break;
 | 
					                                break;
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        case "satip:X_SATIPCAP":
 | 
				
			||||||
                        case "X_SATIPCAP":
 | 
					                        case "X_SATIPCAP":
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
                                // <satip:X_SATIPCAP xmlns:satip="urn:ses-com:satip">DVBS2-2</satip:X_SATIPCAP>
 | 
					                                // <satip:X_SATIPCAP xmlns:satip="urn:ses-com:satip">DVBS2-2</satip:X_SATIPCAP>
 | 
				
			||||||
@ -202,6 +204,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
 | 
				
			|||||||
                                break;
 | 
					                                break;
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        case "satip:X_SATIPM3U":
 | 
				
			||||||
                        case "X_SATIPM3U":
 | 
					                        case "X_SATIPM3U":
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
                                // <satip:X_SATIPM3U xmlns:satip="urn:ses-com:satip">/channellist.lua?select=m3u</satip:X_SATIPM3U>
 | 
					                                // <satip:X_SATIPM3U xmlns:satip="urn:ses-com:satip">/channellist.lua?select=m3u</satip:X_SATIPM3U>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user