mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 05:47:14 -04:00
added metadata editor sidebar
This commit is contained in:
parent
f9e1f3f4e8
commit
a52ea4cf08
@ -144,6 +144,25 @@ namespace MediaBrowser.Api
|
||||
public Guid? UserId { get; set; }
|
||||
}
|
||||
|
||||
[Route("/Items/{Id}/Ancestors", "GET")]
|
||||
[Api(Description = "Gets all parents of an item")]
|
||||
public class GetAncestors : IReturn<BaseItemDto[]>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the user id.
|
||||
/// </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; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <value>The id.</value>
|
||||
[ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
||||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class LibraryService
|
||||
/// </summary>
|
||||
@ -174,6 +193,84 @@ namespace MediaBrowser.Api
|
||||
_userDataRepository = userDataRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specified request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public object Get(GetAncestors request)
|
||||
{
|
||||
var result = GetAncestors(request).Result;
|
||||
|
||||
return ToOptimizedResult(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ancestors.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <returns>Task{BaseItemDto[]}.</returns>
|
||||
public async Task<BaseItemDto[]> GetAncestors(GetAncestors request)
|
||||
{
|
||||
var item = DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager);
|
||||
|
||||
var tasks = new List<Task<BaseItemDto>>();
|
||||
|
||||
var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null;
|
||||
|
||||
// Get everything
|
||||
var fields = Enum.GetNames(typeof(ItemFields))
|
||||
.Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true))
|
||||
.ToList();
|
||||
|
||||
var dtoBuilder = new DtoBuilder(Logger, _libraryManager, _userDataRepository, _itemRepo);
|
||||
|
||||
BaseItem parent = item.Parent;
|
||||
|
||||
while (parent != null)
|
||||
{
|
||||
if (user != null)
|
||||
{
|
||||
parent = TranslateParentItem(parent, user);
|
||||
}
|
||||
|
||||
tasks.Add(dtoBuilder.GetBaseItemDto(parent, fields, user));
|
||||
|
||||
if (parent is UserRootFolder)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
parent = parent.Parent;
|
||||
}
|
||||
|
||||
return await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private BaseItem TranslateParentItem(BaseItem item, User user)
|
||||
{
|
||||
if (item.Parent is AggregateFolder)
|
||||
{
|
||||
return user.RootFolder.GetChildren(user, true).FirstOrDefault(i =>
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
return i.LocationType == LocationType.FileSystem &&
|
||||
i.ResolveArgs.PhysicalLocations.Contains(item.Path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, i.Path);
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specified request.
|
||||
/// </summary>
|
||||
@ -231,8 +328,7 @@ namespace MediaBrowser.Api
|
||||
{
|
||||
try
|
||||
{
|
||||
await
|
||||
_libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None)
|
||||
await _libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -418,7 +418,8 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
{
|
||||
"http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js",
|
||||
"http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js",
|
||||
"scripts/all.js" + versionString
|
||||
"scripts/all.js" + versionString,
|
||||
"thirdparty/jstree1.0fix2/jquery.jstree.js"
|
||||
};
|
||||
|
||||
var tags = files.Select(s => string.Format("<script src=\"{0}\"></script>", s)).ToArray();
|
||||
@ -546,6 +547,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
"detailtable.css",
|
||||
"posteritem.css",
|
||||
"tileitem.css",
|
||||
"metadataeditor.css",
|
||||
"notifications.css",
|
||||
"search.css",
|
||||
"pluginupdates.css",
|
||||
|
@ -90,6 +90,9 @@
|
||||
<Content Include="dashboard-ui\css\images\remote.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\metadataeditor.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\notifications.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@ -515,6 +518,78 @@
|
||||
<Content Include="dashboard-ui\thirdparty\html5slider.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\jquery.jstree.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\apple\bg.jpg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\apple\d.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\apple\dot_for_ie.gif">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\apple\style.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\apple\throbber.gif">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\classic\d.gif">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\classic\d.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\classic\dot_for_ie.gif">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\classic\style.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\classic\throbber.gif">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\default-rtl\d.gif">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\default-rtl\d.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\default-rtl\dots.gif">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\default-rtl\style.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\default-rtl\throbber.gif">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\default\d.gif">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\default\d.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\default\style.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\default\throbber.gif">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\mb3\d.gif">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\mb3\d.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\mb3\style.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jstree1.0fix2\themes\mb3\throbber.gif">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\tvgenres.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
Loading…
Reference in New Issue
Block a user