left align web client content

This commit is contained in:
Luke Pulverenti 2014-05-04 10:19:46 -04:00
parent f031bb744b
commit c3f2021cad
7 changed files with 93 additions and 15 deletions

View File

@ -542,7 +542,7 @@ namespace MediaBrowser.Api.Playback
var maxWidthParam = request.MaxWidth.Value.ToString(UsCulture); var maxWidthParam = request.MaxWidth.Value.ToString(UsCulture);
return isH264Output ? return isH264Output ?
string.Format("{3} -vf \"{0}scale=min(iw\\,{1}):trunc(ow/a/2)*2{2}\"", yadifParam, maxWidthParam, assSubtitleParam, copyTsParam) : string.Format("{3} -vf \"{0}scale=min(iw\\,{1}):trunc(ow/dar/2)*2{2}\"", yadifParam, maxWidthParam, assSubtitleParam, copyTsParam) :
string.Format("{3} -vf \"{0}scale=min(iw\\,{1}):-1{2}\"", yadifParam, maxWidthParam, assSubtitleParam, copyTsParam); string.Format("{3} -vf \"{0}scale=min(iw\\,{1}):-1{2}\"", yadifParam, maxWidthParam, assSubtitleParam, copyTsParam);
} }

View File

@ -147,7 +147,7 @@ namespace MediaBrowser.Dlna.Ssdp
SendDatagram(header, values, endpoint, null); SendDatagram(header, values, endpoint, null);
_logger.Info("{1} - Responded to a {0} request to {2}", d.Type, endpoint, d.Address.ToString()); _logger.Debug("{1} - Responded to a {0} request to {2}", d.Type, endpoint, d.Address.ToString());
} }
} }
} }

View File

