update notification styles

This commit is contained in:
Luke Pulverenti 2014-05-27 17:17:48 -04:00
parent ce8c5a1a3c
commit b4016ae07e
8 changed files with 86 additions and 19 deletions

View File

@ -212,6 +212,13 @@ namespace MediaBrowser.Model.ApiClient
/// <exception cref="ArgumentNullException">userId</exception>
Task<BaseItemDto> GetRootFolderAsync(string userId);
/// <summary>
/// Gets the additional parts.
/// </summary>
/// <param name="itemId">The item identifier.</param>
/// <returns>Task{BaseItemDto[]}.</returns>
Task<BaseItemDto[]> GetAdditionalParts(string itemId);
/// <summary>
/// Gets the users async.
/// </summary>

View File

@ -57,10 +57,10 @@ namespace MediaBrowser.Model.Channels
{
Name = 0,
CommunityRating = 1,
ContentReleaseDate = 2,
DateAdded = 3,
PremiereDate = 2,
DateCreated = 3,
Runtime = 4,
CommunityMostWatched = 5,
UserPlayCount = 6
PlayCount = 5,
CommunityPlayCount = 6
}
}

View File

@ -1,4 +1,5 @@
using MediaBrowser.Common.Extensions;
using System.Globalization;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Configuration;
@ -299,8 +300,25 @@ namespace MediaBrowser.Server.Implementations.Channels
? null
: _userManager.GetUserById(new Guid(query.UserId));
var itemsResult = await GetChannelItems(channelProvider, user, query.FolderId, providerStartIndex, providerLimit, cancellationToken)
.ConfigureAwait(false);
ChannelItemSortField? sortField = null;
ChannelItemSortField parsedField;
if (query.SortBy.Length == 1 &&
Enum.TryParse(query.SortBy[0], true, out parsedField))
{
sortField = parsedField;
}
var sortDescending = query.SortOrder.HasValue && query.SortOrder.Value == SortOrder.Descending;
var itemsResult = await GetChannelItems(channelProvider,
user,
query.FolderId,
providerStartIndex,
providerLimit,
sortField,
sortDescending,
cancellationToken)
.ConfigureAwait(false);
var providerTotalRecordCount = providerLimit.HasValue ? itemsResult.TotalRecordCount : null;
@ -322,9 +340,16 @@ namespace MediaBrowser.Server.Implementations.Channels
}
private readonly SemaphoreSlim _resourcePool = new SemaphoreSlim(1, 1);
private async Task<ChannelItemResult> GetChannelItems(IChannel channel, User user, string folderId, int? startIndex, int? limit, CancellationToken cancellationToken)
private async Task<ChannelItemResult> GetChannelItems(IChannel channel,
User user,
string folderId,
int? startIndex,
int? limit,
ChannelItemSortField? sortField,
bool sortDescending,
CancellationToken cancellationToken)
{
var cachePath = GetChannelDataCachePath(channel, user, folderId);
var cachePath = GetChannelDataCachePath(channel, user, folderId, sortField, sortDescending);
try
{
@ -376,7 +401,9 @@ namespace MediaBrowser.Server.Implementations.Channels
{
User = user,
StartIndex = startIndex,
Limit = limit
Limit = limit,
SortBy = sortField,
SortDescending = sortDescending
};
if (!string.IsNullOrWhiteSpace(folderId))
@ -415,7 +442,11 @@ namespace MediaBrowser.Server.Implementations.Channels
}
}
private string GetChannelDataCachePath(IChannel channel, User user, string folderId)
private string GetChannelDataCachePath(IChannel channel,
User user,
string folderId,
ChannelItemSortField? sortField,
bool sortDescending)
{
var channelId = GetInternalChannelId(channel.Name).ToString("N");
@ -423,7 +454,26 @@ namespace MediaBrowser.Server.Implementations.Channels
var version = string.IsNullOrWhiteSpace(channel.DataVersion) ? "0" : channel.DataVersion;
return Path.Combine(_config.ApplicationPaths.CachePath, "channels", channelId, version, folderKey, user.Id.ToString("N") + ".json");
var filename = user.Id.ToString("N");
var hashfilename = false;
if (sortField.HasValue)
{
filename += "-sortField-" + sortField.Value;
hashfilename = true;
}
if (sortDescending)
{
filename += "-sortDescending";
hashfilename = true;
}
if (hashfilename)
{
filename = filename.GetMD5().ToString("N");
}
return Path.Combine(_config.ApplicationPaths.CachePath, "channels", channelId, version, folderKey, filename + ".json");
}
private async Task<QueryResult<BaseItemDto>> GetReturnItems(IEnumerable<BaseItem> items, int? totalCountFromProvider, User user, ChannelItemQuery query, CancellationToken cancellationToken)

