mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-16 23:26:22 +00:00
add new image params
This commit is contained in:
@@ -88,6 +88,11 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
}
|
||||
}
|
||||
|
||||
private string XApplicationValue
|
||||
{
|
||||
get { return "Media Browser Server/" + _appHost.ApplicationVersion; }
|
||||
}
|
||||
|
||||
public ConnectManager(ILogger logger,
|
||||
IApplicationPaths appPaths,
|
||||
IJsonSerializer json,
|
||||
@@ -204,9 +209,18 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
postData["localAddress"] = localAddress;
|
||||
}
|
||||
|
||||
using (var stream = await _httpClient.Post(url, postData, CancellationToken.None).ConfigureAwait(false))
|
||||
var options = new HttpRequestOptions
|
||||
{
|
||||
var data = _json.DeserializeFromStream<ServerRegistrationResponse>(stream);
|
||||
Url = url,
|
||||
CancellationToken = CancellationToken.None
|
||||
};
|
||||
|
||||
options.SetPostData(postData);
|
||||
SetApplicationHeader(options);
|
||||
|
||||
using (var response = await _httpClient.Post(options).ConfigureAwait(false))
|
||||
{
|
||||
var data = _json.DeserializeFromStream<ServerRegistrationResponse>(response.Content);
|
||||
|
||||
_data.ServerId = data.Id;
|
||||
_data.AccessKey = data.AccessKey;
|
||||
@@ -252,6 +266,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
options.SetPostData(postData);
|
||||
|
||||
SetServerAccessToken(options);
|
||||
SetApplicationHeader(options);
|
||||
|
||||
// No need to examine the response
|
||||
using (var stream = (await _httpClient.Post(options).ConfigureAwait(false)).Content)
|
||||
@@ -398,6 +413,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
options.SetPostData(postData);
|
||||
|
||||
SetServerAccessToken(options);
|
||||
SetApplicationHeader(options);
|
||||
|
||||
var result = new UserLinkResult();
|
||||
|
||||
@@ -517,6 +533,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
options.SetPostData(postData);
|
||||
|
||||
SetServerAccessToken(options);
|
||||
SetApplicationHeader(options);
|
||||
|
||||
// No need to examine the response
|
||||
using (var stream = (await _httpClient.Post(options).ConfigureAwait(false)).Content)
|
||||
@@ -562,6 +579,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
};
|
||||
|
||||
options.SetPostData(postData);
|
||||
SetApplicationHeader(options);
|
||||
|
||||
// No need to examine the response
|
||||
using (var stream = (await _httpClient.Post(options).ConfigureAwait(false)).Content)
|
||||
@@ -629,6 +647,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
};
|
||||
|
||||
SetServerAccessToken(options);
|
||||
SetApplicationHeader(options);
|
||||
|
||||
using (var stream = await _httpClient.Get(options).ConfigureAwait(false))
|
||||
{
|
||||
@@ -645,6 +664,11 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
}
|
||||
}
|
||||
|
||||
private void SetApplicationHeader(HttpRequestOptions options)
|
||||
{
|
||||
options.RequestHeaders.Add("X-Application", XApplicationValue);
|
||||
}
|
||||
|
||||
private void SetServerAccessToken(HttpRequestOptions options)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(ConnectAccessKey))
|
||||
@@ -687,6 +711,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
};
|
||||
|
||||
SetServerAccessToken(options);
|
||||
SetApplicationHeader(options);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -974,6 +999,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
options.SetPostData(postData);
|
||||
|
||||
SetServerAccessToken(options);
|
||||
SetApplicationHeader(options);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1006,20 +1032,22 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
{
|
||||
throw new ArgumentNullException("passwordMd5");
|
||||
}
|
||||
|
||||
var request = new HttpRequestOptions
|
||||
|
||||
var options = new HttpRequestOptions
|
||||
{
|
||||
Url = GetConnectUrl("user/authenticate")
|
||||
};
|
||||
|
||||
request.SetPostData(new Dictionary<string, string>
|
||||
options.SetPostData(new Dictionary<string, string>
|
||||
{
|
||||
{"userName",username},
|
||||
{"password",passwordMd5}
|
||||
});
|
||||
|
||||
SetApplicationHeader(options);
|
||||
|
||||
// No need to examine the response
|
||||
using (var stream = (await _httpClient.SendAsync(request, "POST").ConfigureAwait(false)).Content)
|
||||
using (var response = (await _httpClient.SendAsync(options, "POST").ConfigureAwait(false)).Content)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1062,6 +1090,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||
options.SetPostData(postData);
|
||||
|
||||
SetServerAccessToken(options);
|
||||
SetApplicationHeader(options);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -69,7 +69,22 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
public BaseItemDto GetBaseItemDto(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null)
|
||||
{
|
||||
var dto = GetBaseItemDtoInternal(item, fields, user, owner);
|
||||
var options = new DtoOptions
|
||||
{
|
||||
Fields = fields
|
||||
};
|
||||
|
||||
// Get everything
|
||||
options.ImageTypes = Enum.GetNames(typeof(ImageType))
|
||||
.Select(i => (ImageType)Enum.Parse(typeof(ImageType), i, true))
|
||||
.ToList();
|
||||
|
||||
return GetBaseItemDto(item, options, user, owner);
|
||||
}
|
||||
|
||||
public BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null)
|
||||
{
|
||||
var dto = GetBaseItemDtoInternal(item, options, user, owner);
|
||||
|
||||
var byName = item as IItemByName;
|
||||
|
||||
@@ -87,8 +102,10 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
return dto;
|
||||
}
|
||||
|
||||
private BaseItemDto GetBaseItemDtoInternal(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null)
|
||||
private BaseItemDto GetBaseItemDtoInternal(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null)
|
||||
{
|
||||
var fields = options.Fields;
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException("item");
|
||||
@@ -115,7 +132,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
{
|
||||
try
|
||||
{
|
||||
AttachPrimaryImageAspectRatio(dto, item);
|
||||
AttachPrimaryImageAspectRatio(dto, item, fields);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -155,7 +172,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
AttachStudios(dto, item);
|
||||
}
|
||||
|
||||
AttachBasicFields(dto, item, owner, fields);
|
||||
AttachBasicFields(dto, item, owner, options);
|
||||
|
||||
if (fields.Contains(ItemFields.SyncInfo))
|
||||
{
|
||||
@@ -174,18 +191,19 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
}
|
||||
}
|
||||
|
||||
if (item is Playlist)
|
||||
var playlist = item as Playlist;
|
||||
if (playlist != null)
|
||||
{
|
||||
AttachLinkedChildImages(dto, (Folder)item, user);
|
||||
AttachLinkedChildImages(dto, playlist, user, options);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
public BaseItemDto GetItemByNameDto<T>(T item, List<ItemFields> fields, List<BaseItem> taggedItems, User user = null)
|
||||
public BaseItemDto GetItemByNameDto<T>(T item, DtoOptions options, List<BaseItem> taggedItems, User user = null)
|
||||
where T : BaseItem, IItemByName
|
||||
{
|
||||
var dto = GetBaseItemDtoInternal(item, fields, user);
|
||||
var dto = GetBaseItemDtoInternal(item, options, user);
|
||||
|
||||
SetItemByNameInfo(item, dto, taggedItems, user);
|
||||
|
||||
@@ -369,36 +387,27 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
dto.GameSystem = item.GameSystemName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the backdrop image tags.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>List{System.String}.</returns>
|
||||
private List<string> GetBackdropImageTags(BaseItem item)
|
||||
private List<string> GetBackdropImageTags(BaseItem item, int limit)
|
||||
{
|
||||
return GetCacheTags(item, ImageType.Backdrop).ToList();
|
||||
return GetCacheTags(item, ImageType.Backdrop, limit).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the screenshot image tags.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>List{Guid}.</returns>
|
||||
private List<string> GetScreenshotImageTags(BaseItem item)
|
||||
private List<string> GetScreenshotImageTags(BaseItem item, int limit)
|
||||
{
|
||||
var hasScreenshots = item as IHasScreenshots;
|
||||
if (hasScreenshots == null)
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
return GetCacheTags(item, ImageType.Screenshot).ToList();
|
||||
return GetCacheTags(item, ImageType.Screenshot, limit).ToList();
|
||||
}
|
||||
|
||||
private IEnumerable<string> GetCacheTags(BaseItem item, ImageType type)
|
||||
private IEnumerable<string> GetCacheTags(BaseItem item, ImageType type, int limit)
|
||||
{
|
||||
return item.GetImages(type)
|
||||
.Select(p => GetImageCacheTag(item, p))
|
||||
.Where(i => i != null)
|
||||
.Take(limit)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
@@ -649,9 +658,11 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
/// <param name="dto">The dto.</param>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="owner">The owner.</param>
|
||||
/// <param name="fields">The fields.</param>
|
||||
private void AttachBasicFields(BaseItemDto dto, BaseItem item, BaseItem owner, List<ItemFields> fields)
|
||||
/// <param name="options">The options.</param>
|
||||
private void AttachBasicFields(BaseItemDto dto, BaseItem item, BaseItem owner, DtoOptions options)
|
||||
{
|
||||
var fields = options.Fields;
|
||||
|
||||
if (fields.Contains(ItemFields.DateCreated))
|
||||
{
|
||||
dto.DateCreated = item.DateCreated;
|
||||
@@ -662,7 +673,11 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
dto.DisplayMediaType = item.DisplayMediaType;
|
||||
}
|
||||
|
||||
dto.IsUnidentified = item.IsUnidentified;
|
||||
// Leave null if false
|
||||
if (item.IsUnidentified)
|
||||
{
|
||||
dto.IsUnidentified = item.IsUnidentified;
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.Settings))
|
||||
{
|
||||
@@ -736,10 +751,13 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
dto.AspectRatio = hasAspectRatio.AspectRatio;
|
||||
}
|
||||
|
||||
var hasMetascore = item as IHasMetascore;
|
||||
if (hasMetascore != null)
|
||||
if (fields.Contains(ItemFields.ProductionLocations))
|
||||
{
|
||||
dto.Metascore = hasMetascore.Metascore;
|
||||
var hasMetascore = item as IHasMetascore;
|
||||
if (hasMetascore != null)
|
||||
{
|
||||
dto.Metascore = hasMetascore.Metascore;
|
||||
}
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.AwardSummary))
|
||||
@@ -751,11 +769,19 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
}
|
||||
}
|
||||
|
||||
dto.BackdropImageTags = GetBackdropImageTags(item);
|
||||
var backdropLimit = options.GetImageLimit(ImageType.Backdrop);
|
||||
if (backdropLimit > 0)
|
||||
{
|
||||
dto.BackdropImageTags = GetBackdropImageTags(item, backdropLimit);
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.ScreenshotImageTags))
|
||||
{
|
||||
dto.ScreenshotImageTags = GetScreenshotImageTags(item);
|
||||
var screenshotLimit = options.GetImageLimit(ImageType.Screenshot);
|
||||
if (screenshotLimit > 0)
|
||||
{
|
||||
dto.ScreenshotImageTags = GetScreenshotImageTags(item, screenshotLimit);
|
||||
}
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.Genres))
|
||||
@@ -769,11 +795,14 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
var currentItem = item;
|
||||
foreach (var image in currentItem.ImageInfos.Where(i => !currentItem.AllowsMultipleImages(i.Type)))
|
||||
{
|
||||
var tag = GetImageCacheTag(item, image);
|
||||
|
||||
if (tag != null)
|
||||
if (options.GetImageLimit(image.Type) > 0)
|
||||
{
|
||||
dto.ImageTags[image.Type] = tag;
|
||||
var tag = GetImageCacheTag(item, image);
|
||||
|
||||
if (tag != null)
|
||||
{
|
||||
dto.ImageTags[image.Type] = tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -851,14 +880,14 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
}
|
||||
|
||||
// If there are no backdrops, indicate what parent has them in case the Ui wants to allow inheritance
|
||||
if (dto.BackdropImageTags.Count == 0)
|
||||
if (backdropLimit > 0 && dto.BackdropImageTags.Count == 0)
|
||||
{
|
||||
var parentWithBackdrop = GetParentBackdropItem(item, owner);
|
||||
|
||||
if (parentWithBackdrop != null)
|
||||
{
|
||||
dto.ParentBackdropItemId = GetDtoId(parentWithBackdrop);
|
||||
dto.ParentBackdropImageTags = GetBackdropImageTags(parentWithBackdrop);
|
||||
dto.ParentBackdropImageTags = GetBackdropImageTags(parentWithBackdrop, backdropLimit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -874,7 +903,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
dto.ParentIndexNumber = item.ParentIndexNumber;
|
||||
|
||||
// If there is no logo, indicate what parent has one in case the Ui wants to allow inheritance
|
||||
if (!dto.HasLogo)
|
||||
if (!dto.HasLogo && options.GetImageLimit(ImageType.Logo) > 0)
|
||||
{
|
||||
var parentWithLogo = GetParentImageItem(item, ImageType.Logo, owner);
|
||||
|
||||
@@ -887,7 +916,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
}
|
||||
|
||||
// If there is no art, indicate what parent has one in case the Ui wants to allow inheritance
|
||||
if (!dto.HasArtImage)
|
||||
if (!dto.HasArtImage && options.GetImageLimit(ImageType.Thumb) > 0)
|
||||
{
|
||||
var parentWithImage = GetParentImageItem(item, ImageType.Art, owner);
|
||||
|
||||
@@ -900,7 +929,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
}
|
||||
|
||||
// If there is no thumb, indicate what parent has one in case the Ui wants to allow inheritance
|
||||
if (!dto.HasThumb)
|
||||
if (!dto.HasThumb && options.GetImageLimit(ImageType.Thumb) > 0)
|
||||
{
|
||||
var parentWithImage = GetParentImageItem(item, ImageType.Thumb, owner);
|
||||
|
||||
@@ -953,7 +982,11 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
|
||||
dto.Type = item.GetClientTypeName();
|
||||
dto.CommunityRating = item.CommunityRating;
|
||||
dto.VoteCount = item.VoteCount;
|
||||
|
||||
if (fields.Contains(ItemFields.VoteCount))
|
||||
{
|
||||
dto.VoteCount = item.VoteCount;
|
||||
}
|
||||
|
||||
if (item.IsFolder)
|
||||
{
|
||||
@@ -1017,8 +1050,15 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
dto.IsoType = video.IsoType;
|
||||
dto.IsHD = video.IsHD;
|
||||
|
||||
dto.PartCount = video.AdditionalPartIds.Count + 1;
|
||||
dto.MediaSourceCount = video.MediaSourceCount;
|
||||
if (fields.Contains(ItemFields.Chapters))
|
||||
{
|
||||
dto.PartCount = video.AdditionalPartIds.Count + 1;
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.MediaSourceCount))
|
||||
{
|
||||
dto.MediaSourceCount = video.MediaSourceCount;
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.Chapters))
|
||||
{
|
||||
@@ -1200,28 +1240,28 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
}
|
||||
}
|
||||
|
||||
private void AttachLinkedChildImages(BaseItemDto dto, Folder folder, User user)
|
||||
private void AttachLinkedChildImages(BaseItemDto dto, Folder folder, User user, DtoOptions options)
|
||||
{
|
||||
List<BaseItem> linkedChildren = null;
|
||||
|
||||
if (dto.BackdropImageTags.Count == 0)
|
||||
var backdropLimit = options.GetImageLimit(ImageType.Backdrop);
|
||||
|
||||
if (backdropLimit > 0 && dto.BackdropImageTags.Count == 0)
|
||||
{
|
||||
if (linkedChildren == null)
|
||||
{
|
||||
linkedChildren = user == null
|
||||
? folder.GetRecursiveChildren().ToList()
|
||||
: folder.GetRecursiveChildren(user, true).ToList();
|
||||
}
|
||||
linkedChildren = user == null
|
||||
? folder.GetRecursiveChildren().ToList()
|
||||
: folder.GetRecursiveChildren(user, true).ToList();
|
||||
|
||||
var parentWithBackdrop = linkedChildren.FirstOrDefault(i => i.GetImages(ImageType.Backdrop).Any());
|
||||
|
||||
if (parentWithBackdrop != null)
|
||||
{
|
||||
dto.ParentBackdropItemId = GetDtoId(parentWithBackdrop);
|
||||
dto.ParentBackdropImageTags = GetBackdropImageTags(parentWithBackdrop);
|
||||
dto.ParentBackdropImageTags = GetBackdropImageTags(parentWithBackdrop, backdropLimit);
|
||||
}
|
||||
}
|
||||
|
||||
if (!dto.ImageTags.ContainsKey(ImageType.Primary))
|
||||
if (!dto.ImageTags.ContainsKey(ImageType.Primary) && options.GetImageLimit(ImageType.Primary) > 0)
|
||||
{
|
||||
if (linkedChildren == null)
|
||||
{
|
||||
@@ -1380,8 +1420,9 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
/// </summary>
|
||||
/// <param name="dto">The dto.</param>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="fields">The fields.</param>
|
||||
/// <returns>Task.</returns>
|
||||
public void AttachPrimaryImageAspectRatio(IItemDto dto, IHasImages item)
|
||||
public void AttachPrimaryImageAspectRatio(IItemDto dto, IHasImages item, List<ItemFields> fields)
|
||||
{
|
||||
var imageInfo = item.GetImageInfo(ImageType.Primary, 0);
|
||||
|
||||
@@ -1412,7 +1453,10 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
return;
|
||||
}
|
||||
|
||||
dto.OriginalPrimaryImageAspectRatio = size.Width / size.Height;
|
||||
if (fields.Contains(ItemFields.OriginalPrimaryImageAspectRatio))
|
||||
{
|
||||
dto.OriginalPrimaryImageAspectRatio = size.Width / size.Height;
|
||||
}
|
||||
|
||||
var supportedEnhancers = _imageProcessor.GetSupportedEnhancers(item, ImageType.Primary).ToList();
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Naming.Audio;
|
||||
using MediaBrowser.Naming.Common;
|
||||
using MediaBrowser.Naming.IO;
|
||||
using MediaBrowser.Naming.Video;
|
||||
using MediaBrowser.Server.Implementations.Library.Resolvers.TV;
|
||||
using MediaBrowser.Server.Implementations.Library.Validators;
|
||||
@@ -485,12 +484,36 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
ResolverHelper.SetInitialItemValues(item, args, _fileSystem);
|
||||
ResolverHelper.SetInitialItemValues(item, args, _fileSystem, this);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
public Guid GetNewItemId(string key, Type type)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(key))
|
||||
{
|
||||
throw new ArgumentNullException("key");
|
||||
}
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentNullException("type");
|
||||
}
|
||||
|
||||
if (ConfigurationManager.Configuration.EnableLocalizedGuids && key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath))
|
||||
{
|
||||
// Try to normalize paths located underneath program-data in an attempt to make them more portable
|
||||
key = key.Substring(ConfigurationManager.ApplicationPaths.ProgramDataPath.Length)
|
||||
.TrimStart(new[] { '/', '\\' })
|
||||
.Replace("/", "\\");
|
||||
}
|
||||
|
||||
key = type.FullName + key.ToLower();
|
||||
|
||||
return key.GetMD5();
|
||||
}
|
||||
|
||||
public IEnumerable<BaseItem> ReplaceVideosWithPrimaryVersions(IEnumerable<BaseItem> items)
|
||||
{
|
||||
var dict = new Dictionary<Guid, BaseItem>();
|
||||
@@ -651,7 +674,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
Directory.CreateDirectory(rootFolderPath);
|
||||
|
||||
var rootFolder = GetItemById(rootFolderPath.GetMBId(typeof(AggregateFolder))) as AggregateFolder ?? (AggregateFolder)ResolvePath(new DirectoryInfo(rootFolderPath));
|
||||
var rootFolder = GetItemById(GetNewItemId(rootFolderPath, typeof(AggregateFolder))) as AggregateFolder ?? (AggregateFolder)ResolvePath(new DirectoryInfo(rootFolderPath));
|
||||
|
||||
// Add in the plug-in folders
|
||||
foreach (var child in PluginFolderCreators)
|
||||
@@ -662,7 +685,14 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
{
|
||||
if (folder.Id == Guid.Empty)
|
||||
{
|
||||
folder.Id = (folder.Path ?? folder.GetType().Name).GetMBId(folder.GetType());
|
||||
if (string.IsNullOrWhiteSpace(folder.Path))
|
||||
{
|
||||
folder.Id = GetNewItemId(folder.GetType().Name, folder.GetType());
|
||||
}
|
||||
else
|
||||
{
|
||||
folder.Id = GetNewItemId(folder.Path, folder.GetType());
|
||||
}
|
||||
}
|
||||
|
||||
folder = GetItemById(folder.Id) as BasePluginFolder ?? folder;
|
||||
@@ -685,7 +715,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
Directory.CreateDirectory(userRootPath);
|
||||
|
||||
_userRootFolder = GetItemById(userRootPath.GetMBId(typeof(UserRootFolder))) as UserRootFolder ??
|
||||
_userRootFolder = GetItemById(GetNewItemId(userRootPath, typeof(UserRootFolder))) as UserRootFolder ??
|
||||
(UserRootFolder)ResolvePath(new DirectoryInfo(userRootPath));
|
||||
}
|
||||
|
||||
@@ -801,7 +831,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
Path.Combine(path, validFilename) :
|
||||
Path.Combine(path, subFolderPrefix, validFilename);
|
||||
|
||||
var id = fullPath.GetMBId(type);
|
||||
var id = GetNewItemId(fullPath, type);
|
||||
|
||||
BaseItem obj;
|
||||
|
||||
@@ -1513,7 +1543,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
path = Path.Combine(path, _fileSystem.GetValidFilename(type));
|
||||
|
||||
var id = (path + "_namedview_" + name).GetMBId(typeof(UserView));
|
||||
var id = GetNewItemId(path + "_namedview_" + name, typeof(UserView));
|
||||
|
||||
var item = GetItemById(id) as UserView;
|
||||
|
||||
@@ -1578,7 +1608,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
throw new ArgumentNullException("viewType");
|
||||
}
|
||||
|
||||
var id = ("7_namedview_" + name + user.Id.ToString("N") + parentId).GetMBId(typeof(UserView));
|
||||
var id = GetNewItemId("7_namedview_" + name + user.Id.ToString("N") + parentId, typeof(UserView));
|
||||
|
||||
var path = BaseItem.GetInternalMetadataPathForId(id);
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System;
|
||||
@@ -20,7 +19,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="args">The args.</param>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
public static void SetInitialItemValues(BaseItem item, ItemResolveArgs args, IFileSystem fileSystem)
|
||||
public static void SetInitialItemValues(BaseItem item, ItemResolveArgs args, IFileSystem fileSystem, ILibraryManager libraryManager)
|
||||
{
|
||||
// If the resolver didn't specify this
|
||||
if (string.IsNullOrEmpty(item.Path))
|
||||
@@ -34,7 +33,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
item.Parent = args.Parent;
|
||||
}
|
||||
|
||||
item.Id = item.Path.GetMBId(item.GetType());
|
||||
item.Id = libraryManager.GetNewItemId(item.Path, item.GetType());
|
||||
|
||||
// If the resolver didn't specify this
|
||||
if (string.IsNullOrEmpty(item.DisplayMediaType))
|
||||
|
||||
@@ -17,6 +17,7 @@ using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Users;
|
||||
using System;
|
||||
@@ -327,7 +328,10 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
try
|
||||
{
|
||||
_dtoServiceFactory().AttachPrimaryImageAspectRatio(dto, user);
|
||||
_dtoServiceFactory().AttachPrimaryImageAspectRatio(dto, user, new List<ItemFields>
|
||||
{
|
||||
ItemFields.PrimaryImageAspectRatio
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -765,5 +769,14 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
public DateTime ExpirationDate { get; set; }
|
||||
}
|
||||
|
||||
public UserPolicy GetUserPolicy(string userId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task UpdateUserPolicy(string userId, UserPolicy userPolicy)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Querying;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
{
|
||||
@@ -247,7 +248,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
if (imageTag != null)
|
||||
{
|
||||
dto.ImageTags[ImageType.Primary] = imageTag;
|
||||
_dtoService.AttachPrimaryImageAspectRatio(dto, recording);
|
||||
_dtoService.AttachPrimaryImageAspectRatio(dto, recording, new List<ItemFields>
|
||||
{
|
||||
ItemFields.PrimaryImageAspectRatio
|
||||
});
|
||||
}
|
||||
|
||||
if (user != null)
|
||||
@@ -337,7 +341,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
{
|
||||
dto.ImageTags[ImageType.Primary] = imageTag;
|
||||
|
||||
_dtoService.AttachPrimaryImageAspectRatio(dto, info);
|
||||
_dtoService.AttachPrimaryImageAspectRatio(dto, info, new List<ItemFields>
|
||||
{
|
||||
ItemFields.PrimaryImageAspectRatio
|
||||
});
|
||||
}
|
||||
|
||||
if (currentProgram != null)
|
||||
@@ -401,7 +408,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
if (imageTag != null)
|
||||
{
|
||||
dto.ImageTags[ImageType.Primary] = imageTag;
|
||||
_dtoService.AttachPrimaryImageAspectRatio(dto, item);
|
||||
_dtoService.AttachPrimaryImageAspectRatio(dto, item, new List<ItemFields>
|
||||
{
|
||||
ItemFields.PrimaryImageAspectRatio
|
||||
});
|
||||
}
|
||||
|
||||
if (user != null)
|
||||
|
||||
@@ -542,7 +542,7 @@
|
||||
"HeaderRunningTasks": "Running Tasks",
|
||||
"HeaderActiveDevices": "Active Devices",
|
||||
"HeaderPendingInstallations": "Pending Installations",
|
||||
"HeaerServerInformation": "Server Information",
|
||||
"HeaderServerInformation": "Server Information",
|
||||
"ButtonRestartNow": "Restart Now",
|
||||
"ButtonRestart": "Restart",
|
||||
"ButtonShutdown": "Shutdown",
|
||||
|
||||
Reference in New Issue
Block a user