mirror of https://github.com/jellyfin/jellyfin.git
fix xbox one browser access
This commit is contained in:
parent
6c97afef23
commit
e6d9d240e4
|
@ -6,16 +6,29 @@ using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace MediaBrowser.Common.Implementations.Networking
|
namespace MediaBrowser.Common.Implementations.Networking
|
||||||
{
|
{
|
||||||
public abstract class BaseNetworkManager
|
public abstract class BaseNetworkManager
|
||||||
{
|
{
|
||||||
protected ILogger Logger { get; private set; }
|
protected ILogger Logger { get; private set; }
|
||||||
|
private Timer _clearCacheTimer;
|
||||||
|
|
||||||
protected BaseNetworkManager(ILogger logger)
|
protected BaseNetworkManager(ILogger logger)
|
||||||
{
|
{
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
|
|
||||||
|
// Can't use network change events due to a crash in Linux
|
||||||
|
_clearCacheTimer = new Timer(ClearCacheTimerCallback, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClearCacheTimerCallback(object state)
|
||||||
|
{
|
||||||
|
lock (_localIpAddressSyncLock)
|
||||||
|
{
|
||||||
|
_localIpAddresses = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private volatile List<string> _localIpAddresses;
|
private volatile List<string> _localIpAddresses;
|
||||||
|
@ -36,7 +49,6 @@ namespace MediaBrowser.Common.Implementations.Networking
|
||||||
var addresses = GetLocalIpAddressesInternal().ToList();
|
var addresses = GetLocalIpAddressesInternal().ToList();
|
||||||
|
|
||||||
_localIpAddresses = addresses;
|
_localIpAddresses = addresses;
|
||||||
BindEvents();
|
|
||||||
|
|
||||||
return addresses;
|
return addresses;
|
||||||
}
|
}
|
||||||
|
@ -46,35 +58,6 @@ namespace MediaBrowser.Common.Implementations.Networking
|
||||||
return _localIpAddresses;
|
return _localIpAddresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BindEvents()
|
|
||||||
{
|
|
||||||
NetworkChange.NetworkAddressChanged -= NetworkChange_NetworkAddressChanged;
|
|
||||||
NetworkChange.NetworkAvailabilityChanged -= NetworkChange_NetworkAvailabilityChanged;
|
|
||||||
|
|
||||||
NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged;
|
|
||||||
NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
|
|
||||||
{
|
|
||||||
Logger.Debug("NetworkAvailabilityChanged fired. Resetting cached network info.");
|
|
||||||
|
|
||||||
lock (_localIpAddressSyncLock)
|
|
||||||
{
|
|
||||||
_localIpAddresses = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NetworkChange_NetworkAddressChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Logger.Debug("NetworkAddressChanged fired. Resetting cached network info.");
|
|
||||||
|
|
||||||
lock (_localIpAddressSyncLock)
|
|
||||||
{
|
|
||||||
_localIpAddresses = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<string> GetLocalIpAddressesInternal()
|
private IEnumerable<string> GetLocalIpAddressesInternal()
|
||||||
{
|
{
|
||||||
var list = GetIPsDefault()
|
var list = GetIPsDefault()
|
||||||
|
|
|
@ -14,6 +14,9 @@ namespace MediaBrowser.Model.Dlna
|
||||||
[XmlAttribute("codec")]
|
[XmlAttribute("codec")]
|
||||||
public string Codec { get; set; }
|
public string Codec { get; set; }
|
||||||
|
|
||||||
|
[XmlAttribute("container")]
|
||||||
|
public string Container { get; set; }
|
||||||
|
|
||||||
public CodecProfile()
|
public CodecProfile()
|
||||||
{
|
{
|
||||||
Conditions = new ProfileCondition[] {};
|
Conditions = new ProfileCondition[] {};
|
||||||
|
@ -29,8 +32,30 @@ namespace MediaBrowser.Model.Dlna
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ContainsCodec(string codec)
|
public List<string> GetContainers()
|
||||||
{
|
{
|
||||||
|
List<string> list = new List<string>();
|
||||||
|
foreach (string i in (Container ?? string.Empty).Split(','))
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(i)) list.Add(i);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ContainsContainer(string container)
|
||||||
|
{
|
||||||
|
List<string> containers = GetContainers();
|
||||||
|
|
||||||
|
return containers.Count == 0 || ListHelper.ContainsIgnoreCase(containers, container ?? string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ContainsCodec(string codec, string container)
|
||||||
|
{
|
||||||
|
if (!ContainsContainer(container))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
List<string> codecs = GetCodecs();
|
List<string> codecs = GetCodecs();
|
||||||
|
|
||||||
return codecs.Count == 0 || ListHelper.ContainsIgnoreCase(codecs, codec);
|
return codecs.Count == 0 || ListHelper.ContainsIgnoreCase(codecs, codec);
|
||||||
|
|
|
@ -131,7 +131,7 @@ namespace MediaBrowser.Model.Dlna
|
||||||
List<ProfileCondition> conditions = new List<ProfileCondition>();
|
List<ProfileCondition> conditions = new List<ProfileCondition>();
|
||||||
foreach (CodecProfile i in options.Profile.CodecProfiles)
|
foreach (CodecProfile i in options.Profile.CodecProfiles)
|
||||||
{
|
{
|
||||||
if (i.Type == CodecType.Audio && i.ContainsCodec(audioCodec))
|
if (i.Type == CodecType.Audio && i.ContainsCodec(audioCodec, item.Container))
|
||||||
{
|
{
|
||||||
foreach (ProfileCondition c in i.Conditions)
|
foreach (ProfileCondition c in i.Conditions)
|
||||||
{
|
{
|
||||||
|
@ -206,7 +206,7 @@ namespace MediaBrowser.Model.Dlna
|
||||||
List<CodecProfile> audioCodecProfiles = new List<CodecProfile>();
|
List<CodecProfile> audioCodecProfiles = new List<CodecProfile>();
|
||||||
foreach (CodecProfile i in options.Profile.CodecProfiles)
|
foreach (CodecProfile i in options.Profile.CodecProfiles)
|
||||||
{
|
{
|
||||||
if (i.Type == CodecType.Audio && i.ContainsCodec(transcodingProfile.AudioCodec))
|
if (i.Type == CodecType.Audio && i.ContainsCodec(transcodingProfile.AudioCodec, transcodingProfile.Container))
|
||||||
{
|
{
|
||||||
audioCodecProfiles.Add(i);
|
audioCodecProfiles.Add(i);
|
||||||
}
|
}
|
||||||
|
@ -423,7 +423,7 @@ namespace MediaBrowser.Model.Dlna
|
||||||
List<ProfileCondition> videoTranscodingConditions = new List<ProfileCondition>();
|
List<ProfileCondition> videoTranscodingConditions = new List<ProfileCondition>();
|
||||||
foreach (CodecProfile i in options.Profile.CodecProfiles)
|
foreach (CodecProfile i in options.Profile.CodecProfiles)
|
||||||
{
|
{
|
||||||
if (i.Type == CodecType.Video && i.ContainsCodec(transcodingProfile.VideoCodec))
|
if (i.Type == CodecType.Video && i.ContainsCodec(transcodingProfile.VideoCodec, transcodingProfile.Container))
|
||||||
{
|
{
|
||||||
foreach (ProfileCondition c in i.Conditions)
|
foreach (ProfileCondition c in i.Conditions)
|
||||||
{
|
{
|
||||||
|
@ -437,7 +437,7 @@ namespace MediaBrowser.Model.Dlna
|
||||||
List<ProfileCondition> audioTranscodingConditions = new List<ProfileCondition>();
|
List<ProfileCondition> audioTranscodingConditions = new List<ProfileCondition>();
|
||||||
foreach (CodecProfile i in options.Profile.CodecProfiles)
|
foreach (CodecProfile i in options.Profile.CodecProfiles)
|
||||||
{
|
{
|
||||||
if (i.Type == CodecType.VideoAudio && i.ContainsCodec(transcodingProfile.AudioCodec))
|
if (i.Type == CodecType.VideoAudio && i.ContainsCodec(transcodingProfile.AudioCodec, transcodingProfile.Container))
|
||||||
{
|
{
|
||||||
foreach (ProfileCondition c in i.Conditions)
|
foreach (ProfileCondition c in i.Conditions)
|
||||||
{
|
{
|
||||||
|
@ -600,7 +600,7 @@ namespace MediaBrowser.Model.Dlna
|
||||||
conditions = new List<ProfileCondition>();
|
conditions = new List<ProfileCondition>();
|
||||||
foreach (CodecProfile i in profile.CodecProfiles)
|
foreach (CodecProfile i in profile.CodecProfiles)
|
||||||
{
|
{
|
||||||
if (i.Type == CodecType.Video && i.ContainsCodec(videoCodec))
|
if (i.Type == CodecType.Video && i.ContainsCodec(videoCodec, container))
|
||||||
{
|
{
|
||||||
foreach (ProfileCondition c in i.Conditions)
|
foreach (ProfileCondition c in i.Conditions)
|
||||||
{
|
{
|
||||||
|
@ -635,7 +635,7 @@ namespace MediaBrowser.Model.Dlna
|
||||||
conditions = new List<ProfileCondition>();
|
conditions = new List<ProfileCondition>();
|
||||||
foreach (CodecProfile i in profile.CodecProfiles)
|
foreach (CodecProfile i in profile.CodecProfiles)
|
||||||
{
|
{
|
||||||
if (i.Type == CodecType.VideoAudio && i.ContainsCodec(audioCodec))
|
if (i.Type == CodecType.VideoAudio && i.ContainsCodec(audioCodec, container))
|
||||||
{
|
{
|
||||||
foreach (ProfileCondition c in i.Conditions)
|
foreach (ProfileCondition c in i.Conditions)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,7 @@ using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Providers;
|
using MediaBrowser.Model.Providers;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -29,12 +30,14 @@ namespace MediaBrowser.Providers.TV
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
public TvdbEpisodeProvider(IFileSystem fileSystem, IServerConfigurationManager config, IHttpClient httpClient)
|
public TvdbEpisodeProvider(IFileSystem fileSystem, IServerConfigurationManager config, IHttpClient httpClient, ILogger logger)
|
||||||
{
|
{
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_config = config;
|
_config = config;
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
|
_logger = logger;
|
||||||
Current = this;
|
Current = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +103,8 @@ namespace MediaBrowser.Providers.TV
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
result.Item = FetchEpisodeData(searchInfo, identity, seriesDataPath, searchInfo.SeriesProviderIds, cancellationToken);
|
result.Item = FetchEpisodeData(searchInfo, identity, seriesDataPath, searchInfo.SeriesProviderIds,
|
||||||
|
cancellationToken);
|
||||||
result.HasMetadata = result.Item != null;
|
result.HasMetadata = result.Item != null;
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException)
|
catch (FileNotFoundException)
|
||||||
|
@ -112,6 +116,10 @@ namespace MediaBrowser.Providers.TV
|
||||||
// Don't fail the provider because this will just keep on going and going.
|
// Don't fail the provider because this will just keep on going and going.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Debug("No series identity found for {0}", searchInfo.Name);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +273,6 @@ namespace MediaBrowser.Providers.TV
|
||||||
|
|
||||||
FetchMainEpisodeInfo(episode, file, cancellationToken);
|
FetchMainEpisodeInfo(episode, file, cancellationToken);
|
||||||
usingAbsoluteData = true;
|
usingAbsoluteData = true;
|
||||||
success = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var end = identity.IndexNumberEnd ?? episodeNumber;
|
var end = identity.IndexNumberEnd ?? episodeNumber;
|
||||||
|
@ -298,7 +305,7 @@ namespace MediaBrowser.Providers.TV
|
||||||
episodeNumber++;
|
episodeNumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return success ? episode : null;
|
return episode;
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||||
|
|
|
@ -387,7 +387,6 @@
|
||||||
"ButtonSignOut": "Sign Out",
|
"ButtonSignOut": "Sign Out",
|
||||||
"ButtonMyProfile": "My Profile",
|
"ButtonMyProfile": "My Profile",
|
||||||
"ButtonMyPreferences": "My Preferences",
|
"ButtonMyPreferences": "My Preferences",
|
||||||
"MessageBrowserDoesNotSupportWebSockets": "This browser does not support web sockets. For a better experience, try a newer browser such as Chrome, Firefox, IE10+, Safari (iOS) or Opera.",
|
|
||||||
"LabelInstallingPackage": "Installing {0}",
|
"LabelInstallingPackage": "Installing {0}",
|
||||||
"LabelPackageInstallCompleted": "{0} installation completed.",
|
"LabelPackageInstallCompleted": "{0} installation completed.",
|
||||||
"LabelPackageInstallFailed": "{0} installation failed.",
|
"LabelPackageInstallFailed": "{0} installation failed.",
|
||||||
|
|
|
@ -770,5 +770,6 @@
|
||||||
"EmbyIntroDownloadMessage": "To download and install Emby Server visit {0}.",
|
"EmbyIntroDownloadMessage": "To download and install Emby Server visit {0}.",
|
||||||
"ButtonNewServer": "New Server",
|
"ButtonNewServer": "New Server",
|
||||||
"ButtonSignInWithConnect": "Sign in with Emby Connect",
|
"ButtonSignInWithConnect": "Sign in with Emby Connect",
|
||||||
"HeaderNewServer": "New Server"
|
"HeaderNewServer": "New Server",
|
||||||
|
"MyDevice": "My Device"
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,6 +281,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
|
|
||||||
await AppendResource(memoryStream, "thirdparty/jstree3.0.8/jstree.js", newLineBytes).ConfigureAwait(false);
|
await AppendResource(memoryStream, "thirdparty/jstree3.0.8/jstree.js", newLineBytes).ConfigureAwait(false);
|
||||||
|
|
||||||
|
await AppendResource(memoryStream, "thirdparty/fastclick.js", newLineBytes).ConfigureAwait(false);
|
||||||
await AppendResource(memoryStream, "thirdparty/headroom.js", newLineBytes).ConfigureAwait(false);
|
await AppendResource(memoryStream, "thirdparty/headroom.js", newLineBytes).ConfigureAwait(false);
|
||||||
|
|
||||||
await AppendLocalization(memoryStream, culture).ConfigureAwait(false);
|
await AppendLocalization(memoryStream, culture).ConfigureAwait(false);
|
||||||
|
|
|
@ -90,6 +90,9 @@
|
||||||
<Content Include="dashboard-ui\css\images\clients\androidtv-tile.png">
|
<Content Include="dashboard-ui\css\images\clients\androidtv-tile.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\css\images\empty.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\css\images\kids\bg.jpg">
|
<Content Include="dashboard-ui\css\images\kids\bg.jpg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
@ -993,6 +996,9 @@
|
||||||
<Content Include="dashboard-ui\thirdparty\cast_sender.js">
|
<Content Include="dashboard-ui\thirdparty\cast_sender.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\thirdparty\fastclick.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\thirdparty\fontawesome\css\font-awesome.css">
|
<Content Include="dashboard-ui\thirdparty\fontawesome\css\font-awesome.css">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
Loading…
Reference in New Issue