commit
88a6e43075
|
@ -201,12 +201,14 @@ namespace MediaBrowser.Model.Configuration
|
||||||
public bool EnableFolderView { get; set; }
|
public bool EnableFolderView { get; set; }
|
||||||
public bool EnableGroupingIntoCollections { get; set; }
|
public bool EnableGroupingIntoCollections { get; set; }
|
||||||
public bool DisplaySpecialsWithinSeasons { get; set; }
|
public bool DisplaySpecialsWithinSeasons { get; set; }
|
||||||
|
public string[] LocalNetworkAddresses { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
|
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ServerConfiguration()
|
public ServerConfiguration()
|
||||||
{
|
{
|
||||||
|
LocalNetworkAddresses = new string[] { };
|
||||||
Migrations = new string[] { };
|
Migrations = new string[] { };
|
||||||
|
|
||||||
EnableCustomPathSubFolders = true;
|
EnableCustomPathSubFolders = true;
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
private readonly IApplicationHost _appHost;
|
private readonly IApplicationHost _appHost;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
public static string MusicBrainzBaseUrl = "https://www.musicbrainz.org";
|
public static string MusicBrainzBaseUrl = "http://musicbrainz.fercasas.com:5000";
|
||||||
|
|
||||||
public MusicBrainzAlbumProvider(IHttpClient httpClient, IApplicationHost appHost, ILogger logger)
|
public MusicBrainzAlbumProvider(IHttpClient httpClient, IApplicationHost appHost, ILogger logger)
|
||||||
{
|
{
|
||||||
|
|
|
@ -362,6 +362,10 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (item is Photo)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
//if (!(item is Folder))
|
//if (!(item is Folder))
|
||||||
//{
|
//{
|
||||||
// return;
|
// return;
|
||||||
|
|
|
@ -3,12 +3,14 @@ using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.LiveTv;
|
using MediaBrowser.Model.LiveTv;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Emby.XmlTv.Classes;
|
using Emby.XmlTv.Classes;
|
||||||
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
||||||
|
@ -16,10 +18,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
||||||
public class XmlTvListingsProvider : IListingsProvider
|
public class XmlTvListingsProvider : IListingsProvider
|
||||||
{
|
{
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
private readonly IHttpClient _httpClient;
|
||||||
|
|
||||||
public XmlTvListingsProvider(IServerConfigurationManager config)
|
public XmlTvListingsProvider(IServerConfigurationManager config, IHttpClient httpClient)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
|
_httpClient = httpClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
|
@ -37,13 +41,39 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
||||||
return _config.Configuration.PreferredMetadataLanguage;
|
return _config.Configuration.PreferredMetadataLanguage;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Should this method be async?
|
private async Task<string> GetXml(string path, CancellationToken cancellationToken)
|
||||||
public Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, string channelName, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
|
|
||||||
{
|
{
|
||||||
var reader = new XmlTvReader(info.Path, GetLanguage(), null);
|
if (!path.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
var cacheFilename = DateTime.UtcNow.DayOfYear.ToString(CultureInfo.InvariantCulture) + "_" + DateTime.UtcNow.Hour.ToString(CultureInfo.InvariantCulture) + ".xml";
|
||||||
|
var cacheFile = Path.Combine(_config.ApplicationPaths.CachePath, "xmltv", cacheFilename);
|
||||||
|
if (File.Exists(cacheFile))
|
||||||
|
{
|
||||||
|
return cacheFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
var tempFile = await _httpClient.GetTempFile(new HttpRequestOptions
|
||||||
|
{
|
||||||
|
CancellationToken = cancellationToken,
|
||||||
|
Url = path
|
||||||
|
|
||||||
|
}).ConfigureAwait(false);
|
||||||
|
File.Copy(tempFile, cacheFile, true);
|
||||||
|
|
||||||
|
return cacheFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Should this method be async?
|
||||||
|
public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, string channelName, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
|
||||||
|
var reader = new XmlTvReader(path, GetLanguage(), null);
|
||||||
|
|
||||||
var results = reader.GetProgrammes(channelNumber, startDateUtc, endDateUtc, cancellationToken);
|
var results = reader.GetProgrammes(channelNumber, startDateUtc, endDateUtc, cancellationToken);
|
||||||
return Task.FromResult(results.Select(p => new ProgramInfo()
|
return results.Select(p => new ProgramInfo()
|
||||||
{
|
{
|
||||||
ChannelId = p.ChannelId,
|
ChannelId = p.ChannelId,
|
||||||
EndDate = p.EndDate,
|
EndDate = p.EndDate,
|
||||||
|
@ -68,34 +98,39 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
||||||
HasImage = p.Icon != null && !String.IsNullOrEmpty(p.Icon.Source),
|
HasImage = p.Icon != null && !String.IsNullOrEmpty(p.Icon.Source),
|
||||||
OfficialRating = p.Rating != null && !String.IsNullOrEmpty(p.Rating.Value) ? p.Rating.Value : null,
|
OfficialRating = p.Rating != null && !String.IsNullOrEmpty(p.Rating.Value) ? p.Rating.Value : null,
|
||||||
CommunityRating = p.StarRating.HasValue ? p.StarRating.Value : (float?)null
|
CommunityRating = p.StarRating.HasValue ? p.StarRating.Value : (float?)null
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task AddMetadata(ListingsProviderInfo info, List<ChannelInfo> channels, CancellationToken cancellationToken)
|
public Task AddMetadata(ListingsProviderInfo info, List<ChannelInfo> channels, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
// Add the channel image url
|
// Add the channel image url
|
||||||
var reader = new XmlTvReader(info.Path, GetLanguage(), null);
|
var reader = new XmlTvReader(info.Path, GetLanguage(), null);
|
||||||
var results = reader.GetChannels().ToList();
|
var results = reader.GetChannels().ToList();
|
||||||
|
|
||||||
if (channels != null && channels.Count > 0)
|
if (channels != null && channels.Count > 0)
|
||||||
{
|
{
|
||||||
channels.ForEach(c => {
|
channels.ForEach(c =>
|
||||||
|
{
|
||||||
var match = results.FirstOrDefault(r => r.Id == c.Id);
|
var match = results.FirstOrDefault(r => r.Id == c.Id);
|
||||||
if (match != null && match.Icon != null && !String.IsNullOrEmpty(match.Icon.Source))
|
if (match != null && match.Icon != null && !String.IsNullOrEmpty(match.Icon.Source))
|
||||||
{
|
{
|
||||||
c.ImageUrl = match.Icon.Source;
|
c.ImageUrl = match.Icon.Source;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings)
|
public Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings)
|
||||||
{
|
{
|
||||||
// Check that the path or url is valid. If not, throw a file not found exception
|
// Assume all urls are valid. check files for existence
|
||||||
if (!File.Exists(info.Path))
|
if (!info.Path.StartsWith("http", StringComparison.OrdinalIgnoreCase) && !File.Exists(info.Path))
|
||||||
{
|
{
|
||||||
throw new FileNotFoundException("Could not find the XmlTv file specified:", info.Path);
|
throw new FileNotFoundException("Could not find the XmlTv file specified:", info.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<List<NameIdPair>> GetLineups(ListingsProviderInfo info, string country, string location)
|
public Task<List<NameIdPair>> GetLineups(ListingsProviderInfo info, string country, string location)
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
<HintPath>..\packages\CommonIO.1.0.0.9\lib\net45\CommonIO.dll</HintPath>
|
<HintPath>..\packages\CommonIO.1.0.0.9\lib\net45\CommonIO.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Emby.XmlTv, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Emby.XmlTv, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Emby.XmlTv.1.0.0.50\lib\net45\Emby.XmlTv.dll</HintPath>
|
<HintPath>..\packages\Emby.XmlTv.1.0.0.51\lib\net45\Emby.XmlTv.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="INIFileParser, Version=2.3.0.0, Culture=neutral, PublicKeyToken=79af7b307b65cf3c, processorArchitecture=MSIL">
|
<Reference Include="INIFileParser, Version=2.3.0.0, Culture=neutral, PublicKeyToken=79af7b307b65cf3c, processorArchitecture=MSIL">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="CommonIO" version="1.0.0.9" targetFramework="net45" />
|
<package id="CommonIO" version="1.0.0.9" targetFramework="net45" />
|
||||||
<package id="Emby.XmlTv" version="1.0.0.50" targetFramework="net45" />
|
<package id="Emby.XmlTv" version="1.0.0.51" targetFramework="net45" />
|
||||||
<package id="ini-parser" version="2.3.0" targetFramework="net45" />
|
<package id="ini-parser" version="2.3.0" 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.51" targetFramework="net45" />
|
<package id="MediaBrowser.Naming" version="1.0.0.51" targetFramework="net45" />
|
||||||
|
|
|
@ -833,17 +833,40 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
|
|
||||||
private IEnumerable<string> GetUrlPrefixes()
|
private IEnumerable<string> GetUrlPrefixes()
|
||||||
{
|
{
|
||||||
var prefixes = new List<string>
|
var hosts = ServerConfigurationManager.Configuration.LocalNetworkAddresses.ToList();
|
||||||
{
|
|
||||||
"http://+:" + ServerConfigurationManager.Configuration.HttpServerPortNumber + "/"
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(CertificatePath))
|
if (hosts.Count == 0)
|
||||||
{
|
{
|
||||||
prefixes.Add("https://+:" + ServerConfigurationManager.Configuration.HttpsPortNumber + "/");
|
hosts.Add("+");
|
||||||
}
|
}
|
||||||
|
|
||||||
return prefixes;
|
if (!hosts.Contains("+", StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
if (!hosts.Contains("localhost", StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
hosts.Add("localhost");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hosts.Contains("127.0.0.1", StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
hosts.Add("127.0.0.1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hosts.SelectMany(i =>
|
||||||
|
{
|
||||||
|
var prefixes = new List<string>
|
||||||
|
{
|
||||||
|
"http://"+i+":" + ServerConfigurationManager.Configuration.HttpServerPortNumber + "/"
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(CertificatePath))
|
||||||
|
{
|
||||||
|
prefixes.Add("https://" + i + ":" + ServerConfigurationManager.Configuration.HttpsPortNumber + "/");
|
||||||
|
}
|
||||||
|
|
||||||
|
return prefixes;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1122,9 +1122,6 @@
|
||||||
<Content Include="dashboard-ui\music.html">
|
<Content Include="dashboard-ui\music.html">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="dashboard-ui\scripts\alphapicker.js">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="dashboard-ui\components\imageeditor\imageeditor.js">
|
<Content Include="dashboard-ui\components\imageeditor\imageeditor.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user