mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-03 22:38:30 +01:00
update live tv data transfer
This commit is contained in:
@@ -1853,9 +1853,9 @@ namespace Emby.Server.Implementations
|
||||
HasPendingRestart = HasPendingRestart,
|
||||
Version = ApplicationVersion.ToString(),
|
||||
WebSocketPortNumber = HttpPort,
|
||||
FailedPluginAssemblies = FailedAssemblies.ToList(),
|
||||
InProgressInstallations = InstallationManager.CurrentInstallations.Select(i => i.Item1).ToList(),
|
||||
CompletedInstallations = InstallationManager.CompletedInstallations.ToList(),
|
||||
FailedPluginAssemblies = FailedAssemblies.ToArray(),
|
||||
InProgressInstallations = InstallationManager.CurrentInstallations.Select(i => i.Item1).ToArray(),
|
||||
CompletedInstallations = InstallationManager.CompletedInstallations.ToArray(),
|
||||
Id = SystemId,
|
||||
ProgramDataPath = ApplicationPaths.ProgramDataPath,
|
||||
LogPath = ApplicationPaths.LogDirectoryPath,
|
||||
|
||||
@@ -182,10 +182,8 @@ namespace Emby.Server.Implementations.Channels
|
||||
{
|
||||
};
|
||||
|
||||
var returnList = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user)
|
||||
var returnItems = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user)
|
||||
.ConfigureAwait(false));
|
||||
var returnItems = returnList
|
||||
.ToArray(returnList.Count);
|
||||
|
||||
var result = new QueryResult<BaseItemDto>
|
||||
{
|
||||
@@ -464,14 +462,14 @@ namespace Emby.Server.Implementations.Channels
|
||||
return _libraryManager.GetItemById(id) as Channel;
|
||||
}
|
||||
|
||||
public IEnumerable<ChannelFeatures> GetAllChannelFeatures()
|
||||
public ChannelFeatures[] GetAllChannelFeatures()
|
||||
{
|
||||
return _libraryManager.GetItemIds(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(Channel).Name },
|
||||
SortBy = new[] { ItemSortBy.SortName }
|
||||
|
||||
}).Select(i => GetChannelFeatures(i.ToString("N")));
|
||||
}).Select(i => GetChannelFeatures(i.ToString("N"))).ToArray();
|
||||
}
|
||||
|
||||
public ChannelFeatures GetChannelFeatures(string id)
|
||||
@@ -511,10 +509,10 @@ namespace Emby.Server.Implementations.Channels
|
||||
{
|
||||
CanFilter = !features.MaxPageSize.HasValue,
|
||||
CanSearch = provider is ISearchableChannel,
|
||||
ContentTypes = features.ContentTypes,
|
||||
DefaultSortFields = features.DefaultSortFields,
|
||||
ContentTypes = features.ContentTypes.ToArray(),
|
||||
DefaultSortFields = features.DefaultSortFields.ToArray(),
|
||||
MaxPageSize = features.MaxPageSize,
|
||||
MediaTypes = features.MediaTypes,
|
||||
MediaTypes = features.MediaTypes.ToArray(),
|
||||
SupportsSortOrderToggle = features.SupportsSortOrderToggle,
|
||||
SupportsLatestMedia = supportsLatest,
|
||||
Name = channel.Name,
|
||||
@@ -566,12 +564,10 @@ namespace Emby.Server.Implementations.Channels
|
||||
|
||||
var dtoOptions = new DtoOptions()
|
||||
{
|
||||
Fields = query.Fields.ToList()
|
||||
Fields = query.Fields
|
||||
};
|
||||
|
||||
var returnList = (await _dtoService.GetBaseItemDtos(items, dtoOptions, user).ConfigureAwait(false));
|
||||
var returnItems = returnList
|
||||
.ToArray(returnList.Count);
|
||||
var returnItems = (await _dtoService.GetBaseItemDtos(items, dtoOptions, user).ConfigureAwait(false));
|
||||
|
||||
var result = new QueryResult<BaseItemDto>
|
||||
{
|
||||
@@ -833,13 +829,11 @@ namespace Emby.Server.Implementations.Channels
|
||||
|
||||
var dtoOptions = new DtoOptions()
|
||||
{
|
||||
Fields = query.Fields.ToList()
|
||||
Fields = query.Fields
|
||||
};
|
||||
|
||||
var returnList = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user)
|
||||
var returnItems = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user)
|
||||
.ConfigureAwait(false));
|
||||
var returnItems = returnList
|
||||
.ToArray(returnList.Count);
|
||||
|
||||
var result = new QueryResult<BaseItemDto>
|
||||
{
|
||||
@@ -987,13 +981,11 @@ namespace Emby.Server.Implementations.Channels
|
||||
|
||||
var dtoOptions = new DtoOptions()
|
||||
{
|
||||
Fields = query.Fields.ToList()
|
||||
Fields = query.Fields
|
||||
};
|
||||
|
||||
var returnList = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user)
|
||||
var returnItems = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user)
|
||||
.ConfigureAwait(false));
|
||||
var returnItems = returnList
|
||||
.ToArray(returnList.Count);
|
||||
|
||||
var result = new QueryResult<BaseItemDto>
|
||||
{
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Emby.Server.Implementations.Collections
|
||||
ProviderIds = options.ProviderIds,
|
||||
Shares = options.UserIds.Select(i => new Share
|
||||
{
|
||||
UserId = i.ToString("N"),
|
||||
UserId = i,
|
||||
CanEdit = true
|
||||
|
||||
}).ToList()
|
||||
@@ -92,7 +92,7 @@ namespace Emby.Server.Implementations.Collections
|
||||
|
||||
await parentFolder.AddChild(collection, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
if (options.ItemIdList.Count > 0)
|
||||
if (options.ItemIdList.Length > 0)
|
||||
{
|
||||
await AddToCollection(collection.Id, options.ItemIdList, false, new MetadataRefreshOptions(_fileSystem)
|
||||
{
|
||||
@@ -149,12 +149,12 @@ namespace Emby.Server.Implementations.Collections
|
||||
return GetCollectionsFolder(string.Empty);
|
||||
}
|
||||
|
||||
public Task AddToCollection(Guid collectionId, IEnumerable<Guid> ids)
|
||||
public Task AddToCollection(Guid collectionId, string[] ids)
|
||||
{
|
||||
return AddToCollection(collectionId, ids, true, new MetadataRefreshOptions(_fileSystem));
|
||||
}
|
||||
|
||||
private async Task AddToCollection(Guid collectionId, IEnumerable<Guid> ids, bool fireEvent, MetadataRefreshOptions refreshOptions)
|
||||
private async Task AddToCollection(Guid collectionId, string[] ids, bool fireEvent, MetadataRefreshOptions refreshOptions)
|
||||
{
|
||||
var collection = _libraryManager.GetItemById(collectionId) as BoxSet;
|
||||
|
||||
@@ -165,11 +165,12 @@ namespace Emby.Server.Implementations.Collections
|
||||
|
||||
var list = new List<LinkedChild>();
|
||||
var itemList = new List<BaseItem>();
|
||||
var currentLinkedChildren = collection.GetLinkedChildren().ToList();
|
||||
var currentLinkedChildrenIds = collection.GetLinkedChildren().Select(i => i.Id).ToList();
|
||||
|
||||
foreach (var itemId in ids)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
var guidId = new Guid(itemId);
|
||||
var item = _libraryManager.GetItemById(guidId);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(item.Path))
|
||||
{
|
||||
@@ -183,7 +184,7 @@ namespace Emby.Server.Implementations.Collections
|
||||
|
||||
itemList.Add(item);
|
||||
|
||||
if (currentLinkedChildren.All(i => i.Id != itemId))
|
||||
if (!currentLinkedChildrenIds.Contains(guidId))
|
||||
{
|
||||
list.Add(LinkedChild.Create(item));
|
||||
}
|
||||
@@ -213,7 +214,7 @@ namespace Emby.Server.Implementations.Collections
|
||||
}
|
||||
}
|
||||
|
||||
public async Task RemoveFromCollection(Guid collectionId, IEnumerable<Guid> itemIds)
|
||||
public async Task RemoveFromCollection(Guid collectionId, string[] itemIds)
|
||||
{
|
||||
var collection = _libraryManager.GetItemById(collectionId) as BoxSet;
|
||||
|
||||
@@ -227,9 +228,10 @@ namespace Emby.Server.Implementations.Collections
|
||||
|
||||
foreach (var itemId in itemIds)
|
||||
{
|
||||
var childItem = _libraryManager.GetItemById(itemId);
|
||||
var guidId = new Guid(itemId);
|
||||
var childItem = _libraryManager.GetItemById(guidId);
|
||||
|
||||
var child = collection.LinkedChildren.FirstOrDefault(i => (i.ItemId.HasValue && i.ItemId.Value == itemId) || (childItem != null && string.Equals(childItem.Path, i.Path, StringComparison.OrdinalIgnoreCase)));
|
||||
var child = collection.LinkedChildren.FirstOrDefault(i => (i.ItemId.HasValue && i.ItemId.Value == guidId) || (childItem != null && string.Equals(childItem.Path, i.Path, StringComparison.OrdinalIgnoreCase)));
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
"create table if not exists AncestorIds (ItemId GUID, AncestorId GUID, AncestorIdText TEXT, PRIMARY KEY (ItemId, AncestorId))",
|
||||
"create index if not exists idx_AncestorIds1 on AncestorIds(AncestorId)",
|
||||
"create index if not exists idx_AncestorIds2 on AncestorIds(AncestorIdText)",
|
||||
"create index if not exists idx_AncestorIds5 on AncestorIds(AncestorIdText,ItemId)",
|
||||
|
||||
"create table if not exists ItemValues (ItemId GUID, Type INT, Value TEXT, CleanValue TEXT)",
|
||||
|
||||
@@ -308,6 +308,7 @@ namespace Emby.Server.Implementations.Data
|
||||
"drop index if exists idx_TypeSeriesPresentationUniqueKey2",
|
||||
"drop index if exists idx_AncestorIds3",
|
||||
"drop index if exists idx_AncestorIds4",
|
||||
"drop index if exists idx_AncestorIds2",
|
||||
|
||||
"create index if not exists idx_PathTypedBaseItems on TypedBaseItems(Path)",
|
||||
"create index if not exists idx_ParentIdTypedBaseItems on TypedBaseItems(ParentId)",
|
||||
|
||||
@@ -11,6 +11,7 @@ using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Session;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
|
||||
namespace Emby.Server.Implementations.Devices
|
||||
{
|
||||
@@ -199,7 +200,10 @@ namespace Emby.Server.Implementations.Devices
|
||||
}
|
||||
|
||||
history.DeviceId = deviceId;
|
||||
history.FilesUploaded.Add(file);
|
||||
|
||||
var list = history.FilesUploaded.ToList();
|
||||
list.Add(file);
|
||||
history.FilesUploaded = list.ToArray(list.Count);
|
||||
|
||||
_json.SerializeToFile(history, path);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
/// <param name="owner">The owner.</param>
|
||||
/// <returns>Task{DtoBaseItem}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
public BaseItemDto GetBaseItemDto(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null)
|
||||
public BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, User user = null, BaseItem owner = null)
|
||||
{
|
||||
var options = new DtoOptions
|
||||
{
|
||||
@@ -87,7 +87,17 @@ namespace Emby.Server.Implementations.Dto
|
||||
return GetBaseItemDto(item, options, user, owner);
|
||||
}
|
||||
|
||||
public async Task<List<BaseItemDto>> GetBaseItemDtos(IEnumerable<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null)
|
||||
public Task<BaseItemDto[]> GetBaseItemDtos(List<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null)
|
||||
{
|
||||
return GetBaseItemDtos(items, items.Count, options, user, owner);
|
||||
}
|
||||
|
||||
public Task<BaseItemDto[]> GetBaseItemDtos(BaseItem[] items, DtoOptions options, User user = null, BaseItem owner = null)
|
||||
{
|
||||
return GetBaseItemDtos(items, items.Length, options, user, owner);
|
||||
}
|
||||
|
||||
public async Task<BaseItemDto[]> GetBaseItemDtos(IEnumerable<BaseItem> items, int itemCount, DtoOptions options, User user = null, BaseItem owner = null)
|
||||
{
|
||||
if (items == null)
|
||||
{
|
||||
@@ -101,7 +111,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
|
||||
var syncDictionary = GetSyncedItemProgress(options);
|
||||
|
||||
var list = new List<BaseItemDto>();
|
||||
var returnItems = new BaseItemDto[itemCount];
|
||||
var programTuples = new List<Tuple<BaseItem, BaseItemDto>>();
|
||||
var channelTuples = new List<Tuple<BaseItemDto, LiveTvChannel>>();
|
||||
|
||||
@@ -109,6 +119,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
? _providerManager.GetRefreshQueue()
|
||||
: null;
|
||||
|
||||
var index = 0;
|
||||
foreach (var item in items)
|
||||
{
|
||||
var dto = GetBaseItemDtoInternal(item, options, refreshQueue, user, owner);
|
||||
@@ -144,7 +155,8 @@ namespace Emby.Server.Implementations.Dto
|
||||
|
||||
FillSyncInfo(dto, item, options, user, syncDictionary);
|
||||
|
||||
list.Add(dto);
|
||||
returnItems[index] = dto;
|
||||
index++;
|
||||
}
|
||||
|
||||
if (programTuples.Count > 0)
|
||||
@@ -157,7 +169,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
await _livetvManager().AddChannelInfo(channelTuples, options, user).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return list;
|
||||
return returnItems;
|
||||
}
|
||||
|
||||
public BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null)
|
||||
@@ -992,7 +1004,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
{
|
||||
dto.RemoteTrailers = hasTrailers != null ?
|
||||
hasTrailers.RemoteTrailers :
|
||||
new MediaUrl[] {};
|
||||
new MediaUrl[] { };
|
||||
}
|
||||
|
||||
dto.Name = item.Name;
|
||||
@@ -1053,7 +1065,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
|
||||
if (dto.Taglines == null)
|
||||
{
|
||||
dto.Taglines = new string[]{};
|
||||
dto.Taglines = new string[] { };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1243,17 +1255,17 @@ namespace Emby.Server.Implementations.Dto
|
||||
|
||||
if (iHasMediaSources != null)
|
||||
{
|
||||
List<MediaStream> mediaStreams;
|
||||
MediaStream[] mediaStreams;
|
||||
|
||||
if (dto.MediaSources != null && dto.MediaSources.Count > 0)
|
||||
{
|
||||
mediaStreams = dto.MediaSources.Where(i => new Guid(i.Id) == item.Id)
|
||||
.SelectMany(i => i.MediaStreams)
|
||||
.ToList();
|
||||
.ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
mediaStreams = _mediaSourceManager().GetStaticMediaSources(iHasMediaSources, true).First().MediaStreams;
|
||||
mediaStreams = _mediaSourceManager().GetStaticMediaSources(iHasMediaSources, true).First().MediaStreams.ToArray();
|
||||
}
|
||||
|
||||
dto.MediaStreams = mediaStreams;
|
||||
|
||||
@@ -367,15 +367,15 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
|
||||
return new LibraryUpdateInfo
|
||||
{
|
||||
ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
||||
ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray(),
|
||||
|
||||
ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
||||
ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray(),
|
||||
|
||||
ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, true)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
||||
ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, true)).Select(i => i.Id.ToString("N")).Distinct().ToArray(),
|
||||
|
||||
FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
||||
FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray(),
|
||||
|
||||
FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList()
|
||||
FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
dto.ItemId = i.Id.ToString("N");
|
||||
return dto;
|
||||
})
|
||||
.ToList();
|
||||
.ToArray();
|
||||
|
||||
var info = new UserDataChangeInfo
|
||||
{
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
return serviceType;
|
||||
}
|
||||
|
||||
public void AddServiceInfo(Type serviceType, Type requestType, Type responseType)
|
||||
public void AddServiceInfo(Type serviceType, Type requestType)
|
||||
{
|
||||
ServiceOperationsMap[requestType] = serviceType;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Emby.Server.Implementations.IO
|
||||
/// <summary>
|
||||
/// Any file name ending in any of these will be ignored by the watchers
|
||||
/// </summary>
|
||||
private readonly IReadOnlyList<string> _alwaysIgnoreFiles = new List<string>
|
||||
private readonly string[] _alwaysIgnoreFiles = new string[]
|
||||
{
|
||||
"small.jpg",
|
||||
"albumart.jpg",
|
||||
@@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.IO
|
||||
"TempSBE"
|
||||
};
|
||||
|
||||
private readonly IReadOnlyList<string> _alwaysIgnoreSubstrings = new List<string>
|
||||
private readonly string[] _alwaysIgnoreSubstrings = new string[]
|
||||
{
|
||||
// Synology
|
||||
"eaDir",
|
||||
@@ -54,7 +54,7 @@ namespace Emby.Server.Implementations.IO
|
||||
".actors"
|
||||
};
|
||||
|
||||
private readonly IReadOnlyList<string> _alwaysIgnoreExtensions = new List<string>
|
||||
private readonly string[] _alwaysIgnoreExtensions = new string[]
|
||||
{
|
||||
// thumbs.db
|
||||
".db",
|
||||
|
||||
@@ -1208,7 +1208,7 @@ namespace Emby.Server.Implementations.Library
|
||||
.Where(i => string.Equals(ShortcutFileExtension, Path.GetExtension(i), StringComparison.OrdinalIgnoreCase))
|
||||
.Select(_fileSystem.ResolveShortcut)
|
||||
.OrderBy(i => i)
|
||||
.ToList(),
|
||||
.ToArray(),
|
||||
|
||||
CollectionType = GetCollectionType(dir)
|
||||
};
|
||||
@@ -1554,7 +1554,7 @@ namespace Emby.Server.Implementations.Library
|
||||
IncludeHidden = true,
|
||||
IncludeExternalContent = allowExternalContent
|
||||
|
||||
}, CancellationToken.None).Result.ToList();
|
||||
}, CancellationToken.None).Result;
|
||||
|
||||
query.TopParentIds = userViews.SelectMany(i => GetTopParentIdsForQuery(i, user)).Select(i => i.ToString("N")).ToArray();
|
||||
}
|
||||
@@ -3061,7 +3061,7 @@ namespace Emby.Server.Implementations.Library
|
||||
var topLibraryFolders = GetUserRootFolder().Children.ToList();
|
||||
var info = GetVirtualFolderInfo(virtualFolderPath, topLibraryFolders, null);
|
||||
|
||||
if (info.Locations.Count > 0 && info.Locations.Count != options.PathInfos.Length)
|
||||
if (info.Locations.Length > 0 && info.Locations.Length != options.PathInfos.Length)
|
||||
{
|
||||
var list = options.PathInfos.ToList();
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
DtoOptions = new DtoOptions
|
||||
{
|
||||
Fields = new List<ItemFields>
|
||||
Fields = new ItemFields[]
|
||||
{
|
||||
ItemFields.AirTime,
|
||||
ItemFields.DateCreated,
|
||||
|
||||
@@ -187,11 +187,11 @@ namespace Emby.Server.Implementations.Library
|
||||
var userData = GetUserData(user.Id, item);
|
||||
var dto = GetUserItemDataDto(userData);
|
||||
|
||||
item.FillUserDataDtoValues(dto, userData, null, user, new List<ItemFields>());
|
||||
item.FillUserDataDtoValues(dto, userData, null, user, new ItemFields[]{});
|
||||
return dto;
|
||||
}
|
||||
|
||||
public UserItemDataDto GetUserDataDto(IHasUserData item, BaseItemDto itemDto, User user, List<ItemFields> fields)
|
||||
public UserItemDataDto GetUserDataDto(IHasUserData item, BaseItemDto itemDto, User user, ItemFields[] fields)
|
||||
{
|
||||
var userData = GetUserData(user.Id, item);
|
||||
var dto = GetUserItemDataDto(userData);
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Emby.Server.Implementations.Library
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Folder>> GetUserViews(UserViewQuery query, CancellationToken cancellationToken)
|
||||
public async Task<Folder[]> GetUserViews(UserViewQuery query, CancellationToken cancellationToken)
|
||||
{
|
||||
var user = _userManager.GetUserById(query.UserId);
|
||||
|
||||
@@ -154,7 +154,8 @@ namespace Emby.Server.Implementations.Library
|
||||
return index == -1 ? int.MaxValue : index;
|
||||
})
|
||||
.ThenBy(sorted.IndexOf)
|
||||
.ThenBy(i => i.SortName);
|
||||
.ThenBy(i => i.SortName)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
public Task<UserView> GetUserSubView(string name, string parentId, string type, string sortName, CancellationToken cancellationToken)
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
continue;
|
||||
}
|
||||
|
||||
if (virtualFolder.Locations.Count == 1)
|
||||
if (virtualFolder.Locations.Length == 1)
|
||||
{
|
||||
// remove entire virtual folder
|
||||
try
|
||||
@@ -458,7 +458,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
return GetEpgChannelFromTunerChannel(info, tunerChannel, epgChannels);
|
||||
}
|
||||
|
||||
private string GetMappedChannel(string channelId, List<NameValuePair> mappings)
|
||||
private string GetMappedChannel(string channelId, NameValuePair[] mappings)
|
||||
{
|
||||
foreach (NameValuePair mapping in mappings)
|
||||
{
|
||||
@@ -472,10 +472,10 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
private ChannelInfo GetEpgChannelFromTunerChannel(ListingsProviderInfo info, ChannelInfo tunerChannel, List<ChannelInfo> epgChannels)
|
||||
{
|
||||
return GetEpgChannelFromTunerChannel(info.ChannelMappings.ToList(), tunerChannel, epgChannels);
|
||||
return GetEpgChannelFromTunerChannel(info.ChannelMappings, tunerChannel, epgChannels);
|
||||
}
|
||||
|
||||
public ChannelInfo GetEpgChannelFromTunerChannel(List<NameValuePair> mappings, ChannelInfo tunerChannel, List<ChannelInfo> epgChannels)
|
||||
public ChannelInfo GetEpgChannelFromTunerChannel(NameValuePair[] mappings, ChannelInfo tunerChannel, List<ChannelInfo> epgChannels)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(tunerChannel.Id))
|
||||
{
|
||||
@@ -2591,7 +2591,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
list.Add(new VirtualFolderInfo
|
||||
{
|
||||
Locations = new List<string> { defaultFolder },
|
||||
Locations = new string[] { defaultFolder },
|
||||
Name = defaultName
|
||||
});
|
||||
}
|
||||
@@ -2601,7 +2601,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
list.Add(new VirtualFolderInfo
|
||||
{
|
||||
Locations = new List<string> { customPath },
|
||||
Locations = new string[] { customPath },
|
||||
Name = "Recorded Movies",
|
||||
CollectionType = CollectionType.Movies
|
||||
});
|
||||
@@ -2612,7 +2612,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
list.Add(new VirtualFolderInfo
|
||||
{
|
||||
Locations = new List<string> { customPath },
|
||||
Locations = new string[] { customPath },
|
||||
Name = "Recorded Shows",
|
||||
CollectionType = CollectionType.TvShows
|
||||
});
|
||||
|
||||
@@ -15,6 +15,8 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.Querying;
|
||||
|
||||
namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
@@ -110,7 +112,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
PostPaddingSeconds = info.PostPaddingSeconds,
|
||||
IsPostPaddingRequired = info.IsPostPaddingRequired,
|
||||
IsPrePaddingRequired = info.IsPrePaddingRequired,
|
||||
Days = info.Days,
|
||||
Days = info.Days.ToArray(),
|
||||
Priority = info.Priority,
|
||||
RecordAnyChannel = info.RecordAnyChannel,
|
||||
RecordAnyTime = info.RecordAnyTime,
|
||||
@@ -135,7 +137,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
dto.ProgramId = GetInternalProgramId(service.Name, info.ProgramId).ToString("N");
|
||||
}
|
||||
|
||||
dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days);
|
||||
dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days.ToArray(info.Days.Count));
|
||||
|
||||
FillImages(dto, info.Name, info.SeriesId);
|
||||
|
||||
@@ -150,10 +152,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
Name = seriesName,
|
||||
Limit = 1,
|
||||
ImageTypes = new ImageType[] { ImageType.Thumb },
|
||||
DtoOptions = new DtoOptions
|
||||
{
|
||||
Fields = new List<MediaBrowser.Model.Querying.ItemFields>()
|
||||
}
|
||||
DtoOptions = new DtoOptions(false)
|
||||
|
||||
}).FirstOrDefault();
|
||||
|
||||
@@ -196,10 +195,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
ExternalSeriesId = programSeriesId,
|
||||
Limit = 1,
|
||||
ImageTypes = new ImageType[] { ImageType.Primary },
|
||||
DtoOptions = new DtoOptions
|
||||
{
|
||||
Fields = new List<MediaBrowser.Model.Querying.ItemFields>()
|
||||
}
|
||||
DtoOptions = new DtoOptions(false)
|
||||
|
||||
}).FirstOrDefault();
|
||||
|
||||
@@ -248,10 +244,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
Name = seriesName,
|
||||
Limit = 1,
|
||||
ImageTypes = new ImageType[] { ImageType.Thumb },
|
||||
DtoOptions = new DtoOptions
|
||||
{
|
||||
Fields = new List<MediaBrowser.Model.Querying.ItemFields>()
|
||||
}
|
||||
DtoOptions = new DtoOptions(false)
|
||||
|
||||
}).FirstOrDefault();
|
||||
|
||||
@@ -274,7 +267,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
try
|
||||
{
|
||||
dto.ParentBackdropImageTags = new List<string>
|
||||
dto.ParentBackdropImageTags = new string[]
|
||||
{
|
||||
_imageProcessor.GetImageCacheTag(librarySeries, image)
|
||||
};
|
||||
@@ -294,10 +287,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
Name = seriesName,
|
||||
Limit = 1,
|
||||
ImageTypes = new ImageType[] { ImageType.Primary },
|
||||
DtoOptions = new DtoOptions
|
||||
{
|
||||
Fields = new List<MediaBrowser.Model.Querying.ItemFields>()
|
||||
}
|
||||
DtoOptions = new DtoOptions(false)
|
||||
|
||||
}).FirstOrDefault() ?? _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
@@ -305,10 +295,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
ExternalSeriesId = programSeriesId,
|
||||
Limit = 1,
|
||||
ImageTypes = new ImageType[] { ImageType.Primary },
|
||||
DtoOptions = new DtoOptions
|
||||
{
|
||||
Fields = new List<MediaBrowser.Model.Querying.ItemFields>()
|
||||
}
|
||||
DtoOptions = new DtoOptions(false)
|
||||
|
||||
}).FirstOrDefault();
|
||||
|
||||
@@ -327,14 +314,14 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
}
|
||||
}
|
||||
|
||||
if (dto.ParentBackdropImageTags == null || dto.ParentBackdropImageTags.Count == 0)
|
||||
if (dto.ParentBackdropImageTags == null || dto.ParentBackdropImageTags.Length == 0)
|
||||
{
|
||||
image = program.GetImageInfo(ImageType.Backdrop, 0);
|
||||
if (image != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
dto.ParentBackdropImageTags = new List<string>
|
||||
dto.ParentBackdropImageTags = new string[]
|
||||
{
|
||||
_imageProcessor.GetImageCacheTag(program, image)
|
||||
};
|
||||
@@ -349,24 +336,24 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
}
|
||||
}
|
||||
|
||||
public DayPattern? GetDayPattern(List<DayOfWeek> days)
|
||||
public DayPattern? GetDayPattern(DayOfWeek[] days)
|
||||
{
|
||||
DayPattern? pattern = null;
|
||||
|
||||
if (days.Count > 0)
|
||||
if (days.Length > 0)
|
||||
{
|
||||
if (days.Count == 7)
|
||||
if (days.Length == 7)
|
||||
{
|
||||
pattern = DayPattern.Daily;
|
||||
}
|
||||
else if (days.Count == 2)
|
||||
else if (days.Length == 2)
|
||||
{
|
||||
if (days.Contains(DayOfWeek.Saturday) && days.Contains(DayOfWeek.Sunday))
|
||||
{
|
||||
pattern = DayPattern.Weekends;
|
||||
}
|
||||
}
|
||||
else if (days.Count == 5)
|
||||
else if (days.Length == 5)
|
||||
{
|
||||
if (days.Contains(DayOfWeek.Monday) && days.Contains(DayOfWeek.Tuesday) && days.Contains(DayOfWeek.Wednesday) && days.Contains(DayOfWeek.Thursday) && days.Contains(DayOfWeek.Friday))
|
||||
{
|
||||
@@ -384,7 +371,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
Name = info.Name,
|
||||
Id = info.Id,
|
||||
Clients = info.Clients,
|
||||
Clients = info.Clients.ToArray(),
|
||||
ProgramName = info.ProgramName,
|
||||
SourceType = info.SourceType,
|
||||
Status = info.Status,
|
||||
@@ -543,7 +530,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
PostPaddingSeconds = dto.PostPaddingSeconds,
|
||||
IsPostPaddingRequired = dto.IsPostPaddingRequired,
|
||||
IsPrePaddingRequired = dto.IsPrePaddingRequired,
|
||||
Days = dto.Days,
|
||||
Days = dto.Days.ToList(),
|
||||
Priority = dto.Priority,
|
||||
RecordAnyChannel = dto.RecordAnyChannel,
|
||||
RecordAnyTime = dto.RecordAnyTime,
|
||||
|
||||
@@ -985,9 +985,8 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
var queryResult = _libraryManager.QueryItems(internalQuery);
|
||||
|
||||
var returnList = (await _dtoService.GetBaseItemDtos(queryResult.Items, options, user)
|
||||
var returnArray = (await _dtoService.GetBaseItemDtos(queryResult.Items, options, user)
|
||||
.ConfigureAwait(false));
|
||||
var returnArray = returnList.ToArray(returnList.Count);
|
||||
|
||||
var result = new QueryResult<BaseItemDto>
|
||||
{
|
||||
@@ -998,7 +997,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<QueryResult<LiveTvProgram>> GetRecommendedProgramsInternal(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken)
|
||||
public async Task<QueryResult<BaseItem>> GetRecommendedProgramsInternal(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken)
|
||||
{
|
||||
var user = _userManager.GetUserById(query.UserId);
|
||||
|
||||
@@ -1036,10 +1035,10 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
}
|
||||
}
|
||||
|
||||
var programList = _libraryManager.QueryItems(internalQuery).Items.Cast<LiveTvProgram>().ToList();
|
||||
var totalCount = programList.Count;
|
||||
var programList = _libraryManager.QueryItems(internalQuery).Items;
|
||||
var totalCount = programList.Length;
|
||||
|
||||
IOrderedEnumerable<LiveTvProgram> orderedPrograms = programList.OrderBy(i => i.StartDate.Date);
|
||||
IOrderedEnumerable<LiveTvProgram> orderedPrograms = programList.Cast<LiveTvProgram>().OrderBy(i => i.StartDate.Date);
|
||||
|
||||
if (query.IsAiring ?? false)
|
||||
{
|
||||
@@ -1047,14 +1046,14 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
.ThenByDescending(i => GetRecommendationScore(i, user.Id, true));
|
||||
}
|
||||
|
||||
IEnumerable<LiveTvProgram> programs = orderedPrograms;
|
||||
IEnumerable<BaseItem> programs = orderedPrograms;
|
||||
|
||||
if (query.Limit.HasValue)
|
||||
{
|
||||
programs = programs.Take(query.Limit.Value);
|
||||
}
|
||||
|
||||
var result = new QueryResult<LiveTvProgram>
|
||||
var result = new QueryResult<BaseItem>
|
||||
{
|
||||
Items = programs.ToArray(),
|
||||
TotalRecordCount = totalCount
|
||||
@@ -1071,9 +1070,8 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
var user = _userManager.GetUserById(query.UserId);
|
||||
|
||||
var returnList = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user)
|
||||
var returnArray = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user)
|
||||
.ConfigureAwait(false));
|
||||
var returnArray = returnList.ToArray(returnList.Count);
|
||||
|
||||
var result = new QueryResult<BaseItemDto>
|
||||
{
|
||||
@@ -1262,8 +1260,8 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
progress.Report(100 * percent);
|
||||
}
|
||||
|
||||
await CleanDatabaseInternal(newChannelIdList, new[] { typeof(LiveTvChannel).Name }, progress, cancellationToken).ConfigureAwait(false);
|
||||
await CleanDatabaseInternal(newProgramIdList, new[] { typeof(LiveTvProgram).Name }, progress, cancellationToken).ConfigureAwait(false);
|
||||
await CleanDatabaseInternal(newChannelIdList.ToArray(), new[] { typeof(LiveTvChannel).Name }, progress, cancellationToken).ConfigureAwait(false);
|
||||
await CleanDatabaseInternal(newProgramIdList.ToArray(), new[] { typeof(LiveTvProgram).Name }, progress, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var coreService = _services.OfType<EmbyTV.EmbyTV>().FirstOrDefault();
|
||||
|
||||
@@ -1275,8 +1273,11 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
// Load these now which will prefetch metadata
|
||||
var dtoOptions = new DtoOptions();
|
||||
dtoOptions.Fields.Remove(ItemFields.SyncInfo);
|
||||
dtoOptions.Fields.Remove(ItemFields.BasicSyncInfo);
|
||||
var fields = dtoOptions.Fields.ToList();
|
||||
fields.Remove(ItemFields.SyncInfo);
|
||||
fields.Remove(ItemFields.BasicSyncInfo);
|
||||
dtoOptions.Fields = fields.ToArray(fields.Count);
|
||||
|
||||
await GetRecordings(new RecordingQuery(), dtoOptions, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
progress.Report(100);
|
||||
@@ -1446,14 +1447,14 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
return new Tuple<List<Guid>, List<Guid>>(channels, programs);
|
||||
}
|
||||
|
||||
private async Task CleanDatabaseInternal(List<Guid> currentIdList, string[] validTypes, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
private async Task CleanDatabaseInternal(Guid[] currentIdList, string[] validTypes, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
var list = _itemRepo.GetItemIdsList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = validTypes,
|
||||
DtoOptions = new DtoOptions(false)
|
||||
|
||||
}).ToList();
|
||||
});
|
||||
|
||||
var numComplete = 0;
|
||||
|
||||
@@ -1543,7 +1544,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
var idList = await Task.WhenAll(recordingTasks).ConfigureAwait(false);
|
||||
|
||||
await CleanDatabaseInternal(idList.ToList(), new[] { typeof(LiveTvVideoRecording).Name, typeof(LiveTvAudioRecording).Name }, new SimpleProgress<double>(), cancellationToken).ConfigureAwait(false);
|
||||
await CleanDatabaseInternal(idList, new[] { typeof(LiveTvVideoRecording).Name, typeof(LiveTvAudioRecording).Name }, new SimpleProgress<double>(), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
_lastRecordingRefreshTime = DateTime.UtcNow;
|
||||
}
|
||||
@@ -1701,11 +1702,9 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
DtoOptions = options
|
||||
});
|
||||
|
||||
var returnList = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user)
|
||||
var returnArray = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user)
|
||||
.ConfigureAwait(false));
|
||||
|
||||
var returnArray = returnList.ToArray(returnList.Count);
|
||||
|
||||
return new QueryResult<BaseItemDto>
|
||||
{
|
||||
Items = returnArray,
|
||||
@@ -1841,7 +1840,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
};
|
||||
}
|
||||
|
||||
public async Task AddInfoToProgramDto(List<Tuple<BaseItem, BaseItemDto>> tuples, List<ItemFields> fields, User user = null)
|
||||
public async Task AddInfoToProgramDto(List<Tuple<BaseItem, BaseItemDto>> tuples, ItemFields[] fields, User user = null)
|
||||
{
|
||||
var programTuples = new List<Tuple<BaseItemDto, string, string, string>>();
|
||||
var hasChannelImage = fields.Contains(ItemFields.ChannelImage);
|
||||
@@ -1961,7 +1960,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
if (dto.MediaStreams == null)
|
||||
{
|
||||
dto.MediaStreams = dto.MediaSources.SelectMany(i => i.MediaStreams).ToList();
|
||||
dto.MediaStreams = dto.MediaSources.SelectMany(i => i.MediaStreams).ToArray();
|
||||
}
|
||||
|
||||
if (info.Status == RecordingStatus.InProgress && info.EndDate.HasValue)
|
||||
@@ -1995,9 +1994,8 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
var internalResult = await GetInternalRecordings(query, options, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var returnList = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user)
|
||||
var returnArray = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user)
|
||||
.ConfigureAwait(false));
|
||||
var returnArray = returnList.ToArray(returnList.Count);
|
||||
|
||||
return new QueryResult<BaseItemDto>
|
||||
{
|
||||
@@ -2479,7 +2477,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
var defaults = await GetNewTimerDefaultsInternal(cancellationToken, program).ConfigureAwait(false);
|
||||
var info = _tvDtoService.GetSeriesTimerInfoDto(defaults.Item1, defaults.Item2, null);
|
||||
|
||||
info.Days = defaults.Item1.Days;
|
||||
info.Days = defaults.Item1.Days.ToArray();
|
||||
|
||||
info.DayPattern = _tvDtoService.GetDayPattern(info.Days);
|
||||
|
||||
@@ -2656,8 +2654,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
var series = recordings
|
||||
.Where(i => i.IsSeries)
|
||||
.ToLookup(i => i.Name, StringComparer.OrdinalIgnoreCase)
|
||||
.ToList();
|
||||
.ToLookup(i => i.Name, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
groups.AddRange(series.OrderByString(i => i.Key).Select(i => new BaseItemDto
|
||||
{
|
||||
@@ -2762,7 +2759,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<LiveTvServiceInfo>> GetServiceInfos(CancellationToken cancellationToken)
|
||||
private async Task<LiveTvServiceInfo[]> GetServiceInfos(CancellationToken cancellationToken)
|
||||
{
|
||||
var tasks = Services.Select(i => GetServiceInfo(i, cancellationToken));
|
||||
|
||||
@@ -2806,7 +2803,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
return dto;
|
||||
|
||||
}).ToList();
|
||||
}).ToArray();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -2822,25 +2819,24 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
public async Task<LiveTvInfo> GetLiveTvInfo(CancellationToken cancellationToken)
|
||||
{
|
||||
var services = await GetServiceInfos(CancellationToken.None).ConfigureAwait(false);
|
||||
var servicesList = services.ToList();
|
||||
|
||||
var info = new LiveTvInfo
|
||||
{
|
||||
Services = servicesList.ToList(),
|
||||
IsEnabled = servicesList.Count > 0
|
||||
Services = services,
|
||||
IsEnabled = services.Length > 0
|
||||
};
|
||||
|
||||
info.EnabledUsers = _userManager.Users
|
||||
.Where(IsLiveTvEnabled)
|
||||
.Select(i => i.Id.ToString("N"))
|
||||
.ToList();
|
||||
.ToArray();
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
private bool IsLiveTvEnabled(User user)
|
||||
{
|
||||
return user.Policy.EnableLiveTvAccess && (Services.Count > 1 || GetConfiguration().TunerHosts.Count > 0);
|
||||
return user.Policy.EnableLiveTvAccess && (Services.Count > 1 || GetConfiguration().TunerHosts.Length > 0);
|
||||
}
|
||||
|
||||
public IEnumerable<User> GetEnabledUsers()
|
||||
@@ -2880,10 +2876,13 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
private void RemoveFields(DtoOptions options)
|
||||
{
|
||||
options.Fields.Remove(ItemFields.CanDelete);
|
||||
options.Fields.Remove(ItemFields.CanDownload);
|
||||
options.Fields.Remove(ItemFields.DisplayPreferencesId);
|
||||
options.Fields.Remove(ItemFields.Etag);
|
||||
var fields = options.Fields.ToList();
|
||||
|
||||
fields.Remove(ItemFields.CanDelete);
|
||||
fields.Remove(ItemFields.CanDownload);
|
||||
fields.Remove(ItemFields.DisplayPreferencesId);
|
||||
fields.Remove(ItemFields.Etag);
|
||||
options.Fields = fields.ToArray(fields.Count);
|
||||
}
|
||||
|
||||
public async Task<Folder> GetInternalLiveTvFolder(CancellationToken cancellationToken)
|
||||
@@ -2911,12 +2910,14 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
var config = GetConfiguration();
|
||||
|
||||
var index = config.TunerHosts.FindIndex(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));
|
||||
var list = config.TunerHosts.ToList();
|
||||
var index = list.FindIndex(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (index == -1 || string.IsNullOrWhiteSpace(info.Id))
|
||||
{
|
||||
info.Id = Guid.NewGuid().ToString("N");
|
||||
config.TunerHosts.Add(info);
|
||||
list.Add(info);
|
||||
config.TunerHosts = list.ToArray(list.Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2948,12 +2949,14 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
var config = GetConfiguration();
|
||||
|
||||
var index = config.ListingProviders.FindIndex(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));
|
||||
var list = config.ListingProviders.ToList();
|
||||
var index = list.FindIndex(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (index == -1 || string.IsNullOrWhiteSpace(info.Id))
|
||||
{
|
||||
info.Id = Guid.NewGuid().ToString("N");
|
||||
config.ListingProviders.Add(info);
|
||||
list.Add(info);
|
||||
config.ListingProviders = list.ToArray(list.Count);
|
||||
info.EnableNewProgramIds = true;
|
||||
}
|
||||
else
|
||||
@@ -2972,7 +2975,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
var config = GetConfiguration();
|
||||
|
||||
config.ListingProviders = config.ListingProviders.Where(i => !string.Equals(id, i.Id, StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
config.ListingProviders = config.ListingProviders.Where(i => !string.Equals(id, i.Id, StringComparison.OrdinalIgnoreCase)).ToArray();
|
||||
|
||||
_config.SaveConfiguration("livetv", config);
|
||||
_taskManager.CancelIfRunningAndQueue<RefreshChannelsScheduledTask>();
|
||||
@@ -3004,7 +3007,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
var providerChannels = await GetChannelsFromListingsProviderData(providerId, CancellationToken.None)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
var mappings = listingsProviderInfo.ChannelMappings.ToList();
|
||||
var mappings = listingsProviderInfo.ChannelMappings;
|
||||
|
||||
var tunerChannelMappings =
|
||||
tunerChannels.Select(i => GetTunerChannelMapping(i, mappings, providerChannels)).ToList();
|
||||
@@ -3014,7 +3017,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
return tunerChannelMappings.First(i => string.Equals(i.Id, tunerChannelId, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
public TunerChannelMapping GetTunerChannelMapping(ChannelInfo tunerChannel, List<NameValuePair> mappings, List<ChannelInfo> epgChannels)
|
||||
public TunerChannelMapping GetTunerChannelMapping(ChannelInfo tunerChannel, NameValuePair[] mappings, List<ChannelInfo> epgChannels)
|
||||
{
|
||||
var result = new TunerChannelMapping
|
||||
{
|
||||
@@ -3078,7 +3081,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
if (string.Equals(feature, "dvr-l", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var config = GetConfiguration();
|
||||
if (config.TunerHosts.Count > 0 &&
|
||||
if (config.TunerHosts.Length > 0 &&
|
||||
config.ListingProviders.Count(i => (i.EnableAllTuners || i.EnabledTuners.Length > 0) && string.Equals(i.Type, SchedulesDirect.TypeName, StringComparison.OrdinalIgnoreCase)) > 0)
|
||||
{
|
||||
return Task.FromResult(new MBRegistrationRecord
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
public bool IsHidden
|
||||
{
|
||||
get { return _liveTvManager.Services.Count == 1 && GetConfiguration().TunerHosts.Count == 0; }
|
||||
get { return _liveTvManager.Services.Count == 1 && GetConfiguration().TunerHosts.Length == 0; }
|
||||
}
|
||||
|
||||
public bool IsEnabled
|
||||
|
||||
@@ -24,8 +24,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
|
||||
public async Task CopyUntilCancelled(Stream source, Action onStarted, CancellationToken cancellationToken)
|
||||
{
|
||||
byte[] buffer = new byte[BufferSize];
|
||||
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
@@ -35,6 +33,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
byte[] buffer = new byte[BufferSize];
|
||||
|
||||
var bytesRead = source.Read(buffer, 0, buffer.Length);
|
||||
|
||||
if (bytesRead > 0)
|
||||
@@ -47,12 +47,12 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
//}
|
||||
//else
|
||||
{
|
||||
byte[] copy = new byte[bytesRead];
|
||||
Buffer.BlockCopy(buffer, 0, copy, 0, bytesRead);
|
||||
//byte[] copy = new byte[bytesRead];
|
||||
//Buffer.BlockCopy(buffer, 0, copy, 0, bytesRead);
|
||||
|
||||
foreach (var stream in allStreams)
|
||||
{
|
||||
stream.Value.Queue(copy, 0, copy.Length);
|
||||
stream.Value.Queue(buffer, 0, bytesRead);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
public class QueueStream
|
||||
{
|
||||
private readonly Stream _outputStream;
|
||||
private readonly ConcurrentQueue<Tuple<byte[], int, int>> _queue = new ConcurrentQueue<Tuple<byte[], int, int>>();
|
||||
private readonly BlockingCollection<Tuple<byte[], int, int>> _queue = new BlockingCollection<Tuple<byte[], int, int>>();
|
||||
public TaskCompletionSource<bool> TaskCompletion { get; private set; }
|
||||
|
||||
public Action<QueueStream> OnFinished { get; set; }
|
||||
@@ -29,7 +29,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
|
||||
public void Queue(byte[] bytes, int offset, int count)
|
||||
{
|
||||
_queue.Enqueue(new Tuple<byte[], int, int>(bytes, offset, count));
|
||||
_queue.Add(new Tuple<byte[], int, int>(bytes, offset, count));
|
||||
}
|
||||
|
||||
public void Start(CancellationToken cancellationToken)
|
||||
@@ -37,17 +37,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
Task.Run(() => StartInternal(cancellationToken));
|
||||
}
|
||||
|
||||
private Tuple<byte[], int, int> Dequeue()
|
||||
{
|
||||
Tuple<byte[], int, int> result;
|
||||
if (_queue.TryDequeue(out result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void OnClosed()
|
||||
{
|
||||
GC.Collect();
|
||||
@@ -79,7 +68,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
}
|
||||
}
|
||||
|
||||
private async Task StartInternal(CancellationToken cancellationToken)
|
||||
private void StartInternal(CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -87,15 +76,10 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var result = Dequeue();
|
||||
if (result != null)
|
||||
foreach (var result in _queue.GetConsumingEnumerable())
|
||||
{
|
||||
_outputStream.Write(result.Item1, result.Item2, result.Item3);
|
||||
}
|
||||
else
|
||||
{
|
||||
await Task.Delay(50, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace Emby.Server.Implementations.Localization
|
||||
/// Gets the cultures.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{CultureDto}.</returns>
|
||||
public List<CultureDto> GetCultures()
|
||||
public CultureDto[] GetCultures()
|
||||
{
|
||||
var type = GetType();
|
||||
var path = type.Namespace + ".iso6392.txt";
|
||||
@@ -169,21 +169,21 @@ namespace Emby.Server.Implementations.Localization
|
||||
return list.Where(i => !string.IsNullOrWhiteSpace(i.Name) &&
|
||||
!string.IsNullOrWhiteSpace(i.DisplayName) &&
|
||||
!string.IsNullOrWhiteSpace(i.ThreeLetterISOLanguageName) &&
|
||||
!string.IsNullOrWhiteSpace(i.TwoLetterISOLanguageName)).ToList();
|
||||
!string.IsNullOrWhiteSpace(i.TwoLetterISOLanguageName)).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the countries.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{CountryInfo}.</returns>
|
||||
public List<CountryInfo> GetCountries()
|
||||
public CountryInfo[] GetCountries()
|
||||
{
|
||||
var type = GetType();
|
||||
var path = type.Namespace + ".countries.json";
|
||||
|
||||
using (var stream = _assemblyInfo.GetManifestResourceStream(type, path))
|
||||
{
|
||||
return _jsonSerializer.DeserializeFromStream<List<CountryInfo>>(stream);
|
||||
return _jsonSerializer.DeserializeFromStream<CountryInfo[]>(stream);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,9 +191,9 @@ namespace Emby.Server.Implementations.Localization
|
||||
/// Gets the parental ratings.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{ParentalRating}.</returns>
|
||||
public IEnumerable<ParentalRating> GetParentalRatings()
|
||||
public ParentalRating[] GetParentalRatings()
|
||||
{
|
||||
return GetParentalRatingsDictionary().Values.ToList();
|
||||
return GetParentalRatingsDictionary().Values.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -382,9 +382,9 @@ namespace Emby.Server.Implementations.Localization
|
||||
return culture + ".json";
|
||||
}
|
||||
|
||||
public IEnumerable<LocalizatonOption> GetLocalizationOptions()
|
||||
public LocalizatonOption[] GetLocalizationOptions()
|
||||
{
|
||||
return new List<LocalizatonOption>
|
||||
return new LocalizatonOption[]
|
||||
{
|
||||
new LocalizatonOption{ Name="Arabic", Value="ar"},
|
||||
new LocalizatonOption{ Name="Bulgarian (Bulgaria)", Value="bg-BG"},
|
||||
@@ -421,7 +421,7 @@ namespace Emby.Server.Implementations.Localization
|
||||
new LocalizatonOption{ Name="Ukrainian", Value="uk"},
|
||||
new LocalizatonOption{ Name="Vietnamese", Value="vi"}
|
||||
|
||||
}.OrderBy(i => i.Name);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace Emby.Server.Implementations.MediaEncoder
|
||||
|
||||
var protocol = MediaProtocol.File;
|
||||
|
||||
var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, video.Path, protocol, null, new List<string>());
|
||||
var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, video.Path, protocol, null, new string[] { });
|
||||
|
||||
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
|
||||
|
||||
|
||||
@@ -28,21 +28,21 @@ namespace Emby.Server.Implementations.Notifications
|
||||
Type = NotificationType.ApplicationUpdateInstalled.ToString(),
|
||||
DefaultDescription = "{ReleaseNotes}",
|
||||
DefaultTitle = "A new version of Emby Server has been installed.",
|
||||
Variables = new List<string>{"Version"}
|
||||
Variables = new string[]{"Version"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
{
|
||||
Type = NotificationType.InstallationFailed.ToString(),
|
||||
DefaultTitle = "{Name} installation failed.",
|
||||
Variables = new List<string>{"Name", "Version"}
|
||||
Variables = new string[]{"Name", "Version"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
{
|
||||
Type = NotificationType.PluginInstalled.ToString(),
|
||||
DefaultTitle = "{Name} was installed.",
|
||||
Variables = new List<string>{"Name", "Version"}
|
||||
Variables = new string[]{"Name", "Version"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
@@ -50,14 +50,14 @@ namespace Emby.Server.Implementations.Notifications
|
||||
Type = NotificationType.PluginError.ToString(),
|
||||
DefaultTitle = "{Name} has encountered an error.",
|
||||
DefaultDescription = "{ErrorMessage}",
|
||||
Variables = new List<string>{"Name", "ErrorMessage"}
|
||||
Variables = new string[]{"Name", "ErrorMessage"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
{
|
||||
Type = NotificationType.PluginUninstalled.ToString(),
|
||||
DefaultTitle = "{Name} was uninstalled.",
|
||||
Variables = new List<string>{"Name", "Version"}
|
||||
Variables = new string[]{"Name", "Version"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
@@ -65,7 +65,7 @@ namespace Emby.Server.Implementations.Notifications
|
||||
Type = NotificationType.PluginUpdateInstalled.ToString(),
|
||||
DefaultTitle = "{Name} was updated.",
|
||||
DefaultDescription = "{ReleaseNotes}",
|
||||
Variables = new List<string>{"Name", "ReleaseNotes", "Version"}
|
||||
Variables = new string[]{"Name", "ReleaseNotes", "Version"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
@@ -79,70 +79,70 @@ namespace Emby.Server.Implementations.Notifications
|
||||
Type = NotificationType.TaskFailed.ToString(),
|
||||
DefaultTitle = "{Name} failed.",
|
||||
DefaultDescription = "{ErrorMessage}",
|
||||
Variables = new List<string>{"Name", "ErrorMessage"}
|
||||
Variables = new string[]{"Name", "ErrorMessage"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
{
|
||||
Type = NotificationType.NewLibraryContent.ToString(),
|
||||
DefaultTitle = "{Name} has been added to your media library.",
|
||||
Variables = new List<string>{"Name"}
|
||||
Variables = new string[]{"Name"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
{
|
||||
Type = NotificationType.AudioPlayback.ToString(),
|
||||
DefaultTitle = "{UserName} is playing {ItemName} on {DeviceName}.",
|
||||
Variables = new List<string>{"UserName", "ItemName", "DeviceName", "AppName"}
|
||||
Variables = new string[]{"UserName", "ItemName", "DeviceName", "AppName"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
{
|
||||
Type = NotificationType.GamePlayback.ToString(),
|
||||
DefaultTitle = "{UserName} is playing {ItemName} on {DeviceName}.",
|
||||
Variables = new List<string>{"UserName", "ItemName", "DeviceName", "AppName"}
|
||||
Variables = new string[]{"UserName", "ItemName", "DeviceName", "AppName"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
{
|
||||
Type = NotificationType.VideoPlayback.ToString(),
|
||||
DefaultTitle = "{UserName} is playing {ItemName} on {DeviceName}.",
|
||||
Variables = new List<string>{"UserName", "ItemName", "DeviceName", "AppName"}
|
||||
Variables = new string[]{"UserName", "ItemName", "DeviceName", "AppName"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
{
|
||||
Type = NotificationType.AudioPlaybackStopped.ToString(),
|
||||
DefaultTitle = "{UserName} has finished playing {ItemName} on {DeviceName}.",
|
||||
Variables = new List<string>{"UserName", "ItemName", "DeviceName", "AppName"}
|
||||
Variables = new string[]{"UserName", "ItemName", "DeviceName", "AppName"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
{
|
||||
Type = NotificationType.GamePlaybackStopped.ToString(),
|
||||
DefaultTitle = "{UserName} has finished playing {ItemName} on {DeviceName}.",
|
||||
Variables = new List<string>{"UserName", "ItemName", "DeviceName", "AppName"}
|
||||
Variables = new string[]{"UserName", "ItemName", "DeviceName", "AppName"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
{
|
||||
Type = NotificationType.VideoPlaybackStopped.ToString(),
|
||||
DefaultTitle = "{UserName} has finished playing {ItemName} on {DeviceName}.",
|
||||
Variables = new List<string>{"UserName", "ItemName", "DeviceName", "AppName"}
|
||||
Variables = new string[]{"UserName", "ItemName", "DeviceName", "AppName"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
{
|
||||
Type = NotificationType.CameraImageUploaded.ToString(),
|
||||
DefaultTitle = "A new camera image has been uploaded from {DeviceName}.",
|
||||
Variables = new List<string>{"DeviceName"}
|
||||
Variables = new string[]{"DeviceName"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
{
|
||||
Type = NotificationType.UserLockedOut.ToString(),
|
||||
DefaultTitle = "{UserName} has been locked out.",
|
||||
Variables = new List<string>{"UserName"}
|
||||
Variables = new string[]{"UserName"}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ namespace Emby.Server.Implementations.Notifications
|
||||
_typeFactories = notificationTypeFactories.ToArray();
|
||||
}
|
||||
|
||||
public IEnumerable<NotificationTypeInfo> GetNotificationTypes()
|
||||
public List<NotificationTypeInfo> GetNotificationTypes()
|
||||
{
|
||||
var list = _typeFactories.Select(i =>
|
||||
{
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||
await playlist.RefreshMetadata(new MetadataRefreshOptions(_fileSystem) { ForceSave = true }, CancellationToken.None)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (options.ItemIdList.Count > 0)
|
||||
if (options.ItemIdList.Length > 0)
|
||||
{
|
||||
await AddToPlaylistInternal(playlist.Id.ToString("N"), options.ItemIdList, user, new DtoOptions(false)
|
||||
{
|
||||
|
||||
@@ -29,13 +29,6 @@ namespace Emby.Server.Implementations.Services
|
||||
}
|
||||
}
|
||||
|
||||
private Type[] GetGenericArguments(Type type)
|
||||
{
|
||||
return type.GetTypeInfo().IsGenericTypeDefinition
|
||||
? type.GetTypeInfo().GenericTypeParameters
|
||||
: type.GetTypeInfo().GenericTypeArguments;
|
||||
}
|
||||
|
||||
public void RegisterService(HttpListenerHost appHost, Type serviceType)
|
||||
{
|
||||
var processedReqs = new HashSet<Type>();
|
||||
@@ -50,38 +43,19 @@ namespace Emby.Server.Implementations.Services
|
||||
|
||||
ServiceExecGeneral.CreateServiceRunnersFor(requestType, actions);
|
||||
|
||||
var returnMarker = GetTypeWithGenericTypeDefinitionOf(requestType, typeof(IReturn<>));
|
||||
var responseType = returnMarker != null ?
|
||||
GetGenericArguments(returnMarker)[0]
|
||||
: mi.ReturnType != typeof(object) && mi.ReturnType != typeof(void) ?
|
||||
mi.ReturnType
|
||||
: Type.GetType(requestType.FullName + "Response");
|
||||
//var returnMarker = GetTypeWithGenericTypeDefinitionOf(requestType, typeof(IReturn<>));
|
||||
//var responseType = returnMarker != null ?
|
||||
// GetGenericArguments(returnMarker)[0]
|
||||
// : mi.ReturnType != typeof(object) && mi.ReturnType != typeof(void) ?
|
||||
// mi.ReturnType
|
||||
// : Type.GetType(requestType.FullName + "Response");
|
||||
|
||||
RegisterRestPaths(appHost, requestType);
|
||||
|
||||
appHost.AddServiceInfo(serviceType, requestType, responseType);
|
||||
appHost.AddServiceInfo(serviceType, requestType);
|
||||
}
|
||||
}
|
||||
|
||||
private static Type GetTypeWithGenericTypeDefinitionOf(Type type, Type genericTypeDefinition)
|
||||
{
|
||||
foreach (var t in type.GetTypeInfo().ImplementedInterfaces)
|
||||
{
|
||||
if (t.GetTypeInfo().IsGenericType && t.GetGenericTypeDefinition() == genericTypeDefinition)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
var genericType = FirstGenericType(type);
|
||||
if (genericType != null && genericType.GetGenericTypeDefinition() == genericTypeDefinition)
|
||||
{
|
||||
return genericType;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Type FirstGenericType(Type type)
|
||||
{
|
||||
while (type != null)
|
||||
|
||||
@@ -468,7 +468,7 @@ namespace Emby.Server.Implementations.Session
|
||||
|
||||
if (!userId.HasValue)
|
||||
{
|
||||
sessionInfo.AdditionalUsers.Clear();
|
||||
sessionInfo.AdditionalUsers = new SessionUserInfo[] { };
|
||||
}
|
||||
|
||||
if (sessionInfo.SessionController == null)
|
||||
@@ -1074,7 +1074,7 @@ namespace Emby.Server.Implementations.Session
|
||||
DtoOptions = new DtoOptions(false)
|
||||
{
|
||||
EnableImages = false,
|
||||
Fields = new List<ItemFields>
|
||||
Fields = new ItemFields[]
|
||||
{
|
||||
ItemFields.SortName
|
||||
}
|
||||
@@ -1097,7 +1097,7 @@ namespace Emby.Server.Implementations.Session
|
||||
DtoOptions = new DtoOptions(false)
|
||||
{
|
||||
EnableImages = false,
|
||||
Fields = new List<ItemFields>
|
||||
Fields = new ItemFields[]
|
||||
{
|
||||
ItemFields.SortName
|
||||
}
|
||||
@@ -1340,11 +1340,15 @@ namespace Emby.Server.Implementations.Session
|
||||
{
|
||||
var user = _userManager.GetUserById(userId);
|
||||
|
||||
session.AdditionalUsers.Add(new SessionUserInfo
|
||||
var list = session.AdditionalUsers.ToList();
|
||||
|
||||
list.Add(new SessionUserInfo
|
||||
{
|
||||
UserId = userId,
|
||||
UserName = user.Name
|
||||
});
|
||||
|
||||
session.AdditionalUsers = list.ToArray(list.Count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1368,7 +1372,10 @@ namespace Emby.Server.Implementations.Session
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
session.AdditionalUsers.Remove(user);
|
||||
var list = session.AdditionalUsers.ToList();
|
||||
list.Remove(user);
|
||||
|
||||
session.AdditionalUsers = list.ToArray(list.Count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1661,35 +1668,39 @@ namespace Emby.Server.Implementations.Session
|
||||
AddProgramRecordingInfo = false
|
||||
};
|
||||
|
||||
dtoOptions.Fields.Remove(ItemFields.BasicSyncInfo);
|
||||
dtoOptions.Fields.Remove(ItemFields.SyncInfo);
|
||||
dtoOptions.Fields.Remove(ItemFields.CanDelete);
|
||||
dtoOptions.Fields.Remove(ItemFields.CanDownload);
|
||||
dtoOptions.Fields.Remove(ItemFields.ChildCount);
|
||||
dtoOptions.Fields.Remove(ItemFields.CustomRating);
|
||||
dtoOptions.Fields.Remove(ItemFields.DateLastMediaAdded);
|
||||
dtoOptions.Fields.Remove(ItemFields.DateLastRefreshed);
|
||||
dtoOptions.Fields.Remove(ItemFields.DateLastSaved);
|
||||
dtoOptions.Fields.Remove(ItemFields.DisplayPreferencesId);
|
||||
dtoOptions.Fields.Remove(ItemFields.Etag);
|
||||
dtoOptions.Fields.Remove(ItemFields.ExternalEtag);
|
||||
dtoOptions.Fields.Remove(ItemFields.InheritedParentalRatingValue);
|
||||
dtoOptions.Fields.Remove(ItemFields.ItemCounts);
|
||||
dtoOptions.Fields.Remove(ItemFields.MediaSourceCount);
|
||||
dtoOptions.Fields.Remove(ItemFields.MediaStreams);
|
||||
dtoOptions.Fields.Remove(ItemFields.MediaSources);
|
||||
dtoOptions.Fields.Remove(ItemFields.People);
|
||||
dtoOptions.Fields.Remove(ItemFields.PlayAccess);
|
||||
dtoOptions.Fields.Remove(ItemFields.People);
|
||||
dtoOptions.Fields.Remove(ItemFields.ProductionLocations);
|
||||
dtoOptions.Fields.Remove(ItemFields.RecursiveItemCount);
|
||||
dtoOptions.Fields.Remove(ItemFields.RemoteTrailers);
|
||||
dtoOptions.Fields.Remove(ItemFields.SeasonUserData);
|
||||
dtoOptions.Fields.Remove(ItemFields.Settings);
|
||||
dtoOptions.Fields.Remove(ItemFields.SortName);
|
||||
dtoOptions.Fields.Remove(ItemFields.Tags);
|
||||
dtoOptions.Fields.Remove(ItemFields.ThemeSongIds);
|
||||
dtoOptions.Fields.Remove(ItemFields.ThemeVideoIds);
|
||||
var fields = dtoOptions.Fields.ToList();
|
||||
|
||||
fields.Remove(ItemFields.BasicSyncInfo);
|
||||
fields.Remove(ItemFields.SyncInfo);
|
||||
fields.Remove(ItemFields.CanDelete);
|
||||
fields.Remove(ItemFields.CanDownload);
|
||||
fields.Remove(ItemFields.ChildCount);
|
||||
fields.Remove(ItemFields.CustomRating);
|
||||
fields.Remove(ItemFields.DateLastMediaAdded);
|
||||
fields.Remove(ItemFields.DateLastRefreshed);
|
||||
fields.Remove(ItemFields.DateLastSaved);
|
||||
fields.Remove(ItemFields.DisplayPreferencesId);
|
||||
fields.Remove(ItemFields.Etag);
|
||||
fields.Remove(ItemFields.ExternalEtag);
|
||||
fields.Remove(ItemFields.InheritedParentalRatingValue);
|
||||
fields.Remove(ItemFields.ItemCounts);
|
||||
fields.Remove(ItemFields.MediaSourceCount);
|
||||
fields.Remove(ItemFields.MediaStreams);
|
||||
fields.Remove(ItemFields.MediaSources);
|
||||
fields.Remove(ItemFields.People);
|
||||
fields.Remove(ItemFields.PlayAccess);
|
||||
fields.Remove(ItemFields.People);
|
||||
fields.Remove(ItemFields.ProductionLocations);
|
||||
fields.Remove(ItemFields.RecursiveItemCount);
|
||||
fields.Remove(ItemFields.RemoteTrailers);
|
||||
fields.Remove(ItemFields.SeasonUserData);
|
||||
fields.Remove(ItemFields.Settings);
|
||||
fields.Remove(ItemFields.SortName);
|
||||
fields.Remove(ItemFields.Tags);
|
||||
fields.Remove(ItemFields.ThemeSongIds);
|
||||
fields.Remove(ItemFields.ThemeVideoIds);
|
||||
|
||||
dtoOptions.Fields = fields.ToArray(fields.Count);
|
||||
|
||||
_itemInfoDtoOptions = dtoOptions;
|
||||
}
|
||||
@@ -1698,7 +1709,7 @@ namespace Emby.Server.Implementations.Session
|
||||
|
||||
if (mediaSource != null)
|
||||
{
|
||||
info.MediaStreams = mediaSource.MediaStreams;
|
||||
info.MediaStreams = mediaSource.MediaStreams.ToArray();
|
||||
}
|
||||
|
||||
return info;
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Emby.Server.Implementations.TV
|
||||
Recursive = true,
|
||||
DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions
|
||||
{
|
||||
Fields = new List<ItemFields>
|
||||
Fields = new ItemFields[]
|
||||
{
|
||||
ItemFields.SeriesPresentationUniqueKey
|
||||
}
|
||||
@@ -128,7 +128,7 @@ namespace Emby.Server.Implementations.TV
|
||||
Limit = limit,
|
||||
DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions
|
||||
{
|
||||
Fields = new List<ItemFields>
|
||||
Fields = new ItemFields[]
|
||||
{
|
||||
ItemFields.SeriesPresentationUniqueKey
|
||||
},
|
||||
@@ -207,7 +207,7 @@ namespace Emby.Server.Implementations.TV
|
||||
ParentIndexNumberNotEquals = 0,
|
||||
DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions
|
||||
{
|
||||
Fields = new List<ItemFields>
|
||||
Fields = new ItemFields[]
|
||||
{
|
||||
ItemFields.SortName
|
||||
},
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Emby.Server.Implementations.Updates
|
||||
/// Gets all available packages.
|
||||
/// </summary>
|
||||
/// <returns>Task{List{PackageInfo}}.</returns>
|
||||
public async Task<IEnumerable<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken,
|
||||
public async Task<PackageInfo[]> GetAvailablePackages(CancellationToken cancellationToken,
|
||||
bool withRegistration = true,
|
||||
string packageType = null,
|
||||
Version applicationVersion = null)
|
||||
@@ -175,7 +175,7 @@ namespace Emby.Server.Implementations.Updates
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var packages = _jsonSerializer.DeserializeFromStream<List<PackageInfo>>(json).ToList();
|
||||
var packages = _jsonSerializer.DeserializeFromStream<PackageInfo[]>(json);
|
||||
|
||||
return FilterPackages(packages, packageType, applicationVersion);
|
||||
}
|
||||
@@ -184,7 +184,7 @@ namespace Emby.Server.Implementations.Updates
|
||||
{
|
||||
var packages = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return FilterPackages(packages.ToList(), packageType, applicationVersion);
|
||||
return FilterPackages(packages, packageType, applicationVersion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,14 +195,14 @@ namespace Emby.Server.Implementations.Updates
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{List{PackageInfo}}.</returns>
|
||||
public async Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken)
|
||||
public async Task<PackageInfo[]> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.Info("Opening {0}", PackageCachePath);
|
||||
try
|
||||
{
|
||||
using (var stream = _fileSystem.OpenRead(PackageCachePath))
|
||||
{
|
||||
var packages = _jsonSerializer.DeserializeFromStream<List<PackageInfo>>(stream).ToList();
|
||||
var packages = _jsonSerializer.DeserializeFromStream<PackageInfo[]>(stream);
|
||||
|
||||
if (DateTime.UtcNow - _lastPackageUpdateTime > GetCacheLength())
|
||||
{
|
||||
@@ -221,7 +221,7 @@ namespace Emby.Server.Implementations.Updates
|
||||
await UpdateCachedPackages(cancellationToken, true).ConfigureAwait(false);
|
||||
using (var stream = _fileSystem.OpenRead(PackageCachePath))
|
||||
{
|
||||
return _jsonSerializer.DeserializeFromStream<List<PackageInfo>>(stream).ToList();
|
||||
return _jsonSerializer.DeserializeFromStream<PackageInfo[]>(stream);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,31 +288,29 @@ namespace Emby.Server.Implementations.Updates
|
||||
}
|
||||
}
|
||||
|
||||
protected IEnumerable<PackageInfo> FilterPackages(List<PackageInfo> packages)
|
||||
protected PackageInfo[] FilterPackages(List<PackageInfo> packages)
|
||||
{
|
||||
foreach (var package in packages)
|
||||
{
|
||||
package.versions = package.versions.Where(v => !string.IsNullOrWhiteSpace(v.sourceUrl))
|
||||
.OrderByDescending(GetPackageVersion).ToList();
|
||||
.OrderByDescending(GetPackageVersion).ToArray();
|
||||
}
|
||||
|
||||
// Remove packages with no versions
|
||||
packages = packages.Where(p => p.versions.Any()).ToList();
|
||||
|
||||
return packages;
|
||||
return packages.Where(p => p.versions.Any()).ToArray();
|
||||
}
|
||||
|
||||
protected IEnumerable<PackageInfo> FilterPackages(List<PackageInfo> packages, string packageType, Version applicationVersion)
|
||||
protected PackageInfo[] FilterPackages(PackageInfo[] packages, string packageType, Version applicationVersion)
|
||||
{
|
||||
foreach (var package in packages)
|
||||
{
|
||||
package.versions = package.versions.Where(v => !string.IsNullOrWhiteSpace(v.sourceUrl))
|
||||
.OrderByDescending(GetPackageVersion).ToList();
|
||||
.OrderByDescending(GetPackageVersion).ToArray();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(packageType))
|
||||
{
|
||||
packages = packages.Where(p => string.Equals(p.type, packageType, StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
packages = packages.Where(p => string.Equals(p.type, packageType, StringComparison.OrdinalIgnoreCase)).ToArray();
|
||||
}
|
||||
|
||||
// If an app version was supplied, filter the versions for each package to only include supported versions
|
||||
@@ -320,14 +318,12 @@ namespace Emby.Server.Implementations.Updates
|
||||
{
|
||||
foreach (var package in packages)
|
||||
{
|
||||
package.versions = package.versions.Where(v => IsPackageVersionUpToDate(v, applicationVersion)).ToList();
|
||||
package.versions = package.versions.Where(v => IsPackageVersionUpToDate(v, applicationVersion)).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
// Remove packages with no versions
|
||||
packages = packages.Where(p => p.versions.Any()).ToList();
|
||||
|
||||
return packages;
|
||||
return packages.Where(p => p.versions.Any()).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -418,30 +414,24 @@ namespace Emby.Server.Implementations.Updates
|
||||
/// <returns>Task{IEnumerable{PackageVersionInfo}}.</returns>
|
||||
public async Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdates(Version applicationVersion, bool withAutoUpdateEnabled, CancellationToken cancellationToken)
|
||||
{
|
||||
var catalog = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var plugins = _applicationHost.Plugins.ToList();
|
||||
|
||||
if (withAutoUpdateEnabled)
|
||||
if (!_config.CommonConfiguration.EnableAutoUpdate)
|
||||
{
|
||||
plugins = plugins
|
||||
.Where(p => _config.CommonConfiguration.EnableAutoUpdate)
|
||||
.ToList();
|
||||
return new PackageVersionInfo[] { };
|
||||
}
|
||||
|
||||
var catalog = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var systemUpdateLevel = GetSystemUpdateLevel();
|
||||
|
||||
// Figure out what needs to be installed
|
||||
var packages = plugins.Select(p =>
|
||||
return _applicationHost.Plugins.Select(p =>
|
||||
{
|
||||
var latestPluginInfo = GetLatestCompatibleVersion(catalog, p.Name, p.Id.ToString(), applicationVersion, systemUpdateLevel);
|
||||
|
||||
return latestPluginInfo != null && GetPackageVersion(latestPluginInfo) > p.Version ? latestPluginInfo : null;
|
||||
|
||||
}).Where(i => i != null).ToList();
|
||||
|
||||
return packages
|
||||
.Where(p => !string.IsNullOrWhiteSpace(p.sourceUrl) && !CompletedInstallations.Any(i => string.Equals(i.AssemblyGuid, p.guid, StringComparison.OrdinalIgnoreCase)));
|
||||
}).Where(i => i != null)
|
||||
.Where(p => !string.IsNullOrWhiteSpace(p.sourceUrl) && !CompletedInstallations.Any(i => string.Equals(i.AssemblyGuid, p.guid, StringComparison.OrdinalIgnoreCase)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user