View File

@ -21,6 +21,7 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Serialization;
namespace MediaBrowser.Server.Implementations.LiveTv
{
@ -37,6 +38,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
private readonly IUserDataManager _userDataManager;
private readonly ILibraryManager _libraryManager;
private readonly ITaskManager _taskManager;
private readonly IJsonSerializer _json;
private readonly LiveTvDtoService _tvDtoService;
@ -51,7 +53,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
private readonly SemaphoreSlim _refreshSemaphore = new SemaphoreSlim(1, 1);
public LiveTvManager(IServerConfigurationManager config, IFileSystem fileSystem, ILogger logger, IItemRepository itemRepo, IImageProcessor imageProcessor, IUserDataManager userDataManager, IDtoService dtoService, IUserManager userManager, ILibraryManager libraryManager, ITaskManager taskManager)
public LiveTvManager(IServerConfigurationManager config, IFileSystem fileSystem, ILogger logger, IItemRepository itemRepo, IImageProcessor imageProcessor, IUserDataManager userDataManager, IDtoService dtoService, IUserManager userManager, ILibraryManager libraryManager, ITaskManager taskManager, IJsonSerializer json)
{
_config = config;
_fileSystem = fileSystem;
@ -60,6 +62,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
_userManager = userManager;
_libraryManager = libraryManager;
_taskManager = taskManager;
_json = json;
_userDataManager = userDataManager;
_tvDtoService = new LiveTvDtoService(dtoService, userDataManager, imageProcessor, logger, _itemRepo);
@ -294,6 +297,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var result = await service.GetRecordingStream(recording.Id, cancellationToken).ConfigureAwait(false);
_logger.Debug("Live stream info: " + _json.SerializeToString(result));
if (!string.IsNullOrEmpty(result.Id))
{
_openStreams.AddOrUpdate(result.Id, result, (key, info) => result);
@ -327,6 +332,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var result = await service.GetChannelStream(channel.ExternalId, cancellationToken).ConfigureAwait(false);
_logger.Debug("Live stream info: " + _json.SerializeToString(result));
if (!string.IsNullOrEmpty(result.Id))
{
_openStreams.AddOrUpdate(result.Id, result, (key, info) => result);
@ -1525,6 +1532,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
try
{
await service.CloseLiveStream(id, cancellationToken).ConfigureAwait(false);
LiveStreamInfo removed;
_openStreams.TryRemove(id, out removed);
}
catch (Exception ex)
{

View File

@ -531,7 +531,7 @@ namespace MediaBrowser.ServerApplication
var collectionManager = new CollectionManager(LibraryManager, FileSystemManager, LibraryMonitor);
RegisterSingleInstance<ICollectionManager>(collectionManager);
LiveTvManager = new LiveTvManager(ServerConfigurationManager, FileSystemManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager);
LiveTvManager = new LiveTvManager(ServerConfigurationManager, FileSystemManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, JsonSerializer);
RegisterSingleInstance(LiveTvManager);
NotificationManager = new NotificationManager(LogManager, UserManager, ServerConfigurationManager);

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common.Internal</id>
<version>3.0.384</version>
<version>3.0.386</version>
<title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.384" />
<dependency id="MediaBrowser.Common" version="3.0.386" />
<dependency id="NLog" version="2.1.0" />
<dependency id="SimpleInjector" version="2.5.0" />
<dependency id="sharpcompress" version="0.10.2" />

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common</id>
<version>3.0.384</version>
<version>3.0.386</version>
<title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MediaBrowser.Server.Core</id>
<version>3.0.384</version>
<version>3.0.386</version>
<title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.384" />
<dependency id="MediaBrowser.Common" version="3.0.386" />
</dependencies>
</metadata>
<files>