aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations')
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs10
-rw-r--r--Emby.Server.Implementations/Channels/ChannelManager.cs2
-rw-r--r--Emby.Server.Implementations/Data/SqliteItemRepository.cs6
-rw-r--r--Emby.Server.Implementations/Dto/DtoService.cs2
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs2
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs61
-rw-r--r--Emby.Server.Implementations/Notifications/Notifications.cs4
-rw-r--r--Emby.Server.Implementations/Services/ServiceHandler.cs8
-rw-r--r--Emby.Server.Implementations/Sorting/ArtistComparer.cs2
-rw-r--r--Emby.Server.Implementations/Updates/InstallationManager.cs91
10 files changed, 94 insertions, 94 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index ea6c2aaf5..6441fe4f2 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -861,7 +861,7 @@ namespace Emby.Server.Implementations
SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, LogManager, FileSystemManager, CryptographyProvider);
RegisterSingleInstance(SecurityManager);
- InstallationManager = new InstallationManager(LogManager.GetLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ConfigurationManager, FileSystemManager, CryptographyProvider);
+ InstallationManager = new InstallationManager(LogManager.GetLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ConfigurationManager, FileSystemManager, CryptographyProvider, PackageRuntime);
RegisterSingleInstance(InstallationManager);
ZipClient = new ZipClient(FileSystemManager);
@@ -1048,6 +1048,14 @@ namespace Emby.Server.Implementations
await ((UserManager)UserManager).Initialize().ConfigureAwait(false);
}
+ protected virtual string PackageRuntime
+ {
+ get
+ {
+ return "netframework";
+ }
+ }
+
public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths, bool isStartup)
{
logger.LogMultiline("Emby", LogSeverity.Info, GetBaseExceptionMessage(appPaths));
diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs
index 28a150370..d8d69a62e 100644
--- a/Emby.Server.Implementations/Channels/ChannelManager.cs
+++ b/Emby.Server.Implementations/Channels/ChannelManager.cs
@@ -1330,7 +1330,7 @@ namespace Emby.Server.Implementations.Channels
var hasArtists = item as IHasArtist;
if (hasArtists != null)
{
- hasArtists.Artists = info.Artists;
+ hasArtists.Artists = info.Artists.ToArray();
}
var hasAlbumArtists = item as IHasAlbumArtist;
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
index 064a66cd0..423ad2782 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -1028,9 +1028,9 @@ namespace Emby.Server.Implementations.Data
var hasArtists = item as IHasArtist;
if (hasArtists != null)
{
- if (hasArtists.Artists.Count > 0)
+ if (hasArtists.Artists.Length > 0)
{
- artists = string.Join("|", hasArtists.Artists.ToArray());
+ artists = string.Join("|", hasArtists.Artists);
}
}
saveItemStatement.TryBind("@Artists", artists);
@@ -1908,7 +1908,7 @@ namespace Emby.Server.Implementations.Data
var hasArtists = item as IHasArtist;
if (hasArtists != null && !reader.IsDBNull(index))
{
- hasArtists.Artists = reader.GetString(index).Split('|').Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
+ hasArtists.Artists = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
}
index++;
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index 17e91bfa8..028257270 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -1617,7 +1617,7 @@ namespace Emby.Server.Implementations.Dto
return null;
}
- var supportedEnhancers = _imageProcessor.GetSupportedEnhancers(item, ImageType.Primary).ToList();
+ var supportedEnhancers = _imageProcessor.GetSupportedEnhancers(item, ImageType.Primary);
ImageSize size;
diff --git a/Emby.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs b/Emby.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs
index 6c7c1f052..6a1f8ec6f 100644
--- a/Emby.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs
@@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
return new CollectionFolder
{
CollectionType = GetCollectionType(args),
- PhysicalLocationsList = args.PhysicalLocations.ToList()
+ PhysicalLocationsList = args.PhysicalLocations
};
}
}
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index f3d40ae19..2e12f46bf 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -607,20 +607,22 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var timer = _timerProvider.GetTimer(timerId);
if (timer != null)
{
+ timer.Status = RecordingStatus.Cancelled;
+
if (string.IsNullOrWhiteSpace(timer.SeriesTimerId) || isSeriesCancelled)
{
_timerProvider.Delete(timer);
}
else
{
- timer.Status = RecordingStatus.Cancelled;
_timerProvider.AddOrUpdate(timer, false);
}
}
ActiveRecordingInfo activeRecordingInfo;
if (_activeRecordings.TryGetValue(timerId, out activeRecordingInfo))
- {
+ {
+ activeRecordingInfo.Timer = timer;
activeRecordingInfo.CancellationTokenSource.Cancel();
}
}
@@ -865,7 +867,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
public async Task<IEnumerable<RecordingInfo>> GetRecordingsAsync(CancellationToken cancellationToken)
{
return new List<RecordingInfo>();
- //return _activeRecordings.Values.ToList().Select(GetRecordingInfo).ToList();
}
public string GetActiveRecordingPath(string id)
@@ -881,7 +882,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
public IEnumerable<ActiveRecordingInfo> GetAllActiveRecordings()
{
- return _activeRecordings.Values;
+ return _activeRecordings.Values.Where(i => i.Timer.Status == RecordingStatus.InProgress && !i.CancellationTokenSource.IsCancellationRequested);
}
public ActiveRecordingInfo GetActiveRecordingInfo(string path)
@@ -893,59 +894,19 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
foreach (var recording in _activeRecordings.Values)
{
- if (string.Equals(recording.Path, path, StringComparison.Ordinal))
+ if (string.Equals(recording.Path, path, StringComparison.Ordinal) && !recording.CancellationTokenSource.IsCancellationRequested)
{
+ var timer = recording.Timer;
+ if (timer.Status != RecordingStatus.InProgress)
+ {
+ return null;
+ }
return recording;
}
}
return null;
}
- private RecordingInfo GetRecordingInfo(ActiveRecordingInfo info)
- {
- var timer = info.Timer;
- var program = info.Program;
-
- var result = new RecordingInfo
- {
- ChannelId = timer.ChannelId,
- CommunityRating = timer.CommunityRating,
- DateLastUpdated = DateTime.UtcNow,
- EndDate = timer.EndDate,
- EpisodeTitle = timer.EpisodeTitle,
- Genres = timer.Genres,
- Id = "recording" + timer.Id,
- IsKids = timer.IsKids,
- IsMovie = timer.IsMovie,
- IsNews = timer.IsNews,
- IsRepeat = timer.IsRepeat,
- IsSeries = timer.IsProgramSeries,
- IsSports = timer.IsSports,
- Name = timer.Name,
- OfficialRating = timer.OfficialRating,
- OriginalAirDate = timer.OriginalAirDate,
- Overview = timer.Overview,
- ProgramId = timer.ProgramId,
- SeriesTimerId = timer.SeriesTimerId,
- StartDate = timer.StartDate,
- Status = RecordingStatus.InProgress,
- TimerId = timer.Id
- };
-
- if (program != null)
- {
- result.Audio = program.Audio;
- result.ImagePath = program.ImagePath;
- result.ImageUrl = program.ImageUrl;
- result.IsHD = program.IsHD;
- result.IsLive = program.IsLive;
- result.IsPremiere = program.IsPremiere;
- result.ShowId = program.ShowId;
- }
-
- return result;
- }
-
public Task<IEnumerable<TimerInfo>> GetTimersAsync(CancellationToken cancellationToken)
{
var excludeStatues = new List<RecordingStatus>
diff --git a/Emby.Server.Implementations/Notifications/Notifications.cs b/Emby.Server.Implementations/Notifications/Notifications.cs
index f95b3f701..ac3cc7564 100644
--- a/Emby.Server.Implementations/Notifications/Notifications.cs
+++ b/Emby.Server.Implementations/Notifications/Notifications.cs
@@ -422,7 +422,7 @@ namespace Emby.Server.Implementations.Notifications
{
var artists = hasArtist.AllArtists;
- if (artists.Count > 0)
+ if (artists.Length > 0)
{
name = hasArtist.AllArtists[0] + " - " + name;
}
@@ -440,7 +440,7 @@ namespace Emby.Server.Implementations.Notifications
name = item.SeriesName + " - " + name;
}
- if (item.Artists != null && item.Artists.Count > 0)
+ if (item.Artists != null && item.Artists.Length > 0)
{
name = item.Artists[0] + " - " + name;
}
diff --git a/Emby.Server.Implementations/Services/ServiceHandler.cs b/Emby.Server.Implementations/Services/ServiceHandler.cs
index 526e62d39..f9fcfdbab 100644
--- a/Emby.Server.Implementations/Services/ServiceHandler.cs
+++ b/Emby.Server.Implementations/Services/ServiceHandler.cs
@@ -215,13 +215,13 @@ namespace Emby.Server.Implementations.Services
if (name == null) continue; //thank you ASP.NET
var values = request.QueryString.GetValues(name);
- if (values.Length == 1)
+ if (values.Count == 1)
{
map[name] = values[0];
}
else
{
- for (var i = 0; i < values.Length; i++)
+ for (var i = 0; i < values.Count; i++)
{
map[name + (i == 0 ? "" : "#" + i)] = values[i];
}
@@ -235,13 +235,13 @@ namespace Emby.Server.Implementations.Services
if (name == null) continue; //thank you ASP.NET
var values = request.FormData.GetValues(name);
- if (values.Length == 1)
+ if (values.Count == 1)
{
map[name] = values[0];
}
else
{
- for (var i = 0; i < values.Length; i++)
+ for (var i = 0; i < values.Count; i++)
{
map[name + (i == 0 ? "" : "#" + i)] = values[i];
}
diff --git a/Emby.Server.Implementations/Sorting/ArtistComparer.cs b/Emby.Server.Implementations/Sorting/ArtistComparer.cs
index edb195820..616aff673 100644
--- a/Emby.Server.Implementations/Sorting/ArtistComparer.cs
+++ b/Emby.Server.Implementations/Sorting/ArtistComparer.cs
@@ -36,7 +36,7 @@ namespace Emby.Server.Implementations.Sorting
return string.Empty;
}
- return audio.Artists.Count == 0 ? null : audio.Artists[0];
+ return audio.Artists.Length == 0 ? null : audio.Artists[0];
}
/// <summary>
diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs
index 393fb76e2..75328a39a 100644
--- a/Emby.Server.Implementations/Updates/InstallationManager.cs
+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs
@@ -122,7 +122,10 @@ namespace Emby.Server.Implementations.Updates
private readonly ICryptoProvider _cryptographyProvider;
- public InstallationManager(ILogger logger, IApplicationHost appHost, IApplicationPaths appPaths, IHttpClient httpClient, IJsonSerializer jsonSerializer, ISecurityManager securityManager, IConfigurationManager config, IFileSystem fileSystem, ICryptoProvider cryptographyProvider)
+ // netframework or netcore
+ private readonly string _packageRuntime;
+
+ public InstallationManager(ILogger logger, IApplicationHost appHost, IApplicationPaths appPaths, IHttpClient httpClient, IJsonSerializer jsonSerializer, ISecurityManager securityManager, IConfigurationManager config, IFileSystem fileSystem, ICryptoProvider cryptographyProvider, string packageRuntime)
{
if (logger == null)
{
@@ -140,6 +143,7 @@ namespace Emby.Server.Implementations.Updates
_config = config;
_fileSystem = fileSystem;
_cryptographyProvider = cryptographyProvider;
+ _packageRuntime = packageRuntime;
_logger = logger;
}
@@ -157,7 +161,7 @@ namespace Emby.Server.Implementations.Updates
/// Gets all available packages.
/// </summary>
/// <returns>Task{List{PackageInfo}}.</returns>
- public async Task<PackageInfo[]> GetAvailablePackages(CancellationToken cancellationToken,
+ public async Task<List<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken,
bool withRegistration = true,
string packageType = null,
Version applicationVersion = null)
@@ -171,7 +175,7 @@ namespace Emby.Server.Implementations.Updates
{ "systemid", _applicationHost.SystemId }
};
- using (var json = await _httpClient.Post("https://www.mb3admin.com/admin/service/package/retrieveall", data, cancellationToken).ConfigureAwait(false))
+ using (var json = await _httpClient.Post("https://www.mb3admin.com/admin/service/package/retrieveall?includeAllRuntimes=true", data, cancellationToken).ConfigureAwait(false))
{
cancellationToken.ThrowIfCancellationRequested();
@@ -195,7 +199,7 @@ namespace Emby.Server.Implementations.Updates
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{List{PackageInfo}}.</returns>
- public async Task<PackageInfo[]> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken)
+ public async Task<List<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken)
{
_logger.Info("Opening {0}", PackageCachePath);
try
@@ -209,7 +213,7 @@ namespace Emby.Server.Implementations.Updates
UpdateCachedPackages(CancellationToken.None, false);
}
- return packages;
+ return FilterPackages(packages);
}
}
catch (Exception)
@@ -221,7 +225,7 @@ namespace Emby.Server.Implementations.Updates
await UpdateCachedPackages(cancellationToken, true).ConfigureAwait(false);
using (var stream = _fileSystem.OpenRead(PackageCachePath))
{
- return _jsonSerializer.DeserializeFromStream<PackageInfo[]>(stream);
+ return FilterPackages(_jsonSerializer.DeserializeFromStream<PackageInfo[]>(stream));
}
}
@@ -244,7 +248,7 @@ namespace Emby.Server.Implementations.Updates
var tempFile = await _httpClient.GetTempFile(new HttpRequestOptions
{
- Url = "https://www.mb3admin.com/admin/service/MB3Packages.json",
+ Url = "https://www.mb3admin.com/admin/service/EmbyPackages.json",
CancellationToken = cancellationToken,
Progress = new SimpleProgress<Double>()
@@ -280,47 +284,74 @@ namespace Emby.Server.Implementations.Updates
return TimeSpan.FromMinutes(3);
}
- protected PackageInfo[] FilterPackages(List<PackageInfo> packages)
+ protected List<PackageInfo> FilterPackages(IEnumerable<PackageInfo> packages)
{
+ var list = new List<PackageInfo>();
foreach (var package in packages)
{
- package.versions = package.versions.Where(v => !string.IsNullOrWhiteSpace(v.sourceUrl))
- .OrderByDescending(GetPackageVersion).ToArray();
+ var versions = new List<PackageVersionInfo>();
+ foreach (var version in package.versions)
+ {
+ if (string.IsNullOrWhiteSpace(version.sourceUrl))
+ {
+ continue;
+ }
+
+ if (string.IsNullOrWhiteSpace(version.runtimes) || version.runtimes.IndexOf(_packageRuntime, StringComparison.OrdinalIgnoreCase) == -1)
+ {
+ continue;
+ }
+
+ versions.Add(version);
+ }
+
+ package.versions = versions
+ .OrderByDescending(GetPackageVersion)
+ .ToArray();
+
+ if (package.versions.Length == 0)
+ {
+ continue;
+ }
+
+ list.Add(package);
}
// Remove packages with no versions
- return packages.Where(p => p.versions.Any()).ToArray();
+ return list;
}
- protected PackageInfo[] FilterPackages(PackageInfo[] packages, string packageType, Version applicationVersion)
+ protected List<PackageInfo> FilterPackages(IEnumerable<PackageInfo> packages, string packageType, Version applicationVersion)
{
- foreach (var package in packages)
- {
- package.versions = package.versions.Where(v => !string.IsNullOrWhiteSpace(v.sourceUrl))
- .OrderByDescending(GetPackageVersion).ToArray();
- }
+ var packagesList = FilterPackages(packages);
- IEnumerable<PackageInfo> packagesList = packages;
+ var returnList = new List<PackageInfo>();
- if (!string.IsNullOrWhiteSpace(packageType))
- {
- packagesList = packagesList.Where(p => string.Equals(p.type, packageType, StringComparison.OrdinalIgnoreCase));
- }
+ var filterOnPackageType = !string.IsNullOrWhiteSpace(packageType);
- // If an app version was supplied, filter the versions for each package to only include supported versions
- if (applicationVersion != null)
+ foreach (var p in packagesList)
{
- foreach (var package in packages)
+ if (filterOnPackageType && !string.Equals(p.type, packageType, StringComparison.OrdinalIgnoreCase))
{
- package.versions = package.versions.Where(v => IsPackageVersionUpToDate(v, applicationVersion)).ToArray();
+ continue;
}
- }
- // Remove packages with no versions
- packagesList = packagesList.Where(p => p.versions.Any());
+ // If an app version was supplied, filter the versions for each package to only include supported versions
+ if (applicationVersion != null)
+ {
+ p.versions = p.versions.Where(v => IsPackageVersionUpToDate(v, applicationVersion)).ToArray();
+ }
+
+ if (p.versions.Length == 0)
+ {
+ continue;
+ }
+
+ returnList.Add(p);
+ }
- return packagesList.ToArray();
+ return returnList;
}
/// <summary>