fix metadata manager layout

This commit is contained in:
Luke Pulverenti 2015-09-01 15:18:25 -04:00
parent d8c8e57a0b
commit 3d8287bc6e
5 changed files with 36 additions and 2 deletions

View File

@ -64,7 +64,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
{ {
List<ProgramInfo> programsInfo = new List<ProgramInfo>(); List<ProgramInfo> programsInfo = new List<ProgramInfo>();
var token = await GetToken(info, cancellationToken); var token = await GetToken(info, cancellationToken).ConfigureAwait(false);
if (string.IsNullOrWhiteSpace(token)) if (string.IsNullOrWhiteSpace(token))
{ {
@ -482,7 +482,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
} }
private readonly ConcurrentDictionary<string, NameValuePair> _tokens = new ConcurrentDictionary<string, NameValuePair>(); private readonly ConcurrentDictionary<string, NameValuePair> _tokens = new ConcurrentDictionary<string, NameValuePair>();
private DateTime _lastErrorResponse;
private async Task<string> GetToken(ListingsProviderInfo info, CancellationToken cancellationToken) private async Task<string> GetToken(ListingsProviderInfo info, CancellationToken cancellationToken)
{ {
var username = info.Username; var username = info.Username;
@ -499,6 +499,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
return null; return null;
} }
// Avoid hammering SD
if ((DateTime.UtcNow - _lastErrorResponse).TotalMinutes < 1)
{
return null;
}
NameValuePair savedToken = null; NameValuePair savedToken = null;
if (!_tokens.TryGetValue(username, out savedToken)) if (!_tokens.TryGetValue(username, out savedToken))
{ {
@ -527,6 +533,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
savedToken.Value = DateTime.UtcNow.Ticks.ToString(CultureInfo.InvariantCulture); savedToken.Value = DateTime.UtcNow.Ticks.ToString(CultureInfo.InvariantCulture);
return result; return result;
} }
catch (HttpException ex)
{
if (ex.StatusCode.HasValue)
{
if ((int)ex.StatusCode.Value == 400)
{
_tokens.Clear();
_lastErrorResponse = DateTime.UtcNow;
}
}
throw;
}
finally finally
{ {
_tokenSemaphore.Release(); _tokenSemaphore.Release();

View File

@ -334,6 +334,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var service = GetService(item); var service = GetService(item);
var sources = await service.GetChannelStreamMediaSources(item.ExternalId, cancellationToken).ConfigureAwait(false); var sources = await service.GetChannelStreamMediaSources(item.ExternalId, cancellationToken).ConfigureAwait(false);
if (sources.Count == 0)
{
throw new NotImplementedException();
}
var list = sources.ToList(); var list = sources.ToList();
foreach (var source in list) foreach (var source in list)

View File

@ -377,6 +377,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
protected override async Task<MediaSourceInfo> GetChannelStream(TunerHostInfo info, string channelId, string streamId, CancellationToken cancellationToken) protected override async Task<MediaSourceInfo> GetChannelStream(TunerHostInfo info, string channelId, string streamId, CancellationToken cancellationToken)
{ {
Logger.Debug("GetChannelStream: channel id: {0}. stream id: {1}", channelId, streamId ?? string.Empty);
if (!channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase)) if (!channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase))
{ {
return null; return null;

View File

@ -331,6 +331,8 @@ namespace MediaBrowser.WebDashboard.Api
CopyDirectory(Path.Combine(creator.DashboardUIPath, "bower_components", "swipebox", "src", "css"), Path.Combine(path, "bower_components", "swipebox", "src", "css")); CopyDirectory(Path.Combine(creator.DashboardUIPath, "bower_components", "swipebox", "src", "css"), Path.Combine(path, "bower_components", "swipebox", "src", "css"));
CopyDirectory(Path.Combine(creator.DashboardUIPath, "bower_components", "swipebox", "src", "js"), Path.Combine(path, "bower_components", "swipebox", "src", "js")); CopyDirectory(Path.Combine(creator.DashboardUIPath, "bower_components", "swipebox", "src", "js"), Path.Combine(path, "bower_components", "swipebox", "src", "js"));
CopyDirectory(Path.Combine(creator.DashboardUIPath, "bower_components", "swipebox", "src", "img"), Path.Combine(path, "bower_components", "swipebox", "src", "img")); CopyDirectory(Path.Combine(creator.DashboardUIPath, "bower_components", "swipebox", "src", "img"), Path.Combine(path, "bower_components", "swipebox", "src", "img"));
CopyFile(Path.Combine(creator.DashboardUIPath, "bower_components", "hammerjs", "hammer.min.js"), Path.Combine(path, "bower_components", "hammerjs", "hammer.min.js"));
} }
MinifyCssDirectory(Path.Combine(path, "css")); MinifyCssDirectory(Path.Combine(path, "css"));

View File

@ -90,6 +90,12 @@
<Content Include="dashboard-ui\bower_components\fastclick\lib\fastclick.js"> <Content Include="dashboard-ui\bower_components\fastclick\lib\fastclick.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\bower_components\hammerjs\hammer.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\bower_components\hammerjs\hammer.min.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\bower_components\jquery\dist\jquery.min.js"> <Content Include="dashboard-ui\bower_components\jquery\dist\jquery.min.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>