center guide grid

This commit is contained in:
Luke Pulverenti 2014-01-18 00:55:21 -05:00
parent 0b57b33988
commit 0f7f467478
9 changed files with 29 additions and 9 deletions

View File

@ -1002,6 +1002,11 @@ namespace MediaBrowser.Api.Playback
/// <returns>StreamState.</returns>
protected async Task<StreamState> GetState(StreamRequest request, CancellationToken cancellationToken)
{
if (request.ThrowDebugError)
{
throw new InvalidOperationException("You asked for a debug error, you got one.");
}
var url = Request.PathInfo;
if (!request.AudioCodec.HasValue)

View File

@ -65,6 +65,11 @@ namespace MediaBrowser.Api.Playback
/// No need to put this in api docs since it's dlna only
/// </summary>
public bool AlbumArt { get; set; }
/// <summary>
/// For testing purposes
/// </summary>
public bool ThrowDebugError { get; set; }
}
public class VideoStreamRequest : StreamRequest

View File

@ -144,7 +144,7 @@ namespace MediaBrowser.Api.UserLibrary
{
var libraryItems = user.RootFolder.GetRecursiveChildren(user).ToList();
items = items.Where(i => GetLibraryItems(i, libraryItems).All(l => !l.IsPlayed(user)));
items = items.Where(i => GetLibraryItems(i, libraryItems).All(l => l.IsUnplayed(user)));
}
return items;

View File

@ -107,9 +107,7 @@ namespace MediaBrowser.Api.UserLibrary
/// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns>
protected override IEnumerable<Genre> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items)
{
var itemsList = items.Where(i => i.Genres != null).ToList();
return itemsList
return items
.SelectMany(i => i.Genres)
.Distinct(StringComparer.OrdinalIgnoreCase)
.Select(name => LibraryManager.GetGenre(name));

View File

@ -446,7 +446,7 @@ namespace MediaBrowser.Api.UserLibrary
return items.Where(item => item.IsPlayed(currentUser));
case ItemFilter.IsUnplayed:
return items.Where(item => !item.IsPlayed(currentUser));
return items.Where(item => item.IsUnplayed(currentUser));
case ItemFilter.IsFolder:
return items.Where(item => item.IsFolder);

View File

@ -1713,5 +1713,12 @@ namespace MediaBrowser.Controller.Entities
return userdata != null && userdata.Played;
}
public virtual bool IsUnplayed(User user)
{
var userdata = UserDataManager.GetUserData(user.Id, GetUserDataKey());
return userdata == null || !userdata.Played;
}
}
}

View File

@ -1090,5 +1090,11 @@ namespace MediaBrowser.Controller.Entities
return GetRecursiveChildren(user).Where(i => !i.IsFolder && i.LocationType != LocationType.Virtual)
.All(i => i.IsPlayed(user));
}
public override bool IsUnplayed(User user)
{
return GetRecursiveChildren(user).Where(i => !i.IsFolder && i.LocationType != LocationType.Virtual)
.All(i => i.IsUnplayed(user));
}
}
}

View File

@ -233,7 +233,7 @@ namespace MediaBrowser.Model.Configuration
public ServerConfiguration()
: base()
{
MediaEncodingQuality = EncodingQuality.HighSpeed;
MediaEncodingQuality = EncodingQuality.Auto;
ImageSavingConvention = ImageSavingConvention.Compatible;
HttpServerPortNumber = 8096;
LegacyWebSocketPortNumber = 8945;

View File

@ -1,6 +1,5 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
@ -32,7 +31,7 @@ namespace MediaBrowser.Server.Implementations.Sorting
/// <returns>DateTime.</returns>
private int GetValue(BaseItem x)
{
return x.IsPlayed(User) ? 1 : 0;
return x.IsUnplayed(User) ? 0 : 1;
}
/// <summary>