Skip to content

Commit

Permalink
Merge pull request #1118 from MediaBrowser/dev
Browse files Browse the repository at this point in the history
3.0.5641.4
  • Loading branch information
LukePulverenti committed Jun 15, 2015
2 parents 6afd869 + b8d2fac commit a5ce710
Show file tree
Hide file tree
Showing 520 changed files with 24,433 additions and 22,903 deletions.
Binary file modified Installation/MediaBrowser.Classic.Installer.exe
Binary file not shown.
Binary file modified Installation/MediaBrowser.InstallUtil.dll
Binary file not shown.
Binary file modified Installation/MediaBrowser.Uninstaller.exe
Binary file not shown.
Binary file modified Installation/MediaBrowser.Updater.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion MediaBrowser.Api/ApiEntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ private async void PingTimer(TranscodingJob job, bool isProgressCheckIn)
// We can really reduce the timeout for apps that are using the newer api
if (!string.IsNullOrWhiteSpace(job.PlaySessionId))
{
timerDuration = 60000;
timerDuration = 120000;
}
}

Expand Down
12 changes: 6 additions & 6 deletions MediaBrowser.Api/BaseApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@ protected Person GetPerson(string name, ILibraryManager libraryManager)
return libraryManager.GetPerson(DeSlugPersonName(name, libraryManager));
}

