2019-01-13 21:01:16 +01:00
|
|
|
using System;
|
2019-01-13 20:24:58 +01:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Threading;
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
2014-12-22 07:50:29 +01:00
|
|
|
using MediaBrowser.Controller.Entities;
|
2013-06-27 21:06:37 +02:00
|
|
|
using MediaBrowser.Controller.Entities.Audio;
|
|
|
|
using MediaBrowser.Controller.Entities.TV;
|
|
|
|
using MediaBrowser.Controller.Library;
|
2014-12-23 04:58:14 +01:00
|
|
|
using MediaBrowser.Controller.LiveTv;
|
2014-07-02 20:34:08 +02:00
|
|
|
using MediaBrowser.Controller.Net;
|
2014-12-21 06:57:06 +01:00
|
|
|
using MediaBrowser.Controller.Providers;
|
2013-06-27 21:06:37 +02:00
|
|
|
using MediaBrowser.Model.Dto;
|
2014-12-21 19:58:17 +01:00
|
|
|
using MediaBrowser.Model.Entities;
|
2016-10-24 04:45:23 +02:00
|
|
|
using MediaBrowser.Model.Globalization;
|
2018-09-12 19:26:21 +02:00
|
|
|
using MediaBrowser.Model.IO;
|
2019-01-13 20:24:58 +01:00
|
|
|
using MediaBrowser.Model.Services;
|
2019-11-17 23:05:39 +01:00
|
|
|
using Microsoft.Extensions.Logging;
|
2013-06-27 21:06:37 +02:00
|
|
|
|
|
|
|
namespace MediaBrowser.Api
|
|
|
|
{
|
2014-04-27 05:42:05 +02:00
|
|
|
[Route("/Items/{ItemId}", "POST", Summary = "Updates an item")]
|
2013-06-27 21:06:37 +02:00
|
|
|
public class UpdateItem : BaseItemDto, IReturnVoid
|
|
|
|
{
|
|
|
|
[ApiMember(Name = "ItemId", Description = "The id of the item", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
|
|
|
public string ItemId { get; set; }
|
|
|
|
}
|
|
|
|
|
2014-12-21 06:57:06 +01:00
|
|
|
[Route("/Items/{ItemId}/MetadataEditor", "GET", Summary = "Gets metadata editor info for an item")]
|
|
|
|
public class GetMetadataEditorInfo : IReturn<MetadataEditorInfo>
|
|
|
|
{
|
|
|
|
[ApiMember(Name = "ItemId", Description = "The id of the item", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
|
|
|
public string ItemId { get; set; }
|
|
|
|
}
|
2014-12-21 19:58:17 +01:00
|
|
|
|
|
|
|
[Route("/Items/{ItemId}/ContentType", "POST", Summary = "Updates an item's content type")]
|
|
|
|
public class UpdateItemContentType : IReturnVoid
|
|
|
|
{
|
|
|
|
[ApiMember(Name = "ItemId", Description = "The id of the item", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
2018-09-12 19:26:21 +02:00
|
|
|
public Guid ItemId { get; set; }
|
2014-12-21 19:58:17 +01:00
|
|
|
|
|
|
|
[ApiMember(Name = "ContentType", Description = "The content type of the item", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")]
|
|
|
|
public string ContentType { get; set; }
|
|
|
|
}
|
2015-03-16 02:48:25 +01:00
|
|
|
|
|
|
|
[Authenticated(Roles = "admin")]
|
2013-06-27 21:06:37 +02:00
|
|
|
public class ItemUpdateService : BaseApiService
|
|
|
|
{
|
|
|
|
private readonly ILibraryManager _libraryManager;
|
2014-12-21 06:57:06 +01:00
|
|
|
private readonly IProviderManager _providerManager;
|
|
|
|
private readonly ILocalizationManager _localizationManager;
|
2018-09-12 19:26:21 +02:00
|
|
|
private readonly IFileSystem _fileSystem;
|
2013-06-27 21:06:37 +02:00
|
|
|
|
2019-11-17 23:05:39 +01:00
|
|
|
public ItemUpdateService(
|
|
|
|
ILogger<ItemUpdateService> logger,
|
|
|
|
IServerConfigurationManager serverConfigurationManager,
|
|
|
|
IHttpResultFactory httpResultFactory,
|
|
|
|
IFileSystem fileSystem,
|
|
|
|
ILibraryManager libraryManager,
|
|
|
|
IProviderManager providerManager,
|
|
|
|
ILocalizationManager localizationManager)
|
|
|
|
: base(logger, serverConfigurationManager, httpResultFactory)
|
2013-06-27 21:06:37 +02:00
|
|
|
{
|
|
|
|
_libraryManager = libraryManager;
|
2014-12-21 06:57:06 +01:00
|
|
|
_providerManager = providerManager;
|
|
|
|
_localizationManager = localizationManager;
|
2018-09-12 19:26:21 +02:00
|
|
|
_fileSystem = fileSystem;
|
2014-12-21 06:57:06 +01:00
|
|
|
}
|
|
|
|
|
2019-11-17 23:05:39 +01:00
|
|
|
public object Get(GetMetadataEditorInfo request)
|
2014-12-21 06:57:06 +01:00
|
|
|
{
|
|
|
|
var item = _libraryManager.GetItemById(request.ItemId);
|
2015-03-16 02:48:25 +01:00
|
|
|
|
2014-12-21 06:57:06 +01:00
|
|
|
var info = new MetadataEditorInfo
|
|
|
|
{
|
2019-01-27 10:20:05 +01:00
|
|
|
ParentalRatingOptions = _localizationManager.GetParentalRatings().ToArray(),
|
2017-08-19 21:43:35 +02:00
|
|
|
ExternalIdInfos = _providerManager.GetExternalIdInfos(item).ToArray(),
|
2019-08-16 17:31:47 +02:00
|
|
|
Countries = _localizationManager.GetCountries().ToArray(),
|
|
|
|
Cultures = _localizationManager.GetCultures().ToArray()
|
2014-12-21 06:57:06 +01:00
|
|
|
};
|
|
|
|
|
2016-09-03 19:16:36 +02:00
|
|
|
if (!item.IsVirtualItem && !(item is ICollectionFolder) && !(item is UserView) && !(item is AggregateFolder) && !(item is LiveTvChannel) && !(item is IItemByName) &&
|
|
|
|
item.SourceType == SourceType.Library)
|
2014-12-21 19:58:17 +01:00
|
|
|
{
|
2016-06-27 22:33:35 +02:00
|
|
|
var inheritedContentType = _libraryManager.GetInheritedContentType(item);
|
|
|
|
var configuredContentType = _libraryManager.GetConfiguredContentType(item);
|
|
|
|
|
2016-09-03 19:16:36 +02:00
|
|
|
if (string.IsNullOrWhiteSpace(inheritedContentType) || !string.IsNullOrWhiteSpace(configuredContentType))
|
2014-12-21 19:58:17 +01:00
|
|
|
{
|
2017-08-19 21:43:35 +02:00
|
|
|
info.ContentTypeOptions = GetContentTypeOptions(true).ToArray();
|
2016-06-27 22:33:35 +02:00
|
|
|
info.ContentType = configuredContentType;
|
2015-01-10 02:38:01 +01:00
|
|
|
|
2016-10-13 20:43:47 +02:00
|
|
|
if (string.IsNullOrWhiteSpace(inheritedContentType) || string.Equals(inheritedContentType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
2014-12-22 07:50:29 +01:00
|
|
|
{
|
2016-06-27 22:33:35 +02:00
|
|
|
info.ContentTypeOptions = info.ContentTypeOptions
|
|
|
|
.Where(i => string.IsNullOrWhiteSpace(i.Value) || string.Equals(i.Value, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
2017-08-19 21:43:35 +02:00
|
|
|
.ToArray();
|
2014-12-22 07:50:29 +01:00
|
|
|
}
|
2014-12-21 19:58:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-21 06:57:06 +01:00
|
|
|
return ToOptimizedResult(info);
|
2013-06-27 21:06:37 +02:00
|
|
|
}
|
|
|
|
|
2014-12-21 19:58:17 +01:00
|
|
|
public void Post(UpdateItemContentType request)
|
|
|
|
{
|
2014-12-22 07:50:29 +01:00
|
|
|
var item = _libraryManager.GetItemById(request.ItemId);
|
|
|
|
var path = item.ContainingFolderPath;
|
|
|
|
|
2019-11-17 23:05:39 +01:00
|
|
|
var types = ServerConfigurationManager.Configuration.ContentTypes
|
2016-12-24 08:41:53 +01:00
|
|
|
.Where(i => !string.IsNullOrWhiteSpace(i.Name))
|
2014-12-22 07:50:29 +01:00
|
|
|
.Where(i => !string.Equals(i.Name, path, StringComparison.OrdinalIgnoreCase))
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(request.ContentType))
|
|
|
|
{
|
|
|
|
types.Add(new NameValuePair
|
|
|
|
{
|
|
|
|
Name = path,
|
|
|
|
Value = request.ContentType
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-11-17 23:05:39 +01:00
|
|
|
ServerConfigurationManager.Configuration.ContentTypes = types.ToArray();
|
|
|
|
ServerConfigurationManager.SaveConfiguration();
|
2014-12-21 19:58:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private List<NameValuePair> GetContentTypeOptions(bool isForItem)
|
|
|
|
{
|
|
|
|
var list = new List<NameValuePair>();
|
|
|
|
|
|
|
|
if (isForItem)
|
|
|
|
{
|
|
|
|
list.Add(new NameValuePair
|
|
|
|
{
|
2017-10-13 07:44:20 +02:00
|
|
|
Name = "Inherit",
|
2014-12-21 19:58:17 +01:00
|
|
|
Value = ""
|
|
|
|
});
|
|
|
|
}
|
2015-03-16 02:48:25 +01:00
|
|
|
|
2014-12-21 19:58:17 +01:00
|
|
|
list.Add(new NameValuePair
|
|
|
|
{
|
2017-10-13 07:44:20 +02:00
|
|
|
Name = "Movies",
|
2014-12-21 19:58:17 +01:00
|
|
|
Value = "movies"
|
|
|
|
});
|
|
|
|
list.Add(new NameValuePair
|
|
|
|
{
|
2017-10-13 07:44:20 +02:00
|
|
|
Name = "Music",
|
2014-12-21 19:58:17 +01:00
|
|
|
Value = "music"
|
|
|
|
});
|
|
|
|
list.Add(new NameValuePair
|
|
|
|
{
|
2017-10-13 07:44:20 +02:00
|
|
|
Name = "Shows",
|
2014-12-21 19:58:17 +01:00
|
|
|
Value = "tvshows"
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!isForItem)
|
|
|
|
{
|
|
|
|
list.Add(new NameValuePair
|
|
|
|
{
|
2017-10-13 07:44:20 +02:00
|
|
|
Name = "Books",
|
2014-12-21 19:58:17 +01:00
|
|
|
Value = "books"
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
list.Add(new NameValuePair
|
|
|
|
{
|
2017-10-13 07:44:20 +02:00
|
|
|
Name = "HomeVideos",
|
2014-12-21 19:58:17 +01:00
|
|
|
Value = "homevideos"
|
|
|
|
});
|
|
|
|
list.Add(new NameValuePair
|
|
|
|
{
|
2017-10-13 07:44:20 +02:00
|
|
|
Name = "MusicVideos",
|
2014-12-21 19:58:17 +01:00
|
|
|
Value = "musicvideos"
|
|
|
|
});
|
|
|
|
list.Add(new NameValuePair
|
|
|
|
{
|
2017-10-13 07:44:20 +02:00
|
|
|
Name = "Photos",
|
2014-12-21 19:58:17 +01:00
|
|
|
Value = "photos"
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!isForItem)
|
|
|
|
{
|
|
|
|
list.Add(new NameValuePair
|
|
|
|
{
|
2017-10-13 07:44:20 +02:00
|
|
|
Name = "MixedContent",
|
2014-12-21 19:58:17 +01:00
|
|
|
Value = ""
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach (var val in list)
|
|
|
|
{
|
|
|
|
val.Name = _localizationManager.GetLocalizedString(val.Name);
|
|
|
|
}
|
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2013-06-27 21:06:37 +02:00
|
|
|
public void Post(UpdateItem request)
|
|
|
|
{
|
2014-04-25 22:15:50 +02:00
|
|
|
var item = _libraryManager.GetItemById(request.ItemId);
|
2013-06-27 21:06:37 +02:00
|
|
|
|
2014-02-19 06:21:03 +01:00
|
|
|
var newLockData = request.LockData ?? false;
|
2014-04-27 05:42:05 +02:00
|
|
|
var isLockedChanged = item.IsLocked != newLockData;
|
2013-12-01 07:25:05 +01:00
|
|
|
|
2018-09-12 19:26:21 +02:00
|
|
|
var series = item as Series;
|
|
|
|
var displayOrderChanged = series != null && !string.Equals(series.DisplayOrder ?? string.Empty, request.DisplayOrder ?? string.Empty, StringComparison.OrdinalIgnoreCase);
|
|
|
|
|
2017-06-06 08:13:49 +02:00
|
|
|
// Do this first so that metadata savers can pull the updates from the database.
|
2015-06-21 05:35:22 +02:00
|
|
|
if (request.People != null)
|
|
|
|
{
|
2017-08-27 02:32:33 +02:00
|
|
|
_libraryManager.UpdatePeople(item, request.People.Select(x => new PersonInfo { Name = x.Name, Role = x.Role, Type = x.Type }).ToList());
|
2015-06-21 05:35:22 +02:00
|
|
|
}
|
|
|
|
|
2017-06-06 08:13:49 +02:00
|
|
|
UpdateItem(request, item);
|
|
|
|
|
2017-09-13 20:41:48 +02:00
|
|
|
item.OnMetadataChanged();
|
|
|
|
|
2017-10-03 20:39:37 +02:00
|
|
|
item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
|
2017-06-06 08:13:49 +02:00
|
|
|
|
2014-04-27 05:42:05 +02:00
|
|
|
if (isLockedChanged && item.IsFolder)
|
2013-12-01 07:25:05 +01:00
|
|
|
{
|
|
|
|
var folder = (Folder)item;
|
|
|
|
|
2015-01-25 07:34:50 +01:00
|
|
|
foreach (var child in folder.GetRecursiveChildren())
|
2013-12-01 07:25:05 +01:00
|
|
|
{
|
2014-04-27 05:42:05 +02:00
|
|
|
child.IsLocked = newLockData;
|
2017-10-03 20:39:37 +02:00
|
|
|
child.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
|
2013-12-01 07:25:05 +01:00
|
|
|
}
|
|
|
|
}
|
2018-09-12 19:26:21 +02:00
|
|
|
|
|
|
|
if (displayOrderChanged)
|
|
|
|
{
|
2019-09-10 22:37:53 +02:00
|
|
|
_providerManager.QueueRefresh(
|
|
|
|
series.Id,
|
|
|
|
new MetadataRefreshOptions(new DirectoryService(_fileSystem))
|
|
|
|
{
|
|
|
|
MetadataRefreshMode = MetadataRefreshMode.FullRefresh,
|
|
|
|
ImageRefreshMode = MetadataRefreshMode.FullRefresh,
|
|
|
|
ReplaceAllMetadata = true
|
|
|
|
},
|
|
|
|
RefreshPriority.High);
|
2018-09-12 19:26:21 +02:00
|
|
|
}
|
2013-06-27 21:06:37 +02:00
|
|
|
}
|
|
|
|
|
2014-07-13 06:55:56 +02:00
|
|
|
private DateTime NormalizeDateTime(DateTime val)
|
|
|
|
{
|
|
|
|
return DateTime.SpecifyKind(val, DateTimeKind.Utc);
|
|
|
|
}
|
|
|
|
|
2013-06-27 21:06:37 +02:00
|
|
|
private void UpdateItem(BaseItemDto request, BaseItem item)
|
|
|
|
{
|
|
|
|
item.Name = request.Name;
|
2014-03-24 18:54:45 +01:00
|
|
|
item.ForcedSortName = request.ForcedSortName;
|
2013-06-27 21:06:37 +02:00
|
|
|
|
2016-10-01 09:06:00 +02:00
|
|
|
item.OriginalTitle = string.IsNullOrWhiteSpace(request.OriginalTitle) ? null : request.OriginalTitle;
|
2016-04-20 07:21:40 +02:00
|
|
|
|
2016-10-17 18:35:29 +02:00
|
|
|
item.CriticRating = request.CriticRating;
|
2013-09-17 04:08:18 +02:00
|
|
|
|
2013-09-11 19:54:59 +02:00
|
|
|
item.CommunityRating = request.CommunityRating;
|
2013-06-27 21:06:37 +02:00
|
|
|
item.IndexNumber = request.IndexNumber;
|
|
|
|
item.ParentIndexNumber = request.ParentIndexNumber;
|
|
|
|
item.Overview = request.Overview;
|
|
|
|
item.Genres = request.Genres;
|
2013-12-05 17:50:21 +01:00
|
|
|
|
2020-04-05 18:07:43 +02:00
|
|
|
if (item is Episode episode)
|
2013-12-08 21:33:24 +01:00
|
|
|
{
|
|
|
|
episode.AirsAfterSeasonNumber = request.AirsAfterSeasonNumber;
|
|
|
|
episode.AirsBeforeEpisodeNumber = request.AirsBeforeEpisodeNumber;
|
|
|
|
episode.AirsBeforeSeasonNumber = request.AirsBeforeSeasonNumber;
|
|
|
|
}
|
2014-04-27 05:42:05 +02:00
|
|
|
|
2016-06-02 19:43:29 +02:00
|
|
|
item.Tags = request.Tags;
|
2013-11-25 00:37:38 +01:00
|
|
|
|
2016-10-08 07:57:38 +02:00
|
|
|
if (request.Taglines != null)
|
2014-06-29 04:30:20 +02:00
|
|
|
{
|
2016-10-08 07:57:38 +02:00
|
|
|
item.Tagline = request.Taglines.FirstOrDefault();
|
2014-06-29 04:30:20 +02:00
|
|
|
}
|
|
|
|
|
2013-11-25 00:37:38 +01:00
|
|
|
if (request.Studios != null)
|
|
|
|
{
|
2017-08-09 21:56:38 +02:00
|
|
|
item.Studios = request.Studios.Select(x => x.Name).ToArray();
|
2013-11-25 00:37:38 +01:00
|
|
|
}
|
|
|
|
|
2013-09-03 16:26:17 +02:00
|
|
|
if (request.DateCreated.HasValue)
|
|
|
|
{
|
2014-07-13 06:55:56 +02:00
|
|
|
item.DateCreated = NormalizeDateTime(request.DateCreated.Value);
|
2013-09-03 16:26:17 +02:00
|
|
|
}
|
|
|
|
|
2014-07-13 06:55:56 +02:00
|
|
|
item.EndDate = request.EndDate.HasValue ? NormalizeDateTime(request.EndDate.Value) : (DateTime?)null;
|
|
|
|
item.PremiereDate = request.PremiereDate.HasValue ? NormalizeDateTime(request.PremiereDate.Value) : (DateTime?)null;
|
2013-06-27 21:06:37 +02:00
|
|
|
item.ProductionYear = request.ProductionYear;
|
2016-08-26 19:24:04 +02:00
|
|
|
item.OfficialRating = string.IsNullOrWhiteSpace(request.OfficialRating) ? null : request.OfficialRating;
|
2013-06-27 21:06:37 +02:00
|
|
|
item.CustomRating = request.CustomRating;
|
2013-09-03 16:26:17 +02:00
|
|
|
|
2016-10-21 20:41:49 +02:00
|
|
|
if (request.ProductionLocations != null)
|
|
|
|
{
|
2017-08-09 21:56:38 +02:00
|
|
|
item.ProductionLocations = request.ProductionLocations;
|
2016-10-21 20:41:49 +02:00
|
|
|
}
|
|
|
|
|
2015-09-29 19:35:23 +02:00
|
|
|
item.PreferredMetadataCountryCode = request.PreferredMetadataCountryCode;
|
|
|
|
item.PreferredMetadataLanguage = request.PreferredMetadataLanguage;
|
2014-01-03 21:32:27 +01:00
|
|
|
|
2020-04-05 18:07:43 +02:00
|
|
|
if (item is IHasDisplayOrder hasDisplayOrder)
|
2014-01-03 21:32:27 +01:00
|
|
|
{
|
|
|
|
hasDisplayOrder.DisplayOrder = request.DisplayOrder;
|
|
|
|
}
|
2014-04-27 05:42:05 +02:00
|
|
|
|
2020-04-05 18:07:43 +02:00
|
|
|
if (item is IHasAspectRatio hasAspectRatio)
|
2013-11-20 04:15:48 +01:00
|
|
|
{
|
|
|
|
hasAspectRatio.AspectRatio = request.AspectRatio;
|
|
|
|
}
|
2014-02-19 06:21:03 +01:00
|
|
|
|
2016-03-27 23:11:27 +02:00
|
|
|
item.IsLocked = request.LockData ?? false;
|
2014-02-19 06:21:03 +01:00
|
|
|
|
|
|
|
if (request.LockedFields != null)
|
2013-06-27 21:06:37 +02:00
|
|
|
{
|
|
|
|
item.LockedFields = request.LockedFields;
|
|
|
|
}
|
|
|
|
|
2013-09-13 20:37:44 +02:00
|
|
|
// Only allow this for series. Runtimes for media comes from ffprobe.
|
|
|
|
if (item is Series)
|
|
|
|
{
|
|
|
|
item.RunTimeTicks = request.RunTimeTicks;
|
|
|
|
}
|
|
|
|
|
2013-06-27 21:06:37 +02:00
|
|
|
foreach (var pair in request.ProviderIds.ToList())
|
|
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(pair.Value))
|
|
|
|
{
|
|
|
|
request.ProviderIds.Remove(pair.Key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
item.ProviderIds = request.ProviderIds;
|
|
|
|
|
2020-04-05 18:07:43 +02:00
|
|
|
if (item is Video video)
|
2013-07-29 14:34:46 +02:00
|
|
|
{
|
|
|
|
video.Video3DFormat = request.Video3DFormat;
|
|
|
|
}
|
2013-09-03 16:26:17 +02:00
|
|
|
|
2015-05-19 00:23:03 +02:00
|
|
|
if (request.AlbumArtists != null)
|
2013-06-27 21:06:37 +02:00
|
|
|
{
|
2020-04-05 18:07:43 +02:00
|
|
|
if (item is IHasAlbumArtist hasAlbumArtists)
|
2015-05-19 00:23:03 +02:00
|
|
|
{
|
|
|
|
hasAlbumArtists.AlbumArtists = request
|
|
|
|
.AlbumArtists
|
|
|
|
.Select(i => i.Name)
|
2017-08-10 20:01:31 +02:00
|
|
|
.ToArray();
|
2015-05-19 00:23:03 +02:00
|
|
|
}
|
2013-06-27 21:06:37 +02:00
|
|
|
}
|
|
|
|
|
2015-05-19 00:23:03 +02:00
|
|
|
if (request.ArtistItems != null)
|
2015-03-13 18:25:28 +01:00
|
|
|
{
|
2020-04-05 18:07:43 +02:00
|
|
|
if (item is IHasArtist hasArtists)
|
2015-05-19 00:23:03 +02:00
|
|
|
{
|
|
|
|
hasArtists.Artists = request
|
|
|
|
.ArtistItems
|
|
|
|
.Select(i => i.Name)
|
2017-08-24 21:52:19 +02:00
|
|
|
.ToArray();
|
2015-05-19 00:23:03 +02:00
|
|
|
}
|
2015-03-13 18:25:28 +01:00
|
|
|
}
|
2015-03-16 02:48:25 +01:00
|
|
|
|
2020-04-05 18:07:43 +02:00
|
|
|
if (item is Audio song)
|
2015-03-13 18:25:28 +01:00
|
|
|
{
|
|
|
|
song.Album = request.Album;
|
|
|
|
}
|
2013-07-10 22:10:55 +02:00
|
|
|
|
2020-04-05 18:07:43 +02:00
|
|
|
if (item is MusicVideo musicVideo)
|
2013-07-10 22:10:55 +02:00
|
|
|
{
|
|
|
|
musicVideo.Album = request.Album;
|
|
|
|
}
|
|
|
|
|
2020-04-05 18:07:43 +02:00
|
|
|
if (item is Series series)
|
2013-06-27 21:06:37 +02:00
|
|
|
{
|
2017-02-19 04:46:09 +01:00
|
|
|
series.Status = GetSeriesStatus(request);
|
2017-08-13 22:15:07 +02:00
|
|
|
|
|
|
|
if (request.AirDays != null)
|
|
|
|
{
|
|
|
|
series.AirDays = request.AirDays;
|
|
|
|
series.AirTime = request.AirTime;
|
|
|
|
}
|
2013-06-27 21:06:37 +02:00
|
|
|
}
|
|
|
|
}
|
2017-02-19 04:46:09 +01:00
|
|
|
|
|
|
|
private SeriesStatus? GetSeriesStatus(BaseItemDto item)
|
|
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(item.Status))
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (SeriesStatus)Enum.Parse(typeof(SeriesStatus), item.Status, true);
|
|
|
|
}
|
2013-06-27 21:06:37 +02:00
|
|
|
}
|
|
|
|
}
|