web client re-org

pull/702/head
Luke Pulverenti 10 years ago
parent c741082dfd
commit c7c72dd1a8

@ -154,8 +154,14 @@ namespace MediaBrowser.Api
return libraryManager.GetPerson(DeSlugPersonName(name, libraryManager));
}
protected IList<BaseItem> GetAllLibraryItems(Guid? userId, IUserManager userManager, ILibraryManager libraryManager)
protected IList<BaseItem> GetAllLibraryItems(Guid? userId, IUserManager userManager, ILibraryManager libraryManager, string parentId = null)
{
if (!string.IsNullOrEmpty(parentId))
{
var folder = (Folder) libraryManager.GetItemById(new Guid(parentId));
return folder.GetRecursiveChildren();
}
if (userId.HasValue)
{
var user = userManager.GetUserById(userId.Value);

@ -45,6 +45,13 @@ namespace MediaBrowser.Api.Movies
[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; }
/// <summary>
/// Specify this to localize the search to a specific item or folder. Omit to use the root.
/// </summary>
/// <value>The parent id.</value>
[ApiMember(Name = "ParentId", Description = "Specify this to localize the search to a specific item or folder. Omit to use the root", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string ParentId { get; set; }
public GetMovieRecommendations()
{
CategoryLimit = 5;
@ -117,7 +124,9 @@ namespace MediaBrowser.Api.Movies
{
var user = _userManager.GetUserById(request.UserId.Value);
var movies = user.RootFolder.GetRecursiveChildren(user).OfType<Movie>().ToList();
var movies = GetAllLibraryItems(request.UserId, _userManager, _libraryManager, request.ParentId)
.OfType<Movie>()
.ToList();
var result = GetRecommendationCategories(user, movies, request.CategoryLimit, request.ItemLimit, request.GetItemFields().ToList());

@ -50,6 +50,13 @@ namespace MediaBrowser.Api
[ApiMember(Name = "SeriesId", Description = "Optional. Filter by series id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string SeriesId { get; set; }
/// <summary>
/// Specify this to localize the search to a specific item or folder. Omit to use the root.
/// </summary>
/// <value>The parent id.</value>
[ApiMember(Name = "ParentId", Description = "Specify this to localize the search to a specific item or folder. Omit to use the root", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string ParentId { get; set; }
}
[Route("/Shows/Upcoming", "GET", Summary = "Gets a list of upcoming episodes")]
@ -82,6 +89,13 @@ namespace MediaBrowser.Api
/// <value>The fields.</value>
[ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, OverviewHtml, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines, TrailerUrls", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string Fields { get; set; }
/// <summary>
/// Specify this to localize the search to a specific item or folder. Omit to use the root.
/// </summary>
/// <value>The parent id.</value>
[ApiMember(Name = "ParentId", Description = "Specify this to localize the search to a specific item or folder. Omit to use the root", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string ParentId { get; set; }
}
[Route("/Shows/{Id}/Similar", "GET", Summary = "Finds tv shows similar to a given one.")]
@ -218,7 +232,7 @@ namespace MediaBrowser.Api
{
var user = _userManager.GetUserById(request.UserId);
var items = GetAllLibraryItems(request.UserId, _userManager, _libraryManager)
var items = GetAllLibraryItems(request.UserId, _userManager, _libraryManager, request.ParentId)
.OfType<Episode>();
var itemsList = _libraryManager.Sort(items, user, new[] { "PremiereDate", "AirTime", "SortName" }, SortOrder.Ascending)
@ -276,10 +290,7 @@ namespace MediaBrowser.Api
public IEnumerable<Episode> GetNextUpEpisodes(GetNextUpEpisodes request)
{
var user = _userManager.GetUserById(request.UserId);
var items = user.RootFolder
.GetRecursiveChildren(user)
var items = GetAllLibraryItems(request.UserId, _userManager, _libraryManager, request.ParentId)
.OfType<Series>();
// Avoid implicitly captured closure

@ -138,12 +138,23 @@ namespace MediaBrowser.Controller.Providers
{
// DateCreated
case "Added":
DateTime added;
if (DateTime.TryParse(reader.ReadElementContentAsString() ?? string.Empty, out added))
{
item.DateCreated = added.ToUniversalTime();
var val = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(val))
{
DateTime added;
if (DateTime.TryParse(val, out added))
{
item.DateCreated = added.ToUniversalTime();
}
else
{
Logger.Warn("Invalid Added value found: " + val);
}
}
break;
}
break;
case "LocalTitle":
item.Name = reader.ReadElementContentAsString();

@ -80,7 +80,13 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

@ -1,4 +1,5 @@
using MediaBrowser.Controller.Entities;
using System;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Model.Entities;
using System.Collections.Generic;
@ -186,6 +187,12 @@ namespace MediaBrowser.Providers.Manager
target.IsLocked = source.IsLocked;
target.DisplayMediaType = source.DisplayMediaType;
// Grab the value if it's there, but if not then don't overwrite the default
if (source.DateCreated != default(DateTime))
{
target.DateCreated = source.DateCreated;
}
var sourceHasLanguageSettings = source as IHasPreferredMetadataLanguage;
var targetHasLanguageSettings = target as IHasPreferredMetadataLanguage;

@ -3,8 +3,6 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Logging;
using Mono.Nat;
using Mono.Nat.Enums;
using Mono.Nat.EventArgs;
using System;
using System.IO;
using System.Text;
@ -19,9 +17,9 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
private bool _isStarted;
public ExternalPortForwarding(ILogger logger, IServerApplicationHost appHost, IServerConfigurationManager config)
public ExternalPortForwarding(ILogManager logmanager, IServerApplicationHost appHost, IServerConfigurationManager config)
{
_logger = logger;
_logger = logmanager.GetLogger("PortMapper");
_appHost = appHost;
_config = config;

@ -1,4 +1,5 @@
using System.Net.Sockets;
using System.Runtime.Serialization;
using Funq;
using MediaBrowser.Common;
using MediaBrowser.Common.Extensions;
@ -246,8 +247,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
_autoResetEvents[index].Set();
}
if (context == null) return;
var date = DateTime.Now;
Task.Factory.StartNew(async () =>
@ -375,7 +374,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
};
var operationName = context.Request.GetOperationName();
var httpReq = context.ToRequest(operationName);
var httpReq = GetRequest(context, operationName);
var httpRes = httpReq.Response;
var contentType = httpReq.ResponseContentType;
@ -409,6 +408,13 @@ namespace MediaBrowser.Server.Implementations.HttpServer
}
}
private static ListenerRequest GetRequest(HttpListenerContext httpContext, string operationName)
{
var req = new ListenerRequest(httpContext, operationName, RequestAttributes.None);
req.RequestAttributes = req.GetAttributes();
return req;
}
/// <summary>
/// Shut down the Web Service
/// </summary>
@ -436,7 +442,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
var operationName = context.Request.GetOperationName();
var httpReq = context.ToRequest(operationName);
var httpReq = GetRequest(context, operationName);
var httpRes = httpReq.Response;
var handler = HttpHandlerFactory.GetHandler(httpReq);

@ -620,5 +620,6 @@
"NotificationOptionPluginError": "Plugin failure",
"ButtonVolumeUp": "Volume up",
"ButtonVolumeDown": "Volume down",
"ButtonMute": "Mute"
"ButtonMute": "Mute",
"HeaderLatestMedia": "Latest Media"
}

@ -48,9 +48,9 @@
<Reference Include="Alchemy">
<HintPath>..\packages\Alchemy.2.2.1\lib\net40\Alchemy.dll</HintPath>
</Reference>
<Reference Include="Mono.Nat, Version=1.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Mono.Nat, Version=1.2.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Mono.Nat.1.2.3\lib\Net40\Mono.Nat.dll</HintPath>
<HintPath>..\packages\Mono.Nat.1.2.7.0\lib\net40\Mono.Nat.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Api.Swagger">
<HintPath>..\ThirdParty\ServiceStack\ServiceStack.Api.Swagger.dll</HintPath>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Alchemy" version="2.2.1" targetFramework="net45" />
<package id="Mono.Nat" version="1.2.3" targetFramework="net45" />
<package id="Mono.Nat" version="1.2.7.0" targetFramework="net45" />
<package id="morelinq" version="1.0.16006" targetFramework="net45" />
<package id="System.Data.SQLite.Core" version="1.0.91.3" targetFramework="net45" />
</packages>

@ -41,10 +41,8 @@ namespace MediaBrowser.Server.Mono
var applicationPath = Assembly.GetEntryAssembly ().Location;
#endif
var commandArgs = Environment.GetCommandLineArgs();
// Allow this to be specified on the command line.
var customProgramDataPath = commandArgs.ElementAtOrDefault(1);
var customProgramDataPath = ParseCommandLine();
var appPaths = CreateApplicationPaths(applicationPath, customProgramDataPath);
@ -75,6 +73,20 @@ namespace MediaBrowser.Server.Mono
_appHost.Dispose();
}
}
private static string ParseCommandLine()
{
var commandArgs = Environment.GetCommandLineArgs().ToList();
var programDataPathIndex = commandArgs.IndexOf("-programdata");
if (programDataPathIndex != -1)
{
return commandArgs.ElementAtOrDefault(programDataPathIndex + 1);
}
return null;
}
private static ServerApplicationPaths CreateApplicationPaths(string applicationPath, string programDataPath)
{

Loading…
Cancel
Save