protected IList<BaseItem> GetAllLibraryItems(Guid? userId, IUserManager userManager, ILibraryManager libraryManager, string parentId, Func<BaseItem,bool> filter)
protected IList<BaseItem> GetAllLibraryItems(string userId, IUserManager userManager, ILibraryManager libraryManager, string parentId, Func<BaseItem,bool> filter)
{
if (!string.IsNullOrEmpty(parentId))
{
var folder = (Folder)libraryManager.GetItemById(new Guid(parentId));

if (userId.HasValue)
if (!string.IsNullOrWhiteSpace(userId))
{
var user = userManager.GetUserById(userId.Value);
var user = userManager.GetUserById(userId);

if (user == null)
{
Expand All @@ -221,17 +221,17 @@ protected IList<BaseItem> GetAllLibraryItems(Guid? userId, IUserManager userMana
return folder
.GetRecursiveChildren(filter);
}
if (userId.HasValue)
if (!string.IsNullOrWhiteSpace(userId))
{
var user = userManager.GetUserById(userId.Value);
var user = userManager.GetUserById(userId);

if (user == null)
{
throw new ArgumentException("User not found");
}

return userManager
.GetUserById(userId.Value)
.GetUserById(userId)
.RootFolder
.GetRecursiveChildren(user, filter)
.ToList();
Expand Down
3 changes: 2 additions & 1 deletion MediaBrowser.Api/BrandingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public object Get(GetBrandingCss request)
{
var result = _config.GetConfiguration<BrandingOptions>("branding");

return ResultFactory.GetResult(result.CustomCss, "text/css");
// When null this throws a 405 error under Mono OSX, so default to empty string
return ResultFactory.GetResult(result.CustomCss ?? string.Empty, "text/css");
}
}
}
4 changes: 2 additions & 2 deletions MediaBrowser.Api/DisplayPreferencesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class UpdateDisplayPreferences : DisplayPreferences, IReturnVoid
public string DisplayPreferencesId { get; set; }

[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")]
public Guid UserId { get; set; }
public string UserId { get; set; }
}

[Route("/DisplayPreferences/{Id}", "GET", Summary = "Gets a user's display preferences for an item")]
Expand All @@ -37,7 +37,7 @@ public class GetDisplayPreferences : IReturn<DisplayPreferences>
public string Id { get; set; }

[ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
public Guid UserId { get; set; }
public string UserId { get; set; }

[ApiMember(Name = "Client", Description = "Client", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Client { get; set; }
Expand Down
6 changes: 3 additions & 3 deletions MediaBrowser.Api/GamesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class GetGameSystemSummaries : IReturn<List<GameSystemSummary>>
/// </summary>
/// <value>The user id.</value>
[ApiMember(Name = "UserId", Description = "Optional. Filter by user id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public Guid? UserId { get; set; }
public string UserId { get; set; }
}

/// <summary>
Expand All @@ -46,7 +46,7 @@ public class GetPlayerIndex : IReturn<List<ItemIndex>>
/// </summary>
/// <value>The user id.</value>
[ApiMember(Name = "UserId", Description = "Optional. Filter by user id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public Guid? UserId { get; set; }
public string UserId { get; set; }
}

/// <summary>
Expand Down Expand Up @@ -106,7 +106,7 @@ public object Get(GetGameSystemSummaries request)
.Cast<GameSystem>()
.ToList();

var user = request.UserId == null ? null : _userManager.GetUserById(request.UserId.Value);
var user = request.UserId == null ? null : _userManager.GetUserById(request.UserId);

var result = gameSystems
.Select(i => GetSummary(i, user))
Expand Down
12 changes: 10 additions & 2 deletions MediaBrowser.Api/Images/ImageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -675,10 +675,18 @@ private ImageFormat GetOutputFormat(ImageRequest request, ItemImageInfo image, L

private ImageFormat[] GetClientSupportedFormats()
{
if ((Request.AcceptTypes ?? new string[] { }).Contains("image/webp", StringComparer.OrdinalIgnoreCase))
var supportsWebP = (Request.AcceptTypes ?? new string[] {}).Contains("image/webp", StringComparer.OrdinalIgnoreCase);

var userAgent = Request.UserAgent ?? string.Empty;

if (userAgent.IndexOf("crosswalk", StringComparison.OrdinalIgnoreCase) != -1 &&
userAgent.IndexOf("android", StringComparison.OrdinalIgnoreCase) != -1)
{
var userAgent = Request.UserAgent ?? string.Empty;
supportsWebP = true;
}

if (supportsWebP)
{
// Not displaying properly on iOS
if (userAgent.IndexOf("cfnetwork", StringComparison.OrdinalIgnoreCase) == -1)
{
Expand Down
2 changes: 1 addition & 1 deletion MediaBrowser.Api/ItemUpdateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ private void UpdateItem(BaseItemDto request, BaseItem item)
var series = item as Series;
if (series != null)
{
series.Status = request.Status;
series.Status = request.SeriesStatus;
series.AirDays = request.AirDays;
series.AirTime = request.AirTime;

Expand Down
28 changes: 14 additions & 14 deletions MediaBrowser.Api/Library/LibraryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class GetThemeSongs : IReturn<ThemeMediaResult>
/// </summary>
/// <value>The user id.</value>
[ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public Guid? UserId { get; set; }
public string UserId { get; set; }

/// <summary>
/// Gets or sets the id.
Expand All @@ -102,7 +102,7 @@ public class GetThemeVideos : IReturn<ThemeMediaResult>
/// </summary>
/// <value>The user id.</value>
[ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public Guid? UserId { get; set; }
public string UserId { get; set; }

/// <summary>
/// Gets or sets the id.
Expand All @@ -127,7 +127,7 @@ public class GetThemeMedia : IReturn<AllThemeMediaResult>
/// </summary>
/// <value>The user id.</value>
[ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public Guid? UserId { get; set; }
public string UserId { get; set; }

/// <summary>
/// Gets or sets the id.
Expand Down Expand Up @@ -159,7 +159,7 @@ public class DeleteItem : IReturnVoid
public class GetItemCounts : IReturn<ItemCounts>
{
[ApiMember(Name = "UserId", Description = "Optional. Get counts from a specific user's library.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public Guid? UserId { get; set; }
public string UserId { get; set; }

[ApiMember(Name = "IsFavorite", Description = "Optional. Get counts of favorite items", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool? IsFavorite { get; set; }
Expand All @@ -174,7 +174,7 @@ public class GetAncestors : IReturn<BaseItemDto[]>
/// </summary>
/// <value>The user id.</value>
[ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public Guid? UserId { get; set; }
public string UserId { get; set; }

/// <summary>
/// Gets or sets the id.
Expand All @@ -193,7 +193,7 @@ public class GetYearIndex : IReturn<List<ItemIndex>>
/// </summary>
/// <value>The user id.</value>
[ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public Guid? UserId { get; set; }
public string UserId { get; set; }

[ApiMember(Name = "IncludeItemTypes", Description = "Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string IncludeItemTypes { get; set; }
Expand Down Expand Up @@ -412,7 +412,7 @@ public List<BaseItemDto> GetAncestors(GetAncestors request)

var baseItemDtos = new List<BaseItemDto>();

var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null;
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;

var dtoOptions = GetDtoOptions(request);

Expand Down Expand Up @@ -483,15 +483,15 @@ public object Get(GetItemCounts request)
return ToOptimizedSerializedResultUsingCache(counts);
}

private bool FilterItem(BaseItem item, GetItemCounts request, Guid? userId)
private bool FilterItem(BaseItem item, GetItemCounts request, string userId)
{
if (userId.HasValue)
if (!string.IsNullOrWhiteSpace(userId))
{
if (request.IsFavorite.HasValue)
{
var val = request.IsFavorite.Value;

if (_userDataManager.GetUserData(userId.Value, item.GetUserDataKey()).IsFavorite != val)
if (_userDataManager.GetUserData(userId, item.GetUserDataKey()).IsFavorite != val)
{
return false;
}
Expand Down Expand Up @@ -609,10 +609,10 @@ public object Get(GetThemeSongs request)

private ThemeMediaResult GetThemeSongs(GetThemeSongs request)
{
var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null;
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;

var item = string.IsNullOrEmpty(request.Id)
? (request.UserId.HasValue
? (!string.IsNullOrWhiteSpace(request.UserId)
? user.RootFolder
: (Folder)_libraryManager.RootFolder)
: _libraryManager.GetItemById(request.Id);
Expand Down Expand Up @@ -652,10 +652,10 @@ public object Get(GetThemeVideos request)

public ThemeMediaResult GetThemeVideos(GetThemeVideos request)
{
var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null;
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;

var item = string.IsNullOrEmpty(request.Id)
? (request.UserId.HasValue
? (!string.IsNullOrWhiteSpace(request.UserId)
? user.RootFolder
: (Folder)_libraryManager.RootFolder)
: _libraryManager.GetItemById(request.Id);
Expand Down
14 changes: 7 additions & 7 deletions MediaBrowser.Api/LiveTv/LiveTvService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class GetChannel : IReturn<ChannelInfoDto>

[Route("/LiveTv/Recordings", "GET", Summary = "Gets live tv recordings")]
[Authenticated]
public class GetRecordings : IReturn<QueryResult<RecordingInfoDto>>
public class GetRecordings : IReturn<QueryResult<BaseItemDto>>
{
[ApiMember(Name = "ChannelId", Description = "Optional filter by channel id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string ChannelId { get; set; }
Expand Down Expand Up @@ -107,15 +107,15 @@ public class GetRecordings : IReturn<QueryResult<RecordingInfoDto>>

[Route("/LiveTv/Recordings/Groups", "GET", Summary = "Gets live tv recording groups")]
[Authenticated]
public class GetRecordingGroups : IReturn<QueryResult<RecordingGroupDto>>
public class GetRecordingGroups : IReturn<QueryResult<BaseItemDto>>
{
[ApiMember(Name = "UserId", Description = "Optional filter by user and attach user data.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string UserId { get; set; }
}

[Route("/LiveTv/Recordings/{Id}", "GET", Summary = "Gets a live tv recording")]
[Authenticated]
public class GetRecording : IReturn<RecordingInfoDto>
public class GetRecording : IReturn<BaseItemDto>
{
[ApiMember(Name = "Id", Description = "Recording Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get; set; }
Expand Down Expand Up @@ -161,7 +161,7 @@ public class GetTimers : IReturn<QueryResult<TimerInfoDto>>

[Route("/LiveTv/Programs", "GET,POST", Summary = "Gets available live tv epgs..")]
[Authenticated]
public class GetPrograms : IReturn<QueryResult<ProgramInfoDto>>
public class GetPrograms : IReturn<QueryResult<BaseItemDto>>
{
[ApiMember(Name = "ChannelIds", Description = "The channels to return guide information for.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
public string ChannelIds { get; set; }
Expand Down Expand Up @@ -208,7 +208,7 @@ public class GetPrograms : IReturn<QueryResult<ProgramInfoDto>>

[Route("/LiveTv/Programs/Recommended", "GET", Summary = "Gets available live tv epgs..")]
[Authenticated]
public class GetRecommendedPrograms : IReturn<QueryResult<ProgramInfoDto>>
public class GetRecommendedPrograms : IReturn<QueryResult<BaseItemDto>>
{
[ApiMember(Name = "UserId", Description = "Optional filter by user id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET,POST")]
public string UserId { get; set; }
Expand All @@ -231,7 +231,7 @@ public class GetRecommendedPrograms : IReturn<QueryResult<ProgramInfoDto>>

[Route("/LiveTv/Programs/{Id}", "GET", Summary = "Gets a live tv program")]
[Authenticated]
public class GetProgram : IReturn<ProgramInfoDto>
public class GetProgram : IReturn<BaseItemDto>
{
[ApiMember(Name = "Id", Description = "Program Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get; set; }
Expand Down Expand Up @@ -310,7 +310,7 @@ public class CreateSeriesTimer : SeriesTimerInfoDto, IReturnVoid

[Route("/LiveTv/Recordings/Groups/{Id}", "GET", Summary = "Gets a recording group")]
[Authenticated]
public class GetRecordingGroup : IReturn<RecordingGroupDto>
public class GetRecordingGroup : IReturn<BaseItemDto>
{
[ApiMember(Name = "Id", Description = "Recording group Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get; set; }
Expand Down
16 changes: 8 additions & 8 deletions MediaBrowser.Api/Movies/CollectionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Collections;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Querying;
using ServiceStack;
using System;
using System.Collections.Generic;
Expand All @@ -22,7 +20,7 @@ public class CreateCollection : IReturn<CollectionCreationResult>
public string Name { get; set; }

[ApiMember(Name = "ParentId", Description = "Optional - create the collection within a specific folder", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public Guid? ParentId { get; set; }
public string ParentId { get; set; }

[ApiMember(Name = "Ids", Description = "Item Ids to add to the collection", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST", AllowMultiple = true)]
public string Ids { get; set; }
Expand All @@ -35,7 +33,7 @@ public class AddToCollection : IReturnVoid
public string Ids { get; set; }

[ApiMember(Name = "Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public Guid Id { get; set; }
public string Id { get; set; }
}

[Route("/Collections/{Id}/Items", "DELETE", Summary = "Removes items from a collection")]
Expand All @@ -45,7 +43,7 @@ public class RemoveFromCollection : IReturnVoid
public string Ids { get; set; }

[ApiMember(Name = "Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
public Guid Id { get; set; }
public string Id { get; set; }
}

[Authenticated]
Expand All @@ -64,11 +62,13 @@ public async Task<object> Post(CreateCollection request)
{
var userId = AuthorizationContext.GetAuthorizationInfo(Request).UserId;

var parentId = string.IsNullOrWhiteSpace(request.ParentId) ? (Guid?)null : new Guid(request.ParentId);

var item = await _collectionManager.CreateCollection(new CollectionCreationOptions
{
IsLocked = request.IsLocked,
Name = request.Name,
ParentId = request.ParentId,
ParentId = parentId,
ItemIdList = (request.Ids ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).Select(i => new Guid(i)).ToList(),
UserIds = new List<Guid> { new Guid(userId) }

Expand All @@ -86,14 +86,14 @@ public async Task<object> Post(CreateCollection request)

public void Post(AddToCollection request)
{
var task = _collectionManager.AddToCollection(request.Id, request.Ids.Split(',').Select(i => new Guid(i)));
var task = _collectionManager.AddToCollection(new Guid(request.Id), request.Ids.Split(',').Select(i => new Guid(i)));

Task.WaitAll(task);
}

public void Delete(RemoveFromCollection request)
{
var task = _collectionManager.RemoveFromCollection(request.Id, request.Ids.Split(',').Select(i => new Guid(i)));
var task = _collectionManager.RemoveFromCollection(new Guid(request.Id), request.Ids.Split(',').Select(i => new Guid(i)));

Task.WaitAll(task);
}
Expand Down
Loading

0 comments on commit a5ce710

Please sign in to comment.