aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2018-12-30 01:04:27 -0500
committerGitHub <noreply@github.com>2018-12-30 01:04:27 -0500
commit76b647e0a8eddd65dc9c4de7b887a3faf6e12bcc (patch)
treea0fcc6a59c597f7c288dd3619c7e72bf97d2e0ea /Emby.Server.Implementations
parenta86b71899ec52c44ddc6c3018e8cc5e9d7ff4d62 (diff)
parentd10d632c489b94566bbcf1b7e9c2bb86c31c97b1 (diff)
Merge pull request #325 from jellyfin/devv3.5.2-5
Master 3.5.2-5
Diffstat (limited to 'Emby.Server.Implementations')
-rw-r--r--Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs2
-rw-r--r--Emby.Server.Implementations/Activity/ActivityRepository.cs8
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs37
-rw-r--r--Emby.Server.Implementations/Channels/ChannelManager.cs8
-rw-r--r--Emby.Server.Implementations/Collections/CollectionManager.cs2
-rw-r--r--Emby.Server.Implementations/Data/SqliteItemRepository.cs32
-rw-r--r--Emby.Server.Implementations/Devices/DeviceManager.cs4
-rw-r--r--Emby.Server.Implementations/Dto/DtoService.cs2
-rw-r--r--Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs5
-rw-r--r--Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs2
-rw-r--r--Emby.Server.Implementations/HttpServer/HttpListenerHost.cs4
-rw-r--r--Emby.Server.Implementations/HttpServer/HttpResultFactory.cs13
-rw-r--r--Emby.Server.Implementations/IO/SharpCifs/Util/Sharpen/Collections.cs1
-rw-r--r--Emby.Server.Implementations/Library/LibraryManager.cs6
-rw-r--r--Emby.Server.Implementations/Library/SearchEngine.cs4
-rw-r--r--Emby.Server.Implementations/Library/UserViewManager.cs2
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs2
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvManager.cs22
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs2
-rw-r--r--Emby.Server.Implementations/Networking/NetworkManager.cs2
-rw-r--r--Emby.Server.Implementations/Playlists/PlaylistManager.cs4
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs2
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs142
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs5
-rw-r--r--Emby.Server.Implementations/Security/AuthenticationRepository.cs4
-rw-r--r--Emby.Server.Implementations/Services/ServiceExec.cs4
-rw-r--r--Emby.Server.Implementations/Services/ServicePath.cs10
-rw-r--r--Emby.Server.Implementations/Session/SessionManager.cs10
28 files changed, 113 insertions, 228 deletions
diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
index 079d0af0a..e4b65b58d 100644
--- a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
+++ b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
@@ -466,7 +466,7 @@ namespace Emby.Server.Implementations.Activity
{
Name = string.Format(_localization.GetLocalizedString("ScheduledTaskFailedWithName"), task.Name),
Type = NotificationType.TaskFailed.ToString(),
- Overview = string.Join(Environment.NewLine, vals.ToArray(vals.Count)),
+ Overview = string.Join(Environment.NewLine, vals.ToArray()),
ShortOverview = runningTime,
Severity = LogSeverity.Error
});
diff --git a/Emby.Server.Implementations/Activity/ActivityRepository.cs b/Emby.Server.Implementations/Activity/ActivityRepository.cs
index ce9f460ff..7f76d724b 100644
--- a/Emby.Server.Implementations/Activity/ActivityRepository.cs
+++ b/Emby.Server.Implementations/Activity/ActivityRepository.cs
@@ -189,13 +189,13 @@ namespace Emby.Server.Implementations.Activity
var whereTextWithoutPaging = whereClauses.Count == 0 ?
string.Empty :
- " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count));
+ " where " + string.Join(" AND ", whereClauses.ToArray());
if (startIndex.HasValue && startIndex.Value > 0)
{
var pagingWhereText = whereClauses.Count == 0 ?
string.Empty :
- " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count));
+ " where " + string.Join(" AND ", whereClauses.ToArray());
whereClauses.Add(string.Format("Id NOT IN (SELECT Id FROM ActivityLog {0} ORDER BY DateCreated DESC LIMIT {1})",
pagingWhereText,
@@ -204,7 +204,7 @@ namespace Emby.Server.Implementations.Activity
var whereText = whereClauses.Count == 0 ?
string.Empty :
- " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count));
+ " where " + string.Join(" AND ", whereClauses.ToArray());
commandText += whereText;
@@ -249,7 +249,7 @@ namespace Emby.Server.Implementations.Activity
result.TotalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
}
- result.Items = list.ToArray(list.Count);
+ result.Items = list.ToArray();
return result;
}, ReadTransactionMode);
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index c6cfe7214..ad15b015d 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -728,7 +728,7 @@ namespace Emby.Server.Implementations
Logger.Info("ServerId: {0}", SystemId);
- var entryPoints = GetExports<IServerEntryPoint>().ToList();
+ var entryPoints = GetExports<IServerEntryPoint>();
RunEntryPoints(entryPoints, true);
Logger.Info("Core startup complete");
@@ -1962,6 +1962,7 @@ namespace Emby.Server.Implementations
public async Task<SystemInfo> GetSystemInfo(CancellationToken cancellationToken)
{
var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
+ var wanAddress = await GetWanApiUrl(cancellationToken).ConfigureAwait(false);
return new SystemInfo
{
@@ -1984,8 +1985,7 @@ namespace Emby.Server.Implementations
CanSelfRestart = CanSelfRestart,
CanSelfUpdate = CanSelfUpdate,
CanLaunchWebBrowser = CanLaunchWebBrowser,
- // TODO - remove WanAddress
- WanAddress = "0.0.0.0",
+ WanAddress = wanAddress,
HasUpdateAvailable = HasUpdateAvailable,
SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
TranscodingTempPath = ApplicationPaths.TranscodingTempPath,
@@ -2012,14 +2012,13 @@ namespace Emby.Server.Implementations
public async Task<PublicSystemInfo> GetPublicSystemInfo(CancellationToken cancellationToken)
{
var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
-
+ var wanAddress = await GetWanApiUrl(cancellationToken).ConfigureAwait(false);
return new PublicSystemInfo
{
Version = ApplicationVersion.ToString(),
Id = SystemId,
OperatingSystem = EnvironmentInfo.OperatingSystem.ToString(),
- // TODO - remove WanAddress
- WanAddress = "0.0.0.0",
+ WanAddress = wanAddress,
ServerName = FriendlyName,
LocalAddress = localAddress
};
@@ -2060,6 +2059,32 @@ namespace Emby.Server.Implementations
return null;
}
+ public async Task<string> GetWanApiUrl(CancellationToken cancellationToken)
+ {
+ var url = "http://ipv4.icanhazip.com";
+ try
+ {
+ using (var response = await HttpClient.Get(new HttpRequestOptions
+ {
+ Url = url,
+ LogErrorResponseBody = false,
+ LogErrors = false,
+ LogRequest = false,
+ TimeoutMs = 10000,
+ BufferContent = false,
+ CancellationToken = cancellationToken
+ }))
+ {
+ return GetLocalApiUrl(response.ReadToEnd().Trim());
+ }
+ }
+ catch(Exception ex)
+ {
+ Logger.ErrorException("Error getting WAN Ip address information", ex);
+ }
+ return null;
+ }
+
public string GetLocalApiUrl(IpAddressInfo ipAddress)
{
if (ipAddress.AddressFamily == IpAddressFamily.InterNetworkV6)
diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs
index e61c5e283..dfc9c3474 100644
--- a/Emby.Server.Implementations/Channels/ChannelManager.cs
+++ b/Emby.Server.Implementations/Channels/ChannelManager.cs
@@ -239,7 +239,7 @@ namespace Emby.Server.Implementations.Channels
all = all.Take(query.Limit.Value).ToList();
}
- var returnItems = all.ToArray(all.Count);
+ var returnItems = all.ToArray();
if (query.RefreshLatestChannelItems)
{
@@ -1011,7 +1011,7 @@ namespace Emby.Server.Implementations.Channels
{
item.Name = info.Name;
item.Genres = info.Genres.ToArray();
- item.Studios = info.Studios.ToArray(info.Studios.Count);
+ item.Studios = info.Studios.ToArray();
item.CommunityRating = info.CommunityRating;
item.Overview = info.Overview;
item.IndexNumber = info.IndexNumber;
@@ -1021,7 +1021,7 @@ namespace Emby.Server.Implementations.Channels
item.ProviderIds = info.ProviderIds;
item.OfficialRating = info.OfficialRating;
item.DateCreated = info.DateCreated ?? DateTime.UtcNow;
- item.Tags = info.Tags.ToArray(info.Tags.Count);
+ item.Tags = info.Tags.ToArray();
item.OriginalTitle = info.OriginalTitle;
}
else if (info.Type == ChannelItemType.Folder && info.FolderType == ChannelFolderType.Container)
@@ -1043,7 +1043,7 @@ namespace Emby.Server.Implementations.Channels
var hasAlbumArtists = item as IHasAlbumArtist;
if (hasAlbumArtists != null)
{
- hasAlbumArtists.AlbumArtists = info.AlbumArtists.ToArray(info.AlbumArtists.Count);
+ hasAlbumArtists.AlbumArtists = info.AlbumArtists.ToArray();
}
var trailer = item as Trailer;
diff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.cs
index 675a726e5..bcfc58ca1 100644
--- a/Emby.Server.Implementations/Collections/CollectionManager.cs
+++ b/Emby.Server.Implementations/Collections/CollectionManager.cs
@@ -219,7 +219,7 @@ namespace Emby.Server.Implementations.Collections
{
var newList = collection.LinkedChildren.ToList();
newList.AddRange(list);
- collection.LinkedChildren = newList.ToArray(newList.Count);
+ collection.LinkedChildren = newList.ToArray();
collection.UpdateRatingToItems(linkedChildrenList);
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
index c9495c574..50cd69304 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -1148,7 +1148,7 @@ namespace Emby.Server.Implementations.Data
}
}
- item.ImageInfos = list.ToArray(list.Count);
+ item.ImageInfos = list.ToArray();
}
public string ToValueString(ItemImageInfo image)
@@ -2566,7 +2566,7 @@ namespace Emby.Server.Implementations.Data
excludeIds.Add(item.Id);
excludeIds.AddRange(item.ExtraIds);
- query.ExcludeItemIds = excludeIds.ToArray(excludeIds.Count);
+ query.ExcludeItemIds = excludeIds.ToArray();
query.ExcludeProviderIds = item.ProviderIds;
}
@@ -2587,7 +2587,7 @@ namespace Emby.Server.Implementations.Data
list.Add(builder.ToString());
}
- return list.ToArray(list.Count);
+ return list.ToArray();
}
private void BindSearchParams(InternalItemsQuery query, IStatement statement)
@@ -2666,7 +2666,7 @@ namespace Emby.Server.Implementations.Data
if (groups.Count > 0)
{
- return " Group by " + string.Join(",", groups.ToArray(groups.Count));
+ return " Group by " + string.Join(",", groups.ToArray());
}
return string.Empty;
@@ -2703,7 +2703,7 @@ namespace Emby.Server.Implementations.Data
var whereText = whereClauses.Count == 0 ?
string.Empty :
- " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count));
+ " where " + string.Join(" AND ", whereClauses.ToArray());
commandText += whereText;
@@ -2761,7 +2761,7 @@ namespace Emby.Server.Implementations.Data
var whereText = whereClauses.Count == 0 ?
string.Empty :
- " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count));
+ " where " + string.Join(" AND ", whereClauses.ToArray());
commandText += whereText;
@@ -2938,7 +2938,7 @@ namespace Emby.Server.Implementations.Data
var returnList = GetItemList(query);
return new QueryResult<BaseItem>
{
- Items = returnList.ToArray(returnList.Count),
+ Items = returnList.ToArray(),
TotalRecordCount = returnList.Count
};
}
@@ -2961,7 +2961,7 @@ namespace Emby.Server.Implementations.Data
var whereText = whereClauses.Count == 0 ?
string.Empty :
- " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count));
+ " where " + string.Join(" AND ", whereClauses.ToArray());
var whereTextWithoutPaging = whereText;
@@ -3079,7 +3079,7 @@ namespace Emby.Server.Implementations.Data
LogQueryTime("GetItems", commandText, now);
- result.Items = list.ToArray(list.Count);
+ result.Items = list.ToArray();
return result;
}, ReadTransactionMode);
@@ -3227,7 +3227,7 @@ namespace Emby.Server.Implementations.Data
var whereText = whereClauses.Count == 0 ?
string.Empty :
- " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count));
+ " where " + string.Join(" AND ", whereClauses.ToArray());
commandText += whereText;
@@ -3299,7 +3299,7 @@ namespace Emby.Server.Implementations.Data
var whereText = whereClauses.Count == 0 ?
string.Empty :
- " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count));
+ " where " + string.Join(" AND ", whereClauses.ToArray());
commandText += whereText;
@@ -3372,7 +3372,7 @@ namespace Emby.Server.Implementations.Data
var returnList = GetItemIdsList(query);
return new QueryResult<Guid>
{
- Items = returnList.ToArray(returnList.Count),
+ Items = returnList.ToArray(),
TotalRecordCount = returnList.Count
};
}
@@ -3387,7 +3387,7 @@ namespace Emby.Server.Implementations.Data
var whereText = whereClauses.Count == 0 ?
string.Empty :
- " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count));
+ " where " + string.Join(" AND ", whereClauses.ToArray());
var whereTextWithoutPaging = whereText;
@@ -3495,7 +3495,7 @@ namespace Emby.Server.Implementations.Data
LogQueryTime("GetItemIds", commandText, now);
- result.Items = list.ToArray(list.Count);
+ result.Items = list.ToArray();
return result;
}, ReadTransactionMode);
@@ -3690,7 +3690,7 @@ namespace Emby.Server.Implementations.Data
statement.TryBind("@IsMovie", true);
}
- whereClauses.Add("(" + string.Join(" OR ", programAttribtues.ToArray(programAttribtues.Count)) + ")");
+ whereClauses.Add("(" + string.Join(" OR ", programAttribtues.ToArray()) + ")");
}
else if (query.IsMovie.HasValue)
{
@@ -5813,7 +5813,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
{
result.TotalRecordCount = list.Count;
}
- result.Items = list.ToArray(list.Count);
+ result.Items = list.ToArray();
return result;
diff --git a/Emby.Server.Implementations/Devices/DeviceManager.cs b/Emby.Server.Implementations/Devices/DeviceManager.cs
index 0fac886ef..5c84590ae 100644
--- a/Emby.Server.Implementations/Devices/DeviceManager.cs
+++ b/Emby.Server.Implementations/Devices/DeviceManager.cs
@@ -289,7 +289,7 @@ namespace Emby.Server.Implementations.Devices
var list = history.FilesUploaded.ToList();
list.Add(file);
- history.FilesUploaded = list.ToArray(list.Count);
+ history.FilesUploaded = list.ToArray();
_json.SerializeToFile(history, path);
}
@@ -501,4 +501,4 @@ namespace Emby.Server.Implementations.Devices
return config.GetConfiguration<DevicesOptions>("devices");
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index 437917c45..0831b1075 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -648,7 +648,7 @@ namespace Emby.Server.Implementations.Dto
}
}
- dto.People = list.ToArray(list.Count);
+ dto.People = list.ToArray();
}
/// <summary>
diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
index 6801b2823..aa672a1b7 100644
--- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
+++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
@@ -12,7 +12,6 @@ using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Threading;
using Mono.Nat;
-using MediaBrowser.Model.Extensions;
using System.Threading;
namespace Emby.Server.Implementations.EntryPoints
@@ -59,7 +58,7 @@ namespace Emby.Server.Implementations.EntryPoints
values.Add(_appHost.EnableHttps.ToString());
values.Add((config.EnableRemoteAccess).ToString());
- return string.Join("|", values.ToArray(values.Count));
+ return string.Join("|", values.ToArray());
}
void _config_ConfigurationUpdated(object sender, EventArgs e)
@@ -316,4 +315,4 @@ namespace Emby.Server.Implementations.EntryPoints
}
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs
index 97feb32c0..450764040 100644
--- a/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs
+++ b/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs
@@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.EntryPoints
session.ApplicationVersion
};
- var key = string.Join("_", keys.ToArray(keys.Count)).GetMD5();
+ var key = string.Join("_", keys.ToArray()).GetMD5();
ClientInfo info;
if (!_apps.TryGetValue(key, out info))
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
index 0093258e3..70a233c6f 100644
--- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
@@ -825,7 +825,7 @@ namespace Emby.Server.Implementations.HttpServer
});
}
- return routes.ToArray(routes.Count);
+ return routes.ToArray();
}
public Func<string, object> GetParseFn(Type propertyType)
@@ -954,4 +954,4 @@ namespace Emby.Server.Implementations.HttpServer
_listener.Start(UrlPrefixes);
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
index df493b4c3..a0a471cb2 100644
--- a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -112,12 +112,15 @@ namespace Emby.Server.Implementations.HttpServer
/// </summary>
private IHasHeaders GetHttpResult(IRequest requestContext, byte[] content, string contentType, bool addCachePrevention, IDictionary<string, string> responseHeaders = null)
{
- IHasHeaders result;
-
- var compressionType = requestContext == null ? null : GetCompressionType(requestContext, content, contentType);
+ string compressionType = null;
+ bool isHeadRequest = false;
- var isHeadRequest = string.Equals(requestContext.Verb, "head", StringComparison.OrdinalIgnoreCase);
+ if (requestContext != null) {
+ compressionType = GetCompressionType(requestContext, content, contentType);
+ isHeadRequest = string.Equals(requestContext.Verb, "head", StringComparison.OrdinalIgnoreCase);
+ }
+ IHasHeaders result;
if (string.IsNullOrEmpty(compressionType))
{
var contentLength = content.Length;
@@ -791,4 +794,4 @@ namespace Emby.Server.Implementations.HttpServer
{
byte[] Compress(byte[] content);
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/IO/SharpCifs/Util/Sharpen/Collections.cs b/Emby.Server.Implementations/IO/SharpCifs/Util/Sharpen/Collections.cs
index 4432e62fb..8560a2dc2 100644
--- a/Emby.Server.Implementations/IO/SharpCifs/Util/Sharpen/Collections.cs
+++ b/Emby.Server.Implementations/IO/SharpCifs/Util/Sharpen/Collections.cs
@@ -2,6 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+// TODO: @bond Remove
namespace SharpCifs.Util.Sharpen
{
internal static class Collections<T>
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index 17516d6b9..bd823e0c1 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -730,7 +730,7 @@ namespace Emby.Server.Implementations.Library
_fileSystem.CreateDirectory(rootFolderPath);
- var rootFolder = GetItemById(GetNewItemId(rootFolderPath, typeof(AggregateFolder))) as AggregateFolder ?? (AggregateFolder)ResolvePath(_fileSystem.GetDirectoryInfo(rootFolderPath));
+ var rootFolder = GetItemById(GetNewItemId(rootFolderPath, typeof(AggregateFolder))) as AggregateFolder ?? ((Folder)ResolvePath(_fileSystem.GetDirectoryInfo(rootFolderPath))).DeepCopy<Folder,AggregateFolder>();
// In case program data folder was moved
if (!string.Equals(rootFolder.Path, rootFolderPath, StringComparison.Ordinal))
@@ -799,7 +799,7 @@ namespace Emby.Server.Implementations.Library
if (tmpItem == null)
{
- tmpItem = (UserRootFolder)ResolvePath(_fileSystem.GetDirectoryInfo(userRootPath));
+ tmpItem = ((Folder)ResolvePath(_fileSystem.GetDirectoryInfo(userRootPath))).DeepCopy<Folder,UserRootFolder>();
}
// In case program data folder was moved
@@ -1493,7 +1493,7 @@ namespace Emby.Server.Implementations.Library
return new QueryResult<BaseItem>
{
- Items = list.ToArray(list.Count)
+ Items = list.ToArray()
};
}
diff --git a/Emby.Server.Implementations/Library/SearchEngine.cs b/Emby.Server.Implementations/Library/SearchEngine.cs
index 7f04ac5bc..a7db46ef2 100644
--- a/Emby.Server.Implementations/Library/SearchEngine.cs
+++ b/Emby.Server.Implementations/Library/SearchEngine.cs
@@ -161,8 +161,8 @@ namespace Emby.Server.Implementations.Library
var searchQuery = new InternalItemsQuery(user)
{
SearchTerm = searchTerm,
- ExcludeItemTypes = excludeItemTypes.ToArray(excludeItemTypes.Count),
- IncludeItemTypes = includeItemTypes.ToArray(includeItemTypes.Count),
+ ExcludeItemTypes = excludeItemTypes.ToArray(),
+ IncludeItemTypes = includeItemTypes.ToArray(),
Limit = query.Limit,
IncludeItemsByName = string.IsNullOrEmpty(query.ParentId),
ParentId = string.IsNullOrEmpty(query.ParentId) ? Guid.Empty : new Guid(query.ParentId),
diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.cs
index 42f922710..aae5751de 100644
--- a/Emby.Server.Implementations/Library/UserViewManager.cs
+++ b/Emby.Server.Implementations/Library/UserViewManager.cs
@@ -354,7 +354,7 @@ namespace Emby.Server.Implementations.Library
Limit = limit * 5,
IsPlayed = isPlayed,
DtoOptions = options,
- MediaTypes = mediaTypes.ToArray(mediaTypes.Count)
+ MediaTypes = mediaTypes.ToArray()
};
if (parents.Count == 0)
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
index 56b3b5e4b..b0ffd057d 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
@@ -139,7 +139,7 @@ namespace Emby.Server.Implementations.LiveTv
dto.ProgramId = GetInternalProgramId(info.ProgramId).ToString("N");
}
- dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days.ToArray(info.Days.Count));
+ dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days.ToArray());
FillImages(dto, info.Name, info.SeriesId);
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
index 9cdf105d7..2e9679678 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -1140,7 +1140,7 @@ namespace Emby.Server.Implementations.LiveTv
var dtoOptions = new DtoOptions();
var fields = dtoOptions.Fields.ToList();
fields.Remove(ItemFields.BasicSyncInfo);
- dtoOptions.Fields = fields.ToArray(fields.Count);
+ dtoOptions.Fields = fields.ToArray();
progress.Report(100);
}
@@ -1458,16 +1458,16 @@ namespace Emby.Server.Implementations.LiveTv
{
MediaTypes = new[] { MediaType.Video },
Recursive = true,
- AncestorIds = folderIds.ToArray(folderIds.Count),
+ AncestorIds = folderIds.ToArray(),
IsFolder = false,
IsVirtualItem = false,
Limit = limit,
StartIndex = query.StartIndex,
OrderBy = new[] { new ValueTuple<string, SortOrder>(ItemSortBy.DateCreated, SortOrder.Descending) },
EnableTotalRecordCount = query.EnableTotalRecordCount,
- IncludeItemTypes = includeItemTypes.ToArray(includeItemTypes.Count),
- ExcludeItemTypes = excludeItemTypes.ToArray(excludeItemTypes.Count),
- Genres = genres.ToArray(genres.Count),
+ IncludeItemTypes = includeItemTypes.ToArray(),
+ ExcludeItemTypes = excludeItemTypes.ToArray(),
+ Genres = genres.ToArray(),
DtoOptions = dtoOptions
});
@@ -1791,7 +1791,7 @@ namespace Emby.Server.Implementations.LiveTv
var returnArray = returnList
.OrderBy(i => i.StartDate)
- .ToArray(returnList.Count);
+ .ToArray();
return new QueryResult<TimerInfoDto>
{
@@ -2338,7 +2338,7 @@ namespace Emby.Server.Implementations.LiveTv
fields.Remove(ItemFields.CanDownload);
fields.Remove(ItemFields.DisplayPreferencesId);
fields.Remove(ItemFields.Etag);
- options.Fields = fields.ToArray(fields.Count);
+ options.Fields = fields.ToArray();
}
public Folder GetInternalLiveTvFolder(CancellationToken cancellationToken)
@@ -2373,7 +2373,7 @@ namespace Emby.Server.Implementations.LiveTv
{
info.Id = Guid.NewGuid().ToString("N");
list.Add(info);
- config.TunerHosts = list.ToArray(list.Count);
+ config.TunerHosts = list.ToArray();
}
else
{
@@ -2412,7 +2412,7 @@ namespace Emby.Server.Implementations.LiveTv
{
info.Id = Guid.NewGuid().ToString("N");
list.Add(info);
- config.ListingProviders = list.ToArray(list.Count);
+ config.ListingProviders = list.ToArray();
}
else
{
@@ -2451,7 +2451,7 @@ namespace Emby.Server.Implementations.LiveTv
Name = tunerChannelId,
Value = providerChannelId
});
- listingsProviderInfo.ChannelMappings = list.ToArray(list.Count);
+ listingsProviderInfo.ChannelMappings = list.ToArray();
}
_config.SaveConfiguration("livetv", config);
@@ -2602,4 +2602,4 @@ namespace Emby.Server.Implementations.LiveTv
return folders.Cast<BaseItem>().ToList();
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs
index 808672d46..26a84a275 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs
@@ -106,7 +106,7 @@ namespace Emby.Server.Implementations.LiveTv
openKeys.Add(item.GetType().Name);
openKeys.Add(item.Id.ToString("N"));
openKeys.Add(source.Id ?? string.Empty);
- source.OpenToken = string.Join(StreamIdDelimeterString, openKeys.ToArray(openKeys.Count));
+ source.OpenToken = string.Join(StreamIdDelimeterString, openKeys.ToArray());
}
// Dummy this up so that direct play checks can still run
diff --git a/Emby.Server.Implementations/Networking/NetworkManager.cs b/Emby.Server.Implementations/Networking/NetworkManager.cs
index 20abaf27c..4699b5bd4 100644
--- a/Emby.Server.Implementations/Networking/NetworkManager.cs
+++ b/Emby.Server.Implementations/Networking/NetworkManager.cs
@@ -706,7 +706,7 @@ namespace Emby.Server.Implementations.Networking
public async Task<IpAddressInfo[]> GetHostAddressesAsync(string host)
{
var addresses = await Dns.GetHostAddressesAsync(host).ConfigureAwait(false);
- return addresses.Select(ToIpAddressInfo).ToArray(addresses.Length);
+ return addresses.Select(ToIpAddressInfo).ToArray();
}
/// <summary>
diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
index e0a6f56ec..1e8d30ab9 100644
--- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs
+++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
@@ -208,7 +208,7 @@ namespace Emby.Server.Implementations.Playlists
var newList = playlist.LinkedChildren.ToList();
newList.AddRange(list);
- playlist.LinkedChildren = newList.ToArray(newList.Count);
+ playlist.LinkedChildren = newList.ToArray();
playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
@@ -290,7 +290,7 @@ namespace Emby.Server.Implementations.Playlists
newList.Insert(newIndex, item);
}
- playlist.LinkedChildren = newList.ToArray(newList.Count);
+ playlist.LinkedChildren = newList.ToArray();
playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
diff --git a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs
index 7a5efded3..8ed2dbaed 100644
--- a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs
@@ -145,7 +145,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
_fileSystem.CreateDirectory(parentPath);
- _fileSystem.WriteAllText(failHistoryPath, string.Join("|", previouslyFailedImages.ToArray(previouslyFailedImages.Count)));
+ _fileSystem.WriteAllText(failHistoryPath, string.Join("|", previouslyFailedImages.ToArray()));
}
numComplete++;
diff --git a/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs
deleted file mode 100644
index 691112638..000000000
--- a/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-using MediaBrowser.Common;
-using MediaBrowser.Common.Updates;
-using MediaBrowser.Model.Logging;
-using MediaBrowser.Model.Net;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using MediaBrowser.Common.Progress;
-using MediaBrowser.Model.Tasks;
-
-namespace Emby.Server.Implementations.ScheduledTasks
-{
- /// <summary>
- /// Plugin Update Task
- /// </summary>
- public class PluginUpdateTask : IScheduledTask, IConfigurableScheduledTask
- {
- /// <summary>
- /// The _logger
- /// </summary>
- private readonly ILogger _logger;
-
- private readonly IInstallationManager _installationManager;
-
- private readonly IApplicationHost _appHost;
-
- public PluginUpdateTask(ILogger logger, IInstallationManager installationManager, IApplicationHost appHost)
- {
- _logger = logger;
- _installationManager = installationManager;
- _appHost = appHost;
- }
-
- /// <summary>
- /// Creates the triggers that define when the task will run
- /// </summary>
- /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
- public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
- {
- return new[] {
-
- // At startup
- new TaskTriggerInfo {Type = TaskTriggerInfo.TriggerStartup},
-
- // Every so often
- new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
- };
- }
-
- public string Key
- {
- get { return "PluginUpdates"; }
- }
-
- /// <summary>
- /// Update installed plugins
- /// </summary>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <param name="progress">The progress.</param>
- /// <returns>Task.</returns>
- public async Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
- {
- progress.Report(0);
-
- var packagesToInstall = (await _installationManager.GetAvailablePluginUpdates(_appHost.ApplicationVersion, true, cancellationToken).ConfigureAwait(false)).ToList();
-
- progress.Report(10);
-
- var numComplete = 0;
-
- foreach (var package in packagesToInstall)
- {
- cancellationToken.ThrowIfCancellationRequested();
-
- try
- {
- await _installationManager.InstallPackage(package, true, new SimpleProgress<double>(), cancellationToken).ConfigureAwait(false);
- }
- catch (OperationCanceledException)
- {
- // InstallPackage has it's own inner cancellation token, so only throw this if it's ours
- if (cancellationToken.IsCancellationRequested)
- {
- throw;
- }
- }
- catch (HttpException ex)
- {
- _logger.ErrorException("Error downloading {0}", ex, package.name);
- }
- catch (IOException ex)
- {
- _logger.ErrorException("Error updating {0}", ex, package.name);
- }
-
- // Update progress
- lock (progress)
- {
- numComplete++;
- double percent = numComplete;
- percent /= packagesToInstall.Count;
-
- progress.Report(90 * percent + 10);
- }
- }
-
- progress.Report(100);
- }
-
- /// <summary>
- /// Gets the name of the task
- /// </summary>
- /// <value>The name.</value>
- public string Name
- {
- get { return "Check for plugin updates"; }
- }
-
- /// <summary>
- /// Gets the description.
- /// </summary>
- /// <value>The description.</value>
- public string Description
- {
- get { return "Downloads and installs updates for plugins that are configured to update automatically."; }
- }
-
- public string Category
- {
- get { return "Application"; }
- }
-
- public bool IsHidden => true;
-
- public bool IsEnabled => true;
-
- public bool IsLogged => true;
- }
-} \ No newline at end of file
diff --git a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
index f6397b670..eeb38bf54 100644
--- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
@@ -9,7 +9,6 @@ using MediaBrowser.Common.Events;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Progress;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
@@ -276,7 +275,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
get
{
var triggers = InternalTriggers;
- return triggers.Select(i => i.Item1).ToArray(triggers.Length);
+ return triggers.Select(i => i.Item1).ToArray();
}
set
{
@@ -290,7 +289,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
SaveTriggers(triggerList);
- InternalTriggers = triggerList.Select(i => new Tuple<TaskTriggerInfo, ITaskTrigger>(i, GetTrigger(i))).ToArray(triggerList.Length);
+ InternalTriggers = triggerList.Select(i => new Tuple<TaskTriggerInfo, ITaskTrigger>(i, GetTrigger(i))).ToArray();
}
}
diff --git a/Emby.Server.Implementations/Security/AuthenticationRepository.cs b/Emby.Server.Implementations/Security/AuthenticationRepository.cs
index 45f7f1e95..f75eb6364 100644
--- a/Emby.Server.Implementations/Security/AuthenticationRepository.cs
+++ b/Emby.Server.Implementations/Security/AuthenticationRepository.cs
@@ -241,7 +241,7 @@ namespace Emby.Server.Implementations.Security
var whereTextWithoutPaging = whereClauses.Count == 0 ?
string.Empty :
- " where " + string.Join(" AND ", whereClauses.ToArray(whereClauses.Count));
+ " where " + string.Join(" AND ", whereClauses.ToArray());
commandText += whereTextWithoutPaging;
@@ -298,7 +298,7 @@ namespace Emby.Server.Implementations.Security
}
}
- result.Items = list.ToArray(list.Count);
+ result.Items = list.ToArray();
return result;
}, ReadTransactionMode);
diff --git a/Emby.Server.Implementations/Services/ServiceExec.cs b/Emby.Server.Implementations/Services/ServiceExec.cs
index 79b57438c..9516c1e38 100644
--- a/Emby.Server.Implementations/Services/ServiceExec.cs
+++ b/Emby.Server.Implementations/Services/ServiceExec.cs
@@ -181,7 +181,7 @@ namespace Emby.Server.Implementations.Services
}
if (reqFilters.Count > 0)
- actionCtx.RequestFilters = reqFilters.OrderBy(i => i.Priority).ToArray(reqFilters.Count);
+ actionCtx.RequestFilters = reqFilters.OrderBy(i => i.Priority).ToArray();
actions.Add(actionCtx);
}
@@ -220,4 +220,4 @@ namespace Emby.Server.Implementations.Services
}
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/Services/ServicePath.cs b/Emby.Server.Implementations/Services/ServicePath.cs
index 282269e7b..f0e80c216 100644
--- a/Emby.Server.Implementations/Services/ServicePath.cs
+++ b/Emby.Server.Implementations/Services/ServicePath.cs
@@ -132,13 +132,13 @@ namespace Emby.Server.Implementations.Services
}
}
- var components = componentsList.ToArray(componentsList.Count);
+ var components = componentsList.ToArray();
this.TotalComponentsCount = components.Length;
this.literalsToMatch = new string[this.TotalComponentsCount];
this.variablesNames = new string[this.TotalComponentsCount];
this.isWildcard = new bool[this.TotalComponentsCount];
- this.componentsWithSeparators = hasSeparators.ToArray(hasSeparators.Count);
+ this.componentsWithSeparators = hasSeparators.ToArray();
this.PathComponentsCount = this.componentsWithSeparators.Length;
string firstLiteralMatch = null;
@@ -297,7 +297,7 @@ namespace Emby.Server.Implementations.Services
if (mi != null && mi.IsStatic) continue;
pis.Add(pi);
}
- return pis.ToArray(pis.Count);
+ return pis.ToArray();
}
/// <summary>
@@ -463,7 +463,7 @@ namespace Emby.Server.Implementations.Services
}
}
- withPathInfoParts = totalComponents.ToArray(totalComponents.Count);
+ withPathInfoParts = totalComponents.ToArray();
return true;
}
@@ -574,4 +574,4 @@ namespace Emby.Server.Implementations.Services
}
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
index df7f231c7..a2102dc45 100644
--- a/Emby.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -1042,7 +1042,7 @@ namespace Emby.Server.Implementations.Session
command.PlayCommand = PlayCommand.PlayNow;
}
- command.ItemIds = items.Select(i => i.Id).ToArray(items.Count);
+ command.ItemIds = items.Select(i => i.Id).ToArray();
if (user != null)
{
@@ -1070,7 +1070,7 @@ namespace Emby.Server.Implementations.Session
if (episodes.Count > 0)
{
- command.ItemIds = episodes.Select(i => i.Id).ToArray(episodes.Count);
+ command.ItemIds = episodes.Select(i => i.Id).ToArray();
}
}
}
@@ -1316,7 +1316,7 @@ namespace Emby.Server.Implementations.Session
UserName = user.Name
});
- session.AdditionalUsers = list.ToArray(list.Count);
+ session.AdditionalUsers = list.ToArray();
}
}
@@ -1345,7 +1345,7 @@ namespace Emby.Server.Implementations.Session
var list = session.AdditionalUsers.ToList();
list.Remove(user);
- session.AdditionalUsers = list.ToArray(list.Count);
+ session.AdditionalUsers = list.ToArray();
}
}
@@ -1669,7 +1669,7 @@ namespace Emby.Server.Implementations.Session
fields.Remove(ItemFields.Tags);
fields.Remove(ItemFields.ExtraIds);
- dtoOptions.Fields = fields.ToArray(fields.Count);
+ dtoOptions.Fields = fields.ToArray();
_itemInfoDtoOptions = dtoOptions;
}