mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-03 19:17:24 -05:00 
			
		
		
		
	add sat ini mappings
This commit is contained in:
		
							parent
							
								
									86a8c0805f
								
							
						
					
					
						commit
						14b9f94e0a
					
				@ -478,6 +478,13 @@ namespace MediaBrowser.Api.LiveTv
 | 
				
			|||||||
        public string Feature { get; set; }
 | 
					        public string Feature { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [Route("/LiveTv/TunerHosts/Satip/IniMappings", "GET", Summary = "Gets available mappings")]
 | 
				
			||||||
 | 
					    [Authenticated(AllowBeforeStartupWizard = true)]
 | 
				
			||||||
 | 
					    public class GetSatIniMappings : IReturn<List<NameValuePair>>
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public class LiveTvService : BaseApiService
 | 
					    public class LiveTvService : BaseApiService
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        private readonly ILiveTvManager _liveTvManager;
 | 
					        private readonly ILiveTvManager _liveTvManager;
 | 
				
			||||||
@ -500,6 +507,11 @@ namespace MediaBrowser.Api.LiveTv
 | 
				
			|||||||
            return ToOptimizedResult(result);
 | 
					            return ToOptimizedResult(result);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public object Get(GetSatIniMappings request)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return ToOptimizedResult(_liveTvManager.GetSatIniMappings());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public async Task<object> Get(GetSchedulesDirectCountries request)
 | 
					        public async Task<object> Get(GetSchedulesDirectCountries request)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            // https://json.schedulesdirect.org/20141201/available/countries
 | 
					            // https://json.schedulesdirect.org/20141201/available/countries
 | 
				
			||||||
 | 
				
			|||||||
@ -397,5 +397,11 @@ namespace MediaBrowser.Controller.LiveTv
 | 
				
			|||||||
        /// <param name="recording">The recording.</param>
 | 
					        /// <param name="recording">The recording.</param>
 | 
				
			||||||
        /// <returns>Task.</returns>
 | 
					        /// <returns>Task.</returns>
 | 
				
			||||||
        Task OnRecordingFileDeleted(ILiveTvRecording recording);
 | 
					        Task OnRecordingFileDeleted(ILiveTvRecording recording);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets the sat ini mappings.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <returns>List<NameValuePair>.</returns>
 | 
				
			||||||
 | 
					        List<NameValuePair> GetSatIniMappings();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -30,6 +30,8 @@ using System.Linq;
 | 
				
			|||||||
using System.Threading;
 | 
					using System.Threading;
 | 
				
			||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
using CommonIO;
 | 
					using CommonIO;
 | 
				
			||||||
 | 
					using IniParser;
 | 
				
			||||||
 | 
					using IniParser.Model;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace MediaBrowser.Server.Implementations.LiveTv
 | 
					namespace MediaBrowser.Server.Implementations.LiveTv
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -2488,5 +2490,38 @@ namespace MediaBrowser.Server.Implementations.LiveTv
 | 
				
			|||||||
                IsRegistered = true
 | 
					                IsRegistered = true
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public List<NameValuePair> GetSatIniMappings()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var names = GetType().Assembly.GetManifestResourceNames().Where(i => i.IndexOf("SatIp.ini.satellite", StringComparison.OrdinalIgnoreCase) != -1).ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return names.Select(GetSatIniMappings).Where(i => i != null).DistinctBy(i => i.Value.Split('|')[0]).ToList();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public NameValuePair GetSatIniMappings(string resource)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            using (var stream = GetType().Assembly.GetManifestResourceStream(resource))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                using (var reader = new StreamReader(stream))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    var parser = new StreamIniDataParser();
 | 
				
			||||||
 | 
					                    IniData data = parser.ReadData(reader);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    var satType1 = data["SATTYPE"]["1"];
 | 
				
			||||||
 | 
					                    var satType2 = data["SATTYPE"]["2"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (string.IsNullOrWhiteSpace(satType2))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        return null;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    return new NameValuePair
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        Name = satType1 + " " + satType2,
 | 
				
			||||||
 | 
					                        Value = satType2 + "|" + Path.GetFileName(resource)
 | 
				
			||||||
 | 
					                    };
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -49,6 +49,9 @@
 | 
				
			|||||||
      <SpecificVersion>False</SpecificVersion>
 | 
					      <SpecificVersion>False</SpecificVersion>
 | 
				
			||||||
      <HintPath>..\packages\Emby.XmlTv.1.0.0.48\lib\net45\Emby.XmlTv.dll</HintPath>
 | 
					      <HintPath>..\packages\Emby.XmlTv.1.0.0.48\lib\net45\Emby.XmlTv.dll</HintPath>
 | 
				
			||||||
    </Reference>
 | 
					    </Reference>
 | 
				
			||||||
 | 
					    <Reference Include="INIFileParser">
 | 
				
			||||||
 | 
					      <HintPath>..\packages\ini-parser.2.2.4\lib\net20\INIFileParser.dll</HintPath>
 | 
				
			||||||
 | 
					    </Reference>
 | 
				
			||||||
    <Reference Include="Interfaces.IO">
 | 
					    <Reference Include="Interfaces.IO">
 | 
				
			||||||
      <HintPath>..\packages\Interfaces.IO.1.0.0.5\lib\portable-net45+sl4+wp71+win8+wpa81\Interfaces.IO.dll</HintPath>
 | 
					      <HintPath>..\packages\Interfaces.IO.1.0.0.5\lib\portable-net45+sl4+wp71+win8+wpa81\Interfaces.IO.dll</HintPath>
 | 
				
			||||||
    </Reference>
 | 
					    </Reference>
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,7 @@
 | 
				
			|||||||
<packages>
 | 
					<packages>
 | 
				
			||||||
  <package id="CommonIO" version="1.0.0.8" targetFramework="net45" />
 | 
					  <package id="CommonIO" version="1.0.0.8" targetFramework="net45" />
 | 
				
			||||||
  <package id="Emby.XmlTv" version="1.0.0.48" targetFramework="net45" />
 | 
					  <package id="Emby.XmlTv" version="1.0.0.48" targetFramework="net45" />
 | 
				
			||||||
 | 
					  <package id="ini-parser" version="2.2.4" targetFramework="net45" />
 | 
				
			||||||
  <package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" />
 | 
					  <package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" />
 | 
				
			||||||
  <package id="MediaBrowser.Naming" version="1.0.0.49" targetFramework="net45" />
 | 
					  <package id="MediaBrowser.Naming" version="1.0.0.49" targetFramework="net45" />
 | 
				
			||||||
  <package id="Mono.Nat" version="1.2.24.0" targetFramework="net45" />
 | 
					  <package id="Mono.Nat" version="1.2.24.0" targetFramework="net45" />
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user