@ -1,8 +1,6 @@
using System; using MediaBrowser.Model.MediaInfo;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Dlna namespace MediaBrowser.Model.Dlna
{ {

View File

@ -11,6 +11,7 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Querying; using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -33,8 +34,9 @@ namespace MediaBrowser.Server.Implementations.Channels
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IServerConfigurationManager _config; private readonly IServerConfigurationManager _config;
private readonly IFileSystem _fileSystem; private readonly IFileSystem _fileSystem;
private readonly IJsonSerializer _jsonSerializer;
public ChannelManager(IUserManager userManager, IDtoService dtoService, ILibraryManager libraryManager, ILogger logger, IServerConfigurationManager config, IFileSystem fileSystem, IUserDataManager userDataManager) public ChannelManager(IUserManager userManager, IDtoService dtoService, ILibraryManager libraryManager, ILogger logger, IServerConfigurationManager config, IFileSystem fileSystem, IUserDataManager userDataManager, IJsonSerializer jsonSerializer)
{ {
_userManager = userManager; _userManager = userManager;
_dtoService = dtoService; _dtoService = dtoService;
@ -43,6 +45,7 @@ namespace MediaBrowser.Server.Implementations.Channels
_config = config; _config = config;
_fileSystem = fileSystem; _fileSystem = fileSystem;
_userDataManager = userDataManager; _userDataManager = userDataManager;
_jsonSerializer = jsonSerializer;
} }
public void AddParts(IEnumerable<IChannel> channels, IEnumerable<IChannelFactory> factories) public void AddParts(IEnumerable<IChannel> channels, IEnumerable<IChannelFactory> factories)
@ -227,19 +230,90 @@ namespace MediaBrowser.Server.Implementations.Channels
return await GetReturnItems(items, user, query, cancellationToken).ConfigureAwait(false); return await GetReturnItems(items, user, query, cancellationToken).ConfigureAwait(false);
} }
private readonly SemaphoreSlim _resourcePool = new SemaphoreSlim(1, 1);
private async Task<IEnumerable<ChannelItemInfo>> GetChannelItems(IChannel channel, User user, string categoryId, CancellationToken cancellationToken) private async Task<IEnumerable<ChannelItemInfo>> GetChannelItems(IChannel channel, User user, string categoryId, CancellationToken cancellationToken)
{ {
// TODO: Put some caching in here var cachePath = GetChannelDataCachePath(channel, user, categoryId);
var query = new InternalChannelItemQuery try
{ {
User = user, var channelItemResult = _jsonSerializer.DeserializeFromFile<ChannelItemResult>(cachePath);
CategoryId = categoryId
};
var result = await channel.GetChannelItems(query, cancellationToken).ConfigureAwait(false); if (_fileSystem.GetLastWriteTimeUtc(cachePath).Add(channelItemResult.CacheLength) > DateTime.UtcNow)
{
return channelItemResult.Items;
}
}
catch (FileNotFoundException)
{
return result.Items; }
catch (DirectoryNotFoundException)
{
}
await _resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
try
{
try
{
var channelItemResult = _jsonSerializer.DeserializeFromFile<ChannelItemResult>(cachePath);
if (_fileSystem.GetLastWriteTimeUtc(cachePath).Add(channelItemResult.CacheLength) > DateTime.UtcNow)
{
return channelItemResult.Items;
}
}
catch (FileNotFoundException)
{
}
catch (DirectoryNotFoundException)
{
}
var query = new InternalChannelItemQuery
{
User = user,
CategoryId = categoryId
};
var result = await channel.GetChannelItems(query, cancellationToken).ConfigureAwait(false);
CacheResponse(result, cachePath);
return result.Items;
}
finally
{
_resourcePool.Release();
}
}
private void CacheResponse(ChannelItemResult result, string path)
{
try
{
Directory.CreateDirectory(Path.GetDirectoryName(path));
_jsonSerializer.SerializeToFile(result, path);
}
catch (Exception ex)
{
_logger.ErrorException("Error writing to channel cache file: {0}", ex, path);
}
}
private string GetChannelDataCachePath(IChannel channel, User user, string categoryId)
{
var channelId = GetInternalChannelId(channel.Name).ToString("N");
var categoryKey = string.IsNullOrWhiteSpace(categoryId) ? "root" : categoryId.GetMD5().ToString("N");
return Path.Combine(_config.ApplicationPaths.CachePath, channelId, categoryKey, user.Id.ToString("N") + ".json");
} }
private async Task<QueryResult<BaseItemDto>> GetReturnItems(IEnumerable<ChannelItemInfo> items, User user, ChannelItemQuery query, CancellationToken cancellationToken) private async Task<QueryResult<BaseItemDto>> GetReturnItems(IEnumerable<ChannelItemInfo> items, User user, ChannelItemQuery query, CancellationToken cancellationToken)

View File

@ -164,6 +164,12 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
var item = e.MediaInfo; var item = e.MediaInfo;
if (item == null)
{
_logger.Warn("PlaybackStart reported with null media info.");
return;
}
if (e.Item != null && e.Item.Parent == null) if (e.Item != null && e.Item.Parent == null)
{ {
// Don't report theme song or local trailer playback // Don't report theme song or local trailer playback

View File

@ -27,7 +27,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
foreach (var boxset in boxsets) foreach (var boxset in boxsets)
{ {
foreach (var child in boxset.GetLinkedChildren().OfType<ISupportsBoxSetGrouping>()) foreach (var child in boxset.Children.Concat(boxset.GetLinkedChildren()).OfType<ISupportsBoxSetGrouping>())
{ {
var boxsetIdList = child.BoxSetIdList.ToList(); var boxsetIdList = child.BoxSetIdList.ToList();
if (!boxsetIdList.Contains(boxset.Id)) if (!boxsetIdList.Contains(boxset.Id))

View File

@ -507,7 +507,7 @@ namespace MediaBrowser.ServerApplication
MediaEncoder); MediaEncoder);
RegisterSingleInstance(EncodingManager); RegisterSingleInstance(EncodingManager);
ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, Logger, ServerConfigurationManager, FileSystemManager, UserDataManager); ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, Logger, ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer);
RegisterSingleInstance(ChannelManager); RegisterSingleInstance(ChannelManager);
var appThemeManager = new AppThemeManager(ApplicationPaths, FileSystemManager, JsonSerializer, Logger); var appThemeManager = new AppThemeManager(ApplicationPaths, FileSystemManager, JsonSerializer, Logger);