From 51edd5d067c919800f504bfa9fe1708279faaa3f Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Sun, 27 Jan 2019 10:20:05 +0100
Subject: [PATCH 01/93] Reworked LocalizationManager to load data async
---
.../ApplicationHost.cs | 16 +-
.../Library/MediaSourceManager.cs | 16 +-
.../Localization/LocalizationManager.cs | 279 ++++++++----------
.../Localization/Ratings/{br.txt => br.csv} | 0
.../Localization/Ratings/{ca.txt => ca.csv} | 0
.../Localization/Ratings/{co.txt => co.csv} | 0
.../Localization/Ratings/{dk.txt => dk.csv} | 0
.../Localization/Ratings/{es.txt => es.csv} | 0
.../Localization/Ratings/{fr.txt => fr.csv} | 0
.../Localization/Ratings/{gb.txt => gb.csv} | 0
.../Localization/Ratings/{ie.txt => ie.csv} | 0
.../Localization/Ratings/{jp.txt => jp.csv} | 0
.../Localization/Ratings/{kz.txt => kz.csv} | 0
.../Localization/Ratings/{mx.txt => mx.csv} | 0
.../Localization/Ratings/{nl.txt => nl.csv} | 0
.../Localization/Ratings/{nz.txt => nz.csv} | 0
.../Localization/Ratings/{ro.txt => ro.csv} | 0
.../Localization/Ratings/{uk.txt => uk.csv} | 0
.../Localization/Ratings/{us.txt => us.csv} | 0
.../Localization/TextLocalizer.cs | 63 ----
Jellyfin.Server/Program.cs | 2 +-
MediaBrowser.Api/ItemUpdateService.cs | 7 +-
MediaBrowser.Common/IApplicationHost.cs | 4 +-
.../Extensions/StringExtensions.cs | 46 ++-
.../Globalization/ILocalizationManager.cs | 8 +-
.../Manager/MetadataService.cs | 3 +-
.../MediaInfo/FFProbeProvider.cs | 15 +-
27 files changed, 197 insertions(+), 262 deletions(-)
rename Emby.Server.Implementations/Localization/Ratings/{br.txt => br.csv} (100%)
rename Emby.Server.Implementations/Localization/Ratings/{ca.txt => ca.csv} (100%)
rename Emby.Server.Implementations/Localization/Ratings/{co.txt => co.csv} (100%)
rename Emby.Server.Implementations/Localization/Ratings/{dk.txt => dk.csv} (100%)
rename Emby.Server.Implementations/Localization/Ratings/{es.txt => es.csv} (100%)
rename Emby.Server.Implementations/Localization/Ratings/{fr.txt => fr.csv} (100%)
rename Emby.Server.Implementations/Localization/Ratings/{gb.txt => gb.csv} (100%)
rename Emby.Server.Implementations/Localization/Ratings/{ie.txt => ie.csv} (100%)
rename Emby.Server.Implementations/Localization/Ratings/{jp.txt => jp.csv} (100%)
rename Emby.Server.Implementations/Localization/Ratings/{kz.txt => kz.csv} (100%)
rename Emby.Server.Implementations/Localization/Ratings/{mx.txt => mx.csv} (100%)
rename Emby.Server.Implementations/Localization/Ratings/{nl.txt => nl.csv} (100%)
rename Emby.Server.Implementations/Localization/Ratings/{nz.txt => nz.csv} (100%)
rename Emby.Server.Implementations/Localization/Ratings/{ro.txt => ro.csv} (100%)
rename Emby.Server.Implementations/Localization/Ratings/{uk.txt => uk.csv} (100%)
rename Emby.Server.Implementations/Localization/Ratings/{us.txt => us.csv} (100%)
delete mode 100644 Emby.Server.Implementations/Localization/TextLocalizer.cs
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index f0a9149220..b92b631e1f 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -110,9 +110,7 @@ using MediaBrowser.XbmcMetadata.Providers;
using Microsoft.Extensions.Logging;
using ServiceStack;
using ServiceStack.Text.Jsv;
-using StringExtensions = MediaBrowser.Controller.Extensions.StringExtensions;
using X509Certificate = System.Security.Cryptography.X509Certificates.X509Certificate;
-using UtfUnknown;
namespace Emby.Server.Implementations
{
@@ -303,7 +301,7 @@ namespace Emby.Server.Implementations
private ILiveTvManager LiveTvManager { get; set; }
- public ILocalizationManager LocalizationManager { get; set; }
+ public LocalizationManager LocalizationManager { get; set; }
private IEncodingManager EncodingManager { get; set; }
private IChannelManager ChannelManager { get; set; }
@@ -704,7 +702,7 @@ namespace Emby.Server.Implementations
}
}
- public void Init()
+ public async Task Init()
{
HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber;
HttpsPort = ServerConfigurationManager.Configuration.HttpsPortNumber;
@@ -734,7 +732,7 @@ namespace Emby.Server.Implementations
SetHttpLimit();
- RegisterResources();
+ await RegisterResources();
FindParts();
}
@@ -749,7 +747,7 @@ namespace Emby.Server.Implementations
///
/// Registers resources that classes will depend on
///
- protected void RegisterResources()
+ protected async Task RegisterResources()
{
RegisterSingleInstance(ConfigurationManager);
RegisterSingleInstance(this);
@@ -810,9 +808,9 @@ namespace Emby.Server.Implementations
IAssemblyInfo assemblyInfo = new AssemblyInfo();
RegisterSingleInstance(assemblyInfo);
- LocalizationManager = new LocalizationManager(ServerConfigurationManager, FileSystemManager, JsonSerializer, LoggerFactory, assemblyInfo, new TextLocalizer());
- StringExtensions.LocalizationManager = LocalizationManager;
- RegisterSingleInstance(LocalizationManager);
+ LocalizationManager = new LocalizationManager(ServerConfigurationManager, FileSystemManager, JsonSerializer, LoggerFactory);
+ await LocalizationManager.LoadAll();
+ RegisterSingleInstance(LocalizationManager);
BlurayExaminer = new BdInfoExaminer(FileSystemManager);
RegisterSingleInstance(BlurayExaminer);
diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs
index 1ed838893e..100707cea2 100644
--- a/Emby.Server.Implementations/Library/MediaSourceManager.cs
+++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs
@@ -322,18 +322,18 @@ namespace Emby.Server.Implementations.Library
private string[] NormalizeLanguage(string language)
{
- if (language != null)
+ if (language == null)
{
- var culture = _localizationManager.FindLanguageInfo(language);
- if (culture != null)
- {
- return culture.ThreeLetterISOLanguageNames;
- }
+ return Array.Empty();
+ }
- return new string[] { language };
+ var culture = _localizationManager.FindLanguageInfo(language);
+ if (culture != null)
+ {
+ return culture.ThreeLetterISOLanguageNames;
}
- return Array.Empty();
+ return new string[] { language };
}
private void SetDefaultSubtitleStreamIndex(MediaSourceInfo source, UserItemData userData, User user, bool allowRememberingSelection)
diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs
index c408a47f62..47834940b1 100644
--- a/Emby.Server.Implementations/Localization/LocalizationManager.cs
+++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs
@@ -4,12 +4,14 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Reflection;
using MediaBrowser.Model.Serialization;
using Microsoft.Extensions.Logging;
@@ -36,8 +38,7 @@ namespace Emby.Server.Implementations.Localization
private readonly IFileSystem _fileSystem;
private readonly IJsonSerializer _jsonSerializer;
private readonly ILogger _logger;
- private readonly IAssemblyInfo _assemblyInfo;
- private readonly ITextLocalizer _textLocalizer;
+ private static readonly Assembly _assembly = typeof(LocalizationManager).Assembly;
///
/// Initializes a new instance of the class.
@@ -49,67 +50,57 @@ namespace Emby.Server.Implementations.Localization
IServerConfigurationManager configurationManager,
IFileSystem fileSystem,
IJsonSerializer jsonSerializer,
- ILoggerFactory loggerFactory,
- IAssemblyInfo assemblyInfo,
- ITextLocalizer textLocalizer)
+ ILoggerFactory loggerFactory)
{
_configurationManager = configurationManager;
_fileSystem = fileSystem;
_jsonSerializer = jsonSerializer;
_logger = loggerFactory.CreateLogger(nameof(LocalizationManager));
- _assemblyInfo = assemblyInfo;
- _textLocalizer = textLocalizer;
-
- ExtractAll();
}
- private void ExtractAll()
+ public async Task LoadAll()
{
- var type = GetType();
- var resourcePath = type.Namespace + ".Ratings.";
-
- var localizationPath = LocalizationPath;
+ const string ratingsResource = "Emby.Server.Implementations.Ratings.";
- _fileSystem.CreateDirectory(localizationPath);
+ Directory.CreateDirectory(LocalizationPath);
- var existingFiles = GetRatingsFiles(localizationPath)
- .Select(Path.GetFileName)
- .ToList();
+ var existingFiles = GetRatingsFiles(LocalizationPath).Select(Path.GetFileName);
// Extract from the assembly
- foreach (var resource in _assemblyInfo
- .GetManifestResourceNames(type)
- .Where(i => i.StartsWith(resourcePath)))
+ foreach (var resource in _assembly.GetManifestResourceNames()
+ .Where(i => i.StartsWith(ratingsResource)))
{
- var filename = "ratings-" + resource.Substring(resourcePath.Length);
+ string filename = "ratings-" + resource.Substring(ratingsResource.Length);
if (!existingFiles.Contains(filename))
{
- using (var stream = _assemblyInfo.GetManifestResourceStream(type, resource))
+ using (var stream = _assembly.GetManifestResourceStream(resource))
{
- var target = Path.Combine(localizationPath, filename);
+ string target = Path.Combine(LocalizationPath, filename);
_logger.LogInformation("Extracting ratings to {0}", target);
using (var fs = _fileSystem.GetFileStream(target, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
{
- stream.CopyTo(fs);
+ await stream.CopyToAsync(fs);
}
}
}
}
- foreach (var file in GetRatingsFiles(localizationPath))
+ foreach (var file in GetRatingsFiles(LocalizationPath))
{
- LoadRatings(file);
+ await LoadRatings(file);
}
LoadAdditionalRatings();
+
+ await LoadCultures();
}
private void LoadAdditionalRatings()
{
- LoadRatings("au", new[] {
-
+ LoadRatings("au", new[]
+ {
new ParentalRating("AU-G", 1),
new ParentalRating("AU-PG", 5),
new ParentalRating("AU-M", 6),
@@ -120,8 +111,8 @@ namespace Emby.Server.Implementations.Localization
new ParentalRating("AU-RC", 11)
});
- LoadRatings("be", new[] {
-
+ LoadRatings("be", new[]
+ {
new ParentalRating("BE-AL", 1),
new ParentalRating("BE-MG6", 2),
new ParentalRating("BE-6", 3),
@@ -130,8 +121,8 @@ namespace Emby.Server.Implementations.Localization
new ParentalRating("BE-16", 8)
});
- LoadRatings("de", new[] {
-
+ LoadRatings("de", new[]
+ {
new ParentalRating("DE-0", 1),
new ParentalRating("FSK-0", 1),
new ParentalRating("DE-6", 5),
@@ -144,8 +135,8 @@ namespace Emby.Server.Implementations.Localization
new ParentalRating("FSK-18", 9)
});
- LoadRatings("ru", new[] {
-
+ LoadRatings("ru", new[]
+ {
new ParentalRating("RU-0+", 1),
new ParentalRating("RU-6+", 3),
new ParentalRating("RU-12+", 7),
@@ -159,29 +150,20 @@ namespace Emby.Server.Implementations.Localization
_allParentalRatings[country] = ratings.ToDictionary(i => i.Name);
}
- private List GetRatingsFiles(string directory)
- {
- return _fileSystem.GetFilePaths(directory, false)
- .Where(i => string.Equals(Path.GetExtension(i), ".txt", StringComparison.OrdinalIgnoreCase))
- .Where(i => Path.GetFileName(i).StartsWith("ratings-", StringComparison.OrdinalIgnoreCase))
- .ToList();
- }
+ private IEnumerable GetRatingsFiles(string directory)
+ => _fileSystem.GetFilePaths(directory, false)
+ .Where(i => string.Equals(Path.GetExtension(i), ".csv", StringComparison.OrdinalIgnoreCase))
+ .Where(i => Path.GetFileName(i).StartsWith("ratings-", StringComparison.OrdinalIgnoreCase));
///
/// Gets the localization path.
///
/// The localization path.
- public string LocalizationPath => Path.Combine(_configurationManager.ApplicationPaths.ProgramDataPath, "localization");
-
- public string RemoveDiacritics(string text)
- {
- return _textLocalizer.RemoveDiacritics(text);
- }
+ public string LocalizationPath
+ => Path.Combine(_configurationManager.ApplicationPaths.ProgramDataPath, "localization");
public string NormalizeFormKD(string text)
- {
- return _textLocalizer.NormalizeFormKD(text);
- }
+ => text.Normalize(NormalizationForm.FormKD);
private CultureDto[] _cultures;
@@ -190,90 +172,88 @@ namespace Emby.Server.Implementations.Localization
///
/// IEnumerable{CultureDto}.
public CultureDto[] GetCultures()
- {
- var result = _cultures;
- if (result != null)
- {
- return result;
- }
+ => _cultures;
- var type = GetType();
- var path = type.Namespace + ".iso6392.txt";
+ private async Task LoadCultures()
+ {
+ List list = new List();
- var list = new List();
+ const string path = "Emby.Server.Implementations.Localization.iso6392.txt";
- using (var stream = _assemblyInfo.GetManifestResourceStream(type, path))
+ using (var stream = _assembly.GetManifestResourceStream(path))
+ using (var reader = new StreamReader(stream))
{
- using (var reader = new StreamReader(stream))
+ while (!reader.EndOfStream)
{
- while (!reader.EndOfStream)
+ var line = await reader.ReadLineAsync();
+
+ if (string.IsNullOrWhiteSpace(line))
+ {
+ continue;
+ }
+
+ var parts = line.Split('|');
+
+ if (parts.Length == 5)
{
- var line = reader.ReadLine();
+ string name = parts[3];
+ if (string.IsNullOrWhiteSpace(name))
+ {
+ continue;
+ }
+
+ string twoCharName = parts[2];
+ if (string.IsNullOrWhiteSpace(twoCharName))
+ {
+ continue;
+ }
- if (!string.IsNullOrWhiteSpace(line))
+ string[] threeletterNames;
+ if (string.IsNullOrWhiteSpace(parts[1]))
{
- var parts = line.Split('|');
-
- if (parts.Length == 5)
- {
- var threeletterNames = new List { parts[0] };
- if (!string.IsNullOrWhiteSpace(parts[1]))
- {
- threeletterNames.Add(parts[1]);
- }
-
- list.Add(new CultureDto
- {
- DisplayName = parts[3],
- Name = parts[3],
- ThreeLetterISOLanguageNames = threeletterNames.ToArray(),
- TwoLetterISOLanguageName = parts[2]
- });
- }
+ threeletterNames = new [] { parts[0] };
}
+ else
+ {
+ threeletterNames = new [] { parts[0], parts[1] };
+ }
+
+ list.Add(new CultureDto
+ {
+ DisplayName = name,
+ Name = name,
+ ThreeLetterISOLanguageNames = threeletterNames,
+ TwoLetterISOLanguageName = twoCharName
+ });
}
}
}
- result = list.Where(i => !string.IsNullOrWhiteSpace(i.Name) &&
- !string.IsNullOrWhiteSpace(i.DisplayName) &&
- i.ThreeLetterISOLanguageNames.Length > 0 &&
- !string.IsNullOrWhiteSpace(i.TwoLetterISOLanguageName)).ToArray();
-
- _cultures = result;
-
- return result;
+ _cultures = list.ToArray();
}
public CultureDto FindLanguageInfo(string language)
- {
- return GetCultures()
- .FirstOrDefault(i => string.Equals(i.DisplayName, language, StringComparison.OrdinalIgnoreCase) ||
- string.Equals(i.Name, language, StringComparison.OrdinalIgnoreCase) ||
- i.ThreeLetterISOLanguageNames.Contains(language, StringComparer.OrdinalIgnoreCase) ||
- string.Equals(i.TwoLetterISOLanguageName, language, StringComparison.OrdinalIgnoreCase));
- }
+ => GetCultures()
+ .FirstOrDefault(i =>
+ string.Equals(i.DisplayName, language, StringComparison.OrdinalIgnoreCase)
+ || string.Equals(i.Name, language, StringComparison.OrdinalIgnoreCase)
+ || i.ThreeLetterISOLanguageNames.Contains(language, StringComparer.OrdinalIgnoreCase)
+ || string.Equals(i.TwoLetterISOLanguageName, language, StringComparison.OrdinalIgnoreCase));
///
/// Gets the countries.
///
/// IEnumerable{CountryInfo}.
- public CountryInfo[] GetCountries()
- {
- // ToDo: DeserializeFromStream seems broken in this case
- string jsonCountries = "[{\"Name\":\"AF\",\"DisplayName\":\"Afghanistan\",\"TwoLetterISORegionName\":\"AF\",\"ThreeLetterISORegionName\":\"AFG\"},{\"Name\":\"AL\",\"DisplayName\":\"Albania\",\"TwoLetterISORegionName\":\"AL\",\"ThreeLetterISORegionName\":\"ALB\"},{\"Name\":\"DZ\",\"DisplayName\":\"Algeria\",\"TwoLetterISORegionName\":\"DZ\",\"ThreeLetterISORegionName\":\"DZA\"},{\"Name\":\"AR\",\"DisplayName\":\"Argentina\",\"TwoLetterISORegionName\":\"AR\",\"ThreeLetterISORegionName\":\"ARG\"},{\"Name\":\"AM\",\"DisplayName\":\"Armenia\",\"TwoLetterISORegionName\":\"AM\",\"ThreeLetterISORegionName\":\"ARM\"},{\"Name\":\"AU\",\"DisplayName\":\"Australia\",\"TwoLetterISORegionName\":\"AU\",\"ThreeLetterISORegionName\":\"AUS\"},{\"Name\":\"AT\",\"DisplayName\":\"Austria\",\"TwoLetterISORegionName\":\"AT\",\"ThreeLetterISORegionName\":\"AUT\"},{\"Name\":\"AZ\",\"DisplayName\":\"Azerbaijan\",\"TwoLetterISORegionName\":\"AZ\",\"ThreeLetterISORegionName\":\"AZE\"},{\"Name\":\"BH\",\"DisplayName\":\"Bahrain\",\"TwoLetterISORegionName\":\"BH\",\"ThreeLetterISORegionName\":\"BHR\"},{\"Name\":\"BD\",\"DisplayName\":\"Bangladesh\",\"TwoLetterISORegionName\":\"BD\",\"ThreeLetterISORegionName\":\"BGD\"},{\"Name\":\"BY\",\"DisplayName\":\"Belarus\",\"TwoLetterISORegionName\":\"BY\",\"ThreeLetterISORegionName\":\"BLR\"},{\"Name\":\"BE\",\"DisplayName\":\"Belgium\",\"TwoLetterISORegionName\":\"BE\",\"ThreeLetterISORegionName\":\"BEL\"},{\"Name\":\"BZ\",\"DisplayName\":\"Belize\",\"TwoLetterISORegionName\":\"BZ\",\"ThreeLetterISORegionName\":\"BLZ\"},{\"Name\":\"VE\",\"DisplayName\":\"Bolivarian Republic of Venezuela\",\"TwoLetterISORegionName\":\"VE\",\"ThreeLetterISORegionName\":\"VEN\"},{\"Name\":\"BO\",\"DisplayName\":\"Bolivia\",\"TwoLetterISORegionName\":\"BO\",\"ThreeLetterISORegionName\":\"BOL\"},{\"Name\":\"BA\",\"DisplayName\":\"Bosnia and Herzegovina\",\"TwoLetterISORegionName\":\"BA\",\"ThreeLetterISORegionName\":\"BIH\"},{\"Name\":\"BW\",\"DisplayName\":\"Botswana\",\"TwoLetterISORegionName\":\"BW\",\"ThreeLetterISORegionName\":\"BWA\"},{\"Name\":\"BR\",\"DisplayName\":\"Brazil\",\"TwoLetterISORegionName\":\"BR\",\"ThreeLetterISORegionName\":\"BRA\"},{\"Name\":\"BN\",\"DisplayName\":\"Brunei Darussalam\",\"TwoLetterISORegionName\":\"BN\",\"ThreeLetterISORegionName\":\"BRN\"},{\"Name\":\"BG\",\"DisplayName\":\"Bulgaria\",\"TwoLetterISORegionName\":\"BG\",\"ThreeLetterISORegionName\":\"BGR\"},{\"Name\":\"KH\",\"DisplayName\":\"Cambodia\",\"TwoLetterISORegionName\":\"KH\",\"ThreeLetterISORegionName\":\"KHM\"},{\"Name\":\"CM\",\"DisplayName\":\"Cameroon\",\"TwoLetterISORegionName\":\"CM\",\"ThreeLetterISORegionName\":\"CMR\"},{\"Name\":\"CA\",\"DisplayName\":\"Canada\",\"TwoLetterISORegionName\":\"CA\",\"ThreeLetterISORegionName\":\"CAN\"},{\"Name\":\"029\",\"DisplayName\":\"Caribbean\",\"TwoLetterISORegionName\":\"029\",\"ThreeLetterISORegionName\":\"029\"},{\"Name\":\"CL\",\"DisplayName\":\"Chile\",\"TwoLetterISORegionName\":\"CL\",\"ThreeLetterISORegionName\":\"CHL\"},{\"Name\":\"CO\",\"DisplayName\":\"Colombia\",\"TwoLetterISORegionName\":\"CO\",\"ThreeLetterISORegionName\":\"COL\"},{\"Name\":\"CD\",\"DisplayName\":\"Congo [DRC]\",\"TwoLetterISORegionName\":\"CD\",\"ThreeLetterISORegionName\":\"COD\"},{\"Name\":\"CR\",\"DisplayName\":\"Costa Rica\",\"TwoLetterISORegionName\":\"CR\",\"ThreeLetterISORegionName\":\"CRI\"},{\"Name\":\"HR\",\"DisplayName\":\"Croatia\",\"TwoLetterISORegionName\":\"HR\",\"ThreeLetterISORegionName\":\"HRV\"},{\"Name\":\"CZ\",\"DisplayName\":\"Czech Republic\",\"TwoLetterISORegionName\":\"CZ\",\"ThreeLetterISORegionName\":\"CZE\"},{\"Name\":\"DK\",\"DisplayName\":\"Denmark\",\"TwoLetterISORegionName\":\"DK\",\"ThreeLetterISORegionName\":\"DNK\"},{\"Name\":\"DO\",\"DisplayName\":\"Dominican Republic\",\"TwoLetterISORegionName\":\"DO\",\"ThreeLetterISORegionName\":\"DOM\"},{\"Name\":\"EC\",\"DisplayName\":\"Ecuador\",\"TwoLetterISORegionName\":\"EC\",\"ThreeLetterISORegionName\":\"ECU\"},{\"Name\":\"EG\",\"DisplayName\":\"Egypt\",\"TwoLetterISORegionName\":\"EG\",\"ThreeLetterISORegionName\":\"EGY\"},{\"Name\":\"SV\",\"DisplayName\":\"El Salvador\",\"TwoLetterISORegionName\":\"SV\",\"ThreeLetterISORegionName\":\"SLV\"},{\"Name\":\"ER\",\"DisplayName\":\"Eritrea\",\"TwoLetterISORegionName\":\"ER\",\"ThreeLetterISORegionName\":\"ERI\"},{\"Name\":\"EE\",\"DisplayName\":\"Estonia\",\"TwoLetterISORegionName\":\"EE\",\"ThreeLetterISORegionName\":\"EST\"},{\"Name\":\"ET\",\"DisplayName\":\"Ethiopia\",\"TwoLetterISORegionName\":\"ET\",\"ThreeLetterISORegionName\":\"ETH\"},{\"Name\":\"FO\",\"DisplayName\":\"Faroe Islands\",\"TwoLetterISORegionName\":\"FO\",\"ThreeLetterISORegionName\":\"FRO\"},{\"Name\":\"FI\",\"DisplayName\":\"Finland\",\"TwoLetterISORegionName\":\"FI\",\"ThreeLetterISORegionName\":\"FIN\"},{\"Name\":\"FR\",\"DisplayName\":\"France\",\"TwoLetterISORegionName\":\"FR\",\"ThreeLetterISORegionName\":\"FRA\"},{\"Name\":\"GE\",\"DisplayName\":\"Georgia\",\"TwoLetterISORegionName\":\"GE\",\"ThreeLetterISORegionName\":\"GEO\"},{\"Name\":\"DE\",\"DisplayName\":\"Germany\",\"TwoLetterISORegionName\":\"DE\",\"ThreeLetterISORegionName\":\"DEU\"},{\"Name\":\"GR\",\"DisplayName\":\"Greece\",\"TwoLetterISORegionName\":\"GR\",\"ThreeLetterISORegionName\":\"GRC\"},{\"Name\":\"GL\",\"DisplayName\":\"Greenland\",\"TwoLetterISORegionName\":\"GL\",\"ThreeLetterISORegionName\":\"GRL\"},{\"Name\":\"GT\",\"DisplayName\":\"Guatemala\",\"TwoLetterISORegionName\":\"GT\",\"ThreeLetterISORegionName\":\"GTM\"},{\"Name\":\"HT\",\"DisplayName\":\"Haiti\",\"TwoLetterISORegionName\":\"HT\",\"ThreeLetterISORegionName\":\"HTI\"},{\"Name\":\"HN\",\"DisplayName\":\"Honduras\",\"TwoLetterISORegionName\":\"HN\",\"ThreeLetterISORegionName\":\"HND\"},{\"Name\":\"HK\",\"DisplayName\":\"Hong Kong S.A.R.\",\"TwoLetterISORegionName\":\"HK\",\"ThreeLetterISORegionName\":\"HKG\"},{\"Name\":\"HU\",\"DisplayName\":\"Hungary\",\"TwoLetterISORegionName\":\"HU\",\"ThreeLetterISORegionName\":\"HUN\"},{\"Name\":\"IS\",\"DisplayName\":\"Iceland\",\"TwoLetterISORegionName\":\"IS\",\"ThreeLetterISORegionName\":\"ISL\"},{\"Name\":\"IN\",\"DisplayName\":\"India\",\"TwoLetterISORegionName\":\"IN\",\"ThreeLetterISORegionName\":\"IND\"},{\"Name\":\"ID\",\"DisplayName\":\"Indonesia\",\"TwoLetterISORegionName\":\"ID\",\"ThreeLetterISORegionName\":\"IDN\"},{\"Name\":\"IR\",\"DisplayName\":\"Iran\",\"TwoLetterISORegionName\":\"IR\",\"ThreeLetterISORegionName\":\"IRN\"},{\"Name\":\"IQ\",\"DisplayName\":\"Iraq\",\"TwoLetterISORegionName\":\"IQ\",\"ThreeLetterISORegionName\":\"IRQ\"},{\"Name\":\"IE\",\"DisplayName\":\"Ireland\",\"TwoLetterISORegionName\":\"IE\",\"ThreeLetterISORegionName\":\"IRL\"},{\"Name\":\"PK\",\"DisplayName\":\"Islamic Republic of Pakistan\",\"TwoLetterISORegionName\":\"PK\",\"ThreeLetterISORegionName\":\"PAK\"},{\"Name\":\"IL\",\"DisplayName\":\"Israel\",\"TwoLetterISORegionName\":\"IL\",\"ThreeLetterISORegionName\":\"ISR\"},{\"Name\":\"IT\",\"DisplayName\":\"Italy\",\"TwoLetterISORegionName\":\"IT\",\"ThreeLetterISORegionName\":\"ITA\"},{\"Name\":\"CI\",\"DisplayName\":\"Ivory Coast\",\"TwoLetterISORegionName\":\"CI\",\"ThreeLetterISORegionName\":\"CIV\"},{\"Name\":\"JM\",\"DisplayName\":\"Jamaica\",\"TwoLetterISORegionName\":\"JM\",\"ThreeLetterISORegionName\":\"JAM\"},{\"Name\":\"JP\",\"DisplayName\":\"Japan\",\"TwoLetterISORegionName\":\"JP\",\"ThreeLetterISORegionName\":\"JPN\"},{\"Name\":\"JO\",\"DisplayName\":\"Jordan\",\"TwoLetterISORegionName\":\"JO\",\"ThreeLetterISORegionName\":\"JOR\"},{\"Name\":\"KZ\",\"DisplayName\":\"Kazakhstan\",\"TwoLetterISORegionName\":\"KZ\",\"ThreeLetterISORegionName\":\"KAZ\"},{\"Name\":\"KE\",\"DisplayName\":\"Kenya\",\"TwoLetterISORegionName\":\"KE\",\"ThreeLetterISORegionName\":\"KEN\"},{\"Name\":\"KR\",\"DisplayName\":\"Korea\",\"TwoLetterISORegionName\":\"KR\",\"ThreeLetterISORegionName\":\"KOR\"},{\"Name\":\"KW\",\"DisplayName\":\"Kuwait\",\"TwoLetterISORegionName\":\"KW\",\"ThreeLetterISORegionName\":\"KWT\"},{\"Name\":\"KG\",\"DisplayName\":\"Kyrgyzstan\",\"TwoLetterISORegionName\":\"KG\",\"ThreeLetterISORegionName\":\"KGZ\"},{\"Name\":\"LA\",\"DisplayName\":\"Lao P.D.R.\",\"TwoLetterISORegionName\":\"LA\",\"ThreeLetterISORegionName\":\"LAO\"},{\"Name\":\"419\",\"DisplayName\":\"Latin America\",\"TwoLetterISORegionName\":\"419\",\"ThreeLetterISORegionName\":\"419\"},{\"Name\":\"LV\",\"DisplayName\":\"Latvia\",\"TwoLetterISORegionName\":\"LV\",\"ThreeLetterISORegionName\":\"LVA\"},{\"Name\":\"LB\",\"DisplayName\":\"Lebanon\",\"TwoLetterISORegionName\":\"LB\",\"ThreeLetterISORegionName\":\"LBN\"},{\"Name\":\"LY\",\"DisplayName\":\"Libya\",\"TwoLetterISORegionName\":\"LY\",\"ThreeLetterISORegionName\":\"LBY\"},{\"Name\":\"LI\",\"DisplayName\":\"Liechtenstein\",\"TwoLetterISORegionName\":\"LI\",\"ThreeLetterISORegionName\":\"LIE\"},{\"Name\":\"LT\",\"DisplayName\":\"Lithuania\",\"TwoLetterISORegionName\":\"LT\",\"ThreeLetterISORegionName\":\"LTU\"},{\"Name\":\"LU\",\"DisplayName\":\"Luxembourg\",\"TwoLetterISORegionName\":\"LU\",\"ThreeLetterISORegionName\":\"LUX\"},{\"Name\":\"MO\",\"DisplayName\":\"Macao S.A.R.\",\"TwoLetterISORegionName\":\"MO\",\"ThreeLetterISORegionName\":\"MAC\"},{\"Name\":\"MK\",\"DisplayName\":\"Macedonia (FYROM)\",\"TwoLetterISORegionName\":\"MK\",\"ThreeLetterISORegionName\":\"MKD\"},{\"Name\":\"MY\",\"DisplayName\":\"Malaysia\",\"TwoLetterISORegionName\":\"MY\",\"ThreeLetterISORegionName\":\"MYS\"},{\"Name\":\"MV\",\"DisplayName\":\"Maldives\",\"TwoLetterISORegionName\":\"MV\",\"ThreeLetterISORegionName\":\"MDV\"},{\"Name\":\"ML\",\"DisplayName\":\"Mali\",\"TwoLetterISORegionName\":\"ML\",\"ThreeLetterISORegionName\":\"MLI\"},{\"Name\":\"MT\",\"DisplayName\":\"Malta\",\"TwoLetterISORegionName\":\"MT\",\"ThreeLetterISORegionName\":\"MLT\"},{\"Name\":\"MX\",\"DisplayName\":\"Mexico\",\"TwoLetterISORegionName\":\"MX\",\"ThreeLetterISORegionName\":\"MEX\"},{\"Name\":\"MN\",\"DisplayName\":\"Mongolia\",\"TwoLetterISORegionName\":\"MN\",\"ThreeLetterISORegionName\":\"MNG\"},{\"Name\":\"ME\",\"DisplayName\":\"Montenegro\",\"TwoLetterISORegionName\":\"ME\",\"ThreeLetterISORegionName\":\"MNE\"},{\"Name\":\"MA\",\"DisplayName\":\"Morocco\",\"TwoLetterISORegionName\":\"MA\",\"ThreeLetterISORegionName\":\"MAR\"},{\"Name\":\"NP\",\"DisplayName\":\"Nepal\",\"TwoLetterISORegionName\":\"NP\",\"ThreeLetterISORegionName\":\"NPL\"},{\"Name\":\"NL\",\"DisplayName\":\"Netherlands\",\"TwoLetterISORegionName\":\"NL\",\"ThreeLetterISORegionName\":\"NLD\"},{\"Name\":\"NZ\",\"DisplayName\":\"New Zealand\",\"TwoLetterISORegionName\":\"NZ\",\"ThreeLetterISORegionName\":\"NZL\"},{\"Name\":\"NI\",\"DisplayName\":\"Nicaragua\",\"TwoLetterISORegionName\":\"NI\",\"ThreeLetterISORegionName\":\"NIC\"},{\"Name\":\"NG\",\"DisplayName\":\"Nigeria\",\"TwoLetterISORegionName\":\"NG\",\"ThreeLetterISORegionName\":\"NGA\"},{\"Name\":\"NO\",\"DisplayName\":\"Norway\",\"TwoLetterISORegionName\":\"NO\",\"ThreeLetterISORegionName\":\"NOR\"},{\"Name\":\"OM\",\"DisplayName\":\"Oman\",\"TwoLetterISORegionName\":\"OM\",\"ThreeLetterISORegionName\":\"OMN\"},{\"Name\":\"PA\",\"DisplayName\":\"Panama\",\"TwoLetterISORegionName\":\"PA\",\"ThreeLetterISORegionName\":\"PAN\"},{\"Name\":\"PY\",\"DisplayName\":\"Paraguay\",\"TwoLetterISORegionName\":\"PY\",\"ThreeLetterISORegionName\":\"PRY\"},{\"Name\":\"CN\",\"DisplayName\":\"People's Republic of China\",\"TwoLetterISORegionName\":\"CN\",\"ThreeLetterISORegionName\":\"CHN\"},{\"Name\":\"PE\",\"DisplayName\":\"Peru\",\"TwoLetterISORegionName\":\"PE\",\"ThreeLetterISORegionName\":\"PER\"},{\"Name\":\"PH\",\"DisplayName\":\"Philippines\",\"TwoLetterISORegionName\":\"PH\",\"ThreeLetterISORegionName\":\"PHL\"},{\"Name\":\"PL\",\"DisplayName\":\"Poland\",\"TwoLetterISORegionName\":\"PL\",\"ThreeLetterISORegionName\":\"POL\"},{\"Name\":\"PT\",\"DisplayName\":\"Portugal\",\"TwoLetterISORegionName\":\"PT\",\"ThreeLetterISORegionName\":\"PRT\"},{\"Name\":\"MC\",\"DisplayName\":\"Principality of Monaco\",\"TwoLetterISORegionName\":\"MC\",\"ThreeLetterISORegionName\":\"MCO\"},{\"Name\":\"PR\",\"DisplayName\":\"Puerto Rico\",\"TwoLetterISORegionName\":\"PR\",\"ThreeLetterISORegionName\":\"PRI\"},{\"Name\":\"QA\",\"DisplayName\":\"Qatar\",\"TwoLetterISORegionName\":\"QA\",\"ThreeLetterISORegionName\":\"QAT\"},{\"Name\":\"MD\",\"DisplayName\":\"Republica Moldova\",\"TwoLetterISORegionName\":\"MD\",\"ThreeLetterISORegionName\":\"MDA\"},{\"Name\":\"RE\",\"DisplayName\":\"Réunion\",\"TwoLetterISORegionName\":\"RE\",\"ThreeLetterISORegionName\":\"REU\"},{\"Name\":\"RO\",\"DisplayName\":\"Romania\",\"TwoLetterISORegionName\":\"RO\",\"ThreeLetterISORegionName\":\"ROU\"},{\"Name\":\"RU\",\"DisplayName\":\"Russia\",\"TwoLetterISORegionName\":\"RU\",\"ThreeLetterISORegionName\":\"RUS\"},{\"Name\":\"RW\",\"DisplayName\":\"Rwanda\",\"TwoLetterISORegionName\":\"RW\",\"ThreeLetterISORegionName\":\"RWA\"},{\"Name\":\"SA\",\"DisplayName\":\"Saudi Arabia\",\"TwoLetterISORegionName\":\"SA\",\"ThreeLetterISORegionName\":\"SAU\"},{\"Name\":\"SN\",\"DisplayName\":\"Senegal\",\"TwoLetterISORegionName\":\"SN\",\"ThreeLetterISORegionName\":\"SEN\"},{\"Name\":\"RS\",\"DisplayName\":\"Serbia\",\"TwoLetterISORegionName\":\"RS\",\"ThreeLetterISORegionName\":\"SRB\"},{\"Name\":\"CS\",\"DisplayName\":\"Serbia and Montenegro (Former)\",\"TwoLetterISORegionName\":\"CS\",\"ThreeLetterISORegionName\":\"SCG\"},{\"Name\":\"SG\",\"DisplayName\":\"Singapore\",\"TwoLetterISORegionName\":\"SG\",\"ThreeLetterISORegionName\":\"SGP\"},{\"Name\":\"SK\",\"DisplayName\":\"Slovakia\",\"TwoLetterISORegionName\":\"SK\",\"ThreeLetterISORegionName\":\"SVK\"},{\"Name\":\"SI\",\"DisplayName\":\"Slovenia\",\"TwoLetterISORegionName\":\"SI\",\"ThreeLetterISORegionName\":\"SVN\"},{\"Name\":\"SO\",\"DisplayName\":\"Soomaaliya\",\"TwoLetterISORegionName\":\"SO\",\"ThreeLetterISORegionName\":\"SOM\"},{\"Name\":\"ZA\",\"DisplayName\":\"South Africa\",\"TwoLetterISORegionName\":\"ZA\",\"ThreeLetterISORegionName\":\"ZAF\"},{\"Name\":\"ES\",\"DisplayName\":\"Spain\",\"TwoLetterISORegionName\":\"ES\",\"ThreeLetterISORegionName\":\"ESP\"},{\"Name\":\"LK\",\"DisplayName\":\"Sri Lanka\",\"TwoLetterISORegionName\":\"LK\",\"ThreeLetterISORegionName\":\"LKA\"},{\"Name\":\"SE\",\"DisplayName\":\"Sweden\",\"TwoLetterISORegionName\":\"SE\",\"ThreeLetterISORegionName\":\"SWE\"},{\"Name\":\"CH\",\"DisplayName\":\"Switzerland\",\"TwoLetterISORegionName\":\"CH\",\"ThreeLetterISORegionName\":\"CHE\"},{\"Name\":\"SY\",\"DisplayName\":\"Syria\",\"TwoLetterISORegionName\":\"SY\",\"ThreeLetterISORegionName\":\"SYR\"},{\"Name\":\"TW\",\"DisplayName\":\"Taiwan\",\"TwoLetterISORegionName\":\"TW\",\"ThreeLetterISORegionName\":\"TWN\"},{\"Name\":\"TJ\",\"DisplayName\":\"Tajikistan\",\"TwoLetterISORegionName\":\"TJ\",\"ThreeLetterISORegionName\":\"TAJ\"},{\"Name\":\"TH\",\"DisplayName\":\"Thailand\",\"TwoLetterISORegionName\":\"TH\",\"ThreeLetterISORegionName\":\"THA\"},{\"Name\":\"TT\",\"DisplayName\":\"Trinidad and Tobago\",\"TwoLetterISORegionName\":\"TT\",\"ThreeLetterISORegionName\":\"TTO\"},{\"Name\":\"TN\",\"DisplayName\":\"Tunisia\",\"TwoLetterISORegionName\":\"TN\",\"ThreeLetterISORegionName\":\"TUN\"},{\"Name\":\"TR\",\"DisplayName\":\"Turkey\",\"TwoLetterISORegionName\":\"TR\",\"ThreeLetterISORegionName\":\"TUR\"},{\"Name\":\"TM\",\"DisplayName\":\"Turkmenistan\",\"TwoLetterISORegionName\":\"TM\",\"ThreeLetterISORegionName\":\"TKM\"},{\"Name\":\"AE\",\"DisplayName\":\"U.A.E.\",\"TwoLetterISORegionName\":\"AE\",\"ThreeLetterISORegionName\":\"ARE\"},{\"Name\":\"UA\",\"DisplayName\":\"Ukraine\",\"TwoLetterISORegionName\":\"UA\",\"ThreeLetterISORegionName\":\"UKR\"},{\"Name\":\"GB\",\"DisplayName\":\"United Kingdom\",\"TwoLetterISORegionName\":\"GB\",\"ThreeLetterISORegionName\":\"GBR\"},{\"Name\":\"US\",\"DisplayName\":\"United States\",\"TwoLetterISORegionName\":\"US\",\"ThreeLetterISORegionName\":\"USA\"},{\"Name\":\"UY\",\"DisplayName\":\"Uruguay\",\"TwoLetterISORegionName\":\"UY\",\"ThreeLetterISORegionName\":\"URY\"},{\"Name\":\"UZ\",\"DisplayName\":\"Uzbekistan\",\"TwoLetterISORegionName\":\"UZ\",\"ThreeLetterISORegionName\":\"UZB\"},{\"Name\":\"VN\",\"DisplayName\":\"Vietnam\",\"TwoLetterISORegionName\":\"VN\",\"ThreeLetterISORegionName\":\"VNM\"},{\"Name\":\"YE\",\"DisplayName\":\"Yemen\",\"TwoLetterISORegionName\":\"YE\",\"ThreeLetterISORegionName\":\"YEM\"},{\"Name\":\"ZW\",\"DisplayName\":\"Zimbabwe\",\"TwoLetterISORegionName\":\"ZW\",\"ThreeLetterISORegionName\":\"ZWE\"}]";
-
- return _jsonSerializer.DeserializeFromString(jsonCountries);
- }
+ public Task GetCountries()
+ => _jsonSerializer.DeserializeFromStreamAsync(
+ _assembly.GetManifestResourceStream("Emby.Server.Implementations.Localization.countries.json"));
///
/// Gets the parental ratings.
///
/// IEnumerable{ParentalRating}.
- public ParentalRating[] GetParentalRatings()
- {
- return GetParentalRatingsDictionary().Values.ToArray();
- }
+ public IEnumerable GetParentalRatings()
+ => GetParentalRatingsDictionary().Values;
///
/// Gets the parental ratings dictionary.
@@ -288,12 +268,7 @@ namespace Emby.Server.Implementations.Localization
countryCode = "us";
}
- var ratings = GetRatings(countryCode);
-
- if (ratings == null)
- {
- ratings = GetRatings("us");
- }
+ var ratings = GetRatings(countryCode) ?? GetRatings("us");
return ratings;
}
@@ -314,37 +289,38 @@ namespace Emby.Server.Implementations.Localization
///
/// The file.
/// Dictionary{System.StringParentalRating}.
- private void LoadRatings(string file)
+ private async Task LoadRatings(string file)
{
- var dict = _fileSystem.ReadAllLines(file).Select(i =>
+ Dictionary dict = new Dictionary(StringComparer.OrdinalIgnoreCase);
+ using (var str = File.OpenRead(file))
+ using (var reader = new StreamReader(str))
{
- if (!string.IsNullOrWhiteSpace(i))
+ string line;
+ while ((line = await reader.ReadLineAsync()) != null)
{
- var parts = i.Split(',');
+ if (string.IsNullOrWhiteSpace(line))
+ {
+ continue;
+ }
- if (parts.Length == 2)
+ string[] parts = line.Split(',');
+ if (parts.Length == 2
+ && int.TryParse(parts[1], NumberStyles.Integer, UsCulture, out var value))
{
- if (int.TryParse(parts[1], NumberStyles.Integer, UsCulture, out var value))
- {
- return new ParentalRating { Name = parts[0], Value = value };
- }
+ dict.Add(parts[0], (new ParentalRating { Name = parts[0], Value = value }));
}
+#if DEBUG
+ _logger.LogWarning("Misformed line in {Path}", file);
+#endif
}
+ }
- return null;
-
- })
- .Where(i => i != null)
- .ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase);
-
- var countryCode = _fileSystem.GetFileNameWithoutExtension(file)
- .Split('-')
- .Last();
+ var countryCode = Path.GetFileNameWithoutExtension(file).Split('-')[1];
_allParentalRatings[countryCode] = dict;
}
- private readonly string[] _unratedValues = { "n/a", "unrated", "not rated" };
+ private static readonly string[] _unratedValues = { "n/a", "unrated", "not rated" };
///
/// Gets the rating level.
@@ -435,7 +411,7 @@ namespace Emby.Server.Implementations.Localization
return phrase;
}
- const string DefaultCulture = "en-US";
+ private const string DefaultCulture = "en-US";
private readonly ConcurrentDictionary> _dictionaries =
new ConcurrentDictionary>(StringComparer.OrdinalIgnoreCase);
@@ -450,10 +426,11 @@ namespace Emby.Server.Implementations.Localization
const string prefix = "Core";
var key = prefix + culture;
- return _dictionaries.GetOrAdd(key, k => GetDictionary(prefix, culture, DefaultCulture + ".json"));
+ return _dictionaries.GetOrAdd(key,
+ f => GetDictionary(prefix, culture, DefaultCulture + ".json").GetAwaiter().GetResult());
}
- private Dictionary GetDictionary(string prefix, string culture, string baseFilename)
+ private async Task> GetDictionary(string prefix, string culture, string baseFilename)
{
if (string.IsNullOrEmpty(culture))
{
@@ -464,24 +441,21 @@ namespace Emby.Server.Implementations.Localization
var namespaceName = GetType().Namespace + "." + prefix;
- CopyInto(dictionary, namespaceName + "." + baseFilename);
- CopyInto(dictionary, namespaceName + "." + GetResourceFilename(culture));
+ await CopyInto(dictionary, namespaceName + "." + baseFilename);
+ await CopyInto(dictionary, namespaceName + "." + GetResourceFilename(culture));
return dictionary;
}
- private void CopyInto(IDictionary dictionary, string resourcePath)
+ private async Task CopyInto(IDictionary dictionary, string resourcePath)
{
- using (var stream = _assemblyInfo.GetManifestResourceStream(GetType(), resourcePath))
+ using (var stream = _assembly.GetManifestResourceStream(resourcePath))
{
- if (stream != null)
- {
- var dict = _jsonSerializer.DeserializeFromStream>(stream);
+ var dict = await _jsonSerializer.DeserializeFromStreamAsync>(stream);
- foreach (var key in dict.Keys)
- {
- dictionary[key] = dict[key];
- }
+ foreach (var key in dict.Keys)
+ {
+ dictionary[key] = dict[key];
}
}
}
@@ -552,11 +526,4 @@ namespace Emby.Server.Implementations.Localization
new LocalizationOption("Vietnamese", "vi")
};
}
-
- public interface ITextLocalizer
- {
- string RemoveDiacritics(string text);
-
- string NormalizeFormKD(string text);
- }
}
diff --git a/Emby.Server.Implementations/Localization/Ratings/br.txt b/Emby.Server.Implementations/Localization/Ratings/br.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/br.txt
rename to Emby.Server.Implementations/Localization/Ratings/br.csv
diff --git a/Emby.Server.Implementations/Localization/Ratings/ca.txt b/Emby.Server.Implementations/Localization/Ratings/ca.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/ca.txt
rename to Emby.Server.Implementations/Localization/Ratings/ca.csv
diff --git a/Emby.Server.Implementations/Localization/Ratings/co.txt b/Emby.Server.Implementations/Localization/Ratings/co.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/co.txt
rename to Emby.Server.Implementations/Localization/Ratings/co.csv
diff --git a/Emby.Server.Implementations/Localization/Ratings/dk.txt b/Emby.Server.Implementations/Localization/Ratings/dk.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/dk.txt
rename to Emby.Server.Implementations/Localization/Ratings/dk.csv
diff --git a/Emby.Server.Implementations/Localization/Ratings/es.txt b/Emby.Server.Implementations/Localization/Ratings/es.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/es.txt
rename to Emby.Server.Implementations/Localization/Ratings/es.csv
diff --git a/Emby.Server.Implementations/Localization/Ratings/fr.txt b/Emby.Server.Implementations/Localization/Ratings/fr.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/fr.txt
rename to Emby.Server.Implementations/Localization/Ratings/fr.csv
diff --git a/Emby.Server.Implementations/Localization/Ratings/gb.txt b/Emby.Server.Implementations/Localization/Ratings/gb.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/gb.txt
rename to Emby.Server.Implementations/Localization/Ratings/gb.csv
diff --git a/Emby.Server.Implementations/Localization/Ratings/ie.txt b/Emby.Server.Implementations/Localization/Ratings/ie.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/ie.txt
rename to Emby.Server.Implementations/Localization/Ratings/ie.csv
diff --git a/Emby.Server.Implementations/Localization/Ratings/jp.txt b/Emby.Server.Implementations/Localization/Ratings/jp.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/jp.txt
rename to Emby.Server.Implementations/Localization/Ratings/jp.csv
diff --git a/Emby.Server.Implementations/Localization/Ratings/kz.txt b/Emby.Server.Implementations/Localization/Ratings/kz.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/kz.txt
rename to Emby.Server.Implementations/Localization/Ratings/kz.csv
diff --git a/Emby.Server.Implementations/Localization/Ratings/mx.txt b/Emby.Server.Implementations/Localization/Ratings/mx.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/mx.txt
rename to Emby.Server.Implementations/Localization/Ratings/mx.csv
diff --git a/Emby.Server.Implementations/Localization/Ratings/nl.txt b/Emby.Server.Implementations/Localization/Ratings/nl.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/nl.txt
rename to Emby.Server.Implementations/Localization/Ratings/nl.csv
diff --git a/Emby.Server.Implementations/Localization/Ratings/nz.txt b/Emby.Server.Implementations/Localization/Ratings/nz.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/nz.txt
rename to Emby.Server.Implementations/Localization/Ratings/nz.csv
diff --git a/Emby.Server.Implementations/Localization/Ratings/ro.txt b/Emby.Server.Implementations/Localization/Ratings/ro.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/ro.txt
rename to Emby.Server.Implementations/Localization/Ratings/ro.csv
diff --git a/Emby.Server.Implementations/Localization/Ratings/uk.txt b/Emby.Server.Implementations/Localization/Ratings/uk.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/uk.txt
rename to Emby.Server.Implementations/Localization/Ratings/uk.csv
diff --git a/Emby.Server.Implementations/Localization/Ratings/us.txt b/Emby.Server.Implementations/Localization/Ratings/us.csv
similarity index 100%
rename from Emby.Server.Implementations/Localization/Ratings/us.txt
rename to Emby.Server.Implementations/Localization/Ratings/us.csv
diff --git a/Emby.Server.Implementations/Localization/TextLocalizer.cs b/Emby.Server.Implementations/Localization/TextLocalizer.cs
deleted file mode 100644
index 96591e5e67..0000000000
--- a/Emby.Server.Implementations/Localization/TextLocalizer.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-using System;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-
-namespace Emby.Server.Implementations.Localization
-{
- public class TextLocalizer : ITextLocalizer
- {
- public string RemoveDiacritics(string text)
- {
- if (text == null)
- {
- throw new ArgumentNullException(nameof(text));
- }
-
- var chars = Normalize(text, NormalizationForm.FormD)
- .Where(ch => CharUnicodeInfo.GetUnicodeCategory(ch) != UnicodeCategory.NonSpacingMark);
-
- return Normalize(string.Concat(chars), NormalizationForm.FormC);
- }
-
- private static string Normalize(string text, NormalizationForm form, bool stripStringOnFailure = true)
- {
- if (stripStringOnFailure)
- {
- try
- {
- return text.Normalize(form);
- }
- catch (ArgumentException)
- {
- // will throw if input contains invalid unicode chars
- // https://mnaoumov.wordpress.com/2014/06/14/stripping-invalid-characters-from-utf-16-strings/
- text = StripInvalidUnicodeCharacters(text);
- return Normalize(text, form, false);
- }
- }
-
- try
- {
- return text.Normalize(form);
- }
- catch (ArgumentException)
- {
- // if it still fails, return the original text
- return text;
- }
- }
-
- private static string StripInvalidUnicodeCharacters(string str)
- {
- var invalidCharactersRegex = new Regex("([\ud800-\udbff](?![\udc00-\udfff]))|((? Get(GetMetadataEditorInfo request)
{
var item = _libraryManager.GetItemById(request.ItemId);
var info = new MetadataEditorInfo
{
- ParentalRatingOptions = _localizationManager.GetParentalRatings(),
+ ParentalRatingOptions = _localizationManager.GetParentalRatings().ToArray(),
ExternalIdInfos = _providerManager.GetExternalIdInfos(item).ToArray(),
- Countries = _localizationManager.GetCountries(),
+ Countries = await _localizationManager.GetCountries(),
Cultures = _localizationManager.GetCultures()
};
diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs
index 385127c54b..59e3c17674 100644
--- a/MediaBrowser.Common/IApplicationHost.cs
+++ b/MediaBrowser.Common/IApplicationHost.cs
@@ -89,7 +89,7 @@ namespace MediaBrowser.Common
///
/// if set to true [manage liftime].
/// IEnumerable{``0}.
- IEnumerable GetExports(bool manageLiftime = true);
+ IEnumerable GetExports(bool manageLifetime = true);
///
/// Updates the application.
@@ -131,7 +131,7 @@ namespace MediaBrowser.Common
///
/// Inits this instance.
///
- void Init();
+ Task Init();
///
/// Creates the instance.
diff --git a/MediaBrowser.Controller/Extensions/StringExtensions.cs b/MediaBrowser.Controller/Extensions/StringExtensions.cs
index 73f529fc01..b1aaf6534e 100644
--- a/MediaBrowser.Controller/Extensions/StringExtensions.cs
+++ b/MediaBrowser.Controller/Extensions/StringExtensions.cs
@@ -1,4 +1,8 @@
-using MediaBrowser.Model.Globalization;
+using System;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
namespace MediaBrowser.Controller.Extensions
{
@@ -7,11 +11,45 @@ namespace MediaBrowser.Controller.Extensions
///
public static class StringExtensions
{
- public static ILocalizationManager LocalizationManager { get; set; }
-
public static string RemoveDiacritics(this string text)
{
- return LocalizationManager.RemoveDiacritics(text);
+ if (text == null)
+ {
+ throw new ArgumentNullException(nameof(text));
+ }
+
+ var chars = Normalize(text, NormalizationForm.FormD)
+ .Where(ch => CharUnicodeInfo.GetUnicodeCategory(ch) != UnicodeCategory.NonSpacingMark);
+
+ return Normalize(string.Concat(chars), NormalizationForm.FormC);
+ }
+
+ private static string Normalize(string text, NormalizationForm form, bool stripStringOnFailure = true)
+ {
+ if (stripStringOnFailure)
+ {
+ try
+ {
+ return text.Normalize(form);
+ }
+ catch (ArgumentException)
+ {
+ // will throw if input contains invalid unicode chars
+ // https://mnaoumov.wordpress.com/2014/06/14/stripping-invalid-characters-from-utf-16-strings/
+ text = Regex.Replace(text, "([\ud800-\udbff](?![\udc00-\udfff]))|((?
/// IEnumerable{CountryInfo}.
- CountryInfo[] GetCountries();
+ Task GetCountries();
///
/// Gets the parental ratings.
///
/// IEnumerable{ParentalRating}.
- ParentalRating[] GetParentalRatings();
+ IEnumerable GetParentalRatings();
///
/// Gets the rating level.
///
@@ -51,8 +53,6 @@ namespace MediaBrowser.Model.Globalization
/// IEnumerable{LocalizatonOption}.
LocalizationOption[] GetLocalizationOptions();
- string RemoveDiacritics(string text);
-
string NormalizeFormKD(string text);
bool HasUnicodeCategory(string value, UnicodeCategory category);
diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs
index 1972ad290c..77028e526a 100644
--- a/MediaBrowser.Providers/Manager/MetadataService.cs
+++ b/MediaBrowser.Providers/Manager/MetadataService.cs
@@ -566,8 +566,7 @@ namespace MediaBrowser.Providers.Manager
var providersWithChanges = providers
.Where(i =>
{
- var hasFileChangeMonitor = i as IHasItemChangeMonitor;
- if (hasFileChangeMonitor != null)
+ if (i is IHasItemChangeMonitor hasFileChangeMonitor)
{
return HasChanged(item, hasFileChangeMonitor, options.DirectoryService);
}
diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs
index 5e9824ed1f..77bc700588 100644
--- a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs
+++ b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs
@@ -73,17 +73,12 @@ namespace MediaBrowser.Providers.MediaInfo
}
}
- if (item.SupportsLocalMetadata)
+ if (item.SupportsLocalMetadata && video != null && !video.IsPlaceHolder
+ && !video.SubtitleFiles.SequenceEqual(
+ _subtitleResolver.GetExternalSubtitleFiles(video, directoryService, false), StringComparer.Ordinal))
{
- if (video != null && !video.IsPlaceHolder)
- {
- if (!video.SubtitleFiles
- .SequenceEqual(_subtitleResolver.GetExternalSubtitleFiles(video, directoryService, false), StringComparer.Ordinal))
- {
- _logger.LogDebug("Refreshing {0} due to external subtitles change.", item.Path);
- return true;
- }
- }
+ _logger.LogDebug("Refreshing {0} due to external subtitles change.", item.Path);
+ return true;
}
return false;
From 08b63a7c11d5db9126c48e644b090223f86f0eb8 Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Sun, 27 Jan 2019 10:49:23 +0100
Subject: [PATCH 02/93] Remove unused function
RunStartupTasks never executes because "startuptasks.txt" is never
created
---
.../ScheduledTasks/ScheduledTaskWorker.cs | 1 -
.../ScheduledTasks/TaskManager.cs | 43 +------------------
2 files changed, 2 insertions(+), 42 deletions(-)
diff --git a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
index 93a9a0d814..952f17678e 100644
--- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
@@ -10,7 +10,6 @@ using MediaBrowser.Common.Progress;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks;
using Microsoft.Extensions.Logging;
diff --git a/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs b/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs
index d74c8fe8c9..595c3037d7 100644
--- a/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs
@@ -1,14 +1,12 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks;
using Microsoft.Extensions.Logging;
@@ -74,38 +72,6 @@ namespace Emby.Server.Implementations.ScheduledTasks
ScheduledTasks = new IScheduledTaskWorker[] { };
}
- private void RunStartupTasks()
- {
- var path = Path.Combine(ApplicationPaths.CachePath, "startuptasks.txt");
-
- // ToDo: Fix this shit
- if (!File.Exists(path))
- return;
-
- List lines;
-
- try
- {
- lines = _fileSystem.ReadAllLines(path).Where(i => !string.IsNullOrWhiteSpace(i)).Distinct(StringComparer.OrdinalIgnoreCase).ToList();
-
- foreach (var key in lines)
- {
- var task = ScheduledTasks.FirstOrDefault(i => string.Equals(i.ScheduledTask.Key, key, StringComparison.OrdinalIgnoreCase));
-
- if (task != null)
- {
- QueueScheduledTask(task, new TaskOptions());
- }
- }
-
- _fileSystem.DeleteFile(path);
- }
- catch
- {
- return;
- }
- }
-
///
/// Cancels if running and queue.
///
@@ -247,14 +213,9 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// The tasks.
public void AddTasks(IEnumerable tasks)
{
- var myTasks = ScheduledTasks.ToList();
-
- var list = tasks.ToList();
- myTasks.AddRange(list.Select(t => new ScheduledTaskWorker(t, ApplicationPaths, this, JsonSerializer, Logger, _fileSystem)));
-
- ScheduledTasks = myTasks.ToArray();
+ var list = tasks.Select(t => new ScheduledTaskWorker(t, ApplicationPaths, this, JsonSerializer, Logger, _fileSystem));
- RunStartupTasks();
+ ScheduledTasks = ScheduledTasks.Concat(list).ToArray();
}
///
From a709cbdc64de36a1ce989636a19344af61d9026d Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Sun, 27 Jan 2019 12:03:43 +0100
Subject: [PATCH 03/93] Fix more analyzer warnings
---
Emby.Dlna/Api/DlnaServerService.cs | 4 +-
Emby.Dlna/Didl/DidlBuilder.cs | 8 +-
Emby.Dlna/DlnaManager.cs | 6 +-
Emby.Dlna/Main/DlnaEntryPoint.cs | 2 +-
Emby.Dlna/PlayTo/Device.cs | 68 ++++----
Emby.Dlna/Server/DescriptionXmlBuilder.cs | 146 +++++++++---------
Emby.Drawing/ImageProcessor.cs | 4 +-
.../IsoMounter/LinuxIsoManager.cs | 7 +-
.../AppBase/BaseConfigurationManager.cs | 2 +-
.../Data/SqliteItemRepository.cs | 6 +-
.../HttpClientManager/HttpClientManager.cs | 6 +-
.../HttpServer/HttpResultFactory.cs | 2 +-
.../Library/LibraryManager.cs | 2 +-
.../LiveTv/EmbyTV/EmbyTV.cs | 2 +-
.../LiveTv/LiveTvDtoService.cs | 8 +-
.../Localization/LocalizationManager.cs | 4 +-
.../Services/RequestHelper.cs | 2 +-
.../Services/ServiceExec.cs | 2 +-
.../Services/ServiceMethod.cs | 2 +-
.../Services/ServicePath.cs | 10 +-
.../Services/SwaggerService.cs | 28 +---
Jellyfin.Drawing.Skia/StripCollageBuilder.cs | 2 +-
Jellyfin.Server/SocketSharp/RequestMono.cs | 25 ++-
.../SocketSharp/WebSocketSharpRequest.cs | 41 +++--
MediaBrowser.Api/Images/ImageByNameService.cs | 2 +-
MediaBrowser.Api/LiveTv/LiveTvService.cs | 4 +-
.../Playback/BaseStreamingService.cs | 4 +-
MediaBrowser.Controller/Entities/BaseItem.cs | 4 +-
MediaBrowser.Controller/Entities/Video.cs | 2 +-
.../MediaEncoding/EncodingHelper.cs | 16 +-
.../Images/LocalImageProvider.cs | 2 +-
.../Savers/BaseXmlSaver.cs | 6 +-
.../Encoder/BaseEncoder.cs | 4 +-
.../Subtitles/SsaParser.cs | 24 +--
MediaBrowser.Model/Dlna/StreamInfo.cs | 22 +--
MediaBrowser.Model/Entities/MediaStream.cs | 6 +-
MediaBrowser.Model/Extensions/StringHelper.cs | 2 +-
MediaBrowser.Model/MediaInfo/AudioCodec.cs | 9 +-
MediaBrowser.Model/Net/MimeTypes.cs | 2 +-
MediaBrowser.Providers/Manager/ImageSaver.cs | 4 +-
.../Manager/ItemImageProvider.cs | 2 +-
.../MediaInfo/SubtitleResolver.cs | 2 +-
.../Movies/MovieDbProvider.cs | 2 +-
.../Movies/MovieDbSearch.cs | 2 +-
.../Subtitles/SubtitleManager.cs | 6 +-
.../TV/TheTVDB/TvdbSeriesProvider.cs | 6 +-
.../Savers/BaseNfoSaver.cs | 25 +--
SocketHttpListener/Ext.cs | 2 +-
SocketHttpListener/Net/HttpListenerRequest.cs | 2 +-
49 files changed, 290 insertions(+), 261 deletions(-)
diff --git a/Emby.Dlna/Api/DlnaServerService.cs b/Emby.Dlna/Api/DlnaServerService.cs
index 01c9fe50f5..68bf801637 100644
--- a/Emby.Dlna/Api/DlnaServerService.cs
+++ b/Emby.Dlna/Api/DlnaServerService.cs
@@ -236,7 +236,9 @@ namespace Emby.Dlna.Api
public object Get(GetIcon request)
{
- var contentType = "image/" + Path.GetExtension(request.Filename).TrimStart('.').ToLower();
+ var contentType = "image/" + Path.GetExtension(request.Filename)
+ .TrimStart('.')
+ .ToLowerInvariant();
var cacheLength = TimeSpan.FromDays(365);
var cacheKey = Request.RawUrl.GetMD5();
diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs
index 440f96b3f9..24c10b3891 100644
--- a/Emby.Dlna/Didl/DidlBuilder.cs
+++ b/Emby.Dlna/Didl/DidlBuilder.cs
@@ -265,7 +265,7 @@ namespace Emby.Dlna.Didl
// http://192.168.1.3:9999/video.srt
writer.WriteStartElement("sec", "CaptionInfoEx", null);
- writer.WriteAttributeString("sec", "type", null, info.Format.ToLower());
+ writer.WriteAttributeString("sec", "type", null, info.Format.ToLowerInvariant());
writer.WriteString(info.Url);
writer.WriteFullEndElement();
@@ -282,7 +282,7 @@ namespace Emby.Dlna.Didl
else
{
writer.WriteStartElement(string.Empty, "res", NS_DIDL);
- var protocolInfo = string.Format("http-get:*:text/{0}:*", info.Format.ToLower());
+ var protocolInfo = string.Format("http-get:*:text/{0}:*", info.Format.ToLowerInvariant());
writer.WriteAttributeString("protocolInfo", protocolInfo);
writer.WriteString(info.Url);
@@ -844,7 +844,7 @@ namespace Emby.Dlna.Didl
// var type = types.FirstOrDefault(i => string.Equals(i, actor.Type, StringComparison.OrdinalIgnoreCase) || string.Equals(i, actor.Role, StringComparison.OrdinalIgnoreCase))
// ?? PersonType.Actor;
- // AddValue(writer, "upnp", type.ToLower(), actor.Name, NS_UPNP);
+ // AddValue(writer, "upnp", type.ToLowerInvariant(), actor.Name, NS_UPNP);
// index++;
@@ -1147,7 +1147,7 @@ namespace Emby.Dlna.Didl
if (stubType.HasValue)
{
- id = stubType.Value.ToString().ToLower() + "_" + id;
+ id = stubType.Value.ToString().ToLowerInvariant() + "_" + id;
}
return id;
diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.cs
index f795b58cbb..a668b3b214 100644
--- a/Emby.Dlna/DlnaManager.cs
+++ b/Emby.Dlna/DlnaManager.cs
@@ -300,7 +300,7 @@ namespace Emby.Dlna
profile = ReserializeProfile(tempProfile);
- profile.Id = path.ToLower().GetMD5().ToString("N");
+ profile.Id = path.ToLowerInvariant().GetMD5().ToString("N");
_profiles[path] = new Tuple(GetInternalProfileInfo(_fileSystem.GetFileInfo(path), type), profile);
@@ -352,7 +352,7 @@ namespace Emby.Dlna
Info = new DeviceProfileInfo
{
- Id = file.FullName.ToLower().GetMD5().ToString("N"),
+ Id = file.FullName.ToLowerInvariant().GetMD5().ToString("N"),
Name = _fileSystem.GetFileNameWithoutExtension(file),
Type = type
}
@@ -506,7 +506,7 @@ namespace Emby.Dlna
? ImageFormat.Png
: ImageFormat.Jpg;
- var resource = GetType().Namespace + ".Images." + filename.ToLower();
+ var resource = GetType().Namespace + ".Images." + filename.ToLowerInvariant();
return new ImageStream
{
diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs
index 1ab6014eb0..ad90da49b7 100644
--- a/Emby.Dlna/Main/DlnaEntryPoint.cs
+++ b/Emby.Dlna/Main/DlnaEntryPoint.cs
@@ -263,7 +263,7 @@ namespace Emby.Dlna.Main
var fullService = "urn:schemas-upnp-org:device:MediaServer:1";
- _logger.LogInformation("Registering publisher for {0} on {1}", fullService, address.ToString());
+ _logger.LogInformation("Registering publisher for {0} on {1}", fullService, address);
var descriptorUri = "/dlna/" + udn + "/description.xml";
var uri = new Uri(_appHost.GetLocalApiUrl(address) + descriptorUri);
diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.cs
index 68aa0a6a71..85a522d1cc 100644
--- a/Emby.Dlna/PlayTo/Device.cs
+++ b/Emby.Dlna/PlayTo/Device.cs
@@ -902,54 +902,75 @@ namespace Emby.Dlna.PlayTo
var name = document.Descendants(uPnpNamespaces.ud.GetName("friendlyName")).FirstOrDefault();
if (name != null && !string.IsNullOrWhiteSpace(name.Value))
+ {
friendlyNames.Add(name.Value);
+ }
var room = document.Descendants(uPnpNamespaces.ud.GetName("roomName")).FirstOrDefault();
if (room != null && !string.IsNullOrWhiteSpace(room.Value))
+ {
friendlyNames.Add(room.Value);
+ }
- deviceProperties.Name = string.Join(" ", friendlyNames.ToArray());
+ deviceProperties.Name = string.Join(" ", friendlyNames);
var model = document.Descendants(uPnpNamespaces.ud.GetName("modelName")).FirstOrDefault();
if (model != null)
+ {
deviceProperties.ModelName = model.Value;
+ }
var modelNumber = document.Descendants(uPnpNamespaces.ud.GetName("modelNumber")).FirstOrDefault();
if (modelNumber != null)
+ {
deviceProperties.ModelNumber = modelNumber.Value;
+ }
var uuid = document.Descendants(uPnpNamespaces.ud.GetName("UDN")).FirstOrDefault();
if (uuid != null)
+ {
deviceProperties.UUID = uuid.Value;
+ }
var manufacturer = document.Descendants(uPnpNamespaces.ud.GetName("manufacturer")).FirstOrDefault();
if (manufacturer != null)
+ {
deviceProperties.Manufacturer = manufacturer.Value;
+ }
var manufacturerUrl = document.Descendants(uPnpNamespaces.ud.GetName("manufacturerURL")).FirstOrDefault();
if (manufacturerUrl != null)
+ {
deviceProperties.ManufacturerUrl = manufacturerUrl.Value;
+ }
var presentationUrl = document.Descendants(uPnpNamespaces.ud.GetName("presentationURL")).FirstOrDefault();
if (presentationUrl != null)
+ {
deviceProperties.PresentationUrl = presentationUrl.Value;
+ }
var modelUrl = document.Descendants(uPnpNamespaces.ud.GetName("modelURL")).FirstOrDefault();
if (modelUrl != null)
+ {
deviceProperties.ModelUrl = modelUrl.Value;
+ }
var serialNumber = document.Descendants(uPnpNamespaces.ud.GetName("serialNumber")).FirstOrDefault();
if (serialNumber != null)
+ {
deviceProperties.SerialNumber = serialNumber.Value;
+ }
var modelDescription = document.Descendants(uPnpNamespaces.ud.GetName("modelDescription")).FirstOrDefault();
if (modelDescription != null)
+ {
deviceProperties.ModelDescription = modelDescription.Value;
+ }
deviceProperties.BaseUrl = string.Format("http://{0}:{1}", url.Host, url.Port);
var icon = document.Descendants(uPnpNamespaces.ud.GetName("icon")).FirstOrDefault();
-
if (icon != null)
{
deviceProperties.Icon = CreateIcon(icon);
@@ -958,12 +979,16 @@ namespace Emby.Dlna.PlayTo
foreach (var services in document.Descendants(uPnpNamespaces.ud.GetName("serviceList")))
{
if (services == null)
+ {
continue;
+ }
var servicesList = services.Descendants(uPnpNamespaces.ud.GetName("service"));
if (servicesList == null)
+ {
continue;
+ }
foreach (var element in servicesList)
{
@@ -1065,13 +1090,10 @@ namespace Emby.Dlna.PlayTo
private void OnPlaybackStart(uBaseObject mediaInfo)
{
- if (PlaybackStart != null)
+ PlaybackStart?.Invoke(this, new PlaybackStartEventArgs
{
- PlaybackStart.Invoke(this, new PlaybackStartEventArgs
- {
- MediaInfo = mediaInfo
- });
- }
+ MediaInfo = mediaInfo
+ });
}
private void OnPlaybackProgress(uBaseObject mediaInfo)
@@ -1082,36 +1104,28 @@ namespace Emby.Dlna.PlayTo
return;
}
- if (PlaybackProgress != null)
+ PlaybackProgress?.Invoke(this, new PlaybackProgressEventArgs
{
- PlaybackProgress.Invoke(this, new PlaybackProgressEventArgs
- {
- MediaInfo = mediaInfo
- });
- }
+ MediaInfo = mediaInfo
+ });
}
private void OnPlaybackStop(uBaseObject mediaInfo)
{
- if (PlaybackStopped != null)
+
+ PlaybackStopped?.Invoke(this, new PlaybackStoppedEventArgs
{
- PlaybackStopped.Invoke(this, new PlaybackStoppedEventArgs
- {
- MediaInfo = mediaInfo
- });
- }
+ MediaInfo = mediaInfo
+ });
}
private void OnMediaChanged(uBaseObject old, uBaseObject newMedia)
{
- if (MediaChanged != null)
+ MediaChanged?.Invoke(this, new MediaChangedEventArgs
{
- MediaChanged.Invoke(this, new MediaChangedEventArgs
- {
- OldMediaInfo = old,
- NewMediaInfo = newMedia
- });
- }
+ OldMediaInfo = old,
+ NewMediaInfo = newMedia
+ });
}
#region IDisposable
diff --git a/Emby.Dlna/Server/DescriptionXmlBuilder.cs b/Emby.Dlna/Server/DescriptionXmlBuilder.cs
index e0ecbee43f..03d8f80abb 100644
--- a/Emby.Dlna/Server/DescriptionXmlBuilder.cs
+++ b/Emby.Dlna/Server/DescriptionXmlBuilder.cs
@@ -107,19 +107,19 @@ namespace Emby.Dlna.Server
'&'
};
- private static readonly string[] s_escapeStringPairs = new string[]
-{
- "<",
- "<",
- ">",
- ">",
- "\"",
- """,
- "'",
- "'",
- "&",
- "&"
-};
+ private static readonly string[] s_escapeStringPairs = new[]
+ {
+ "<",
+ "<",
+ ">",
+ ">",
+ "\"",
+ """,
+ "'",
+ "'",
+ "&",
+ "&"
+ };
private static string GetEscapeSequence(char c)
{
@@ -133,7 +133,7 @@ namespace Emby.Dlna.Server
return result;
}
}
- return c.ToString();
+ return c.ToString(CultureInfo.InvariantCulture);
}
/// Replaces invalid XML characters in a string with their valid XML equivalent.
@@ -145,6 +145,7 @@ namespace Emby.Dlna.Server
{
return null;
}
+
StringBuilder stringBuilder = null;
int length = str.Length;
int num = 0;
@@ -230,9 +231,9 @@ namespace Emby.Dlna.Server
var serverName = new string(characters);
- var name = (_profile.FriendlyName ?? string.Empty).Replace("${HostName}", serverName, StringComparison.OrdinalIgnoreCase);
+ var name = _profile.FriendlyName?.Replace("${HostName}", serverName, StringComparison.OrdinalIgnoreCase);
- return name;
+ return name ?? string.Empty;
}
private void AppendIconList(StringBuilder builder)
@@ -295,65 +296,62 @@ namespace Emby.Dlna.Server
}
private IEnumerable GetIcons()
- {
- var list = new List();
-
- list.Add(new DeviceIcon
- {
- MimeType = "image/png",
- Depth = "24",
- Width = 240,
- Height = 240,
- Url = "icons/logo240.png"
- });
-
- list.Add(new DeviceIcon
- {
- MimeType = "image/jpeg",
- Depth = "24",
- Width = 240,
- Height = 240,
- Url = "icons/logo240.jpg"
- });
-
- list.Add(new DeviceIcon
- {
- MimeType = "image/png",
- Depth = "24",
- Width = 120,
- Height = 120,
- Url = "icons/logo120.png"
- });
-
- list.Add(new DeviceIcon
- {
- MimeType = "image/jpeg",
- Depth = "24",
- Width = 120,
- Height = 120,
- Url = "icons/logo120.jpg"
- });
-
- list.Add(new DeviceIcon
- {
- MimeType = "image/png",
- Depth = "24",
- Width = 48,
- Height = 48,
- Url = "icons/logo48.png"
- });
-
- list.Add(new DeviceIcon
+ => new[]
{
- MimeType = "image/jpeg",
- Depth = "24",
- Width = 48,
- Height = 48,
- Url = "icons/logo48.jpg"
- });
-
- return list;
- }
+ new DeviceIcon
+ {
+ MimeType = "image/png",
+ Depth = "24",
+ Width = 240,
+ Height = 240,
+ Url = "icons/logo240.png"
+ },
+
+ new DeviceIcon
+ {
+ MimeType = "image/jpeg",
+ Depth = "24",
+ Width = 240,
+ Height = 240,
+ Url = "icons/logo240.jpg"
+ },
+
+ new DeviceIcon
+ {
+ MimeType = "image/png",
+ Depth = "24",
+ Width = 120,
+ Height = 120,
+ Url = "icons/logo120.png"
+ },
+
+ new DeviceIcon
+ {
+ MimeType = "image/jpeg",
+ Depth = "24",
+ Width = 120,
+ Height = 120,
+ Url = "icons/logo120.jpg"
+ },
+
+ new DeviceIcon
+ {
+ MimeType = "image/png",
+ Depth = "24",
+ Width = 48,
+ Height = 48,
+ Url = "icons/logo48.png"
+ },
+
+ new DeviceIcon
+ {
+ MimeType = "image/jpeg",
+ Depth = "24",
+ Width = 48,
+ Height = 48,
+ Url = "icons/logo48.jpg"
+ }
+ };
private IEnumerable GetServices()
{
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs
index 8ac2b9b275..dbea337e9c 100644
--- a/Emby.Drawing/ImageProcessor.cs
+++ b/Emby.Drawing/ImageProcessor.cs
@@ -144,7 +144,7 @@ namespace Emby.Drawing
private static readonly string[] TransparentImageTypes = new string[] { ".png", ".webp", ".gif" };
public bool SupportsTransparency(string path)
- => TransparentImageTypes.Contains(Path.GetExtension(path).ToLower());
+ => TransparentImageTypes.Contains(Path.GetExtension(path).ToLowerInvariant());
public async Task<(string path, string mimeType, DateTime dateModified)> ProcessImage(ImageProcessingOptions options)
{
@@ -374,7 +374,7 @@ namespace Emby.Drawing
filename += "v=" + Version;
- return GetCachePath(ResizedImageCachePath, filename, "." + format.ToString().ToLower());
+ return GetCachePath(ResizedImageCachePath, filename, "." + format.ToString().ToLowerInvariant());
}
public ImageDimensions GetImageSize(BaseItem item, ItemImageInfo info)
diff --git a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs
index ac486f1675..62c83c0114 100644
--- a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs
+++ b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs
@@ -121,7 +121,7 @@ namespace IsoMounter
path,
Path.GetExtension(path),
EnvironmentInfo.OperatingSystem,
- ExecutablesAvailable.ToString()
+ ExecutablesAvailable
);
if (ExecutablesAvailable)
@@ -183,7 +183,7 @@ namespace IsoMounter
_logger.LogInformation(
"[{0}] Disposing [{1}].",
Name,
- disposing.ToString()
+ disposing
);
if (disposing)
@@ -229,9 +229,8 @@ namespace IsoMounter
var uid = getuid();
_logger.LogDebug(
- "[{0}] Our current UID is [{1}], GetUserId() returned [{2}].",
+ "[{0}] GetUserId() returned [{2}].",
Name,
- uid.ToString(),
uid
);
diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
index 59c7c655f1..ff35b32050 100644
--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
@@ -218,7 +218,7 @@ namespace Emby.Server.Implementations.AppBase
private string GetConfigurationFile(string key)
{
- return Path.Combine(CommonApplicationPaths.ConfigurationDirectoryPath, key.ToLower() + ".xml");
+ return Path.Combine(CommonApplicationPaths.ConfigurationDirectoryPath, key.ToLowerInvariant() + ".xml");
}
public object GetConfiguration(string key)
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
index 3de4da4447..5e81ddd8b1 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -3905,7 +3905,7 @@ namespace Emby.Server.Implementations.Data
// lowercase this because SortName is stored as lowercase
if (statement != null)
{
- statement.TryBind("@NameStartsWithOrGreater", query.NameStartsWithOrGreater.ToLower());
+ statement.TryBind("@NameStartsWithOrGreater", query.NameStartsWithOrGreater.ToLowerInvariant());
}
}
if (!string.IsNullOrWhiteSpace(query.NameLessThan))
@@ -3914,7 +3914,7 @@ namespace Emby.Server.Implementations.Data
// lowercase this because SortName is stored as lowercase
if (statement != null)
{
- statement.TryBind("@NameLessThan", query.NameLessThan.ToLower());
+ statement.TryBind("@NameLessThan", query.NameLessThan.ToLowerInvariant());
}
}
@@ -4822,7 +4822,7 @@ namespace Emby.Server.Implementations.Data
return value;
}
- return value.RemoveDiacritics().ToLower();
+ return value.RemoveDiacritics().ToLowerInvariant();
}
private bool EnableGroupByPresentationUniqueKey(InternalItemsQuery query)
diff --git a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
index ea620cb2ee..03066c2cb9 100644
--- a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
+++ b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
@@ -264,7 +264,7 @@ namespace Emby.Server.Implementations.HttpClientManager
}
var url = options.Url;
- var urlHash = url.ToLower().GetMD5().ToString("N");
+ var urlHash = url.ToLowerInvariant().GetMD5().ToString("N");
var responseCachePath = Path.Combine(_appPaths.CachePath, "httpclient", urlHash);
@@ -384,11 +384,11 @@ namespace Emby.Server.Implementations.HttpClientManager
{
if (options.LogRequestAsDebug)
{
- _logger.LogDebug("HttpClientManager {0}: {1}", httpMethod.ToUpper(), options.Url);
+ _logger.LogDebug("HttpClientManager {0}: {1}", httpMethod.ToUpper(CultureInfo.CurrentCulture), options.Url);
}
else
{
- _logger.LogInformation("HttpClientManager {0}: {1}", httpMethod.ToUpper(), options.Url);
+ _logger.LogInformation("HttpClientManager {0}: {1}", httpMethod.ToUpper(CultureInfo.CurrentCulture), options.Url);
}
}
diff --git a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
index 0ad4d8406b..7445fd3c28 100644
--- a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -394,7 +394,7 @@ namespace Emby.Server.Implementations.HttpServer
{
return contentType == null
? null
- : contentType.Split(';')[0].ToLower().Trim();
+ : contentType.Split(';')[0].ToLowerInvariant().Trim();
}
private static string SerializeToXmlString(object from)
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index ad070ed794..06e7dd15ee 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -517,7 +517,7 @@ namespace Emby.Server.Implementations.Library
if (forceCaseInsensitive || !ConfigurationManager.Configuration.EnableCaseSensitiveItemIds)
{
- key = key.ToLower();
+ key = key.ToLowerInvariant();
}
key = type.FullName + key;
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index 4805e54ddf..2572a12545 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -2193,7 +2193,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (lockData)
{
- writer.WriteElementString("lockdata", true.ToString().ToLower());
+ writer.WriteElementString("lockdata", true.ToString(CultureInfo.InvariantCulture).ToLowerInvariant());
}
if (item.CriticRating.HasValue)
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
index 724e8afdf8..1144c9ab17 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
@@ -399,7 +399,7 @@ namespace Emby.Server.Implementations.LiveTv
{
var name = serviceName + externalId + InternalVersionNumber;
- return _libraryManager.GetNewItemId(name.ToLower(), typeof(LiveTvChannel));
+ return _libraryManager.GetNewItemId(name.ToLowerInvariant(), typeof(LiveTvChannel));
}
private const string ServiceName = "Emby";
@@ -407,21 +407,21 @@ namespace Emby.Server.Implementations.LiveTv
{
var name = ServiceName + externalId + InternalVersionNumber;
- return name.ToLower().GetMD5().ToString("N");
+ return name.ToLowerInvariant().GetMD5().ToString("N");
}
public Guid GetInternalSeriesTimerId(string externalId)
{
var name = ServiceName + externalId + InternalVersionNumber;
- return name.ToLower().GetMD5();
+ return name.ToLowerInvariant().GetMD5();
}
public Guid GetInternalProgramId(string externalId)
{
var name = ServiceName + externalId + InternalVersionNumber;
- return _libraryManager.GetNewItemId(name.ToLower(), typeof(LiveTvProgram));
+ return _libraryManager.GetNewItemId(name.ToLowerInvariant(), typeof(LiveTvProgram));
}
public async Task GetTimerInfo(TimerInfoDto dto, bool isNew, LiveTvManager liveTv, CancellationToken cancellationToken)
diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs
index c408a47f62..a2af9e244a 100644
--- a/Emby.Server.Implementations/Localization/LocalizationManager.cs
+++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs
@@ -492,11 +492,11 @@ namespace Emby.Server.Implementations.Localization
if (parts.Length == 2)
{
- culture = parts[0].ToLower() + "-" + parts[1].ToUpper();
+ culture = parts[0].ToLowerInvariant() + "-" + parts[1].ToUpperInvariant();
}
else
{
- culture = culture.ToLower();
+ culture = culture.ToLowerInvariant();
}
return culture + ".json";
diff --git a/Emby.Server.Implementations/Services/RequestHelper.cs b/Emby.Server.Implementations/Services/RequestHelper.cs
index 24e9cbfa4d..2563cac999 100644
--- a/Emby.Server.Implementations/Services/RequestHelper.cs
+++ b/Emby.Server.Implementations/Services/RequestHelper.cs
@@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.Services
{
return contentType == null
? null
- : contentType.Split(';')[0].ToLower().Trim();
+ : contentType.Split(';')[0].ToLowerInvariant().Trim();
}
}
diff --git a/Emby.Server.Implementations/Services/ServiceExec.cs b/Emby.Server.Implementations/Services/ServiceExec.cs
index 45c918fa1b..aa67a36010 100644
--- a/Emby.Server.Implementations/Services/ServiceExec.cs
+++ b/Emby.Server.Implementations/Services/ServiceExec.cs
@@ -98,7 +98,7 @@ namespace Emby.Server.Implementations.Services
return Task.FromResult(response);
}
- var expectedMethodName = actionName.Substring(0, 1) + actionName.Substring(1).ToLower();
+ var expectedMethodName = actionName.Substring(0, 1) + actionName.Substring(1).ToLowerInvariant();
throw new NotImplementedException(string.Format("Could not find method named {1}({0}) or Any({0}) on Service {2}", requestDto.GetType().GetMethodName(), expectedMethodName, serviceType.GetMethodName()));
}
diff --git a/Emby.Server.Implementations/Services/ServiceMethod.cs b/Emby.Server.Implementations/Services/ServiceMethod.cs
index 7add728151..5018bf4a2e 100644
--- a/Emby.Server.Implementations/Services/ServiceMethod.cs
+++ b/Emby.Server.Implementations/Services/ServiceMethod.cs
@@ -11,7 +11,7 @@ namespace Emby.Server.Implementations.Services
public static string Key(Type serviceType, string method, string requestDtoName)
{
- return serviceType.FullName + " " + method.ToUpper() + " " + requestDtoName;
+ return serviceType.FullName + " " + method.ToUpperInvariant() + " " + requestDtoName;
}
}
}
diff --git a/Emby.Server.Implementations/Services/ServicePath.cs b/Emby.Server.Implementations/Services/ServicePath.cs
index 7e1993b710..f575baca30 100644
--- a/Emby.Server.Implementations/Services/ServicePath.cs
+++ b/Emby.Server.Implementations/Services/ServicePath.cs
@@ -60,7 +60,7 @@ namespace Emby.Server.Implementations.Services
public static string[] GetPathPartsForMatching(string pathInfo)
{
- return pathInfo.ToLower().Split(new[] { PathSeperatorChar }, StringSplitOptions.RemoveEmptyEntries);
+ return pathInfo.ToLowerInvariant().Split(new[] { PathSeperatorChar }, StringSplitOptions.RemoveEmptyEntries);
}
public static List GetFirstMatchHashKeys(string[] pathPartsForMatching)
@@ -104,7 +104,7 @@ namespace Emby.Server.Implementations.Services
this.Description = description;
this.restPath = path;
- this.Verbs = string.IsNullOrWhiteSpace(verbs) ? ServiceExecExtensions.AllVerbs : verbs.ToUpper().Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
+ this.Verbs = string.IsNullOrWhiteSpace(verbs) ? ServiceExecExtensions.AllVerbs : verbs.ToUpperInvariant().Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
var componentsList = new List();
@@ -154,7 +154,7 @@ namespace Emby.Server.Implementations.Services
}
else
{
- this.literalsToMatch[i] = component.ToLower();
+ this.literalsToMatch[i] = component.ToLowerInvariant();
if (firstLiteralMatch == null)
{
@@ -189,7 +189,7 @@ namespace Emby.Server.Implementations.Services
foreach (var propertyInfo in GetSerializableProperties(RequestType))
{
var propertyName = propertyInfo.Name;
- propertyNamesMap.Add(propertyName.ToLower(), propertyName);
+ propertyNamesMap.Add(propertyName.ToLowerInvariant(), propertyName);
}
}
@@ -483,7 +483,7 @@ namespace Emby.Server.Implementations.Services
continue;
}
- if (!this.propertyNamesMap.TryGetValue(variableName.ToLower(), out var propertyNameOnRequest))
+ if (!this.propertyNamesMap.TryGetValue(variableName.ToLowerInvariant(), out var propertyNameOnRequest))
{
if (string.Equals("ignore", variableName, StringComparison.OrdinalIgnoreCase))
{
diff --git a/Emby.Server.Implementations/Services/SwaggerService.cs b/Emby.Server.Implementations/Services/SwaggerService.cs
index 9bceeabec2..3e6970eefd 100644
--- a/Emby.Server.Implementations/Services/SwaggerService.cs
+++ b/Emby.Server.Implementations/Services/SwaggerService.cs
@@ -216,40 +216,28 @@ namespace Emby.Server.Implementations.Services
{
var responses = new Dictionary
{
+ { "200", new SwaggerResponse { description = "OK" } }
};
- responses["200"] = new SwaggerResponse
+ var apiKeySecurity = new Dictionary
{
- description = "OK"
+ { "api_key", Array.Empty() }
};
- var security = new List>();
-
- var apiKeySecurity = new Dictionary();
- apiKeySecurity["api_key"] = Array.Empty();
-
- security.Add(apiKeySecurity);
-
- result[verb.ToLower()] = new SwaggerMethod
+ result[verb.ToLowerInvariant()] = new SwaggerMethod
{
summary = info.Summary,
description = info.Description,
- produces = new[]
- {
- "application/json"
- },
- consumes = new[]
- {
- "application/json"
- },
+ produces = new[] { "application/json" },
+ consumes = new[] { "application/json" },
operationId = info.RequestType.Name,
tags = Array.Empty(),
- parameters = new SwaggerParam[] { },
+ parameters = Array.Empty(),
responses = responses,
- security = security.ToArray()
+ security = new [] { apiKeySecurity }
};
}
diff --git a/Jellyfin.Drawing.Skia/StripCollageBuilder.cs b/Jellyfin.Drawing.Skia/StripCollageBuilder.cs
index 92115047c1..dfdf398710 100644
--- a/Jellyfin.Drawing.Skia/StripCollageBuilder.cs
+++ b/Jellyfin.Drawing.Skia/StripCollageBuilder.cs
@@ -25,7 +25,7 @@ namespace Jellyfin.Drawing.Skia
throw new ArgumentNullException(nameof(outputPath));
}
- var ext = Path.GetExtension(outputPath).ToLower();
+ var ext = Path.GetExtension(outputPath).ToLowerInvariant();
if (ext == ".jpg" || ext == ".jpeg")
return SKEncodedImageFormat.Jpeg;
diff --git a/Jellyfin.Server/SocketSharp/RequestMono.cs b/Jellyfin.Server/SocketSharp/RequestMono.cs
index 017690062e..f09197fb35 100644
--- a/Jellyfin.Server/SocketSharp/RequestMono.cs
+++ b/Jellyfin.Server/SocketSharp/RequestMono.cs
@@ -360,13 +360,13 @@ namespace Jellyfin.SocketSharp
int len = buffer.Length;
if (dest_offset > len)
{
- throw new ArgumentException("destination offset is beyond array size");
+ throw new ArgumentException("destination offset is beyond array size", nameof(dest_offset));
}
// reordered to avoid possible integer overflow
if (dest_offset > len - count)
{
- throw new ArgumentException("Reading would overrun buffer");
+ throw new ArgumentException("Reading would overrun buffer", nameof(count));
}
if (count > end - position)
@@ -528,7 +528,7 @@ namespace Jellyfin.SocketSharp
}
}
- class HttpMultipart
+ private class HttpMultipart
{
public class Element
@@ -543,19 +543,19 @@ namespace Jellyfin.SocketSharp
public override string ToString()
{
return "ContentType " + ContentType + ", Name " + Name + ", Filename " + Filename + ", Start " +
- Start.ToString() + ", Length " + Length.ToString();
+ Start.ToString(CultureInfo.CurrentCulture) + ", Length " + Length.ToString(CultureInfo.CurrentCulture);
}
}
- Stream data;
- string boundary;
- byte[] boundary_bytes;
- byte[] buffer;
- bool at_eof;
- Encoding encoding;
- StringBuilder sb;
+ private Stream data;
+ private string boundary;
+ private byte[] boundary_bytes;
+ private byte[] buffer;
+ private bool at_eof;
+ private Encoding encoding;
+ private StringBuilder sb;
- const byte LF = (byte)'\n', CR = (byte)'\r';
+ private const byte LF = (byte)'\n', CR = (byte)'\r';
// See RFC 2046
// In the case of multipart entities, in which one or more different
@@ -610,7 +610,6 @@ namespace Jellyfin.SocketSharp
}
return sb.ToString();
-
}
private static string GetContentDispositionAttribute(string l, string name)
diff --git a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs
index 97550e686c..2e8dd9185b 100644
--- a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs
+++ b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs
@@ -29,12 +29,24 @@ namespace Jellyfin.SocketSharp
private static string GetHandlerPathIfAny(string listenerUrl)
{
- if (listenerUrl == null) return null;
+ if (listenerUrl == null)
+ {
+ return null;
+ }
+
var pos = listenerUrl.IndexOf("://", StringComparison.OrdinalIgnoreCase);
- if (pos == -1) return null;
+ if (pos == -1)
+ {
+ return null;
+ }
+
var startHostUrl = listenerUrl.Substring(pos + "://".Length);
var endPos = startHostUrl.IndexOf('/');
- if (endPos == -1) return null;
+ if (endPos == -1)
+ {
+ return null;
+ }
+
var endHostUrl = startHostUrl.Substring(endPos + 1);
return string.IsNullOrEmpty(endHostUrl) ? null : endHostUrl.TrimEnd('/');
}
@@ -210,9 +222,13 @@ namespace Jellyfin.SocketSharp
if (acceptsAnything)
{
if (hasDefaultContentType)
+ {
return defaultContentType;
- if (serverDefaultContentType != null)
+ }
+ else if (serverDefaultContentType != null)
+ {
return serverDefaultContentType;
+ }
}
}
@@ -229,11 +245,16 @@ namespace Jellyfin.SocketSharp
public static bool HasAnyOfContentTypes(IRequest request, params string[] contentTypes)
{
- if (contentTypes == null || request.ContentType == null) return false;
+ if (contentTypes == null || request.ContentType == null)
+ {
+ return false;
+ }
+
foreach (var contentType in contentTypes)
{
if (IsContentType(request, contentType)) return true;
}
+
return false;
}
@@ -264,12 +285,12 @@ namespace Jellyfin.SocketSharp
}
}
- format = LeftPart(format, '.').ToLower();
+ format = LeftPart(format, '.').ToLowerInvariant();
if (format.Contains("json", StringComparison.OrdinalIgnoreCase))
{
return "application/json";
}
- if (format.Contains("xml", StringComparison.OrdinalIgnoreCase))
+ else if (format.Contains("xml", StringComparison.OrdinalIgnoreCase))
{
return "application/xml";
}
@@ -283,10 +304,9 @@ namespace Jellyfin.SocketSharp
{
return null;
}
+
var pos = strVal.IndexOf(needle);
- return pos == -1
- ? strVal
- : strVal.Substring(0, pos);
+ return pos == -1 ? strVal : strVal.Substring(0, pos);
}
public static string HandlerFactoryPath;
@@ -433,6 +453,7 @@ namespace Jellyfin.SocketSharp
{
return null;
}
+
try
{
return Encoding.GetEncoding(param);
diff --git a/MediaBrowser.Api/Images/ImageByNameService.cs b/MediaBrowser.Api/Images/ImageByNameService.cs
index 61efae46d4..9334e7eea9 100644
--- a/MediaBrowser.Api/Images/ImageByNameService.cs
+++ b/MediaBrowser.Api/Images/ImageByNameService.cs
@@ -145,7 +145,7 @@ namespace MediaBrowser.Api.Images
Theme = supportsThemes ? GetThemeName(i.FullName, path) : null,
Context = supportsThemes ? null : GetThemeName(i.FullName, path),
- Format = i.Extension.ToLower().TrimStart('.')
+ Format = i.Extension.ToLowerInvariant().TrimStart('.')
})
.OrderBy(i => i.Name)
.ToList();
diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs
index 88ed4b5254..8fdd726b7b 100644
--- a/MediaBrowser.Api/LiveTv/LiveTvService.cs
+++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs
@@ -875,7 +875,9 @@ namespace MediaBrowser.Api.LiveTv
private string GetHashedString(string str)
{
// legacy
- return BitConverter.ToString(_cryptographyProvider.ComputeSHA1(Encoding.UTF8.GetBytes(str))).Replace("-", string.Empty).ToLower();
+ return BitConverter.ToString(
+ _cryptographyProvider.ComputeSHA1(Encoding.UTF8.GetBytes(str)))
+ .Replace("-", string.Empty).ToLowerInvariant();
}
public void Delete(DeleteListingProvider request)
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index bb525adc73..9460dc523e 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -135,10 +135,10 @@ namespace MediaBrowser.Api.Playback
if (EnableOutputInSubFolder)
{
- return Path.Combine(folder, dataHash, dataHash + (outputFileExtension ?? string.Empty).ToLower());
+ return Path.Combine(folder, dataHash, dataHash + (outputFileExtension ?? string.Empty).ToLowerInvariant());
}
- return Path.Combine(folder, dataHash + (outputFileExtension ?? string.Empty).ToLower());
+ return Path.Combine(folder, dataHash + (outputFileExtension ?? string.Empty).ToLowerInvariant());
}
protected virtual bool EnableOutputInSubFolder => false;
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 846fd9eec4..60e41834b9 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -614,7 +614,7 @@ namespace MediaBrowser.Controller.Entities
if (!string.IsNullOrEmpty(ForcedSortName))
{
// Need the ToLower because that's what CreateSortName does
- _sortName = ModifySortChunks(ForcedSortName).ToLower();
+ _sortName = ModifySortChunks(ForcedSortName).ToLowerInvariant();
}
else
{
@@ -660,7 +660,7 @@ namespace MediaBrowser.Controller.Entities
return Name.TrimStart();
}
- var sortable = Name.Trim().ToLower();
+ var sortable = Name.Trim().ToLowerInvariant();
foreach (var removeChar in ConfigurationManager.Configuration.SortRemoveCharacters)
{
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index dd4440c3b6..d925ad3247 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -305,7 +305,7 @@ namespace MediaBrowser.Controller.Entities
private string GetUserDataKey(string providerId)
{
- var key = providerId + "-" + ExtraType.ToString().ToLower();
+ var key = providerId + "-" + ExtraType.ToString().ToLowerInvariant();
// Make sure different trailers have their own data.
if (RunTimeTicks.HasValue)
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index 968e3dbcb5..858c004cb7 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -136,7 +136,7 @@ namespace MediaBrowser.Controller.MediaEncoding
return "libtheora";
}
- return codec.ToLower();
+ return codec.ToLowerInvariant();
}
return "copy";
@@ -405,7 +405,7 @@ namespace MediaBrowser.Controller.MediaEncoding
return "libopus";
}
- return codec.ToLower();
+ return codec.ToLowerInvariant();
}
///
@@ -762,7 +762,7 @@ namespace MediaBrowser.Controller.MediaEncoding
// vaapi does not support Baseline profile, force Constrained Baseline in this case,
// which is compatible (and ugly)
if (string.Equals(videoEncoder, "h264_vaapi", StringComparison.OrdinalIgnoreCase) &&
- profile != null && profile.ToLower().Contains("baseline"))
+ profile != null && profile.ToLowerInvariant().Contains("baseline"))
{
profile = "constrained_baseline";
}
@@ -2175,7 +2175,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{
if (string.Equals(encodingOptions.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
{
- switch (videoStream.Codec.ToLower())
+ switch (videoStream.Codec.ToLowerInvariant())
{
case "avc":
case "h264":
@@ -2215,7 +2215,7 @@ namespace MediaBrowser.Controller.MediaEncoding
else if (string.Equals(encodingOptions.HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase))
{
- switch (videoStream.Codec.ToLower())
+ switch (videoStream.Codec.ToLowerInvariant())
{
case "avc":
case "h264":
@@ -2254,7 +2254,7 @@ namespace MediaBrowser.Controller.MediaEncoding
else if (string.Equals(encodingOptions.HardwareAccelerationType, "mediacodec", StringComparison.OrdinalIgnoreCase))
{
- switch (videoStream.Codec.ToLower())
+ switch (videoStream.Codec.ToLowerInvariant())
{
case "avc":
case "h264":
@@ -2299,7 +2299,7 @@ namespace MediaBrowser.Controller.MediaEncoding
else if (string.Equals(encodingOptions.HardwareAccelerationType, "omx", StringComparison.OrdinalIgnoreCase))
{
- switch (videoStream.Codec.ToLower())
+ switch (videoStream.Codec.ToLowerInvariant())
{
case "avc":
case "h264":
@@ -2324,7 +2324,7 @@ namespace MediaBrowser.Controller.MediaEncoding
return "-hwaccel dxva2";
}
- switch (videoStream.Codec.ToLower())
+ switch (videoStream.Codec.ToLowerInvariant())
{
case "avc":
case "h264":
diff --git a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs
index 0a4928ed7f..aec5dc3484 100644
--- a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs
+++ b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs
@@ -417,7 +417,7 @@ namespace MediaBrowser.LocalMetadata.Images
var seriesFiles = GetFiles(series, false, directoryService).ToList();
// Try using the season name
- var prefix = season.Name.ToLower().Replace(" ", string.Empty);
+ var prefix = season.Name.ToLowerInvariant().Replace(" ", string.Empty);
var filenamePrefixes = new List { prefix };
diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs
index 2eac35f282..6bfa59d07d 100644
--- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs
+++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs
@@ -172,7 +172,7 @@ namespace MediaBrowser.LocalMetadata.Savers
writer.WriteElementString("Added", item.DateCreated.ToLocalTime().ToString("G"));
- writer.WriteElementString("LockData", item.IsLocked.ToString().ToLower());
+ writer.WriteElementString("LockData", item.IsLocked.ToString(CultureInfo.InvariantCulture).ToLowerInvariant());
if (item.LockedFields.Length > 0)
{
@@ -410,7 +410,9 @@ namespace MediaBrowser.LocalMetadata.Savers
writer.WriteStartElement("Share");
writer.WriteElementString("UserId", share.UserId);
- writer.WriteElementString("CanEdit", share.CanEdit.ToString().ToLower());
+ writer.WriteElementString(
+ "CanEdit",
+ share.CanEdit.ToString(CultureInfo.InvariantCulture).ToLowerInvariant());
writer.WriteEndElement();
}
diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
index ed4c445cd1..b0d8efab8c 100644
--- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
@@ -272,7 +272,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
var outputFileExtension = GetOutputFileExtension(state);
- var filename = state.Id + (outputFileExtension ?? string.Empty).ToLower();
+ var filename = state.Id + (outputFileExtension ?? string.Empty).ToLowerInvariant();
return Path.Combine(folder, filename);
}
@@ -310,7 +310,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
{
if (string.Equals(GetEncodingOptions().HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
{
- switch (state.MediaSource.VideoStream.Codec.ToLower())
+ switch (state.MediaSource.VideoStream.Codec.ToLowerInvariant())
{
case "avc":
case "h264":
diff --git a/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs b/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs
index 2c18a02ef8..0d696b9064 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs
@@ -44,7 +44,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
if (!eventsStarted)
header.AppendLine(line);
- if (line.Trim().ToLower() == "[events]")
+ if (line.Trim().ToLowerInvariant() == "[events]")
{
eventsStarted = true;
}
@@ -54,25 +54,25 @@ namespace MediaBrowser.MediaEncoding.Subtitles
}
else if (eventsStarted && line.Trim().Length > 0)
{
- string s = line.Trim().ToLower();
+ string s = line.Trim().ToLowerInvariant();
if (s.StartsWith("format:"))
{
if (line.Length > 10)
{
- format = line.ToLower().Substring(8).Split(',');
+ format = line.ToLowerInvariant().Substring(8).Split(',');
for (int i = 0; i < format.Length; i++)
{
- if (format[i].Trim().ToLower() == "layer")
+ if (format[i].Trim().ToLowerInvariant() == "layer")
indexLayer = i;
- else if (format[i].Trim().ToLower() == "start")
+ else if (format[i].Trim().ToLowerInvariant() == "start")
indexStart = i;
- else if (format[i].Trim().ToLower() == "end")
+ else if (format[i].Trim().ToLowerInvariant() == "end")
indexEnd = i;
- else if (format[i].Trim().ToLower() == "text")
+ else if (format[i].Trim().ToLowerInvariant() == "text")
indexText = i;
- else if (format[i].Trim().ToLower() == "effect")
+ else if (format[i].Trim().ToLowerInvariant() == "effect")
indexEffect = i;
- else if (format[i].Trim().ToLower() == "style")
+ else if (format[i].Trim().ToLowerInvariant() == "style")
indexStyle = i;
}
}
@@ -222,7 +222,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
// switch to rrggbb from bbggrr
color = "#" + color.Remove(color.Length - 6) + color.Substring(color.Length - 2, 2) + color.Substring(color.Length - 4, 2) + color.Substring(color.Length - 6, 2);
- color = color.ToLower();
+ color = color.ToLowerInvariant();
text = text.Remove(start, end - start + 1);
if (italic)
@@ -252,7 +252,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
// switch to rrggbb from bbggrr
color = "#" + color.Remove(color.Length - 6) + color.Substring(color.Length - 2, 2) + color.Substring(color.Length - 4, 2) + color.Substring(color.Length - 6, 2);
- color = color.ToLower();
+ color = color.ToLowerInvariant();
text = text.Remove(start, end - start + 1);
if (italic)
@@ -367,7 +367,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
color = color.PadLeft(6, '0');
// switch to rrggbb from bbggrr
color = "#" + color.Remove(color.Length - 6) + color.Substring(color.Length - 2, 2) + color.Substring(color.Length - 4, 2) + color.Substring(color.Length - 6, 2);
- color = color.ToLower();
+ color = color.ToLowerInvariant();
extraTags += " color=\"" + color + "\"";
}
diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs
index 6d03a03b0f..10efb9b383 100644
--- a/MediaBrowser.Model/Dlna/StreamInfo.cs
+++ b/MediaBrowser.Model/Dlna/StreamInfo.cs
@@ -223,7 +223,7 @@ namespace MediaBrowser.Model.Dlna
list.Add(new NameValuePair("DeviceProfileId", item.DeviceProfileId ?? string.Empty));
list.Add(new NameValuePair("DeviceId", item.DeviceId ?? string.Empty));
list.Add(new NameValuePair("MediaSourceId", item.MediaSourceId ?? string.Empty));
- list.Add(new NameValuePair("Static", item.IsDirectStream.ToString().ToLower()));
+ list.Add(new NameValuePair("Static", item.IsDirectStream.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()));
list.Add(new NameValuePair("VideoCodec", videoCodecs));
list.Add(new NameValuePair("AudioCodec", audioCodecs));
list.Add(new NameValuePair("AudioStreamIndex", item.AudioStreamIndex.HasValue ? item.AudioStreamIndex.Value.ToString(CultureInfo.InvariantCulture) : string.Empty));
@@ -251,7 +251,7 @@ namespace MediaBrowser.Model.Dlna
list.Add(new NameValuePair("PlaySessionId", item.PlaySessionId ?? string.Empty));
list.Add(new NameValuePair("api_key", accessToken ?? string.Empty));
- string liveStreamId = item.MediaSource == null ? null : item.MediaSource.LiveStreamId;
+ string liveStreamId = item.MediaSource?.LiveStreamId;
list.Add(new NameValuePair("LiveStreamId", liveStreamId ?? string.Empty));
list.Add(new NameValuePair("SubtitleMethod", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? item.SubtitleDeliveryMethod.ToString() : string.Empty));
@@ -261,37 +261,37 @@ namespace MediaBrowser.Model.Dlna
{
if (item.RequireNonAnamorphic)
{
- list.Add(new NameValuePair("RequireNonAnamorphic", item.RequireNonAnamorphic.ToString().ToLower()));
+ list.Add(new NameValuePair("RequireNonAnamorphic", item.RequireNonAnamorphic.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()));
}
list.Add(new NameValuePair("TranscodingMaxAudioChannels", item.TranscodingMaxAudioChannels.HasValue ? item.TranscodingMaxAudioChannels.Value.ToString(CultureInfo.InvariantCulture) : string.Empty));
if (item.EnableSubtitlesInManifest)
{
- list.Add(new NameValuePair("EnableSubtitlesInManifest", item.EnableSubtitlesInManifest.ToString().ToLower()));
+ list.Add(new NameValuePair("EnableSubtitlesInManifest", item.EnableSubtitlesInManifest.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()));
}
if (item.EnableMpegtsM2TsMode)
{
- list.Add(new NameValuePair("EnableMpegtsM2TsMode", item.EnableMpegtsM2TsMode.ToString().ToLower()));
+ list.Add(new NameValuePair("EnableMpegtsM2TsMode", item.EnableMpegtsM2TsMode.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()));
}
if (item.EstimateContentLength)
{
- list.Add(new NameValuePair("EstimateContentLength", item.EstimateContentLength.ToString().ToLower()));
+ list.Add(new NameValuePair("EstimateContentLength", item.EstimateContentLength.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()));
}
if (item.TranscodeSeekInfo != TranscodeSeekInfo.Auto)
{
- list.Add(new NameValuePair("TranscodeSeekInfo", item.TranscodeSeekInfo.ToString().ToLower()));
+ list.Add(new NameValuePair("TranscodeSeekInfo", item.TranscodeSeekInfo.ToString().ToLowerInvariant()));
}
if (item.CopyTimestamps)
{
- list.Add(new NameValuePair("CopyTimestamps", item.CopyTimestamps.ToString().ToLower()));
+ list.Add(new NameValuePair("CopyTimestamps", item.CopyTimestamps.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()));
}
- list.Add(new NameValuePair("RequireAvc", item.RequireAvc.ToString().ToLower()));
+ list.Add(new NameValuePair("RequireAvc", item.RequireAvc.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()));
}
list.Add(new NameValuePair("Tag", item.MediaSource.ETag ?? string.Empty));
@@ -316,7 +316,7 @@ namespace MediaBrowser.Model.Dlna
list.Add(new NameValuePair("MinSegments", item.MinSegments.Value.ToString(CultureInfo.InvariantCulture)));
}
- list.Add(new NameValuePair("BreakOnNonKeyFrames", item.BreakOnNonKeyFrames.ToString()));
+ list.Add(new NameValuePair("BreakOnNonKeyFrames", item.BreakOnNonKeyFrames.ToString(CultureInfo.InvariantCulture)));
}
foreach (var pair in item.StreamOptions)
@@ -332,7 +332,7 @@ namespace MediaBrowser.Model.Dlna
if (!item.IsDirectStream)
{
- list.Add(new NameValuePair("TranscodeReasons", string.Join(",", item.TranscodeReasons.Distinct().Select(i => i.ToString()).ToArray())));
+ list.Add(new NameValuePair("TranscodeReasons", string.Join(",", item.TranscodeReasons.Distinct().Select(i => i.ToString()))));
}
return list;
diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs
index e0c3bead1d..fc346df376 100644
--- a/MediaBrowser.Model/Entities/MediaStream.cs
+++ b/MediaBrowser.Model/Entities/MediaStream.cs
@@ -104,7 +104,7 @@ namespace MediaBrowser.Model.Entities
attributes.Add("Default");
}
- return string.Join(" ", attributes.ToArray());
+ return string.Join(" ", attributes);
}
if (Type == MediaStreamType.Video)
@@ -120,10 +120,10 @@ namespace MediaBrowser.Model.Entities
if (!string.IsNullOrEmpty(Codec))
{
- attributes.Add(Codec.ToUpper());
+ attributes.Add(Codec.ToUpperInvariant());
}
- return string.Join(" ", attributes.ToArray());
+ return string.Join(" ", attributes);
}
if (Type == MediaStreamType.Subtitle)
diff --git a/MediaBrowser.Model/Extensions/StringHelper.cs b/MediaBrowser.Model/Extensions/StringHelper.cs
index 78e23e7676..75ba12a178 100644
--- a/MediaBrowser.Model/Extensions/StringHelper.cs
+++ b/MediaBrowser.Model/Extensions/StringHelper.cs
@@ -51,7 +51,7 @@ namespace MediaBrowser.Model.Extensions
public static string FirstToUpper(this string str)
{
- return string.IsNullOrEmpty(str) ? "" : str.Substring(0, 1).ToUpper() + str.Substring(1);
+ return string.IsNullOrEmpty(str) ? string.Empty : str.Substring(0, 1).ToUpperInvariant() + str.Substring(1);
}
}
}
diff --git a/MediaBrowser.Model/MediaInfo/AudioCodec.cs b/MediaBrowser.Model/MediaInfo/AudioCodec.cs
index 5ed67fd784..5ebdb99cb6 100644
--- a/MediaBrowser.Model/MediaInfo/AudioCodec.cs
+++ b/MediaBrowser.Model/MediaInfo/AudioCodec.cs
@@ -8,9 +8,12 @@ namespace MediaBrowser.Model.MediaInfo
public static string GetFriendlyName(string codec)
{
- if (string.IsNullOrEmpty(codec)) return "";
+ if (string.IsNullOrEmpty(codec))
+ {
+ return string.Empty;
+ }
- switch (codec.ToLower())
+ switch (codec.ToLowerInvariant())
{
case "ac3":
return "Dolby Digital";
@@ -19,7 +22,7 @@ namespace MediaBrowser.Model.MediaInfo
case "dca":
return "DTS";
default:
- return codec.ToUpper();
+ return codec.ToUpperInvariant();
}
}
}
diff --git a/MediaBrowser.Model/Net/MimeTypes.cs b/MediaBrowser.Model/Net/MimeTypes.cs
index fe13413e2e..659abe84c9 100644
--- a/MediaBrowser.Model/Net/MimeTypes.cs
+++ b/MediaBrowser.Model/Net/MimeTypes.cs
@@ -158,7 +158,7 @@ namespace MediaBrowser.Model.Net
// Catch-all for all video types that don't require specific mime types
if (VideoFileExtensionsDictionary.ContainsKey(ext))
{
- return "video/" + ext.TrimStart('.').ToLower();
+ return "video/" + ext.TrimStart('.').ToLowerInvariant();
}
// Type text
diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.cs
index d0d00ef127..313a70a2ae 100644
--- a/MediaBrowser.Providers/Manager/ImageSaver.cs
+++ b/MediaBrowser.Providers/Manager/ImageSaver.cs
@@ -420,7 +420,7 @@ namespace MediaBrowser.Providers.Manager
filename = GetBackdropSaveFilename(item.GetImages(type), "screenshot", "screenshot", imageIndex);
break;
default:
- filename = type.ToString().ToLower();
+ filename = type.ToString().ToLowerInvariant();
break;
}
@@ -429,7 +429,7 @@ namespace MediaBrowser.Providers.Manager
extension = ".jpg";
}
- extension = extension.ToLower();
+ extension = extension.ToLowerInvariant();
string path = null;
diff --git a/MediaBrowser.Providers/Manager/ItemImageProvider.cs b/MediaBrowser.Providers/Manager/ItemImageProvider.cs
index c2e53ae6c4..6aa85ff37f 100644
--- a/MediaBrowser.Providers/Manager/ItemImageProvider.cs
+++ b/MediaBrowser.Providers/Manager/ItemImageProvider.cs
@@ -148,7 +148,7 @@ namespace MediaBrowser.Providers.Manager
}
else
{
- var mimeType = "image/" + response.Format.ToString().ToLower();
+ var mimeType = "image/" + response.Format.ToString().ToLowerInvariant();
await _providerManager.SaveImage(item, response.Stream, mimeType, imageType, null, cancellationToken).ConfigureAwait(false);
}
diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs b/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs
index 2ce10b656a..78d9f3d8f0 100644
--- a/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs
+++ b/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs
@@ -119,7 +119,7 @@ namespace MediaBrowser.Providers.MediaInfo
continue;
}
- var codec = Path.GetExtension(fullName).ToLower().TrimStart('.');
+ var codec = Path.GetExtension(fullName).ToLowerInvariant().TrimStart('.');
if (string.Equals(codec, "txt", StringComparison.OrdinalIgnoreCase))
{
diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs
index f03a8c2c28..482f3021b7 100644
--- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs
+++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs
@@ -285,7 +285,7 @@ namespace MediaBrowser.Providers.Movies
if (parts.Length == 2)
{
- language = parts[0] + "-" + parts[1].ToUpper();
+ language = parts[0] + "-" + parts[1].ToUpperInvariant();
}
}
diff --git a/MediaBrowser.Providers/Movies/MovieDbSearch.cs b/MediaBrowser.Providers/Movies/MovieDbSearch.cs
index 47d3d21bd6..e466d40a0c 100644
--- a/MediaBrowser.Providers/Movies/MovieDbSearch.cs
+++ b/MediaBrowser.Providers/Movies/MovieDbSearch.cs
@@ -72,7 +72,7 @@ namespace MediaBrowser.Providers.Movies
}
_logger.LogInformation("MovieDbProvider: Finding id for item: " + name);
- var language = idInfo.MetadataLanguage.ToLower();
+ var language = idInfo.MetadataLanguage.ToLowerInvariant();
//nope - search for it
//var searchType = item is BoxSet ? "collection" : "movie";
diff --git a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs
index 468ba730ab..6657407c0a 100644
--- a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs
+++ b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs
@@ -168,14 +168,14 @@ namespace MediaBrowser.Providers.Subtitles
memoryStream.Position = 0;
var savePaths = new List();
- var saveFileName = _fileSystem.GetFileNameWithoutExtension(video.Path) + "." + response.Language.ToLower();
+ var saveFileName = _fileSystem.GetFileNameWithoutExtension(video.Path) + "." + response.Language.ToLowerInvariant();
if (response.IsForced)
{
saveFileName += ".forced";
}
- saveFileName += "." + response.Format.ToLower();
+ saveFileName += "." + response.Format.ToLowerInvariant();
if (saveInMediaFolder)
{
@@ -305,7 +305,7 @@ namespace MediaBrowser.Providers.Subtitles
private string GetProviderId(string name)
{
- return name.ToLower().GetMD5().ToString("N");
+ return name.ToLowerInvariant().GetMD5().ToString("N");
}
private ISubtitleProvider GetProvider(string id)
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
index b6df64396c..920721926e 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
@@ -66,7 +66,7 @@ namespace MediaBrowser.Providers.TV
}
// pt-br is just pt to tvdb
- return language.Split('-')[0].ToLower();
+ return language.Split('-')[0].ToLowerInvariant();
}
public async Task> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken)
@@ -776,7 +776,7 @@ namespace MediaBrowser.Providers.TV
/// System.String.
private string GetComparableName(string name)
{
- name = name.ToLower();
+ name = name.ToLowerInvariant();
name = _localizationManager.NormalizeFormKD(name);
var sb = new StringBuilder();
foreach (var c in name)
@@ -1620,7 +1620,7 @@ namespace MediaBrowser.Providers.TV
{
var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
- var seriesXmlFilename = language.ToLower() + ".xml";
+ var seriesXmlFilename = language.ToLowerInvariant() + ".xml";
return Path.Combine(seriesDataPath, seriesXmlFilename);
}
diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs
index 1efffff3dc..b049ddc625 100644
--- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs
+++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs
@@ -290,7 +290,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
foreach (var stream in mediaStreams)
{
- writer.WriteStartElement(stream.Type.ToString().ToLower());
+ writer.WriteStartElement(stream.Type.ToString().ToLowerInvariant());
if (!string.IsNullOrEmpty(stream.Codec))
{
@@ -471,7 +471,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
writer.WriteElementString("customrating", item.CustomRating);
}
- writer.WriteElementString("lockdata", item.IsLocked.ToString().ToLower());
+ writer.WriteElementString("lockdata", item.IsLocked.ToString(CultureInfo.InvariantCulture).ToLowerInvariant());
if (item.LockedFields.Length > 0)
{
@@ -871,21 +871,21 @@ namespace MediaBrowser.XbmcMetadata.Savers
var userdata = userDataRepo.GetUserData(user, item);
- writer.WriteElementString("isuserfavorite", userdata.IsFavorite.ToString().ToLower());
+ writer.WriteElementString("isuserfavorite", userdata.IsFavorite.ToString(CultureInfo.InvariantCulture).ToLowerInvariant());
if (userdata.Rating.HasValue)
{
- writer.WriteElementString("userrating", userdata.Rating.Value.ToString(CultureInfo.InvariantCulture).ToLower());
+ writer.WriteElementString("userrating", userdata.Rating.Value.ToString(CultureInfo.InvariantCulture).ToLowerInvariant());
}
if (!item.IsFolder)
{
writer.WriteElementString("playcount", userdata.PlayCount.ToString(UsCulture));
- writer.WriteElementString("watched", userdata.Played.ToString().ToLower());
+ writer.WriteElementString("watched", userdata.Played.ToString(CultureInfo.InvariantCulture).ToLowerInvariant());
if (userdata.LastPlayedDate.HasValue)
{
- writer.WriteElementString("lastplayed", userdata.LastPlayedDate.Value.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss").ToLower());
+ writer.WriteElementString("lastplayed", userdata.LastPlayedDate.Value.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss").ToLowerInvariant());
}
writer.WriteStartElement("resume");
@@ -901,12 +901,13 @@ namespace MediaBrowser.XbmcMetadata.Savers
private void AddActors(List people, XmlWriter writer, ILibraryManager libraryManager, IFileSystem fileSystem, IServerConfigurationManager config, bool saveImagePath)
{
- var actors = people
- .Where(i => !IsPersonType(i, PersonType.Director) && !IsPersonType(i, PersonType.Writer))
- .ToList();
-
- foreach (var person in actors)
+ foreach (var person in people)
{
+ if (IsPersonType(person, PersonType.Director) || IsPersonType(person, PersonType.Writer))
+ {
+ continue;
+ }
+
writer.WriteStartElement("actor");
if (!string.IsNullOrWhiteSpace(person.Name))
@@ -1021,7 +1022,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
private string GetTagForProviderKey(string providerKey)
{
- return providerKey.ToLower() + "id";
+ return providerKey.ToLowerInvariant() + "id";
}
}
}
diff --git a/SocketHttpListener/Ext.cs b/SocketHttpListener/Ext.cs
index b051b67187..a02b48061d 100644
--- a/SocketHttpListener/Ext.cs
+++ b/SocketHttpListener/Ext.cs
@@ -486,7 +486,7 @@ namespace SocketHttpListener
if (method == CompressionMethod.None)
return string.Empty;
- var m = string.Format("permessage-{0}", method.ToString().ToLower());
+ var m = string.Format("permessage-{0}", method.ToString().ToLowerInvariant());
if (parameters == null || parameters.Length == 0)
return m;
diff --git a/SocketHttpListener/Net/HttpListenerRequest.cs b/SocketHttpListener/Net/HttpListenerRequest.cs
index faeca78b25..667d58ea7b 100644
--- a/SocketHttpListener/Net/HttpListenerRequest.cs
+++ b/SocketHttpListener/Net/HttpListenerRequest.cs
@@ -155,7 +155,7 @@ namespace SocketHttpListener.Net
}
else
{
- header = header.ToLower(CultureInfo.InvariantCulture);
+ header = header.ToLowerInvariant();
_keepAlive =
header.IndexOf("close", StringComparison.OrdinalIgnoreCase) < 0 ||
header.IndexOf("keep-alive", StringComparison.OrdinalIgnoreCase) >= 0;
From 85a58fd655240fd0ddd10bdaaad4a9bb8cd7051d Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Sun, 27 Jan 2019 15:40:37 +0100
Subject: [PATCH 04/93] Start startup tasks async
---
Emby.Dlna/DlnaManager.cs | 9 ++---
Emby.Dlna/Main/DlnaEntryPoint.cs | 4 +--
Emby.Notifications/Notifications.cs | 4 ++-
.../Activity/ActivityLogEntryPoint.cs | 5 ++-
.../ApplicationHost.cs | 35 ++++++++-----------
.../Collections/CollectionManager.cs | 2 +-
.../Devices/DeviceManager.cs | 2 +-
.../EntryPoints/AutomaticRestartEntryPoint.cs | 4 ++-
.../EntryPoints/ExternalPortForwarding.cs | 8 +++--
.../EntryPoints/LibraryChangedNotifier.cs | 5 ++-
.../EntryPoints/RecordingNotifier.cs | 5 ++-
.../EntryPoints/ServerEventNotifier.cs | 5 ++-
.../EntryPoints/StartupWizard.cs | 7 ++--
.../EntryPoints/UdpServerEntryPoint.cs | 5 ++-
.../EntryPoints/UserDataChangeNotifier.cs | 4 ++-
.../IO/LibraryMonitor.cs | 3 +-
.../Library/UserManager.cs | 4 ++-
.../LiveTv/EmbyTV/EmbyTV.cs | 2 +-
.../LiveTv/EmbyTV/EntryPoint.cs | 5 +--
Jellyfin.Server/Program.cs | 4 ---
MediaBrowser.Api/ApiEntryPoint.cs | 7 ++--
.../Plugins/IServerEntryPoint.cs | 3 +-
.../Api/DashboardService.cs | 6 ++--
MediaBrowser.WebDashboard/ServerEntryPoint.cs | 5 ++-
MediaBrowser.XbmcMetadata/EntryPoint.cs | 5 ++-
25 files changed, 87 insertions(+), 61 deletions(-)
diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.cs
index f795b58cbb..3be5968655 100644
--- a/Emby.Dlna/DlnaManager.cs
+++ b/Emby.Dlna/DlnaManager.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
+using System.Threading.Tasks;
using Emby.Dlna.Profiles;
using Emby.Dlna.Server;
using MediaBrowser.Common.Configuration;
@@ -48,11 +49,11 @@ namespace Emby.Dlna
_assemblyInfo = assemblyInfo;
}
- public void InitProfiles()
+ public async Task InitProfilesAsync()
{
try
{
- ExtractSystemProfiles();
+ await ExtractSystemProfilesAsync();
LoadProfiles();
}
catch (Exception ex)
@@ -359,7 +360,7 @@ namespace Emby.Dlna
};
}
- private void ExtractSystemProfiles()
+ private async Task ExtractSystemProfilesAsync()
{
var namespaceName = GetType().Namespace + ".Profiles.Xml.";
@@ -383,7 +384,7 @@ namespace Emby.Dlna
using (var fileStream = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
{
- stream.CopyTo(fileStream);
+ await stream.CopyToAsync(fileStream);
}
}
}
diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs
index 1ab6014eb0..89cba4c47d 100644
--- a/Emby.Dlna/Main/DlnaEntryPoint.cs
+++ b/Emby.Dlna/Main/DlnaEntryPoint.cs
@@ -125,9 +125,9 @@ namespace Emby.Dlna.Main
Current = this;
}
- public void Run()
+ public async Task RunAsync()
{
- ((DlnaManager)_dlnaManager).InitProfiles();
+ await ((DlnaManager)_dlnaManager).InitProfilesAsync().ConfigureAwait(false);
ReloadComponents();
diff --git a/Emby.Notifications/Notifications.cs b/Emby.Notifications/Notifications.cs
index fbdc39f94f..045aa6f16d 100644
--- a/Emby.Notifications/Notifications.cs
+++ b/Emby.Notifications/Notifications.cs
@@ -71,12 +71,14 @@ namespace Emby.Notifications
_coreNotificationTypes = new CoreNotificationTypes(localization, appHost).GetNotificationTypes().Select(i => i.Type).ToArray();
}
- public void Run()
+ public Task RunAsync()
{
_libraryManager.ItemAdded += _libraryManager_ItemAdded;
_appHost.HasPendingRestartChanged += _appHost_HasPendingRestartChanged;
_appHost.HasUpdateAvailableChanged += _appHost_HasUpdateAvailableChanged;
_activityManager.EntryCreated += _activityManager_EntryCreated;
+
+ return Task.CompletedTask;
}
private async void _appHost_HasPendingRestartChanged(object sender, EventArgs e)
diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
index a8e8f815a0..9cdb3b1b59 100644
--- a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
+++ b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.Updates;
@@ -58,7 +59,7 @@ namespace Emby.Server.Implementations.Activity
_deviceManager = deviceManager;
}
- public void Run()
+ public Task RunAsync()
{
_taskManager.TaskCompleted += _taskManager_TaskCompleted;
@@ -90,6 +91,8 @@ namespace Emby.Server.Implementations.Activity
_deviceManager.CameraImageUploaded += _deviceManager_CameraImageUploaded;
_appHost.ApplicationUpdated += _appHost_ApplicationUpdated;
+
+ return Task.CompletedTask;
}
void _deviceManager_CameraImageUploaded(object sender, GenericEventArgs e)
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index f0a9149220..c71b917b8e 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -647,8 +647,10 @@ namespace Emby.Server.Implementations
///
/// Runs the startup tasks.
///
- public Task RunStartupTasks()
+ public async Task RunStartupTasks()
{
+ Logger.LogInformation("Running startup tasks");
+
Resolve().AddTasks(GetExports(false));
ConfigurationManager.ConfigurationUpdated += OnConfigurationUpdated;
@@ -667,20 +669,20 @@ namespace Emby.Server.Implementations
Logger.LogInformation("ServerId: {0}", SystemId);
var entryPoints = GetExports();
- RunEntryPoints(entryPoints, true);
+
+ var now = DateTime.UtcNow;
+ await Task.WhenAll(StartEntryPoints(entryPoints, true));
+ Logger.LogInformation("Executed all pre-startup entry points in {Elapsed:fff} ms", DateTime.Now - now);
Logger.LogInformation("Core startup complete");
HttpServer.GlobalResponse = null;
- Logger.LogInformation("Post-init migrations complete");
-
- RunEntryPoints(entryPoints, false);
- Logger.LogInformation("All entry points have started");
-
- return Task.CompletedTask;
+ now = DateTime.UtcNow;
+ await Task.WhenAll(StartEntryPoints(entryPoints, false));
+ Logger.LogInformation("Executed all post-startup entry points in {Elapsed:fff} ms", DateTime.Now - now);
}
- private void RunEntryPoints(IEnumerable entryPoints, bool isBeforeStartup)
+ private IEnumerable StartEntryPoints(IEnumerable entryPoints, bool isBeforeStartup)
{
foreach (var entryPoint in entryPoints)
{
@@ -689,18 +691,9 @@ namespace Emby.Server.Implementations
continue;
}
- var name = entryPoint.GetType().FullName;
- Logger.LogInformation("Starting entry point {Name}", name);
- var now = DateTime.UtcNow;
- try
- {
- entryPoint.Run();
- }
- catch (Exception ex)
- {
- Logger.LogError(ex, "Error while running entrypoint {Name}", name);
- }
- Logger.LogInformation("Entry point completed: {Name}. Duration: {Duration} seconds", name, (DateTime.UtcNow - now).TotalSeconds.ToString(CultureInfo.InvariantCulture), "ImageInfos");
+ Logger.LogDebug("Starting entry point {Type}", entryPoint.GetType());
+
+ yield return entryPoint.RunAsync();
}
}
diff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.cs
index 0166bbc5ab..7268811f87 100644
--- a/Emby.Server.Implementations/Collections/CollectionManager.cs
+++ b/Emby.Server.Implementations/Collections/CollectionManager.cs
@@ -353,7 +353,7 @@ namespace Emby.Server.Implementations.Collections
_logger = logger;
}
- public async void Run()
+ public async Task RunAsync()
{
if (!_config.Configuration.CollectionsUpgraded && _config.Configuration.IsStartupWizardCompleted)
{
diff --git a/Emby.Server.Implementations/Devices/DeviceManager.cs b/Emby.Server.Implementations/Devices/DeviceManager.cs
index 60d57519e6..46d36f9f64 100644
--- a/Emby.Server.Implementations/Devices/DeviceManager.cs
+++ b/Emby.Server.Implementations/Devices/DeviceManager.cs
@@ -425,7 +425,7 @@ namespace Emby.Server.Implementations.Devices
_logger = logger;
}
- public async void Run()
+ public async Task RunAsync()
{
if (!_config.Configuration.CameraUploadUpgraded && _config.Configuration.IsStartupWizardCompleted)
{
diff --git a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
index 0fc4c38583..361656ff2f 100644
--- a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
+++ b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
@@ -37,12 +37,14 @@ namespace Emby.Server.Implementations.EntryPoints
_timerFactory = timerFactory;
}
- public void Run()
+ public Task RunAsync()
{
if (_appHost.CanSelfRestart)
{
_appHost.HasPendingRestartChanged += _appHost_HasPendingRestartChanged;
}
+
+ return Task.CompletedTask;
}
void _appHost_HasPendingRestartChanged(object sender, EventArgs e)
diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
index 8755ee3a7d..56c730c800 100644
--- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
+++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
@@ -61,17 +61,17 @@ namespace Emby.Server.Implementations.EntryPoints
return string.Join("|", values.ToArray());
}
- void _config_ConfigurationUpdated(object sender, EventArgs e)
+ private async void _config_ConfigurationUpdated(object sender, EventArgs e)
{
if (!string.Equals(_lastConfigIdentifier, GetConfigIdentifier(), StringComparison.OrdinalIgnoreCase))
{
DisposeNat();
- Run();
+ await RunAsync();
}
}
- public void Run()
+ public Task RunAsync()
{
if (_config.Configuration.EnableUPnP && _config.Configuration.EnableRemoteAccess)
{
@@ -80,6 +80,8 @@ namespace Emby.Server.Implementations.EntryPoints
_config.ConfigurationUpdated -= _config_ConfigurationUpdated;
_config.ConfigurationUpdated += _config_ConfigurationUpdated;
+
+ return Task.CompletedTask;
}
private void Start()
diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
index 7a8b09cf78..98c08e6ba9 100644
--- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
+using System.Threading.Tasks;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
@@ -65,7 +66,7 @@ namespace Emby.Server.Implementations.EntryPoints
_providerManager = providerManager;
}
- public void Run()
+ public Task RunAsync()
{
_libraryManager.ItemAdded += libraryManager_ItemAdded;
_libraryManager.ItemUpdated += libraryManager_ItemUpdated;
@@ -74,6 +75,8 @@ namespace Emby.Server.Implementations.EntryPoints
_providerManager.RefreshCompleted += _providerManager_RefreshCompleted;
_providerManager.RefreshStarted += _providerManager_RefreshStarted;
_providerManager.RefreshProgress += _providerManager_RefreshProgress;
+
+ return Task.CompletedTask;
}
private Dictionary _lastProgressMessageTimes = new Dictionary();
diff --git a/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs b/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs
index e37ea96a12..0186da9e1e 100644
--- a/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Threading;
+using System.Threading.Tasks;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Plugins;
@@ -24,12 +25,14 @@ namespace Emby.Server.Implementations.EntryPoints
_liveTvManager = liveTvManager;
}
- public void Run()
+ public Task RunAsync()
{
_liveTvManager.TimerCancelled += _liveTvManager_TimerCancelled;
_liveTvManager.SeriesTimerCancelled += _liveTvManager_SeriesTimerCancelled;
_liveTvManager.TimerCreated += _liveTvManager_TimerCreated;
_liveTvManager.SeriesTimerCreated += _liveTvManager_SeriesTimerCreated;
+
+ return Task.CompletedTask;
}
private void _liveTvManager_SeriesTimerCreated(object sender, MediaBrowser.Model.Events.GenericEventArgs e)
diff --git a/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs b/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs
index 92ea3a8f4a..091dd6a45b 100644
--- a/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading;
+using System.Threading.Tasks;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.Updates;
using MediaBrowser.Controller;
@@ -49,7 +50,7 @@ namespace Emby.Server.Implementations.EntryPoints
_sessionManager = sessionManager;
}
- public void Run()
+ public Task RunAsync()
{
_userManager.UserDeleted += userManager_UserDeleted;
_userManager.UserUpdated += userManager_UserUpdated;
@@ -65,6 +66,8 @@ namespace Emby.Server.Implementations.EntryPoints
_installationManager.PackageInstallationFailed += _installationManager_PackageInstallationFailed;
_taskManager.TaskCompleted += _taskManager_TaskCompleted;
+
+ return Task.CompletedTask;
}
void _installationManager_PackageInstalling(object sender, InstallationEventArgs e)
diff --git a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
index 05c8b07ab5..1d44bffbb9 100644
--- a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
+++ b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
@@ -1,3 +1,4 @@
+using System.Threading.Tasks;
using Emby.Server.Implementations.Browser;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
@@ -32,11 +33,11 @@ namespace Emby.Server.Implementations.EntryPoints
///
/// Runs this instance.
///
- public void Run()
+ public Task RunAsync()
{
if (!_appHost.CanLaunchWebBrowser)
{
- return;
+ return Task.CompletedTask;
}
if (!_config.Configuration.IsStartupWizardCompleted)
@@ -52,6 +53,8 @@ namespace Emby.Server.Implementations.EntryPoints
BrowserLauncher.OpenWebApp(_appHost);
}
}
+
+ return Task.CompletedTask;
}
///
diff --git a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
index 2c8246d13b..5b90dc1fb0 100644
--- a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
+++ b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
@@ -1,4 +1,5 @@
using System;
+using System.Threading.Tasks;
using Emby.Server.Implementations.Udp;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Plugins;
@@ -43,7 +44,7 @@ namespace Emby.Server.Implementations.EntryPoints
///
/// Runs this instance.
///
- public void Run()
+ public Task RunAsync()
{
var udpServer = new UdpServer(_logger, _appHost, _json, _socketFactory);
@@ -57,6 +58,8 @@ namespace Emby.Server.Implementations.EntryPoints
{
_logger.LogError(ex, "Failed to start UDP Server");
}
+
+ return Task.CompletedTask;
}
///
diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
index 9e71ffceb7..d1d05eeb04 100644
--- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
@@ -38,9 +38,11 @@ namespace Emby.Server.Implementations.EntryPoints
_timerFactory = timerFactory;
}
- public void Run()
+ public Task RunAsync()
{
_userDataManager.UserDataSaved += _userDataManager_UserDataSaved;
+
+ return Task.CompletedTask;
}
void _userDataManager_UserDataSaved(object sender, UserDataSaveEventArgs e)
diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs
index 204f9d949f..e432b31daa 100644
--- a/Emby.Server.Implementations/IO/LibraryMonitor.cs
+++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs
@@ -627,9 +627,10 @@ namespace Emby.Server.Implementations.IO
_monitor = monitor;
}
- public void Run()
+ public Task RunAsync()
{
_monitor.Start();
+ return Task.CompletedTask;
}
public void Dispose()
diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs
index 6139659b70..6e4450bb10 100644
--- a/Emby.Server.Implementations/Library/UserManager.cs
+++ b/Emby.Server.Implementations/Library/UserManager.cs
@@ -1204,9 +1204,11 @@ namespace Emby.Server.Implementations.Library
_sessionManager = sessionManager;
}
- public void Run()
+ public Task RunAsync()
{
_userManager.UserPolicyUpdated += _userManager_UserPolicyUpdated;
+
+ return Task.CompletedTask;
}
private void _userManager_UserPolicyUpdated(object sender, GenericEventArgs e)
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index 4805e54ddf..4e131c941d 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -124,7 +124,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
}
- public async void Start()
+ public async Task Start()
{
_timerProvider.RestartTimers();
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs
index 982a54b68d..9c9ba09f5f 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EntryPoint.cs
@@ -1,12 +1,13 @@
+using System.Threading.Tasks;
using MediaBrowser.Controller.Plugins;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
public class EntryPoint : IServerEntryPoint
{
- public void Run()
+ public Task RunAsync()
{
- EmbyTV.Current.Start();
+ return EmbyTV.Current.Start();
}
public void Dispose()
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 66586d4e4f..4dfe834411 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -103,8 +103,6 @@ namespace Jellyfin.Server
appHost.ImageProcessor.ImageEncoder = GetImageEncoder(fileSystem, appPaths, appHost.LocalizationManager);
- _logger.LogInformation("Running startup tasks");
-
await appHost.RunStartupTasks();
// TODO: read input for a stop command
@@ -118,8 +116,6 @@ namespace Jellyfin.Server
{
// Don't throw on cancellation
}
-
- _logger.LogInformation("Disposing app host");
}
if (_restartOnShutdown)
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs
index 8ae0ad9428..cfd37667a2 100644
--- a/MediaBrowser.Api/ApiEntryPoint.cs
+++ b/MediaBrowser.Api/ApiEntryPoint.cs
@@ -130,7 +130,7 @@ namespace MediaBrowser.Api
///
/// Runs this instance.
///
- public void Run()
+ public Task RunAsync()
{
try
{
@@ -148,6 +148,8 @@ namespace MediaBrowser.Api
{
Logger.LogError(ex, "Error deleting encoded media cache");
}
+
+ return Task.CompletedTask;
}
public EncodingOptions GetEncodingOptions()
@@ -162,8 +164,7 @@ namespace MediaBrowser.Api
{
var path = _config.ApplicationPaths.TranscodingTempPath;
- foreach (var file in _fileSystem.GetFilePaths(path, true)
- .ToList())
+ foreach (var file in _fileSystem.GetFilePaths(path, true))
{
_fileSystem.DeleteFile(file);
}
diff --git a/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs b/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs
index 7b7a591aa0..e57929989a 100644
--- a/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs
+++ b/MediaBrowser.Controller/Plugins/IServerEntryPoint.cs
@@ -1,4 +1,5 @@
using System;
+using System.Threading.Tasks;
namespace MediaBrowser.Controller.Plugins
{
@@ -10,7 +11,7 @@ namespace MediaBrowser.Controller.Plugins
///
/// Runs this instance.
///
- void Run();
+ Task RunAsync();
}
public interface IRunBeforeStartup
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs
index db00111143..5405934ce5 100644
--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs
+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs
@@ -425,11 +425,9 @@ namespace MediaBrowser.WebDashboard.Api
private async Task DumpFile(PackageCreator packageCreator, string resourceVirtualPath, string destinationFilePath, string mode, string appVersion)
{
using (var stream = await packageCreator.GetResource(resourceVirtualPath, mode, null, appVersion).ConfigureAwait(false))
+ using (var fs = _fileSystem.GetFileStream(destinationFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
{
- using (var fs = _fileSystem.GetFileStream(destinationFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
- {
- stream.CopyTo(fs);
- }
+ await stream.CopyToAsync(fs);
}
}
diff --git a/MediaBrowser.WebDashboard/ServerEntryPoint.cs b/MediaBrowser.WebDashboard/ServerEntryPoint.cs
index 221fa62c79..18ed54a786 100644
--- a/MediaBrowser.WebDashboard/ServerEntryPoint.cs
+++ b/MediaBrowser.WebDashboard/ServerEntryPoint.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
+using System.Threading.Tasks;
using MediaBrowser.Common;
using MediaBrowser.Controller.Plugins;
@@ -23,9 +24,11 @@ namespace MediaBrowser.WebDashboard
Instance = this;
}
- public void Run()
+ public Task RunAsync()
{
PluginConfigurationPages = _appHost.GetExports().ToList();
+
+ return Task.CompletedTask;
}
public void Dispose()
diff --git a/MediaBrowser.XbmcMetadata/EntryPoint.cs b/MediaBrowser.XbmcMetadata/EntryPoint.cs
index 37a1d4c350..992991a7ed 100644
--- a/MediaBrowser.XbmcMetadata/EntryPoint.cs
+++ b/MediaBrowser.XbmcMetadata/EntryPoint.cs
@@ -1,4 +1,5 @@
using System;
+using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
@@ -28,9 +29,11 @@ namespace MediaBrowser.XbmcMetadata
_config = config;
}
- public void Run()
+ public Task RunAsync()
{
_userDataManager.UserDataSaved += _userDataManager_UserDataSaved;
+
+ return Task.CompletedTask;
}
void _userDataManager_UserDataSaved(object sender, UserDataSaveEventArgs e)
From 055e43eda72dbf77a91ca22b5b007161c9d75c46 Mon Sep 17 00:00:00 2001
From: Vasily
Date: Tue, 29 Jan 2019 18:01:55 +0100
Subject: [PATCH 05/93] Update
Emby.Server.Implementations/Localization/LocalizationManager.cs
Co-Authored-By: Bond-009
---
Emby.Server.Implementations/Localization/LocalizationManager.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs
index 47834940b1..682fbb6aa7 100644
--- a/Emby.Server.Implementations/Localization/LocalizationManager.cs
+++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs
@@ -268,7 +268,7 @@ namespace Emby.Server.Implementations.Localization
countryCode = "us";
}
- var ratings = GetRatings(countryCode) ?? GetRatings("us");
+ return GetRatings(countryCode) ?? GetRatings("us");
return ratings;
}
From f7a46c7a56a76c644b5a6222df4e52371aeb27eb Mon Sep 17 00:00:00 2001
From: Claus Vium
Date: Mon, 28 Jan 2019 23:07:03 +0100
Subject: [PATCH 06/93] Remove more Connect related stuff
---
.../Library/UserManager.cs | 36 ++++---------------
MediaBrowser.Api/StartupWizardService.cs | 16 ++-------
MediaBrowser.Api/UserService.cs | 6 ----
.../Connect/UserLinkResult.cs | 9 -----
MediaBrowser.Controller/Entities/User.cs | 6 ----
.../Connect/ConnectAuthorization.cs | 21 -----------
MediaBrowser.Model/Connect/ConnectUser.cs | 11 ------
.../Connect/ConnectUserQuery.cs | 10 ------
MediaBrowser.Model/Connect/UserLinkType.cs | 14 --------
MediaBrowser.Model/Dto/UserDto.cs | 17 ---------
10 files changed, 8 insertions(+), 138 deletions(-)
delete mode 100644 MediaBrowser.Controller/Connect/UserLinkResult.cs
delete mode 100644 MediaBrowser.Model/Connect/ConnectAuthorization.cs
delete mode 100644 MediaBrowser.Model/Connect/ConnectUser.cs
delete mode 100644 MediaBrowser.Model/Connect/ConnectUserQuery.cs
delete mode 100644 MediaBrowser.Model/Connect/UserLinkType.cs
diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs
index 05fce4542f..b33ae72b70 100644
--- a/Emby.Server.Implementations/Library/UserManager.cs
+++ b/Emby.Server.Implementations/Library/UserManager.cs
@@ -23,7 +23,6 @@ using MediaBrowser.Controller.Providers;
using MediaBrowser.Controller.Security;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Configuration;
-using MediaBrowser.Model.Connect;
using MediaBrowser.Model.Cryptography;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
@@ -211,11 +210,8 @@ namespace Emby.Server.Implementations.Library
{
foreach (var user in users)
{
- if (!user.ConnectLinkType.HasValue || user.ConnectLinkType.Value == UserLinkType.LinkedUser)
- {
- user.Policy.IsAdministrator = true;
- UpdateUserPolicy(user, user.Policy, false);
- }
+ user.Policy.IsAdministrator = true;
+ UpdateUserPolicy(user, user.Policy, false);
}
}
}
@@ -273,13 +269,9 @@ namespace Emby.Server.Implementations.Library
if (user != null)
{
- // Authenticate using local credentials if not a guest
- if (!user.ConnectLinkType.HasValue || user.ConnectLinkType.Value != UserLinkType.Guest)
- {
- var authResult = await AuthenticateLocalUser(username, password, hashedPassword, user, remoteEndPoint).ConfigureAwait(false);
- authenticationProvider = authResult.Item1;
- success = authResult.Item2;
- }
+ var authResult = await AuthenticateLocalUser(username, password, hashedPassword, user, remoteEndPoint).ConfigureAwait(false);
+ authenticationProvider = authResult.Item1;
+ success = authResult.Item2;
}
else
{
@@ -554,9 +546,6 @@ namespace Emby.Server.Implementations.Library
LastActivityDate = user.LastActivityDate,
LastLoginDate = user.LastLoginDate,
Configuration = user.Configuration,
- ConnectLinkType = user.ConnectLinkType,
- ConnectUserId = user.ConnectUserId,
- ConnectUserName = user.ConnectUserName,
ServerId = _appHost.SystemId,
Policy = user.Policy
};
@@ -815,11 +804,6 @@ namespace Emby.Server.Implementations.Library
throw new ArgumentNullException(nameof(user));
}
- if (user.ConnectLinkType.HasValue && user.ConnectLinkType.Value == UserLinkType.Guest)
- {
- throw new ArgumentException("Passwords for guests cannot be changed.");
- }
-
await GetAuthenticationProvider(user).ChangePassword(user, newPassword).ConfigureAwait(false);
UpdateUser(user);
@@ -926,11 +910,6 @@ namespace Emby.Server.Implementations.Library
null :
GetUserByName(enteredUsername);
- if (user != null && user.ConnectLinkType.HasValue && user.ConnectLinkType.Value == UserLinkType.Guest)
- {
- throw new ArgumentException("Unable to process forgot password request for guests.");
- }
-
var action = ForgotPasswordAction.InNetworkRequired;
string pinFile = null;
DateTime? expirationDate = null;
@@ -975,10 +954,7 @@ namespace Emby.Server.Implementations.Library
_lastPin = null;
_lastPasswordPinCreationResult = null;
- var users = Users.Where(i => !i.ConnectLinkType.HasValue || i.ConnectLinkType.Value != UserLinkType.Guest)
- .ToList();
-
- foreach (var user in users)
+ foreach (var user in Users)
{
await ResetPassword(user).ConfigureAwait(false);
diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs
index 3d59b4c9a0..53ba7eefd9 100644
--- a/MediaBrowser.Api/StartupWizardService.cs
+++ b/MediaBrowser.Api/StartupWizardService.cs
@@ -3,7 +3,6 @@ using System.Threading.Tasks;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Controller.Connect;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Net;
@@ -39,7 +38,7 @@ namespace MediaBrowser.Api
}
[Route("/Startup/User", "POST", Summary = "Updates initial user info", IsHidden = true)]
- public class UpdateStartupUser : StartupUser, IReturn
+ public class UpdateStartupUser : StartupUser
{
}
@@ -102,12 +101,11 @@ namespace MediaBrowser.Api
return new StartupUser
{
Name = user.Name,
- ConnectUserName = user.ConnectUserName,
Password = user.Password
};
}
- public async Task
public class StartupOptions
{
- [Option('d', "programdata", Required = false, HelpText = "Path to use for program data (databases files etc.).")]
- public string PathProgramData { get; set; }
+ [Option('d', "datadir", Required = false, HelpText = "Path to use for the data folder (databases files etc.).")]
+ public string PathData { get; set; }
[Option('c', "configdir", Required = false, HelpText = "Path to use for config data (user policies and puctures).")]
public string PathConfig { get; set; }
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index dbfd59ebf4..2f7edee656 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -27,6 +27,7 @@ using ILogger = Microsoft.Extensions.Logging.ILogger;
namespace Jellyfin.Server
{
using CommandLine;
+ using System.Text.RegularExpressions;
public static class Program
{
@@ -37,6 +38,18 @@ namespace Jellyfin.Server
public static async Task Main(string[] args)
{
+ // For backwards compatibility.
+ // Modify any input arguments now which start with single-hyphen to POSIX standard
+ // double-hyphen to allow parsing by CommandLineParser package.
+ var pattern = @"^(-[^-\s]{2})"; // Match -xx, not -x, not --xx, not xx
+ var substitution = @"-$1"; // Prepend with additional single-hyphen
+ var regex = new Regex(pattern);
+
+ for (var i = 0; i < args.Length; i++)
+ {
+ args[i] = regex.Replace(args[i], substitution);
+ }
+
// For CommandLine package, change default behaviour to output errors to stdout (instead of stderr)
var parser = new Parser(config => config.HelpWriter = Console.Out);
@@ -139,9 +152,9 @@ namespace Jellyfin.Server
string programDataPath = Environment.GetEnvironmentVariable("JELLYFIN_DATA_PATH");
if (string.IsNullOrEmpty(programDataPath))
{
- if (options.PathProgramData != null)
+ if (options.PathData != null)
{
- programDataPath = options.PathProgramData;
+ programDataPath = options.PathData;
}
else
{
From e18b89ca275feceee21b540878017a2373e7de6c Mon Sep 17 00:00:00 2001
From: PloughPuff
Date: Mon, 28 Jan 2019 20:58:47 +0000
Subject: [PATCH 09/93] Move Options to Jellyfin.Server and create interface
file
Changes following review comments.
---
.../ApplicationHost.cs | 7 ++-
.../Emby.Server.Implementations.csproj | 3 +-
.../EntryPoints/StartupWizard.cs | 2 +-
.../FFMpeg/FFMpegLoader.cs | 7 ++-
.../IStartupOptions.cs | 55 +++++++++++++++++++
Jellyfin.Server/Jellyfin.Server.csproj | 1 +
Jellyfin.Server/Program.cs | 21 ++++---
.../StartupOptions.cs | 34 +++++++-----
8 files changed, 95 insertions(+), 35 deletions(-)
create mode 100644 Emby.Server.Implementations/IStartupOptions.cs
rename {Emby.Server.Implementations => Jellyfin.Server}/StartupOptions.cs (62%)
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 2306fb370c..3af9e487e9 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -43,6 +43,7 @@ using Emby.Server.Implementations.ScheduledTasks;
using Emby.Server.Implementations.Security;
using Emby.Server.Implementations.Serialization;
using Emby.Server.Implementations.Session;
+using Emby.Server.Implementations.ParsedStartupOptions;
using Emby.Server.Implementations.Threading;
using Emby.Server.Implementations.TV;
using Emby.Server.Implementations.Updates;
@@ -141,7 +142,7 @@ namespace Emby.Server.Implementations
return false;
}
- if (StartupOptions.Service)
+ if (StartupOptions.IsService)
{
return false;
}
@@ -343,7 +344,7 @@ namespace Emby.Server.Implementations
protected IHttpResultFactory HttpResultFactory { get; private set; }
protected IAuthService AuthService { get; private set; }
- public StartupOptions StartupOptions { get; private set; }
+ public IStartupOptions StartupOptions { get; private set; }
internal IImageEncoder ImageEncoder { get; private set; }
@@ -364,7 +365,7 @@ namespace Emby.Server.Implementations
///
public ApplicationHost(ServerApplicationPaths applicationPaths,
ILoggerFactory loggerFactory,
- StartupOptions options,
+ IStartupOptions options,
IFileSystem fileSystem,
IEnvironmentInfo environmentInfo,
IImageEncoder imageEncoder,
diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
index bf0546f2e0..92e3172f14 100644
--- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj
+++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
@@ -1,4 +1,4 @@
-
+
@@ -22,7 +22,6 @@
-
diff --git a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
index bb96120f41..43d18e135f 100644
--- a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
+++ b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
@@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.EntryPoints
{
var options = ((ApplicationHost)_appHost).StartupOptions;
- if (!options.NoAutoRunWebApp)
+ if (options.AutoRunWebApp)
{
BrowserLauncher.OpenWebApp(_appHost);
}
diff --git a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs
index 4c926b91a6..b422b88625 100644
--- a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs
+++ b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs
@@ -6,6 +6,7 @@ using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Net;
using MediaBrowser.Model.IO;
using Microsoft.Extensions.Logging;
+using Emby.Server.Implementations.ParsedStartupOptions;
namespace Emby.Server.Implementations.FFMpeg
{
@@ -28,10 +29,10 @@ namespace Emby.Server.Implementations.FFMpeg
_ffmpegInstallInfo = ffmpegInstallInfo;
}
- public FFMpegInfo GetFFMpegInfo(StartupOptions options)
+ public FFMpegInfo GetFFMpegInfo(IStartupOptions options)
{
- var customffMpegPath = options.FFmpeg;
- var customffProbePath = options.FFprobe;
+ var customffMpegPath = options.FFmpegPath;
+ var customffProbePath = options.FFprobePath;
if (!string.IsNullOrWhiteSpace(customffMpegPath) && !string.IsNullOrWhiteSpace(customffProbePath))
{
diff --git a/Emby.Server.Implementations/IStartupOptions.cs b/Emby.Server.Implementations/IStartupOptions.cs
new file mode 100644
index 0000000000..878bb66406
--- /dev/null
+++ b/Emby.Server.Implementations/IStartupOptions.cs
@@ -0,0 +1,55 @@
+namespace Emby.Server.Implementations.ParsedStartupOptions
+{
+ public interface IStartupOptions
+ {
+ ///
+ /// --datadir
+ ///
+ string DataDir { get; }
+
+ ///
+ /// --configdir
+ ///
+ string ConfigDir { get; }
+
+ ///
+ /// --logdir
+ ///
+ string LogDir { get; }
+
+ ///
+ /// --ffmpeg
+ ///
+ string FFmpegPath { get; }
+
+ ///
+ /// --ffprobe
+ ///
+ string FFprobePath { get; }
+
+ ///
+ /// --service
+ ///
+ bool IsService { get; }
+
+ ///
+ /// --noautorunwebapp
+ ///
+ bool AutoRunWebApp { get; }
+
+ ///
+ /// --package-name
+ ///
+ string PackageName { get; }
+
+ ///
+ /// --restartpath
+ ///
+ string RestartPath { get; }
+
+ ///
+ /// --restartargs
+ ///
+ string RestartArgs { get; }
+ }
+}
diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj
index 5a4bf5149d..1f72de86d7 100644
--- a/Jellyfin.Server/Jellyfin.Server.csproj
+++ b/Jellyfin.Server/Jellyfin.Server.csproj
@@ -32,6 +32,7 @@
+
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 2f7edee656..905cf3aa0d 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -6,8 +6,10 @@ using System.Net;
using System.Net.Security;
using System.Reflection;
using System.Runtime.InteropServices;
+using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
+using CommandLine;
using Emby.Drawing;
using Emby.Server.Implementations;
using Emby.Server.Implementations.EnvironmentInfo;
@@ -26,9 +28,6 @@ using ILogger = Microsoft.Extensions.Logging.ILogger;
namespace Jellyfin.Server
{
- using CommandLine;
- using System.Text.RegularExpressions;
-
public static class Program
{
private static readonly CancellationTokenSource _tokenSource = new CancellationTokenSource();
@@ -41,8 +40,8 @@ namespace Jellyfin.Server
// For backwards compatibility.
// Modify any input arguments now which start with single-hyphen to POSIX standard
// double-hyphen to allow parsing by CommandLineParser package.
- var pattern = @"^(-[^-\s]{2})"; // Match -xx, not -x, not --xx, not xx
- var substitution = @"-$1"; // Prepend with additional single-hyphen
+ const string pattern = @"^(-[^-\s]{2})"; // Match -xx, not -x, not --xx, not xx
+ const string substitution = @"-$1"; // Prepend with additional single-hyphen
var regex = new Regex(pattern);
for (var i = 0; i < args.Length; i++)
@@ -152,9 +151,9 @@ namespace Jellyfin.Server
string programDataPath = Environment.GetEnvironmentVariable("JELLYFIN_DATA_PATH");
if (string.IsNullOrEmpty(programDataPath))
{
- if (options.PathData != null)
+ if (options.DataDir != null)
{
- programDataPath = options.PathData;
+ programDataPath = options.DataDir;
}
else
{
@@ -190,9 +189,9 @@ namespace Jellyfin.Server
string configDir = Environment.GetEnvironmentVariable("JELLYFIN_CONFIG_DIR");
if (string.IsNullOrEmpty(configDir))
{
- if (options.PathConfig != null)
+ if (options.ConfigDir != null)
{
- configDir = options.PathConfig;
+ configDir = options.ConfigDir;
}
else
{
@@ -209,9 +208,9 @@ namespace Jellyfin.Server
string logDir = Environment.GetEnvironmentVariable("JELLYFIN_LOG_DIR");
if (string.IsNullOrEmpty(logDir))
{
- if (options.PathLog != null)
+ if (options.LogDir != null)
{
- logDir = options.PathLog;
+ logDir = options.LogDir;
}
else
{
diff --git a/Emby.Server.Implementations/StartupOptions.cs b/Jellyfin.Server/StartupOptions.cs
similarity index 62%
rename from Emby.Server.Implementations/StartupOptions.cs
rename to Jellyfin.Server/StartupOptions.cs
index f4bb94f740..97fcb633a7 100644
--- a/Emby.Server.Implementations/StartupOptions.cs
+++ b/Jellyfin.Server/StartupOptions.cs
@@ -1,43 +1,47 @@
-namespace Emby.Server.Implementations
-{
- using CommandLine;
+using CommandLine;
+using Emby.Server.Implementations.ParsedStartupOptions;
+namespace Jellyfin.Server
+{
///
/// Class used by CommandLine package when parsing the command line arguments.
///
- public class StartupOptions
+ public class StartupOptions : IStartupOptions
{
[Option('d', "datadir", Required = false, HelpText = "Path to use for the data folder (databases files etc.).")]
- public string PathData { get; set; }
+ public string DataDir { get; set; }
[Option('c', "configdir", Required = false, HelpText = "Path to use for config data (user policies and puctures).")]
- public string PathConfig { get; set; }
+ public string ConfigDir { get; set; }
[Option('l', "logdir", Required = false, HelpText = "Path to use for writing log files.")]
- public string PathLog { get; set; }
-
+ public string LogDir { get; set; }
[Option("ffmpeg", Required = false, HelpText = "Path to external FFmpeg exe to use in place of built-in.")]
- public string FFmpeg { get; set; }
+ public string FFmpegPath { get; set; }
[Option("ffprobe", Required = false, HelpText = "ffmpeg and ffprobe switches must be supplied together.")]
- public string FFprobe { get; set; }
-
+ public string FFprobePath { get; set; }
[Option("service", Required = false, HelpText = "Run as headless service.")]
- public bool Service { get; set; }
+ public bool IsService { get; set; }
[Option("noautorunwebapp", Required = false, HelpText = "Run headless if startup wizard is complete.")]
- public bool NoAutoRunWebApp { get; set; }
+ public bool AutoRunWebApp { get => !NoautoRunWebApp; set => NoautoRunWebApp = value; }
[Option("package-name", Required = false, HelpText = "Used when packaging Jellyfin (example, synology).")]
public string PackageName { get; set; }
-
[Option("restartpath", Required = false, HelpText = "Path to reset script.")]
public string RestartPath { get; set; }
[Option("restartargs", Required = false, HelpText = "Arguments for restart script.")]
public string RestartArgs { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether to run not run the web app.
+ /// Command line switch is --noautorunwebapp, which we store privately here, but provide inverse (AutoRunWebApp) for users.
+ ///
+ private bool NoautoRunWebApp { get; set; }
}
- }
+}
From 211ae30188546e9c652b68b609ab6266ab42a49d Mon Sep 17 00:00:00 2001
From: PloughPuff
Date: Mon, 28 Jan 2019 21:45:00 +0000
Subject: [PATCH 10/93] Revert back to NoAutoRunWebApp
Addressed further review comments. Removed unnecessary .ParsedStartupOptions namespace. Removed DataDir, ConfigDir and LogDir from Interface file as not necessary.
---
.../ApplicationHost.cs | 1 -
.../EntryPoints/StartupWizard.cs | 2 +-
.../FFMpeg/FFMpegLoader.cs | 1 -
.../IStartupOptions.cs | 19 ++-----------------
Jellyfin.Server/StartupOptions.cs | 10 ++--------
5 files changed, 5 insertions(+), 28 deletions(-)
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 3af9e487e9..c3176bc9c8 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -43,7 +43,6 @@ using Emby.Server.Implementations.ScheduledTasks;
using Emby.Server.Implementations.Security;
using Emby.Server.Implementations.Serialization;
using Emby.Server.Implementations.Session;
-using Emby.Server.Implementations.ParsedStartupOptions;
using Emby.Server.Implementations.Threading;
using Emby.Server.Implementations.TV;
using Emby.Server.Implementations.Updates;
diff --git a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
index 43d18e135f..bb96120f41 100644
--- a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
+++ b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
@@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.EntryPoints
{
var options = ((ApplicationHost)_appHost).StartupOptions;
- if (options.AutoRunWebApp)
+ if (!options.NoAutoRunWebApp)
{
BrowserLauncher.OpenWebApp(_appHost);
}
diff --git a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs
index b422b88625..6167d1eaa4 100644
--- a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs
+++ b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs
@@ -6,7 +6,6 @@ using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Net;
using MediaBrowser.Model.IO;
using Microsoft.Extensions.Logging;
-using Emby.Server.Implementations.ParsedStartupOptions;
namespace Emby.Server.Implementations.FFMpeg
{
diff --git a/Emby.Server.Implementations/IStartupOptions.cs b/Emby.Server.Implementations/IStartupOptions.cs
index 878bb66406..24aaa76c02 100644
--- a/Emby.Server.Implementations/IStartupOptions.cs
+++ b/Emby.Server.Implementations/IStartupOptions.cs
@@ -1,22 +1,7 @@
-namespace Emby.Server.Implementations.ParsedStartupOptions
+namespace Emby.Server.Implementations
{
public interface IStartupOptions
{
- ///
- /// --datadir
- ///
- string DataDir { get; }
-
- ///
- /// --configdir
- ///
- string ConfigDir { get; }
-
- ///
- /// --logdir
- ///
- string LogDir { get; }
-
///
/// --ffmpeg
///
@@ -35,7 +20,7 @@ namespace Emby.Server.Implementations.ParsedStartupOptions
///
/// --noautorunwebapp
///
- bool AutoRunWebApp { get; }
+ bool NoAutoRunWebApp { get; }
///
/// --package-name
diff --git a/Jellyfin.Server/StartupOptions.cs b/Jellyfin.Server/StartupOptions.cs
index 97fcb633a7..a1bdb756ec 100644
--- a/Jellyfin.Server/StartupOptions.cs
+++ b/Jellyfin.Server/StartupOptions.cs
@@ -1,5 +1,5 @@
using CommandLine;
-using Emby.Server.Implementations.ParsedStartupOptions;
+using Emby.Server.Implementations;
namespace Jellyfin.Server
{
@@ -27,7 +27,7 @@ namespace Jellyfin.Server
public bool IsService { get; set; }
[Option("noautorunwebapp", Required = false, HelpText = "Run headless if startup wizard is complete.")]
- public bool AutoRunWebApp { get => !NoautoRunWebApp; set => NoautoRunWebApp = value; }
+ public bool NoAutoRunWebApp { get; set; }
[Option("package-name", Required = false, HelpText = "Used when packaging Jellyfin (example, synology).")]
public string PackageName { get; set; }
@@ -37,11 +37,5 @@ namespace Jellyfin.Server
[Option("restartargs", Required = false, HelpText = "Arguments for restart script.")]
public string RestartArgs { get; set; }
-
- ///
- /// Gets or sets a value indicating whether to run not run the web app.
- /// Command line switch is --noautorunwebapp, which we store privately here, but provide inverse (AutoRunWebApp) for users.
- ///
- private bool NoautoRunWebApp { get; set; }
}
}
From b5e8cce4cfb5356ca3f46d2cde66b5d0d4084f4d Mon Sep 17 00:00:00 2001
From: PloughPuff
Date: Tue, 29 Jan 2019 13:34:59 +0000
Subject: [PATCH 11/93] Improved help text and output errors to stderr
Addressed review comments from JustAMan.
---
Jellyfin.Server/Program.cs | 5 +----
Jellyfin.Server/StartupOptions.cs | 10 +++++-----
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 905cf3aa0d..2f18283360 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -49,11 +49,8 @@ namespace Jellyfin.Server
args[i] = regex.Replace(args[i], substitution);
}
- // For CommandLine package, change default behaviour to output errors to stdout (instead of stderr)
- var parser = new Parser(config => config.HelpWriter = Console.Out);
-
// Parse the command line arguments and either start the app or exit indicating error
- await parser.ParseArguments(args)
+ await Parser.Default.ParseArguments(args)
.MapResult(
options => StartApp(options),
errs => Task.FromResult(0)).ConfigureAwait(false);
diff --git a/Jellyfin.Server/StartupOptions.cs b/Jellyfin.Server/StartupOptions.cs
index a1bdb756ec..6e6b617251 100644
--- a/Jellyfin.Server/StartupOptions.cs
+++ b/Jellyfin.Server/StartupOptions.cs
@@ -8,19 +8,19 @@ namespace Jellyfin.Server
///
public class StartupOptions : IStartupOptions
{
- [Option('d', "datadir", Required = false, HelpText = "Path to use for the data folder (databases files etc.).")]
+ [Option('d', "datadir", Required = false, HelpText = "Path to use for the data folder (database files, etc.).")]
public string DataDir { get; set; }
- [Option('c', "configdir", Required = false, HelpText = "Path to use for config data (user policies and puctures).")]
+ [Option('c', "configdir", Required = false, HelpText = "Path to use for configuration data (user settings and pictures).")]
public string ConfigDir { get; set; }
[Option('l', "logdir", Required = false, HelpText = "Path to use for writing log files.")]
public string LogDir { get; set; }
- [Option("ffmpeg", Required = false, HelpText = "Path to external FFmpeg exe to use in place of built-in.")]
+ [Option("ffmpeg", Required = false, HelpText = "Path to external FFmpeg executable to use in place of default found in PATH. Must be specified along with --ffprobe.")]
public string FFmpegPath { get; set; }
- [Option("ffprobe", Required = false, HelpText = "ffmpeg and ffprobe switches must be supplied together.")]
+ [Option("ffprobe", Required = false, HelpText = "Path to external FFprobe executable to use in place of default found in PATH. Must be specified along with --ffmpeg.")]
public string FFprobePath { get; set; }
[Option("service", Required = false, HelpText = "Run as headless service.")]
@@ -32,7 +32,7 @@ namespace Jellyfin.Server
[Option("package-name", Required = false, HelpText = "Used when packaging Jellyfin (example, synology).")]
public string PackageName { get; set; }
- [Option("restartpath", Required = false, HelpText = "Path to reset script.")]
+ [Option("restartpath", Required = false, HelpText = "Path to restart script.")]
public string RestartPath { get; set; }
[Option("restartargs", Required = false, HelpText = "Arguments for restart script.")]
From 8985fb8d58c9b968b8e773276d7c3902aa4d55f3 Mon Sep 17 00:00:00 2001
From: Claus Vium
Date: Mon, 28 Jan 2019 18:49:25 +0100
Subject: [PATCH 12/93] Remove support for games as a media type
---
Emby.Dlna/ContentDirectory/ControlHandler.cs | 4 +-
Emby.Dlna/Didl/DidlBuilder.cs | 2 +-
Emby.Notifications/CoreNotificationTypes.cs | 10 --
.../Activity/ActivityLogEntryPoint.cs | 8 -
.../ApplicationHost.cs | 1 -
.../Data/SqliteItemRepository.cs | 27 +---
Emby.Server.Implementations/Dto/DtoService.cs | 35 -----
.../Images/BaseDynamicImageProvider.cs | 2 +-
.../Library/LibraryManager.cs | 26 ----
.../Library/SearchEngine.cs | 2 -
.../Library/UserViewManager.cs | 4 -
.../Validators/GameGenresPostScanTask.cs | 45 ------
.../Library/Validators/GameGenresValidator.cs | 72 ---------
.../Localization/Core/ar.json | 3 -
.../Localization/Core/bg-BG.json | 3 -
.../Localization/Core/ca.json | 3 -
.../Localization/Core/cs.json | 3 -
.../Localization/Core/da.json | 3 -
.../Localization/Core/de.json | 3 -
.../Localization/Core/el.json | 3 -
.../Localization/Core/en-GB.json | 3 -
.../Localization/Core/en-US.json | 3 -
.../Localization/Core/es-AR.json | 3 -
.../Localization/Core/es-MX.json | 3 -
.../Localization/Core/es.json | 3 -
.../Localization/Core/fa.json | 3 -
.../Localization/Core/fr-CA.json | 3 -
.../Localization/Core/fr.json | 3 -
.../Localization/Core/gsw.json | 3 -
.../Localization/Core/he.json | 3 -
.../Localization/Core/hr.json | 3 -
.../Localization/Core/hu.json | 3 -
.../Localization/Core/it.json | 3 -
.../Localization/Core/kk.json | 3 -
.../Localization/Core/ko.json | 3 -
.../Localization/Core/lt-LT.json | 3 -
.../Localization/Core/ms.json | 3 -
.../Localization/Core/nb.json | 3 -
.../Localization/Core/nl.json | 3 -
.../Localization/Core/pl.json | 3 -
.../Localization/Core/pt-BR.json | 3 -
.../Localization/Core/pt-PT.json | 3 -
.../Localization/Core/ru.json | 3 -
.../Localization/Core/sk.json | 3 -
.../Localization/Core/sl-SI.json | 3 -
.../Localization/Core/sv.json | 3 -
.../Localization/Core/tr.json | 3 -
.../Localization/Core/zh-CN.json | 3 -
.../Localization/Core/zh-HK.json | 3 -
.../ServerApplicationPaths.cs | 6 -
.../Sorting/GameSystemComparer.cs | 51 -------
.../Sorting/PlayersComparer.cs | 43 ------
.../CollectionFolderImageProvider.cs | 4 -
MediaBrowser.Api/BaseApiService.cs | 19 ---
MediaBrowser.Api/FilterService.cs | 10 --
MediaBrowser.Api/GamesService.cs | 140 ------------------
MediaBrowser.Api/Images/ImageService.cs | 4 -
MediaBrowser.Api/ItemLookupService.cs | 13 --
MediaBrowser.Api/ItemUpdateService.cs | 5 -
MediaBrowser.Api/Library/LibraryService.cs | 5 -
MediaBrowser.Api/Session/SessionsService.cs | 2 +-
.../UserLibrary/BaseItemsByNameService.cs | 1 -
.../UserLibrary/BaseItemsRequest.cs | 6 -
.../UserLibrary/GameGenresService.cs | 105 -------------
MediaBrowser.Api/UserLibrary/GenresService.cs | 5 -
MediaBrowser.Api/UserLibrary/ItemsService.cs | 2 -
MediaBrowser.Controller/Entities/Folder.cs | 10 --
MediaBrowser.Controller/Entities/Game.cs | 113 --------------
MediaBrowser.Controller/Entities/GameGenre.cs | 109 --------------
.../Entities/GameSystem.cs | 77 ----------
MediaBrowser.Controller/Entities/Genre.cs | 2 +-
.../Entities/InternalItemsQuery.cs | 3 -
MediaBrowser.Controller/Entities/UserView.cs | 1 -
.../Entities/UserViewBuilder.cs | 46 ------
.../IServerApplicationPaths.cs | 6 -
.../Library/ILibraryManager.cs | 10 --
.../Persistence/IItemRepository.cs | 2 -
MediaBrowser.Controller/Providers/GameInfo.cs | 11 --
.../Providers/GameSystemInfo.cs | 11 --
.../Images/LocalImageProvider.cs | 16 +-
.../Parsers/GameSystemXmlParser.cs | 66 ---------
.../Parsers/GameXmlParser.cs | 85 -----------
.../Providers/GameSystemXmlProvider.cs | 36 -----
.../Providers/GameXmlProvider.cs | 39 -----
.../Savers/GameSystemXmlSaver.cs | 48 ------
.../Savers/GameXmlSaver.cs | 68 ---------
.../Channels/ChannelMediaContentType.cs | 4 +-
.../Configuration/UnratedItem.cs | 1 -
MediaBrowser.Model/Dto/BaseItemDto.cs | 13 --
MediaBrowser.Model/Dto/GameSystemSummary.cs | 48 ------
MediaBrowser.Model/Dto/ItemCounts.cs | 10 --
MediaBrowser.Model/Entities/CollectionType.cs | 1 -
MediaBrowser.Model/Entities/MediaType.cs | 4 -
.../Entities/MetadataProviders.cs | 1 -
.../Notifications/NotificationType.cs | 2 -
.../Providers/RemoteSearchResult.cs | 2 -
MediaBrowser.Model/Querying/ItemSortBy.cs | 2 -
.../GameGenres/GameGenreMetadataService.cs | 23 ---
.../Games/GameMetadataService.cs | 36 -----
.../Games/GameSystemMetadataService.cs | 31 ----
.../Manager/ProviderManager.cs | 2 -
.../Savers/BaseNfoSaver.cs | 8 -
102 files changed, 9 insertions(+), 1705 deletions(-)
delete mode 100644 Emby.Server.Implementations/Library/Validators/GameGenresPostScanTask.cs
delete mode 100644 Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs
delete mode 100644 Emby.Server.Implementations/Sorting/GameSystemComparer.cs
delete mode 100644 Emby.Server.Implementations/Sorting/PlayersComparer.cs
delete mode 100644 MediaBrowser.Api/GamesService.cs
delete mode 100644 MediaBrowser.Api/UserLibrary/GameGenresService.cs
delete mode 100644 MediaBrowser.Controller/Entities/Game.cs
delete mode 100644 MediaBrowser.Controller/Entities/GameGenre.cs
delete mode 100644 MediaBrowser.Controller/Entities/GameSystem.cs
delete mode 100644 MediaBrowser.Controller/Providers/GameInfo.cs
delete mode 100644 MediaBrowser.Controller/Providers/GameSystemInfo.cs
delete mode 100644 MediaBrowser.LocalMetadata/Parsers/GameSystemXmlParser.cs
delete mode 100644 MediaBrowser.LocalMetadata/Parsers/GameXmlParser.cs
delete mode 100644 MediaBrowser.LocalMetadata/Providers/GameSystemXmlProvider.cs
delete mode 100644 MediaBrowser.LocalMetadata/Providers/GameXmlProvider.cs
delete mode 100644 MediaBrowser.LocalMetadata/Savers/GameSystemXmlSaver.cs
delete mode 100644 MediaBrowser.LocalMetadata/Savers/GameXmlSaver.cs
delete mode 100644 MediaBrowser.Model/Dto/GameSystemSummary.cs
delete mode 100644 MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs
delete mode 100644 MediaBrowser.Providers/Games/GameMetadataService.cs
delete mode 100644 MediaBrowser.Providers/Games/GameSystemMetadataService.cs
diff --git a/Emby.Dlna/ContentDirectory/ControlHandler.cs b/Emby.Dlna/ContentDirectory/ControlHandler.cs
index 2d8bb87f9b..bed4d885c2 100644
--- a/Emby.Dlna/ContentDirectory/ControlHandler.cs
+++ b/Emby.Dlna/ContentDirectory/ControlHandler.cs
@@ -454,7 +454,7 @@ namespace Emby.Dlna.ContentDirectory
User = user,
Recursive = true,
IsMissing = false,
- ExcludeItemTypes = new[] { typeof(Game).Name, typeof(Book).Name },
+ ExcludeItemTypes = new[] { typeof(Book).Name },
IsFolder = isFolder,
MediaTypes = mediaTypes.ToArray(),
DtoOptions = GetDtoOptions()
@@ -523,7 +523,7 @@ namespace Emby.Dlna.ContentDirectory
Limit = limit,
StartIndex = startIndex,
IsVirtualItem = false,
- ExcludeItemTypes = new[] { typeof(Game).Name, typeof(Book).Name },
+ ExcludeItemTypes = new[] { typeof(Book).Name },
IsPlaceHolder = false,
DtoOptions = GetDtoOptions()
};
diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs
index e4a9cbfc66..d6f159d762 100644
--- a/Emby.Dlna/Didl/DidlBuilder.cs
+++ b/Emby.Dlna/Didl/DidlBuilder.cs
@@ -808,7 +808,7 @@ namespace Emby.Dlna.Didl
{
writer.WriteString(_profile.RequiresPlainFolders ? "object.container.storageFolder" : "object.container.genre.musicGenre");
}
- else if (item is Genre || item is GameGenre)
+ else if (item is Genre)
{
writer.WriteString(_profile.RequiresPlainFolders ? "object.container.storageFolder" : "object.container.genre");
}
diff --git a/Emby.Notifications/CoreNotificationTypes.cs b/Emby.Notifications/CoreNotificationTypes.cs
index 158898084c..8cc14fa012 100644
--- a/Emby.Notifications/CoreNotificationTypes.cs
+++ b/Emby.Notifications/CoreNotificationTypes.cs
@@ -73,11 +73,6 @@ namespace Emby.Notifications
Type = NotificationType.AudioPlayback.ToString()
},
- new NotificationTypeInfo
- {
- Type = NotificationType.GamePlayback.ToString()
- },
-
new NotificationTypeInfo
{
Type = NotificationType.VideoPlayback.ToString()
@@ -88,11 +83,6 @@ namespace Emby.Notifications
Type = NotificationType.AudioPlaybackStopped.ToString()
},
- new NotificationTypeInfo
- {
- Type = NotificationType.GamePlaybackStopped.ToString()
- },
-
new NotificationTypeInfo
{
Type = NotificationType.VideoPlaybackStopped.ToString()
diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
index efe8f98ec7..54b70d3b5b 100644
--- a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
+++ b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
@@ -207,10 +207,6 @@ namespace Emby.Server.Implementations.Activity
{
return NotificationType.AudioPlayback.ToString();
}
- if (string.Equals(mediaType, MediaType.Game, StringComparison.OrdinalIgnoreCase))
- {
- return NotificationType.GamePlayback.ToString();
- }
if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
{
return NotificationType.VideoPlayback.ToString();
@@ -225,10 +221,6 @@ namespace Emby.Server.Implementations.Activity
{
return NotificationType.AudioPlaybackStopped.ToString();
}
- if (string.Equals(mediaType, MediaType.Game, StringComparison.OrdinalIgnoreCase))
- {
- return NotificationType.GamePlaybackStopped.ToString();
- }
if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
{
return NotificationType.VideoPlaybackStopped.ToString();
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index c3176bc9c8..87e3b45ab7 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -1671,7 +1671,6 @@ namespace Emby.Server.Implementations
var minRequiredVersions = new Dictionary(StringComparer.OrdinalIgnoreCase)
{
- { "GameBrowser.dll", new Version(3, 1) },
{ "moviethemesongs.dll", new Version(1, 6) },
{ "themesongs.dll", new Version(1, 2) }
};
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
index 3de4da4447..9ea2389f42 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -1239,10 +1239,6 @@ namespace Emby.Server.Implementations.Data
{
return false;
}
- else if (type == typeof(GameGenre))
- {
- return false;
- }
else if (type == typeof(Genre))
{
return false;
@@ -4789,10 +4785,6 @@ namespace Emby.Server.Implementations.Data
{
list.Add(typeof(MusicGenre).Name);
}
- if (IsTypeInQuery(typeof(GameGenre).Name, query))
- {
- list.Add(typeof(GameGenre).Name);
- }
if (IsTypeInQuery(typeof(MusicArtist).Name, query))
{
list.Add(typeof(MusicArtist).Name);
@@ -4891,9 +4883,6 @@ namespace Emby.Server.Implementations.Data
typeof(Book),
typeof(CollectionFolder),
typeof(Folder),
- typeof(Game),
- typeof(GameGenre),
- typeof(GameSystem),
typeof(Genre),
typeof(Person),
typeof(Photo),
@@ -5251,11 +5240,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
return GetItemValues(query, new[] { 2 }, typeof(Genre).FullName);
}
- public QueryResult> GetGameGenres(InternalItemsQuery query)
- {
- return GetItemValues(query, new[] { 2 }, typeof(GameGenre).FullName);
- }
-
public QueryResult> GetMusicGenres(InternalItemsQuery query)
{
return GetItemValues(query, new[] { 2 }, typeof(MusicGenre).FullName);
@@ -5276,14 +5260,9 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
return GetItemValueNames(new[] { 2 }, new List { "Audio", "MusicVideo", "MusicAlbum", "MusicArtist" }, new List());
}
- public List GetGameGenreNames()
- {
- return GetItemValueNames(new[] { 2 }, new List { "Game" }, new List());
- }
-
public List GetGenreNames()
{
- return GetItemValueNames(new[] { 2 }, new List(), new List { "Audio", "MusicVideo", "MusicAlbum", "MusicArtist", "Game", "GameSystem" });
+ return GetItemValueNames(new[] { 2 }, new List(), new List { "Audio", "MusicVideo", "MusicAlbum", "MusicArtist" });
}
private List GetItemValueNames(int[] itemValueTypes, List withItemTypes, List excludeItemTypes)
@@ -5652,10 +5631,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
{
counts.SongCount = value;
}
- else if (string.Equals(typeName, typeof(Game).FullName, StringComparison.OrdinalIgnoreCase))
- {
- counts.GameCount = value;
- }
else if (string.Equals(typeName, typeof(Trailer).FullName, StringComparison.OrdinalIgnoreCase))
{
counts.TrailerCount = value;
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index d0a7de11d7..a3529fdb4a 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -374,10 +374,6 @@ namespace Emby.Server.Implementations.Dto
dto.MusicVideoCount = taggedItems.Count(i => i is MusicVideo);
dto.SongCount = taggedItems.Count(i => i is Audio);
}
- else if (item is GameGenre)
- {
- dto.GameCount = taggedItems.Count(i => i is Game);
- }
else
{
// This populates them all and covers Genre, Person, Studio, Year
@@ -385,7 +381,6 @@ namespace Emby.Server.Implementations.Dto
dto.ArtistCount = taggedItems.Count(i => i is MusicArtist);
dto.AlbumCount = taggedItems.Count(i => i is MusicAlbum);
dto.EpisodeCount = taggedItems.Count(i => i is Episode);
- dto.GameCount = taggedItems.Count(i => i is Game);
dto.MovieCount = taggedItems.Count(i => i is Movie);
dto.TrailerCount = taggedItems.Count(i => i is Trailer);
dto.MusicVideoCount = taggedItems.Count(i => i is MusicVideo);
@@ -532,17 +527,6 @@ namespace Emby.Server.Implementations.Dto
dto.Album = item.Album;
}
- private static void SetGameProperties(BaseItemDto dto, Game item)
- {
- dto.GameSystem = item.GameSystem;
- dto.MultiPartGameFiles = item.MultiPartGameFiles;
- }
-
- private static void SetGameSystemProperties(BaseItemDto dto, GameSystem item)
- {
- dto.GameSystem = item.GameSystemName;
- }
-
private string[] GetImageTags(BaseItem item, List images)
{
return images
@@ -698,11 +682,6 @@ namespace Emby.Server.Implementations.Dto
return _libraryManager.GetMusicGenreId(name);
}
- if (owner is Game || owner is GameSystem)
- {
- return _libraryManager.GetGameGenreId(name);
- }
-
return _libraryManager.GetGenreId(name);
}
@@ -1206,20 +1185,6 @@ namespace Emby.Server.Implementations.Dto
}
}
- var game = item as Game;
-
- if (game != null)
- {
- SetGameProperties(dto, game);
- }
-
- var gameSystem = item as GameSystem;
-
- if (gameSystem != null)
- {
- SetGameSystemProperties(dto, gameSystem);
- }
-
var musicVideo = item as MusicVideo;
if (musicVideo != null)
{
diff --git a/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs b/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs
index 9705d54c9c..109c21f18d 100644
--- a/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs
+++ b/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs
@@ -215,7 +215,7 @@ namespace Emby.Server.Implementations.Images
{
return CreateSquareCollage(item, itemsWithImages, outputPath);
}
- if (item is Playlist || item is MusicGenre || item is Genre || item is GameGenre || item is PhotoAlbum)
+ if (item is Playlist || item is MusicGenre || item is Genre || item is PhotoAlbum)
{
return CreateSquareCollage(item, itemsWithImages, outputPath);
}
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index f96a211ec5..3e2ff0b2ac 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -869,11 +869,6 @@ namespace Emby.Server.Implementations.Library
return GetItemByNameId(MusicGenre.GetPath, name);
}
- public Guid GetGameGenreId(string name)
- {
- return GetItemByNameId(GameGenre.GetPath, name);
- }
-
///
/// Gets a Genre
///
@@ -894,16 +889,6 @@ namespace Emby.Server.Implementations.Library
return CreateItemByName(MusicGenre.GetPath, name, new DtoOptions(true));
}
- ///
- /// Gets the game genre.
- ///
- /// The name.
- /// Task{GameGenre}.
- public GameGenre GetGameGenre(string name)
- {
- return CreateItemByName(GameGenre.GetPath, name, new DtoOptions(true));
- }
-
///
/// Gets a Year
///
@@ -1370,17 +1355,6 @@ namespace Emby.Server.Implementations.Library
return ItemRepository.GetGenres(query);
}
- public QueryResult> GetGameGenres(InternalItemsQuery query)
- {
- if (query.User != null)
- {
- AddUserToQuery(query, query.User);
- }
-
- SetTopParentOrAncestorIds(query);
- return ItemRepository.GetGameGenres(query);
- }
-
public QueryResult> GetMusicGenres(InternalItemsQuery query)
{
if (query.User != null)
diff --git a/Emby.Server.Implementations/Library/SearchEngine.cs b/Emby.Server.Implementations/Library/SearchEngine.cs
index 71638b1978..9c7f7dfcb1 100644
--- a/Emby.Server.Implementations/Library/SearchEngine.cs
+++ b/Emby.Server.Implementations/Library/SearchEngine.cs
@@ -99,14 +99,12 @@ namespace Emby.Server.Implementations.Library
if (!query.IncludeMedia)
{
AddIfMissing(includeItemTypes, typeof(Genre).Name);
- AddIfMissing(includeItemTypes, typeof(GameGenre).Name);
AddIfMissing(includeItemTypes, typeof(MusicGenre).Name);
}
}
else
{
AddIfMissing(excludeItemTypes, typeof(Genre).Name);
- AddIfMissing(excludeItemTypes, typeof(GameGenre).Name);
AddIfMissing(excludeItemTypes, typeof(MusicGenre).Name);
}
diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.cs
index 9fa859bde3..e9ce682ee1 100644
--- a/Emby.Server.Implementations/Library/UserViewManager.cs
+++ b/Emby.Server.Implementations/Library/UserViewManager.cs
@@ -308,9 +308,6 @@ namespace Emby.Server.Implementations.Library
mediaTypes.Add(MediaType.Book);
mediaTypes.Add(MediaType.Audio);
break;
- case CollectionType.Games:
- mediaTypes.Add(MediaType.Game);
- break;
case CollectionType.Music:
mediaTypes.Add(MediaType.Audio);
break;
@@ -336,7 +333,6 @@ namespace Emby.Server.Implementations.Library
typeof(Person).Name,
typeof(Studio).Name,
typeof(Year).Name,
- typeof(GameGenre).Name,
typeof(MusicGenre).Name,
typeof(Genre).Name
diff --git a/Emby.Server.Implementations/Library/Validators/GameGenresPostScanTask.cs b/Emby.Server.Implementations/Library/Validators/GameGenresPostScanTask.cs
deleted file mode 100644
index 2b067951d6..0000000000
--- a/Emby.Server.Implementations/Library/Validators/GameGenresPostScanTask.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.Persistence;
-using Microsoft.Extensions.Logging;
-
-namespace Emby.Server.Implementations.Library.Validators
-{
- ///
- /// Class GameGenresPostScanTask
- ///
- public class GameGenresPostScanTask : ILibraryPostScanTask
- {
- ///
- /// The _library manager
- ///
- private readonly ILibraryManager _libraryManager;
- private readonly ILogger _logger;
- private readonly IItemRepository _itemRepo;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The library manager.
- /// The logger.
- public GameGenresPostScanTask(ILibraryManager libraryManager, ILogger logger, IItemRepository itemRepo)
- {
- _libraryManager = libraryManager;
- _logger = logger;
- _itemRepo = itemRepo;
- }
-
- ///
- /// Runs the specified progress.
- ///
- /// The progress.
- /// The cancellation token.
- /// Task.
- public Task Run(IProgress progress, CancellationToken cancellationToken)
- {
- return new GameGenresValidator(_libraryManager, _logger, _itemRepo).Run(progress, cancellationToken);
- }
- }
-}
diff --git a/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs b/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs
deleted file mode 100644
index f5ffa1e458..0000000000
--- a/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.Persistence;
-using Microsoft.Extensions.Logging;
-
-namespace Emby.Server.Implementations.Library.Validators
-{
- class GameGenresValidator
- {
- ///
- /// The _library manager
- ///
- private readonly ILibraryManager _libraryManager;
-
- ///
- /// The _logger
- ///
- private readonly ILogger _logger;
- private readonly IItemRepository _itemRepo;
-
- public GameGenresValidator(ILibraryManager libraryManager, ILogger logger, IItemRepository itemRepo)
- {
- _libraryManager = libraryManager;
- _logger = logger;
- _itemRepo = itemRepo;
- }
-
- ///
- /// Runs the specified progress.
- ///
- /// The progress.
- /// The cancellation token.
- /// Task.
- public async Task Run(IProgress progress, CancellationToken cancellationToken)
- {
- var names = _itemRepo.GetGameGenreNames();
-
- var numComplete = 0;
- var count = names.Count;
-
- foreach (var name in names)
- {
- try
- {
- var item = _libraryManager.GetGameGenre(name);
-
- await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
- }
- catch (OperationCanceledException)
- {
- // Don't clutter the log
- throw;
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error refreshing {GenreName}", name);
- }
-
- numComplete++;
- double percent = numComplete;
- percent /= count;
- percent *= 100;
-
- progress.Report(percent);
- }
-
- progress.Report(100);
- }
- }
-}
diff --git a/Emby.Server.Implementations/Localization/Core/ar.json b/Emby.Server.Implementations/Localization/Core/ar.json
index ec2c3f2370..eb145b4fef 100644
--- a/Emby.Server.Implementations/Localization/Core/ar.json
+++ b/Emby.Server.Implementations/Localization/Core/ar.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "عملية تسجيل الدخول فشلت من {0}",
"Favorites": "المفضلات",
"Folders": "المجلدات",
- "Games": "الألعاب",
"Genres": "أنواع الأفلام",
"HeaderAlbumArtists": "فنانو الألبومات",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "بدأ تشغيل المقطع الصوتي",
"NotificationOptionAudioPlaybackStopped": "تم إيقاف تشغيل المقطع الصوتي",
"NotificationOptionCameraImageUploaded": "تم رقع صورة الكاميرا",
- "NotificationOptionGamePlayback": "تم تشغيل اللعبة",
- "NotificationOptionGamePlaybackStopped": "تم إيقاف تشغيل اللعبة",
"NotificationOptionInstallationFailed": "عملية التنصيب فشلت",
"NotificationOptionNewLibraryContent": "تم إضافة محتوى جديد",
"NotificationOptionPluginError": "فشل في الملحق",
diff --git a/Emby.Server.Implementations/Localization/Core/bg-BG.json b/Emby.Server.Implementations/Localization/Core/bg-BG.json
index ba6c985550..a71dc93467 100644
--- a/Emby.Server.Implementations/Localization/Core/bg-BG.json
+++ b/Emby.Server.Implementations/Localization/Core/bg-BG.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
"Favorites": "Любими",
"Folders": "Папки",
- "Games": "Игри",
"Genres": "Жанрове",
"HeaderAlbumArtists": "Изпълнители на албуми",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Възпроизвеждането на звук започна",
"NotificationOptionAudioPlaybackStopped": "Възпроизвеждането на звук е спряно",
"NotificationOptionCameraImageUploaded": "Изображението от фотоапарата е качено",
- "NotificationOptionGamePlayback": "Възпроизвеждането на играта започна",
- "NotificationOptionGamePlaybackStopped": "Възпроизвеждането на играта е спряна",
"NotificationOptionInstallationFailed": "Неуспешно инсталиране",
"NotificationOptionNewLibraryContent": "Добавено е ново съдържание",
"NotificationOptionPluginError": "Грешка в приставка",
diff --git a/Emby.Server.Implementations/Localization/Core/ca.json b/Emby.Server.Implementations/Localization/Core/ca.json
index a818b78de9..74406a0641 100644
--- a/Emby.Server.Implementations/Localization/Core/ca.json
+++ b/Emby.Server.Implementations/Localization/Core/ca.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Intent de connexió fallit des de {0}",
"Favorites": "Preferits",
"Folders": "Directoris",
- "Games": "Jocs",
"Genres": "Gèneres",
"HeaderAlbumArtists": "Album Artists",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audio playback started",
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Game playback stopped",
"NotificationOptionInstallationFailed": "Installation failure",
"NotificationOptionNewLibraryContent": "New content added",
"NotificationOptionPluginError": "Un component ha fallat",
diff --git a/Emby.Server.Implementations/Localization/Core/cs.json b/Emby.Server.Implementations/Localization/Core/cs.json
index e066051a84..a8b4a44244 100644
--- a/Emby.Server.Implementations/Localization/Core/cs.json
+++ b/Emby.Server.Implementations/Localization/Core/cs.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Neúspěšný pokus o přihlášení z {0}",
"Favorites": "Oblíbené",
"Folders": "Složky",
- "Games": "Hry",
"Genres": "Žánry",
"HeaderAlbumArtists": "Umělci alba",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Přehrávání audia zahájeno",
"NotificationOptionAudioPlaybackStopped": "Přehrávání audia ukončeno",
"NotificationOptionCameraImageUploaded": "Kamerový záznam nahrán",
- "NotificationOptionGamePlayback": "Spuštění hry zahájeno",
- "NotificationOptionGamePlaybackStopped": "Hra ukončena",
"NotificationOptionInstallationFailed": "Chyba instalace",
"NotificationOptionNewLibraryContent": "Přidán nový obsah",
"NotificationOptionPluginError": "Chyba zásuvného modulu",
diff --git a/Emby.Server.Implementations/Localization/Core/da.json b/Emby.Server.Implementations/Localization/Core/da.json
index 30581c389b..7004d44dba 100644
--- a/Emby.Server.Implementations/Localization/Core/da.json
+++ b/Emby.Server.Implementations/Localization/Core/da.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Fejlet loginforsøg fra {0}",
"Favorites": "Favoritter",
"Folders": "Mapper",
- "Games": "Spil",
"Genres": "Genre",
"HeaderAlbumArtists": "Albumkunstnere",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audioafspilning påbegyndt",
"NotificationOptionAudioPlaybackStopped": "Audioafspilning stoppet",
"NotificationOptionCameraImageUploaded": "Kamerabillede uploadet",
- "NotificationOptionGamePlayback": "Afspilning af Spil påbegyndt",
- "NotificationOptionGamePlaybackStopped": "Afspilning af Spil stoppet",
"NotificationOptionInstallationFailed": "Installationsfejl",
"NotificationOptionNewLibraryContent": "Nyt indhold tilføjet",
"NotificationOptionPluginError": "Pluginfejl",
diff --git a/Emby.Server.Implementations/Localization/Core/de.json b/Emby.Server.Implementations/Localization/Core/de.json
index 98cb07663f..7bd2e90fe4 100644
--- a/Emby.Server.Implementations/Localization/Core/de.json
+++ b/Emby.Server.Implementations/Localization/Core/de.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Fehlgeschlagener Anmeldeversuch von {0}",
"Favorites": "Favoriten",
"Folders": "Verzeichnisse",
- "Games": "Spiele",
"Genres": "Genres",
"HeaderAlbumArtists": "Album-Künstler",
"HeaderCameraUploads": "Kamera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audiowiedergabe gestartet",
"NotificationOptionAudioPlaybackStopped": "Audiowiedergabe gestoppt",
"NotificationOptionCameraImageUploaded": "Kamera Bild hochgeladen",
- "NotificationOptionGamePlayback": "Spielwiedergabe gestartet",
- "NotificationOptionGamePlaybackStopped": "Spielwiedergabe gestoppt",
"NotificationOptionInstallationFailed": "Installationsfehler",
"NotificationOptionNewLibraryContent": "Neuer Inhalt hinzugefügt",
"NotificationOptionPluginError": "Plugin Fehler",
diff --git a/Emby.Server.Implementations/Localization/Core/el.json b/Emby.Server.Implementations/Localization/Core/el.json
index ba687a089a..91ca34edc2 100644
--- a/Emby.Server.Implementations/Localization/Core/el.json
+++ b/Emby.Server.Implementations/Localization/Core/el.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Αποτυχημένη προσπάθεια σύνδεσης από {0}",
"Favorites": "Αγαπημένα",
"Folders": "Φάκελοι",
- "Games": "Παιχνίδια",
"Genres": "Είδη",
"HeaderAlbumArtists": "Άλμπουμ Καλλιτεχνών",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Η αναπαραγωγή ήχου ξεκίνησε",
"NotificationOptionAudioPlaybackStopped": "Η αναπαραγωγή ήχου σταμάτησε",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
- "NotificationOptionGamePlayback": "Η αναπαραγωγή του παιχνιδιού ξεκίνησε",
- "NotificationOptionGamePlaybackStopped": "Η αναπαραγωγή του παιχνιδιού σταμάτησε",
"NotificationOptionInstallationFailed": "Αποτυχία εγκατάστασης",
"NotificationOptionNewLibraryContent": "Προστέθηκε νέο περιεχόμενο",
"NotificationOptionPluginError": "Αποτυχία του plugin",
diff --git a/Emby.Server.Implementations/Localization/Core/en-GB.json b/Emby.Server.Implementations/Localization/Core/en-GB.json
index 20d397a1a0..3329022925 100644
--- a/Emby.Server.Implementations/Localization/Core/en-GB.json
+++ b/Emby.Server.Implementations/Localization/Core/en-GB.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
"Favorites": "Favourites",
"Folders": "Folders",
- "Games": "Games",
"Genres": "Genres",
"HeaderAlbumArtists": "Album Artists",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audio playback started",
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Game playback stopped",
"NotificationOptionInstallationFailed": "Installation failure",
"NotificationOptionNewLibraryContent": "New content added",
"NotificationOptionPluginError": "Plugin failure",
diff --git a/Emby.Server.Implementations/Localization/Core/en-US.json b/Emby.Server.Implementations/Localization/Core/en-US.json
index 69c8bf03c2..f19cd532b9 100644
--- a/Emby.Server.Implementations/Localization/Core/en-US.json
+++ b/Emby.Server.Implementations/Localization/Core/en-US.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
"Favorites": "Favorites",
"Folders": "Folders",
- "Games": "Games",
"Genres": "Genres",
"HeaderAlbumArtists": "Album Artists",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audio playback started",
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Game playback stopped",
"NotificationOptionInstallationFailed": "Installation failure",
"NotificationOptionNewLibraryContent": "New content added",
"NotificationOptionPluginError": "Plugin failure",
diff --git a/Emby.Server.Implementations/Localization/Core/es-AR.json b/Emby.Server.Implementations/Localization/Core/es-AR.json
index aaaf097882..c01bb0c501 100644
--- a/Emby.Server.Implementations/Localization/Core/es-AR.json
+++ b/Emby.Server.Implementations/Localization/Core/es-AR.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
"Favorites": "Favorites",
"Folders": "Folders",
- "Games": "Games",
"Genres": "Genres",
"HeaderAlbumArtists": "Album Artists",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audio playback started",
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Game playback stopped",
"NotificationOptionInstallationFailed": "Installation failure",
"NotificationOptionNewLibraryContent": "New content added",
"NotificationOptionPluginError": "Plugin failure",
diff --git a/Emby.Server.Implementations/Localization/Core/es-MX.json b/Emby.Server.Implementations/Localization/Core/es-MX.json
index 2ba9c8c7ab..2285f2808a 100644
--- a/Emby.Server.Implementations/Localization/Core/es-MX.json
+++ b/Emby.Server.Implementations/Localization/Core/es-MX.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Intento fallido de inicio de sesión de {0}",
"Favorites": "Favoritos",
"Folders": "Carpetas",
- "Games": "Juegos",
"Genres": "Géneros",
"HeaderAlbumArtists": "Artistas del Álbum",
"HeaderCameraUploads": "Subidos desde Camara",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Reproducción de audio iniciada",
"NotificationOptionAudioPlaybackStopped": "Reproducción de audio detenida",
"NotificationOptionCameraImageUploaded": "Imagen de la cámara subida",
- "NotificationOptionGamePlayback": "Ejecución de juego iniciada",
- "NotificationOptionGamePlaybackStopped": "Ejecución de juego detenida",
"NotificationOptionInstallationFailed": "Falla de instalación",
"NotificationOptionNewLibraryContent": "Nuevo contenido agregado",
"NotificationOptionPluginError": "Falla de complemento",
diff --git a/Emby.Server.Implementations/Localization/Core/es.json b/Emby.Server.Implementations/Localization/Core/es.json
index 38a2823827..5d118d21f2 100644
--- a/Emby.Server.Implementations/Localization/Core/es.json
+++ b/Emby.Server.Implementations/Localization/Core/es.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Error al intentar iniciar sesión a partir de {0}",
"Favorites": "Favoritos",
"Folders": "Carpetas",
- "Games": "Juegos",
"Genres": "Géneros",
"HeaderAlbumArtists": "Artistas del Álbum",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Se inició la reproducción de audio",
"NotificationOptionAudioPlaybackStopped": "Se detuvo la reproducción de audio",
"NotificationOptionCameraImageUploaded": "Imagen de la cámara cargada",
- "NotificationOptionGamePlayback": "Se inició la reproducción del juego",
- "NotificationOptionGamePlaybackStopped": "Se detuvo la reproducción del juego",
"NotificationOptionInstallationFailed": "Error de instalación",
"NotificationOptionNewLibraryContent": "Nuevo contenido añadido",
"NotificationOptionPluginError": "Error en plugin",
diff --git a/Emby.Server.Implementations/Localization/Core/fa.json b/Emby.Server.Implementations/Localization/Core/fa.json
index 1d7bc5fe82..0a0c7553b8 100644
--- a/Emby.Server.Implementations/Localization/Core/fa.json
+++ b/Emby.Server.Implementations/Localization/Core/fa.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "تلاش برای ورود از {0} ناموفق بود",
"Favorites": "مورد علاقه ها",
"Folders": "پوشه ها",
- "Games": "بازی ها",
"Genres": "ژانرها",
"HeaderAlbumArtists": "هنرمندان آلبوم",
"HeaderCameraUploads": "آپلودهای دوربین",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "پخش صدا آغاز شد",
"NotificationOptionAudioPlaybackStopped": "پخش صدا متوقف شد",
"NotificationOptionCameraImageUploaded": "تصاویر دوربین آپلود شد",
- "NotificationOptionGamePlayback": "پخش بازی آغاز شد",
- "NotificationOptionGamePlaybackStopped": "پخش بازی متوقف شد",
"NotificationOptionInstallationFailed": "شکست نصب",
"NotificationOptionNewLibraryContent": "محتوای جدید افزوده شد",
"NotificationOptionPluginError": "خرابی افزونه",
diff --git a/Emby.Server.Implementations/Localization/Core/fr-CA.json b/Emby.Server.Implementations/Localization/Core/fr-CA.json
index 22cd4cf6df..7202be9f56 100644
--- a/Emby.Server.Implementations/Localization/Core/fr-CA.json
+++ b/Emby.Server.Implementations/Localization/Core/fr-CA.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
"Favorites": "Favorites",
"Folders": "Folders",
- "Games": "Games",
"Genres": "Genres",
"HeaderAlbumArtists": "Album Artists",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audio playback started",
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Game playback stopped",
"NotificationOptionInstallationFailed": "Installation failure",
"NotificationOptionNewLibraryContent": "New content added",
"NotificationOptionPluginError": "Plugin failure",
diff --git a/Emby.Server.Implementations/Localization/Core/fr.json b/Emby.Server.Implementations/Localization/Core/fr.json
index 085e22cf72..aa9a1add3e 100644
--- a/Emby.Server.Implementations/Localization/Core/fr.json
+++ b/Emby.Server.Implementations/Localization/Core/fr.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Échec d'une tentative de connexion de {0}",
"Favorites": "Favoris",
"Folders": "Dossiers",
- "Games": "Jeux",
"Genres": "Genres",
"HeaderAlbumArtists": "Artistes de l'album",
"HeaderCameraUploads": "Photos transférées",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Lecture audio démarrée",
"NotificationOptionAudioPlaybackStopped": "Lecture audio arrêtée",
"NotificationOptionCameraImageUploaded": "L'image de l'appareil photo a été transférée",
- "NotificationOptionGamePlayback": "Lecture de jeu démarrée",
- "NotificationOptionGamePlaybackStopped": "Lecture de jeu arrêtée",
"NotificationOptionInstallationFailed": "Échec d'installation",
"NotificationOptionNewLibraryContent": "Nouveau contenu ajouté",
"NotificationOptionPluginError": "Erreur d'extension",
diff --git a/Emby.Server.Implementations/Localization/Core/gsw.json b/Emby.Server.Implementations/Localization/Core/gsw.json
index 537fe35d5e..728002a560 100644
--- a/Emby.Server.Implementations/Localization/Core/gsw.json
+++ b/Emby.Server.Implementations/Localization/Core/gsw.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
"Favorites": "Favorites",
"Folders": "Folders",
- "Games": "Spiel",
"Genres": "Genres",
"HeaderAlbumArtists": "Albuminterprete",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audio playback started",
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Game playback stopped",
"NotificationOptionInstallationFailed": "Installation failure",
"NotificationOptionNewLibraryContent": "New content added",
"NotificationOptionPluginError": "Plugin failure",
diff --git a/Emby.Server.Implementations/Localization/Core/he.json b/Emby.Server.Implementations/Localization/Core/he.json
index 6fff9d0abc..fff1d1f0ec 100644
--- a/Emby.Server.Implementations/Localization/Core/he.json
+++ b/Emby.Server.Implementations/Localization/Core/he.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
"Favorites": "Favorites",
"Folders": "Folders",
- "Games": "משחקים",
"Genres": "ז'אנרים",
"HeaderAlbumArtists": "Album Artists",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audio playback started",
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Game playback stopped",
"NotificationOptionInstallationFailed": "Installation failure",
"NotificationOptionNewLibraryContent": "New content added",
"NotificationOptionPluginError": "Plugin failure",
diff --git a/Emby.Server.Implementations/Localization/Core/hr.json b/Emby.Server.Implementations/Localization/Core/hr.json
index 3232a4ff72..f284b3cd98 100644
--- a/Emby.Server.Implementations/Localization/Core/hr.json
+++ b/Emby.Server.Implementations/Localization/Core/hr.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Neuspjeli pokušaj prijave za {0}",
"Favorites": "Omiljeni",
"Folders": "Mape",
- "Games": "Igre",
"Genres": "Žanrovi",
"HeaderAlbumArtists": "Izvođači albuma",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Reprodukcija glazbe započeta",
"NotificationOptionAudioPlaybackStopped": "Reprodukcija audiozapisa je zaustavljena",
"NotificationOptionCameraImageUploaded": "Slike kamere preuzete",
- "NotificationOptionGamePlayback": "Igrica pokrenuta",
- "NotificationOptionGamePlaybackStopped": "Reprodukcija igre je zaustavljena",
"NotificationOptionInstallationFailed": "Instalacija nije izvršena",
"NotificationOptionNewLibraryContent": "Novi sadržaj je dodan",
"NotificationOptionPluginError": "Dodatak otkazao",
diff --git a/Emby.Server.Implementations/Localization/Core/hu.json b/Emby.Server.Implementations/Localization/Core/hu.json
index 3a0119faf9..d2d16b18fe 100644
--- a/Emby.Server.Implementations/Localization/Core/hu.json
+++ b/Emby.Server.Implementations/Localization/Core/hu.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
"Favorites": "Kedvencek",
"Folders": "Könyvtárak",
- "Games": "Játékok",
"Genres": "Műfajok",
"HeaderAlbumArtists": "Album Előadók",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audió lejátszás elkezdve",
"NotificationOptionAudioPlaybackStopped": "Audió lejátszás befejezve",
"NotificationOptionCameraImageUploaded": "Kamera kép feltöltve",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Game playback stopped",
"NotificationOptionInstallationFailed": "Telepítési hiba",
"NotificationOptionNewLibraryContent": "Új tartalom hozzáadva",
"NotificationOptionPluginError": "Bővítmény hiba",
diff --git a/Emby.Server.Implementations/Localization/Core/it.json b/Emby.Server.Implementations/Localization/Core/it.json
index 58b7bb61a0..b3d9c16cf2 100644
--- a/Emby.Server.Implementations/Localization/Core/it.json
+++ b/Emby.Server.Implementations/Localization/Core/it.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Tentativo di accesso fallito da {0}",
"Favorites": "Preferiti",
"Folders": "Cartelle",
- "Games": "Giochi",
"Genres": "Generi",
"HeaderAlbumArtists": "Artisti Album",
"HeaderCameraUploads": "Caricamenti Fotocamera",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "La riproduzione audio è iniziata",
"NotificationOptionAudioPlaybackStopped": "La riproduzione audio è stata interrotta",
"NotificationOptionCameraImageUploaded": "Immagine fotocamera caricata",
- "NotificationOptionGamePlayback": "Il gioco è stato avviato",
- "NotificationOptionGamePlaybackStopped": "Il gioco è stato fermato",
"NotificationOptionInstallationFailed": "Installazione fallita",
"NotificationOptionNewLibraryContent": "Nuovo contenuto aggiunto",
"NotificationOptionPluginError": "Errore del Plug-in",
diff --git a/Emby.Server.Implementations/Localization/Core/kk.json b/Emby.Server.Implementations/Localization/Core/kk.json
index 45b8617f1a..ae256f79d6 100644
--- a/Emby.Server.Implementations/Localization/Core/kk.json
+++ b/Emby.Server.Implementations/Localization/Core/kk.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "{0} тарапынан кіру әрекеті сәтсіз",
"Favorites": "Таңдаулылар",
"Folders": "Қалталар",
- "Games": "Ойындар",
"Genres": "Жанрлар",
"HeaderAlbumArtists": "Альбом орындаушылары",
"HeaderCameraUploads": "Камерадан жүктелгендер",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Дыбыс ойнатуы басталды",
"NotificationOptionAudioPlaybackStopped": "Дыбыс ойнатуы тоқтатылды",
"NotificationOptionCameraImageUploaded": "Камерадан фотосурет кері қотарылған",
- "NotificationOptionGamePlayback": "Ойын ойнатуы басталды",
- "NotificationOptionGamePlaybackStopped": "Ойын ойнатуы тоқтатылды",
"NotificationOptionInstallationFailed": "Орнату сәтсіздігі",
"NotificationOptionNewLibraryContent": "Жаңа мазмұн үстелген",
"NotificationOptionPluginError": "Плагин сәтсіздігі",
diff --git a/Emby.Server.Implementations/Localization/Core/ko.json b/Emby.Server.Implementations/Localization/Core/ko.json
index 04fc52d6ee..21808fd18a 100644
--- a/Emby.Server.Implementations/Localization/Core/ko.json
+++ b/Emby.Server.Implementations/Localization/Core/ko.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
"Favorites": "Favorites",
"Folders": "Folders",
- "Games": "Games",
"Genres": "Genres",
"HeaderAlbumArtists": "앨범 아티스트",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audio playback started",
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Game playback stopped",
"NotificationOptionInstallationFailed": "Installation failure",
"NotificationOptionNewLibraryContent": "New content added",
"NotificationOptionPluginError": "Plugin failure",
diff --git a/Emby.Server.Implementations/Localization/Core/lt-LT.json b/Emby.Server.Implementations/Localization/Core/lt-LT.json
index 653565db65..558904f060 100644
--- a/Emby.Server.Implementations/Localization/Core/lt-LT.json
+++ b/Emby.Server.Implementations/Localization/Core/lt-LT.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
"Favorites": "Favorites",
"Folders": "Folders",
- "Games": "Games",
"Genres": "Žanrai",
"HeaderAlbumArtists": "Album Artists",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audio playback started",
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Game playback stopped",
"NotificationOptionInstallationFailed": "Installation failure",
"NotificationOptionNewLibraryContent": "New content added",
"NotificationOptionPluginError": "Plugin failure",
diff --git a/Emby.Server.Implementations/Localization/Core/ms.json b/Emby.Server.Implementations/Localization/Core/ms.json
index aaaf097882..c01bb0c501 100644
--- a/Emby.Server.Implementations/Localization/Core/ms.json
+++ b/Emby.Server.Implementations/Localization/Core/ms.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
"Favorites": "Favorites",
"Folders": "Folders",
- "Games": "Games",
"Genres": "Genres",
"HeaderAlbumArtists": "Album Artists",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audio playback started",
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Game playback stopped",
"NotificationOptionInstallationFailed": "Installation failure",
"NotificationOptionNewLibraryContent": "New content added",
"NotificationOptionPluginError": "Plugin failure",
diff --git a/Emby.Server.Implementations/Localization/Core/nb.json b/Emby.Server.Implementations/Localization/Core/nb.json
index ed63aa29c5..dbda794ad7 100644
--- a/Emby.Server.Implementations/Localization/Core/nb.json
+++ b/Emby.Server.Implementations/Localization/Core/nb.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Mislykket påloggingsforsøk fra {0}",
"Favorites": "Favoritter",
"Folders": "Mapper",
- "Games": "Spill",
"Genres": "Sjanger",
"HeaderAlbumArtists": "Albumartist",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Lyd tilbakespilling startet",
"NotificationOptionAudioPlaybackStopped": "Lyd avspilling stoppet",
"NotificationOptionCameraImageUploaded": "Kamera bilde lastet opp",
- "NotificationOptionGamePlayback": "Spill avspillingen startet",
- "NotificationOptionGamePlaybackStopped": "Filmer",
"NotificationOptionInstallationFailed": "Installasjon feil",
"NotificationOptionNewLibraryContent": "Ny innhold er lagt til",
"NotificationOptionPluginError": "Plugin feil",
diff --git a/Emby.Server.Implementations/Localization/Core/nl.json b/Emby.Server.Implementations/Localization/Core/nl.json
index 7b8c8765ed..589753c446 100644
--- a/Emby.Server.Implementations/Localization/Core/nl.json
+++ b/Emby.Server.Implementations/Localization/Core/nl.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Mislukte aanmeld poging van {0}",
"Favorites": "Favorieten",
"Folders": "Mappen",
- "Games": "Spellen",
"Genres": "Genres",
"HeaderAlbumArtists": "Album artiesten",
"HeaderCameraUploads": "Camera uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Geluid gestart",
"NotificationOptionAudioPlaybackStopped": "Geluid gestopt",
"NotificationOptionCameraImageUploaded": "Camera afbeelding geüpload",
- "NotificationOptionGamePlayback": "Spel gestart",
- "NotificationOptionGamePlaybackStopped": "Spel gestopt",
"NotificationOptionInstallationFailed": "Installatie mislukt",
"NotificationOptionNewLibraryContent": "Nieuwe content toegevoegd",
"NotificationOptionPluginError": "Plug-in fout",
diff --git a/Emby.Server.Implementations/Localization/Core/pl.json b/Emby.Server.Implementations/Localization/Core/pl.json
index 5aefa740be..92b12409d1 100644
--- a/Emby.Server.Implementations/Localization/Core/pl.json
+++ b/Emby.Server.Implementations/Localization/Core/pl.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Próba logowania przez {0} zakończona niepowodzeniem",
"Favorites": "Ulubione",
"Folders": "Foldery",
- "Games": "Gry",
"Genres": "Gatunki",
"HeaderAlbumArtists": "Wykonawcy albumów",
"HeaderCameraUploads": "Przekazane obrazy",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Rozpoczęto odtwarzanie muzyki",
"NotificationOptionAudioPlaybackStopped": "Odtwarzane dźwięku zatrzymane",
"NotificationOptionCameraImageUploaded": "Przekazano obraz z urządzenia mobilnego",
- "NotificationOptionGamePlayback": "Odtwarzanie gry rozpoczęte",
- "NotificationOptionGamePlaybackStopped": "Odtwarzanie gry zatrzymane",
"NotificationOptionInstallationFailed": "Niepowodzenie instalacji",
"NotificationOptionNewLibraryContent": "Dodano nową zawartość",
"NotificationOptionPluginError": "Awaria wtyczki",
diff --git a/Emby.Server.Implementations/Localization/Core/pt-BR.json b/Emby.Server.Implementations/Localization/Core/pt-BR.json
index 9ae25d3ac9..aaedf08505 100644
--- a/Emby.Server.Implementations/Localization/Core/pt-BR.json
+++ b/Emby.Server.Implementations/Localization/Core/pt-BR.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Falha na tentativa de login de {0}",
"Favorites": "Favoritos",
"Folders": "Pastas",
- "Games": "Jogos",
"Genres": "Gêneros",
"HeaderAlbumArtists": "Artistas do Álbum",
"HeaderCameraUploads": "Uploads da Câmera",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Reprodução de áudio iniciada",
"NotificationOptionAudioPlaybackStopped": "Reprodução de áudio parada",
"NotificationOptionCameraImageUploaded": "Imagem de câmera enviada",
- "NotificationOptionGamePlayback": "Reprodução de jogo iniciada",
- "NotificationOptionGamePlaybackStopped": "Reprodução de jogo parada",
"NotificationOptionInstallationFailed": "Falha na instalação",
"NotificationOptionNewLibraryContent": "Novo conteúdo adicionado",
"NotificationOptionPluginError": "Falha de plugin",
diff --git a/Emby.Server.Implementations/Localization/Core/pt-PT.json b/Emby.Server.Implementations/Localization/Core/pt-PT.json
index 59c25f0e3d..dc69d8af24 100644
--- a/Emby.Server.Implementations/Localization/Core/pt-PT.json
+++ b/Emby.Server.Implementations/Localization/Core/pt-PT.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
"Favorites": "Favorites",
"Folders": "Folders",
- "Games": "Games",
"Genres": "Genres",
"HeaderAlbumArtists": "Album Artists",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audio playback started",
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Game playback stopped",
"NotificationOptionInstallationFailed": "Installation failure",
"NotificationOptionNewLibraryContent": "New content added",
"NotificationOptionPluginError": "Plugin failure",
diff --git a/Emby.Server.Implementations/Localization/Core/ru.json b/Emby.Server.Implementations/Localization/Core/ru.json
index 338141294c..d799fa50b5 100644
--- a/Emby.Server.Implementations/Localization/Core/ru.json
+++ b/Emby.Server.Implementations/Localization/Core/ru.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "{0} - попытка входа неудачна",
"Favorites": "Избранное",
"Folders": "Папки",
- "Games": "Игры",
"Genres": "Жанры",
"HeaderAlbumArtists": "Исп-ли альбома",
"HeaderCameraUploads": "Камеры",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Воспр-ие аудио зап-но",
"NotificationOptionAudioPlaybackStopped": "Восп-ие аудио ост-но",
"NotificationOptionCameraImageUploaded": "Произведена выкладка отснятого с камеры",
- "NotificationOptionGamePlayback": "Воспр-ие игры зап-но",
- "NotificationOptionGamePlaybackStopped": "Восп-ие игры ост-но",
"NotificationOptionInstallationFailed": "Сбой установки",
"NotificationOptionNewLibraryContent": "Новое содержание добавлено",
"NotificationOptionPluginError": "Сбой плагина",
diff --git a/Emby.Server.Implementations/Localization/Core/sk.json b/Emby.Server.Implementations/Localization/Core/sk.json
index ed0c689522..bc7e7184e3 100644
--- a/Emby.Server.Implementations/Localization/Core/sk.json
+++ b/Emby.Server.Implementations/Localization/Core/sk.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Neúspešný pokus o prihlásenie z {0}",
"Favorites": "Obľúbené",
"Folders": "Priečinky",
- "Games": "Hry",
"Genres": "Žánre",
"HeaderAlbumArtists": "Album Artists",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Spustené prehrávanie audia",
"NotificationOptionAudioPlaybackStopped": "Zastavené prehrávanie audia",
"NotificationOptionCameraImageUploaded": "Nahraný obrázok z fotoaparátu",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Hra ukončená",
"NotificationOptionInstallationFailed": "Chyba inštalácie",
"NotificationOptionNewLibraryContent": "Pridaný nový obsah",
"NotificationOptionPluginError": "Chyba rozšírenia",
diff --git a/Emby.Server.Implementations/Localization/Core/sl-SI.json b/Emby.Server.Implementations/Localization/Core/sl-SI.json
index 8fe279836b..e850257d4a 100644
--- a/Emby.Server.Implementations/Localization/Core/sl-SI.json
+++ b/Emby.Server.Implementations/Localization/Core/sl-SI.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
"Favorites": "Favorites",
"Folders": "Folders",
- "Games": "Games",
"Genres": "Genres",
"HeaderAlbumArtists": "Album Artists",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audio playback started",
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Game playback stopped",
"NotificationOptionInstallationFailed": "Installation failure",
"NotificationOptionNewLibraryContent": "New content added",
"NotificationOptionPluginError": "Plugin failure",
diff --git a/Emby.Server.Implementations/Localization/Core/sv.json b/Emby.Server.Implementations/Localization/Core/sv.json
index 517d648bbe..fb2761a7db 100644
--- a/Emby.Server.Implementations/Localization/Core/sv.json
+++ b/Emby.Server.Implementations/Localization/Core/sv.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Misslyckat inloggningsförsök från {0}",
"Favorites": "Favoriter",
"Folders": "Mappar",
- "Games": "Spel",
"Genres": "Genrer",
"HeaderAlbumArtists": "Albumartister",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Ljuduppspelning har påbörjats",
"NotificationOptionAudioPlaybackStopped": "Ljuduppspelning stoppad",
"NotificationOptionCameraImageUploaded": "Kamerabild har laddats upp",
- "NotificationOptionGamePlayback": "Spel har startats",
- "NotificationOptionGamePlaybackStopped": "Spel stoppat",
"NotificationOptionInstallationFailed": "Fel vid installation",
"NotificationOptionNewLibraryContent": "Nytt innehåll har lagts till",
"NotificationOptionPluginError": "Fel uppstod med tillägget",
diff --git a/Emby.Server.Implementations/Localization/Core/tr.json b/Emby.Server.Implementations/Localization/Core/tr.json
index 9e86e2125b..495f82db6d 100644
--- a/Emby.Server.Implementations/Localization/Core/tr.json
+++ b/Emby.Server.Implementations/Localization/Core/tr.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
"Favorites": "Favorites",
"Folders": "Folders",
- "Games": "Games",
"Genres": "Genres",
"HeaderAlbumArtists": "Album Artists",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audio playback started",
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Game playback stopped",
"NotificationOptionInstallationFailed": "Installation failure",
"NotificationOptionNewLibraryContent": "New content added",
"NotificationOptionPluginError": "Plugin failure",
diff --git a/Emby.Server.Implementations/Localization/Core/zh-CN.json b/Emby.Server.Implementations/Localization/Core/zh-CN.json
index 6d877ec171..8910a6bce8 100644
--- a/Emby.Server.Implementations/Localization/Core/zh-CN.json
+++ b/Emby.Server.Implementations/Localization/Core/zh-CN.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "来自 {0} 的失败登入",
"Favorites": "最爱",
"Folders": "文件夹",
- "Games": "游戏",
"Genres": "风格",
"HeaderAlbumArtists": "专辑作家",
"HeaderCameraUploads": "相机上传",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "音频开始播放",
"NotificationOptionAudioPlaybackStopped": "音频播放已停止",
"NotificationOptionCameraImageUploaded": "相机图片已上传",
- "NotificationOptionGamePlayback": "游戏开始",
- "NotificationOptionGamePlaybackStopped": "游戏停止",
"NotificationOptionInstallationFailed": "安装失败",
"NotificationOptionNewLibraryContent": "已添加新内容",
"NotificationOptionPluginError": "插件失败",
diff --git a/Emby.Server.Implementations/Localization/Core/zh-HK.json b/Emby.Server.Implementations/Localization/Core/zh-HK.json
index cad5700fde..387fc2b92b 100644
--- a/Emby.Server.Implementations/Localization/Core/zh-HK.json
+++ b/Emby.Server.Implementations/Localization/Core/zh-HK.json
@@ -14,7 +14,6 @@
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}",
"Favorites": "Favorites",
"Folders": "Folders",
- "Games": "Games",
"Genres": "Genres",
"HeaderAlbumArtists": "Album Artists",
"HeaderCameraUploads": "Camera Uploads",
@@ -51,8 +50,6 @@
"NotificationOptionAudioPlayback": "Audio playback started",
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped",
"NotificationOptionCameraImageUploaded": "Camera image uploaded",
- "NotificationOptionGamePlayback": "Game playback started",
- "NotificationOptionGamePlaybackStopped": "Game playback stopped",
"NotificationOptionInstallationFailed": "Installation failure",
"NotificationOptionNewLibraryContent": "New content added",
"NotificationOptionPluginError": "Plugin failure",
diff --git a/Emby.Server.Implementations/ServerApplicationPaths.cs b/Emby.Server.Implementations/ServerApplicationPaths.cs
index edea10a074..67389536bf 100644
--- a/Emby.Server.Implementations/ServerApplicationPaths.cs
+++ b/Emby.Server.Implementations/ServerApplicationPaths.cs
@@ -136,12 +136,6 @@ namespace Emby.Server.Implementations
return path;
}
- ///
- /// Gets the game genre path.
- ///
- /// The game genre path.
- public string GameGenrePath => Path.Combine(InternalMetadataPath, "GameGenre");
-
private string _internalMetadataPath;
public string InternalMetadataPath
{
diff --git a/Emby.Server.Implementations/Sorting/GameSystemComparer.cs b/Emby.Server.Implementations/Sorting/GameSystemComparer.cs
deleted file mode 100644
index 2a04bae3c3..0000000000
--- a/Emby.Server.Implementations/Sorting/GameSystemComparer.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System;
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.Sorting;
-using MediaBrowser.Model.Querying;
-
-namespace Emby.Server.Implementations.Sorting
-{
- public class GameSystemComparer : IBaseItemComparer
- {
- ///
- /// Compares the specified x.
- ///
- /// The x.
- /// The y.
- /// System.Int32.
- public int Compare(BaseItem x, BaseItem y)
- {
- return string.Compare(GetValue(x), GetValue(y), StringComparison.CurrentCultureIgnoreCase);
- }
-
- ///
- /// Gets the value.
- ///
- /// The x.
- /// System.String.
- private static string GetValue(BaseItem x)
- {
- var game = x as Game;
-
- if (game != null)
- {
- return game.GameSystem;
- }
-
- var system = x as GameSystem;
-
- if (system != null)
- {
- return system.GameSystemName;
- }
-
- return string.Empty;
- }
-
- ///
- /// Gets the name.
- ///
- /// The name.
- public string Name => ItemSortBy.GameSystem;
- }
-}
diff --git a/Emby.Server.Implementations/Sorting/PlayersComparer.cs b/Emby.Server.Implementations/Sorting/PlayersComparer.cs
deleted file mode 100644
index e3652f36b7..0000000000
--- a/Emby.Server.Implementations/Sorting/PlayersComparer.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.Sorting;
-using MediaBrowser.Model.Querying;
-
-namespace Emby.Server.Implementations.Sorting
-{
- public class PlayersComparer : IBaseItemComparer
- {
- ///
- /// Compares the specified x.
- ///
- /// The x.
- /// The y.
- /// System.Int32.
- public int Compare(BaseItem x, BaseItem y)
- {
- return GetValue(x).CompareTo(GetValue(y));
- }
-
- ///
- /// Gets the value.
- ///
- /// The x.
- /// System.String.
- private static int GetValue(BaseItem x)
- {
- var game = x as Game;
-
- if (game != null)
- {
- return game.PlayersSupported ?? 0;
- }
-
- return 0;
- }
-
- ///
- /// Gets the name.
- ///
- /// The name.
- public string Name => ItemSortBy.Players;
- }
-}
diff --git a/Emby.Server.Implementations/UserViews/CollectionFolderImageProvider.cs b/Emby.Server.Implementations/UserViews/CollectionFolderImageProvider.cs
index 8788cfc263..ce6c2cd87d 100644
--- a/Emby.Server.Implementations/UserViews/CollectionFolderImageProvider.cs
+++ b/Emby.Server.Implementations/UserViews/CollectionFolderImageProvider.cs
@@ -43,10 +43,6 @@ namespace Emby.Server.Implementations.UserViews
{
includeItemTypes = new string[] { "Book", "AudioBook" };
}
- else if (string.Equals(viewType, CollectionType.Games))
- {
- includeItemTypes = new string[] { "Game" };
- }
else if (string.Equals(viewType, CollectionType.BoxSets))
{
includeItemTypes = new string[] { "BoxSet" };
diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs
index 8decea5a24..4a484b7185 100644
--- a/MediaBrowser.Api/BaseApiService.cs
+++ b/MediaBrowser.Api/BaseApiService.cs
@@ -228,21 +228,6 @@ namespace MediaBrowser.Api
return libraryManager.GetMusicGenre(name);
}
- protected GameGenre GetGameGenre(string name, ILibraryManager libraryManager, DtoOptions dtoOptions)
- {
- if (name.IndexOf(BaseItem.SlugChar) != -1)
- {
- var result = GetItemFromSlugName(libraryManager, name, dtoOptions);
-
- if (result != null)
- {
- return result;
- }
- }
-
- return libraryManager.GetGameGenre(name);
- }
-
protected Person GetPerson(string name, ILibraryManager libraryManager, DtoOptions dtoOptions)
{
if (name.IndexOf(BaseItem.SlugChar) != -1)
@@ -349,10 +334,6 @@ namespace MediaBrowser.Api
{
item = GetMusicGenre(name, libraryManager, dtoOptions);
}
- else if (type.IndexOf("GameGenre", StringComparison.OrdinalIgnoreCase) == 0)
- {
- item = GetGameGenre(name, libraryManager, dtoOptions);
- }
else if (type.IndexOf("Studio", StringComparison.OrdinalIgnoreCase) == 0)
{
item = GetStudio(name, libraryManager, dtoOptions);
diff --git a/MediaBrowser.Api/FilterService.cs b/MediaBrowser.Api/FilterService.cs
index be80305f9c..9caf07cea2 100644
--- a/MediaBrowser.Api/FilterService.cs
+++ b/MediaBrowser.Api/FilterService.cs
@@ -143,16 +143,6 @@ namespace MediaBrowser.Api
}).ToArray();
}
- else if (string.Equals(request.IncludeItemTypes, "Game", StringComparison.OrdinalIgnoreCase) ||
- string.Equals(request.IncludeItemTypes, "GameSystem", StringComparison.OrdinalIgnoreCase))
- {
- filters.Genres = _libraryManager.GetGameGenres(genreQuery).Items.Select(i => new NameGuidPair
- {
- Name = i.Item1.Name,
- Id = i.Item1.Id
-
- }).ToArray();
- }
else
{
filters.Genres = _libraryManager.GetGenres(genreQuery).Items.Select(i => new NameGuidPair
diff --git a/MediaBrowser.Api/GamesService.cs b/MediaBrowser.Api/GamesService.cs
deleted file mode 100644
index bb908836ce..0000000000
--- a/MediaBrowser.Api/GamesService.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-using System;
-using System.IO;
-using System.Linq;
-using MediaBrowser.Controller.Dto;
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.Net;
-using MediaBrowser.Controller.Persistence;
-using MediaBrowser.Model.Dto;
-using MediaBrowser.Model.Services;
-
-namespace MediaBrowser.Api
-{
- ///
- /// Class GetGameSystemSummaries
- ///
- [Route("/Games/SystemSummaries", "GET", Summary = "Finds games similar to a given game.")]
- public class GetGameSystemSummaries : IReturn
- {
- ///
- /// Gets or sets the user id.
- ///
- /// The user id.
- [ApiMember(Name = "UserId", Description = "Optional. Filter by user id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
- public Guid UserId { get; set; }
- }
-
- ///
- /// Class GamesService
- ///
- [Authenticated]
- public class GamesService : BaseApiService
- {
- ///
- /// The _user manager
- ///
- private readonly IUserManager _userManager;
-
- ///
- /// The _user data repository
- ///
- private readonly IUserDataManager _userDataRepository;
- ///
- /// The _library manager
- ///
- private readonly ILibraryManager _libraryManager;
-
- ///
- /// The _item repo
- ///
- private readonly IItemRepository _itemRepo;
- ///
- /// The _dto service
- ///
- private readonly IDtoService _dtoService;
-
- private readonly IAuthorizationContext _authContext;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The user manager.
- /// The user data repository.
- /// The library manager.
- /// The item repo.
- /// The dto service.
- public GamesService(IUserManager userManager, IUserDataManager userDataRepository, ILibraryManager libraryManager, IItemRepository itemRepo, IDtoService dtoService, IAuthorizationContext authContext)
- {
- _userManager = userManager;
- _userDataRepository = userDataRepository;
- _libraryManager = libraryManager;
- _itemRepo = itemRepo;
- _dtoService = dtoService;
- _authContext = authContext;
- }
-
- ///
- /// Gets the specified request.
- ///
- /// The request.
- /// System.Object.
- public object Get(GetGameSystemSummaries request)
- {
- var user = request.UserId == null ? null : _userManager.GetUserById(request.UserId);
- var query = new InternalItemsQuery(user)
- {
- IncludeItemTypes = new[] { typeof(GameSystem).Name },
- DtoOptions = new DtoOptions(false)
- {
- EnableImages = false
- }
- };
-
- var result = _libraryManager.GetItemList(query)
- .Cast()
- .Select(i => GetSummary(i, user))
- .ToArray();
-
- return ToOptimizedResult(result);
- }
-
- ///
- /// Gets the summary.
- ///
- /// The system.
- /// The user.
- /// GameSystemSummary.
- private GameSystemSummary GetSummary(GameSystem system, User user)
- {
- var summary = new GameSystemSummary
- {
- Name = system.GameSystemName,
- DisplayName = system.Name
- };
-
- var items = user == null ?
- system.GetRecursiveChildren(i => i is Game) :
- system.GetRecursiveChildren(user, new InternalItemsQuery(user)
- {
- IncludeItemTypes = new[] { typeof(Game).Name },
- DtoOptions = new DtoOptions(false)
- {
- EnableImages = false
- }
- });
-
- var games = items.Cast().ToArray();
-
- summary.ClientInstalledGameCount = games.Count(i => i.IsPlaceHolder);
-
- summary.GameCount = games.Length;
-
- summary.GameFileExtensions = games.Where(i => !i.IsPlaceHolder).Select(i => Path.GetExtension(i.Path))
- .Distinct(StringComparer.OrdinalIgnoreCase)
- .ToArray();
-
- return summary;
- }
- }
-}
diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs
index 149e54f016..b5e23476ed 100644
--- a/MediaBrowser.Api/Images/ImageService.cs
+++ b/MediaBrowser.Api/Images/ImageService.cs
@@ -95,8 +95,6 @@ namespace MediaBrowser.Api.Images
[Route("/Artists/{Name}/Images/{Type}/{Index}", "GET")]
[Route("/Genres/{Name}/Images/{Type}", "GET")]
[Route("/Genres/{Name}/Images/{Type}/{Index}", "GET")]
- [Route("/GameGenres/{Name}/Images/{Type}", "GET")]
- [Route("/GameGenres/{Name}/Images/{Type}/{Index}", "GET")]
[Route("/MusicGenres/{Name}/Images/{Type}", "GET")]
[Route("/MusicGenres/{Name}/Images/{Type}/{Index}", "GET")]
[Route("/Persons/{Name}/Images/{Type}", "GET")]
@@ -109,8 +107,6 @@ namespace MediaBrowser.Api.Images
[Route("/Artists/{Name}/Images/{Type}/{Index}", "HEAD")]
[Route("/Genres/{Name}/Images/{Type}", "HEAD")]
[Route("/Genres/{Name}/Images/{Type}/{Index}", "HEAD")]
- [Route("/GameGenres/{Name}/Images/{Type}", "HEAD")]
- [Route("/GameGenres/{Name}/Images/{Type}/{Index}", "HEAD")]
[Route("/MusicGenres/{Name}/Images/{Type}", "HEAD")]
[Route("/MusicGenres/{Name}/Images/{Type}/{Index}", "HEAD")]
[Route("/Persons/{Name}/Images/{Type}", "HEAD")]
diff --git a/MediaBrowser.Api/ItemLookupService.cs b/MediaBrowser.Api/ItemLookupService.cs
index 0e7bdc0860..f3ea7907f6 100644
--- a/MediaBrowser.Api/ItemLookupService.cs
+++ b/MediaBrowser.Api/ItemLookupService.cs
@@ -57,12 +57,6 @@ namespace MediaBrowser.Api
{
}
- [Route("/Items/RemoteSearch/Game", "POST")]
- [Authenticated]
- public class GetGameRemoteSearchResults : RemoteSearchQuery, IReturn>
- {
- }
-
[Route("/Items/RemoteSearch/BoxSet", "POST")]
[Authenticated]
public class GetBoxSetRemoteSearchResults : RemoteSearchQuery, IReturn>
@@ -173,13 +167,6 @@ namespace MediaBrowser.Api
return ToOptimizedResult(result);
}
- public async Task
/// The episode count.
public int EpisodeCount { get; set; }
- ///
- /// Gets or sets the game count.
- ///
- /// The game count.
- public int GameCount { get; set; }
public int ArtistCount { get; set; }
public int ProgramCount { get; set; }
///
- /// Gets or sets the game system count.
- ///
- /// The game system count.
- public int GameSystemCount { get; set; }
- ///
/// Gets or sets the trailer count.
///
/// The trailer count.
diff --git a/MediaBrowser.Model/Entities/CollectionType.cs b/MediaBrowser.Model/Entities/CollectionType.cs
index bda1661184..e26d1b8c3b 100644
--- a/MediaBrowser.Model/Entities/CollectionType.cs
+++ b/MediaBrowser.Model/Entities/CollectionType.cs
@@ -18,7 +18,6 @@ namespace MediaBrowser.Model.Entities
public const string Books = "books";
public const string Photos = "photos";
- public const string Games = "games";
public const string LiveTv = "livetv";
public const string Playlists = "playlists";
public const string Folders = "folders";
diff --git a/MediaBrowser.Model/Entities/MediaType.cs b/MediaBrowser.Model/Entities/MediaType.cs
index af233e61ec..c56c8f8f22 100644
--- a/MediaBrowser.Model/Entities/MediaType.cs
+++ b/MediaBrowser.Model/Entities/MediaType.cs
@@ -14,10 +14,6 @@ namespace MediaBrowser.Model.Entities
///
public const string Audio = "Audio";
///
- /// The game
- ///
- public const string Game = "Game";
- ///
/// The photo
///
public const string Photo = "Photo";
diff --git a/MediaBrowser.Model/Entities/MetadataProviders.cs b/MediaBrowser.Model/Entities/MetadataProviders.cs
index 3999616036..e9802cf460 100644
--- a/MediaBrowser.Model/Entities/MetadataProviders.cs
+++ b/MediaBrowser.Model/Entities/MetadataProviders.cs
@@ -5,7 +5,6 @@ namespace MediaBrowser.Model.Entities
///
public enum MetadataProviders
{
- Gamesdb = 1,
///
/// The imdb
///
diff --git a/MediaBrowser.Model/Notifications/NotificationType.cs b/MediaBrowser.Model/Notifications/NotificationType.cs
index 9d16e4a169..38b519a14b 100644
--- a/MediaBrowser.Model/Notifications/NotificationType.cs
+++ b/MediaBrowser.Model/Notifications/NotificationType.cs
@@ -5,10 +5,8 @@ namespace MediaBrowser.Model.Notifications
ApplicationUpdateAvailable,
ApplicationUpdateInstalled,
AudioPlayback,
- GamePlayback,
VideoPlayback,
AudioPlaybackStopped,
- GamePlaybackStopped,
VideoPlaybackStopped,
InstallationFailed,
PluginError,
diff --git a/MediaBrowser.Model/Providers/RemoteSearchResult.cs b/MediaBrowser.Model/Providers/RemoteSearchResult.cs
index 88e3bc69c7..6e46b1556d 100644
--- a/MediaBrowser.Model/Providers/RemoteSearchResult.cs
+++ b/MediaBrowser.Model/Providers/RemoteSearchResult.cs
@@ -30,8 +30,6 @@ namespace MediaBrowser.Model.Providers
public string ImageUrl { get; set; }
public string SearchProviderName { get; set; }
-
- public string GameSystem { get; set; }
public string Overview { get; set; }
public RemoteSearchResult AlbumArtist { get; set; }
diff --git a/MediaBrowser.Model/Querying/ItemSortBy.cs b/MediaBrowser.Model/Querying/ItemSortBy.cs
index 1b20f43ac8..6a71e3bb3e 100644
--- a/MediaBrowser.Model/Querying/ItemSortBy.cs
+++ b/MediaBrowser.Model/Querying/ItemSortBy.cs
@@ -71,8 +71,6 @@ namespace MediaBrowser.Model.Querying
public const string VideoBitRate = "VideoBitRate";
public const string AirTime = "AirTime";
public const string Studio = "Studio";
- public const string Players = "Players";
- public const string GameSystem = "GameSystem";
public const string IsFavoriteOrLiked = "IsFavoriteOrLiked";
public const string DateLastContentAdded = "DateLastContentAdded";
public const string SeriesDatePlayed = "SeriesDatePlayed";
diff --git a/MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs b/MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs
deleted file mode 100644
index 2034848de4..0000000000
--- a/MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.IO;
-using MediaBrowser.Providers.Manager;
-using Microsoft.Extensions.Logging;
-
-namespace MediaBrowser.Providers.GameGenres
-{
- public class GameGenreMetadataService : MetadataService
- {
- protected override void MergeData(MetadataResult source, MetadataResult target, MetadataFields[] lockedFields, bool replaceData, bool mergeMetadataSettings)
- {
- ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
- }
-
- public GameGenreMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager)
- {
- }
- }
-}
diff --git a/MediaBrowser.Providers/Games/GameMetadataService.cs b/MediaBrowser.Providers/Games/GameMetadataService.cs
deleted file mode 100644
index 764394a21f..0000000000
--- a/MediaBrowser.Providers/Games/GameMetadataService.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.IO;
-using MediaBrowser.Providers.Manager;
-using Microsoft.Extensions.Logging;
-
-namespace MediaBrowser.Providers.Games
-{
- public class GameMetadataService : MetadataService
- {
- protected override void MergeData(MetadataResult source, MetadataResult target, MetadataFields[] lockedFields, bool replaceData, bool mergeMetadataSettings)
- {
- ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
-
- var sourceItem = source.Item;
- var targetItem = target.Item;
-
- if (replaceData || string.IsNullOrEmpty(targetItem.GameSystem))
- {
- targetItem.GameSystem = sourceItem.GameSystem;
- }
-
- if (replaceData || !targetItem.PlayersSupported.HasValue)
- {
- targetItem.PlayersSupported = sourceItem.PlayersSupported;
- }
- }
-
- public GameMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager)
- {
- }
- }
-}
diff --git a/MediaBrowser.Providers/Games/GameSystemMetadataService.cs b/MediaBrowser.Providers/Games/GameSystemMetadataService.cs
deleted file mode 100644
index 5bca4731c2..0000000000
--- a/MediaBrowser.Providers/Games/GameSystemMetadataService.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.IO;
-using MediaBrowser.Providers.Manager;
-using Microsoft.Extensions.Logging;
-
-namespace MediaBrowser.Providers.Games
-{
- public class GameSystemMetadataService : MetadataService
- {
- protected override void MergeData(MetadataResult source, MetadataResult target, MetadataFields[] lockedFields, bool replaceData, bool mergeMetadataSettings)
- {
- ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
-
- var sourceItem = source.Item;
- var targetItem = target.Item;
-
- if (replaceData || string.IsNullOrEmpty(targetItem.GameSystemName))
- {
- targetItem.GameSystemName = sourceItem.GameSystemName;
- }
- }
-
- public GameSystemMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager)
- {
- }
- }
-}
diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs
index eda5163f00..f26087fda3 100644
--- a/MediaBrowser.Providers/Manager/ProviderManager.cs
+++ b/MediaBrowser.Providers/Manager/ProviderManager.cs
@@ -471,8 +471,6 @@ namespace MediaBrowser.Providers.Manager
{
return new MetadataPluginSummary[]
{
- GetPluginSummary(),
- GetPluginSummary(),
GetPluginSummary(),
GetPluginSummary(),
GetPluginSummary(),
diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs
index 96b906b3cd..9613c35590 100644
--- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs
+++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs
@@ -82,7 +82,6 @@ namespace MediaBrowser.XbmcMetadata.Savers
"lockedfields",
"zap2itid",
"tvrageid",
- "gamesdbid",
"musicbrainzartistid",
"musicbrainzalbumartistid",
@@ -737,13 +736,6 @@ namespace MediaBrowser.XbmcMetadata.Savers
writtenProviderIds.Add(MetadataProviders.MusicBrainzReleaseGroup.ToString());
}
- externalId = item.GetProviderId(MetadataProviders.Gamesdb);
- if (!string.IsNullOrEmpty(externalId))
- {
- writer.WriteElementString("gamesdbid", externalId);
- writtenProviderIds.Add(MetadataProviders.Gamesdb.ToString());
- }
-
externalId = item.GetProviderId(MetadataProviders.TvRage);
if (!string.IsNullOrEmpty(externalId))
{
From b982d7c239bc88f32dc2545e4f2b843e9124a3e6 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Thu, 31 Jan 2019 21:50:50 -0500
Subject: [PATCH 13/93] Update to long opts and add cache dirs
---
deployment/debian-package-x64/pkg-src/conf/jellyfin | 3 ++-
deployment/debian-package-x64/pkg-src/jellyfin.service | 2 +-
deployment/fedora-package-x64/pkg-src/jellyfin.env | 3 ++-
deployment/fedora-package-x64/pkg-src/jellyfin.service | 2 +-
4 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/deployment/debian-package-x64/pkg-src/conf/jellyfin b/deployment/debian-package-x64/pkg-src/conf/jellyfin
index 861865aae2..92bc0bab24 100644
--- a/deployment/debian-package-x64/pkg-src/conf/jellyfin
+++ b/deployment/debian-package-x64/pkg-src/conf/jellyfin
@@ -19,6 +19,7 @@
JELLYFIN_DATA_DIRECTORY="/var/lib/jellyfin"
JELLYFIN_CONFIG_DIRECTORY="/etc/jellyfin"
JELLYFIN_LOG_DIRECTORY="/var/log/jellyfin"
+JELLYFIN_CACHE_DIRECTORY="/var/cache/jellyfin"
# Restart script for in-app server control
JELLYFIN_RESTART_SCRIPT="/usr/lib/jellyfin/restart.sh"
# Additional options for the binary
@@ -31,4 +32,4 @@ JELLYFIN_ADD_OPTS=""
# Application username
JELLYFIN_USER="jellyfin"
# Full application command
-JELLYFIN_ARGS="-programdata $JELLYFIN_DATA_DIRECTORY -configdir $JELLYFIN_CONFIG_DIRECTORY -logdir $JELLYFIN_LOG_DIRECTORY -restartpath $JELLYFIN_RESTART_SCRIPT $JELLYFIN_ADD_OPTS"
+JELLYFIN_ARGS="--programdata $JELLYFIN_DATA_DIRECTORY --configdir $JELLYFIN_CONFIG_DIRECTORY --logdir $JELLYFIN_LOG_DIRECTORY --cachedir $JELLYFIN_CACHE_DIRECTORY --restartpath $JELLYFIN_RESTART_SCRIPT $JELLYFIN_ADD_OPTS"
diff --git a/deployment/debian-package-x64/pkg-src/jellyfin.service b/deployment/debian-package-x64/pkg-src/jellyfin.service
index c17422029a..bb77571f75 100644
--- a/deployment/debian-package-x64/pkg-src/jellyfin.service
+++ b/deployment/debian-package-x64/pkg-src/jellyfin.service
@@ -6,7 +6,7 @@ After = network.target
Type = simple
EnvironmentFile = /etc/default/jellyfin
User = jellyfin
-ExecStart = /usr/bin/jellyfin -programdata ${JELLYFIN_DATA_DIRECTORY} -configdir ${JELLYFIN_CONFIG_DIRECTORY} -logdir ${JELLYFIN_LOG_DIRECTORY} -restartpath ${JELLYFIN_RESTART_SCRIPT} ${JELLYFIN_ADD_OPTS}
+ExecStart = /usr/bin/jellyfin --programdata ${JELLYFIN_DATA_DIRECTORY} --configdir ${JELLYFIN_CONFIG_DIRECTORY} --logdir ${JELLYFIN_LOG_DIRECTORY} --cachedir ${JELLYFIN_CACHE_DIRECTORY} --restartpath ${JELLYFIN_RESTART_SCRIPT} ${JELLYFIN_ADD_OPTS}
Restart = on-failure
TimeoutSec = 15
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.env b/deployment/fedora-package-x64/pkg-src/jellyfin.env
index 827a33f468..49e5650065 100644
--- a/deployment/fedora-package-x64/pkg-src/jellyfin.env
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.env
@@ -21,7 +21,8 @@
JELLYFIN_DATA_DIRECTORY="/var/lib/jellyfin"
JELLYFIN_CONFIG_DIRECTORY="/etc/jellyfin"
JELLYFIN_LOG_DIRECTORY="/var/log/jellyfin"
+JELLYFIN_CACHE_DIRECTORY="/var/log/jellyfin"
# In-App service control
JELLYFIN_RESTART_OPT="-restartpath /usr/libexec/jellyfin/restart.sh"
# Additional options for the binary
-JELLYFIN_ADD_OPTS=""
\ No newline at end of file
+JELLYFIN_ADD_OPTS=""
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.service b/deployment/fedora-package-x64/pkg-src/jellyfin.service
index 0ece5b57f4..0c0867967f 100644
--- a/deployment/fedora-package-x64/pkg-src/jellyfin.service
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.service
@@ -5,7 +5,7 @@ Description=Jellyfin is a free software media system that puts you in control of
[Service]
EnvironmentFile=/etc/sysconfig/jellyfin
WorkingDirectory=/var/lib/jellyfin
-ExecStart=/usr/bin/jellyfin -programdata ${JELLYFIN_DATA_DIRECTORY} -configdir ${JELLYFIN_CONFIG_DIRECTORY} -logdir ${JELLYFIN_LOG_DIRECTORY} ${JELLYFIN_RESTART_OPT} ${JELLYFIN_ADD_OPTS} ${JELLYFIN_FFMPEG}
+ExecStart=/usr/bin/jellyfin --programdata ${JELLYFIN_DATA_DIRECTORY} --configdir ${JELLYFIN_CONFIG_DIRECTORY} --logdir ${JELLYFIN_LOG_DIRECTORY} --cachedir ${JELLYFIN_CACHE_DIRECTORY} ${JELLYFIN_RESTART_OPT} ${JELLYFIN_ADD_OPTS} ${JELLYFIN_FFMPEG}
TimeoutSec=15
Restart=on-failure
User=jellyfin
From ae24d644db16071a4926b9b50a135a90926ce0e7 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Thu, 31 Jan 2019 21:52:26 -0500
Subject: [PATCH 14/93] Use double-dash args in install-jellyfn.ps1
---
deployment/win-generic/install-jellyfin.ps1 | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/deployment/win-generic/install-jellyfin.ps1 b/deployment/win-generic/install-jellyfin.ps1
index 56c0984620..3888f5255e 100644
--- a/deployment/win-generic/install-jellyfin.ps1
+++ b/deployment/win-generic/install-jellyfin.ps1
@@ -93,12 +93,12 @@ if($Quiet.IsPresent -or $Quiet -eq $true){
Copy-Item -Path $PSScriptRoot/* -DestinationPath "$Script:DefaultJellyfinInstallDirectory/" -Force -Recurse
if($Script:InstallAsService){
if($Script:InstallServiceAsUser){
- &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" -programdata `"$Script:JellyfinDataDir`"
+ &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" --programdata `"$Script:JellyfinDataDir`"
Start-Sleep -Milliseconds 500
&sc.exe config Jellyfin obj=".\$($Script:UserCredentials.UserName)" password="$($Script:UserCredentials.GetNetworkCredential().Password)"
&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin Start SERVICE_DELAYED_AUTO_START
}else{
- &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" -programdata `"$Script:JellyfinDataDir`"
+ &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" --programdata `"$Script:JellyfinDataDir`"
Start-Sleep -Milliseconds 500
#&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin ObjectName $Script:UserCredentials.UserName $Script:UserCredentials.GetNetworkCredential().Password
#Set-Service -Name Jellyfin -Credential $Script:UserCredentials
@@ -171,13 +171,13 @@ function InstallJellyfin {
if($Script:InstallAsService){
if($Script:InstallServiceAsUser){
Write-Host "Installing Service as user $($Script:UserCredentials.UserName)"
- &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" -programdata `"$Script:JellyfinDataDir`"
+ &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" --programdata `"$Script:JellyfinDataDir`"
Start-Sleep -Milliseconds 2000
&sc.exe config Jellyfin obj=".\$($Script:UserCredentials.UserName)" password="$($Script:UserCredentials.GetNetworkCredential().Password)"
&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin Start SERVICE_DELAYED_AUTO_START
}else{
Write-Host "Installing Service as LocalSystem"
- &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" -programdata `"$Script:JellyfinDataDir`"
+ &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" --programdata `"$Script:JellyfinDataDir`"
Start-Sleep -Milliseconds 2000
&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin Start SERVICE_DELAYED_AUTO_START
}
@@ -457,4 +457,4 @@ $StartProgramCheck.Add_CheckedChanged({StartJellyFinBoxCheckChanged})
#endregion GUI }
-[void]$InstallForm.ShowDialog()
\ No newline at end of file
+[void]$InstallForm.ShowDialog()
From f6227e99ccde84914cf596fb6cf08023c7e8b862 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Thu, 31 Jan 2019 21:57:25 -0500
Subject: [PATCH 15/93] Add cachedir to deployment scripts; fix bad logdir
---
deployment/debian-package-x64/pkg-src/postinst | 6 ++++++
deployment/debian-package-x64/pkg-src/postrm | 8 +++++++-
deployment/debian-package-x64/pkg-src/preinst | 8 ++++++--
deployment/debian-package-x64/pkg-src/prerm | 3 ++-
4 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/deployment/debian-package-x64/pkg-src/postinst b/deployment/debian-package-x64/pkg-src/postinst
index 3690d20ba3..44d944ccb5 100644
--- a/deployment/debian-package-x64/pkg-src/postinst
+++ b/deployment/debian-package-x64/pkg-src/postinst
@@ -13,6 +13,7 @@ fi
PROGRAMDATA=${JELLYFIN_DATA_DIRECTORY-/var/lib/$NAME}
CONFIGDATA=${JELLYFIN_CONFIG_DIRECTORY-/etc/$NAME}
LOGDATA=${JELLYFIN_LOG_DIRECTORY-/var/log/$NAME}
+CACHEDATA=${JELLYFIN_CACHE_DIRECTORY-/var/cache/$NAME}
case "$1" in
configure)
@@ -37,10 +38,15 @@ case "$1" in
if [[ ! -d $LOGDATA ]]; then
mkdir $LOGDATA
fi
+ # ensure $CACHEDATA exists
+ if [[ ! -d $CACHEDATA ]]; then
+ mkdir $CACHEDATA
+ fi
# Ensure permissions are correct on all config directories
chown -R jellyfin:jellyfin $PROGRAMDATA
chown -R jellyfin:jellyfin $CONFIGDATA
chown -R jellyfin:jellyfin $LOGDATA
+ chown -R jellyfin:jellyfin $CACHEDATA
chmod +x /usr/lib/jellyfin/restart.sh > /dev/null 2>&1 || true
diff --git a/deployment/debian-package-x64/pkg-src/postrm b/deployment/debian-package-x64/pkg-src/postrm
index 690f5d587e..1d00a984ec 100644
--- a/deployment/debian-package-x64/pkg-src/postrm
+++ b/deployment/debian-package-x64/pkg-src/postrm
@@ -12,7 +12,8 @@ fi
# Data directories for program data (cache, db), configs, and logs
PROGRAMDATA=${JELLYFIN_DATA_DIRECTORY-/var/lib/$NAME}
CONFIGDATA=${JELLYFIN_CONFIG_DIRECTORY-/etc/$NAME}
-LOGDATA=${JELLYFIN_DATA_DIRECTORY-/var/log/$NAME}
+LOGDATA=${JELLYFIN_LOG_DIRECTORY-/var/log/$NAME}
+CACHEDATA=${JELLYFIN_CACHE_DIRECTORY-/var/cache/$NAME}
# In case this system is running systemd, we make systemd reload the unit files
# to pick up changes.
@@ -44,6 +45,10 @@ case "$1" in
if [[ -d $LOGDATA ]]; then
rm -rf $LOGDATA
fi
+ # Remove cache dir
+ if [[ -d $CACHEDATA ]]; then
+ rm -rf $CACHEDATA
+ fi
# Remove program data dir
if [[ -d $PROGRAMDATA ]]; then
rm -rf $PROGRAMDATA
@@ -55,6 +60,7 @@ case "$1" in
# Remove anything at the default locations; catches situations where the user moved the defaults
[[ -e /etc/jellyfin ]] && rm -rf /etc/jellyfin
[[ -e /var/log/jellyfin ]] && rm -rf /var/log/jellyfin
+ [[ -e /var/cache/jellyfin ]] && rm -rf /var/cache/jellyfin
[[ -e /var/lib/jellyfin ]] && rm -rf /var/lib/jellyfin
;;
remove)
diff --git a/deployment/debian-package-x64/pkg-src/preinst b/deployment/debian-package-x64/pkg-src/preinst
index 0063e0e637..2713fb9b80 100644
--- a/deployment/debian-package-x64/pkg-src/preinst
+++ b/deployment/debian-package-x64/pkg-src/preinst
@@ -12,7 +12,8 @@ fi
# Data directories for program data (cache, db), configs, and logs
PROGRAMDATA=${JELLYFIN_DATA_DIRECTORY-/var/lib/$NAME}
CONFIGDATA=${JELLYFIN_CONFIG_DIRECTORY-/etc/$NAME}
-LOGDATA=${JELLYFIN_DATA_DIRECTORY-/var/log/$NAME}
+LOGDATA=${JELLYFIN_LOG_DIRECTORY-/var/log/$NAME}
+CACHEDATA=${JELLYFIN_CACHE_DIRECTORY-/var/cache/$NAME}
# In case this system is running systemd, we make systemd reload the unit files
# to pick up changes.
@@ -53,13 +54,16 @@ case "$1" in
# Clean up old Emby cruft that can break the user's system
[[ -f /etc/sudoers.d/emby ]] && rm -f /etc/sudoers.d/emby
- # If we have existing config or log dirs in /var/lib/jellyfin, move them into the right place
+ # If we have existing config, log, or cache dirs in /var/lib/jellyfin, move them into the right place
if [[ -d $PROGRAMDATA/config ]]; then
mv $PROGRAMDATA/config $CONFIGDATA
fi
if [[ -d $PROGRAMDATA/logs ]]; then
mv $PROGRAMDATA/logs $LOGDATA
fi
+ if [[ -d $PROGRAMDATA/logs ]]; then
+ mv $PROGRAMDATA/cache $CACHEDATA
+ fi
;;
abort-upgrade)
diff --git a/deployment/debian-package-x64/pkg-src/prerm b/deployment/debian-package-x64/pkg-src/prerm
index 4770c03c41..e965cb7d71 100644
--- a/deployment/debian-package-x64/pkg-src/prerm
+++ b/deployment/debian-package-x64/pkg-src/prerm
@@ -12,7 +12,8 @@ fi
# Data directories for program data (cache, db), configs, and logs
PROGRAMDATA=${JELLYFIN_DATA_DIRECTORY-/var/lib/$NAME}
CONFIGDATA=${JELLYFIN_CONFIG_DIRECTORY-/etc/$NAME}
-LOGDATA=${JELLYFIN_DATA_DIRECTORY-/var/log/$NAME}
+LOGDATA=${JELLYFIN_LOG_DIRECTORY-/var/log/$NAME}
+CACHEDATA=${JELLYFIN_CACHE_DIRECTORY-/var/cache/$NAME}
case "$1" in
remove|upgrade|deconfigure)
From 5e4697802f813d1c2c35c8cc4d57fcd89d39b745 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Thu, 31 Jan 2019 22:03:55 -0500
Subject: [PATCH 16/93] Replace programdata with datadir everywhere
---
deployment/debian-package-x64/pkg-src/conf/jellyfin | 2 +-
deployment/debian-package-x64/pkg-src/jellyfin.service | 2 +-
deployment/fedora-package-x64/pkg-src/jellyfin.service | 2 +-
deployment/win-generic/install-jellyfin.ps1 | 8 ++++----
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/deployment/debian-package-x64/pkg-src/conf/jellyfin b/deployment/debian-package-x64/pkg-src/conf/jellyfin
index 92bc0bab24..7626328c2c 100644
--- a/deployment/debian-package-x64/pkg-src/conf/jellyfin
+++ b/deployment/debian-package-x64/pkg-src/conf/jellyfin
@@ -32,4 +32,4 @@ JELLYFIN_ADD_OPTS=""
# Application username
JELLYFIN_USER="jellyfin"
# Full application command
-JELLYFIN_ARGS="--programdata $JELLYFIN_DATA_DIRECTORY --configdir $JELLYFIN_CONFIG_DIRECTORY --logdir $JELLYFIN_LOG_DIRECTORY --cachedir $JELLYFIN_CACHE_DIRECTORY --restartpath $JELLYFIN_RESTART_SCRIPT $JELLYFIN_ADD_OPTS"
+JELLYFIN_ARGS="--datadir $JELLYFIN_DATA_DIRECTORY --configdir $JELLYFIN_CONFIG_DIRECTORY --logdir $JELLYFIN_LOG_DIRECTORY --cachedir $JELLYFIN_CACHE_DIRECTORY --restartpath $JELLYFIN_RESTART_SCRIPT $JELLYFIN_ADD_OPTS"
diff --git a/deployment/debian-package-x64/pkg-src/jellyfin.service b/deployment/debian-package-x64/pkg-src/jellyfin.service
index bb77571f75..b7ee4e1939 100644
--- a/deployment/debian-package-x64/pkg-src/jellyfin.service
+++ b/deployment/debian-package-x64/pkg-src/jellyfin.service
@@ -6,7 +6,7 @@ After = network.target
Type = simple
EnvironmentFile = /etc/default/jellyfin
User = jellyfin
-ExecStart = /usr/bin/jellyfin --programdata ${JELLYFIN_DATA_DIRECTORY} --configdir ${JELLYFIN_CONFIG_DIRECTORY} --logdir ${JELLYFIN_LOG_DIRECTORY} --cachedir ${JELLYFIN_CACHE_DIRECTORY} --restartpath ${JELLYFIN_RESTART_SCRIPT} ${JELLYFIN_ADD_OPTS}
+ExecStart = /usr/bin/jellyfin --datadir ${JELLYFIN_DATA_DIRECTORY} --configdir ${JELLYFIN_CONFIG_DIRECTORY} --logdir ${JELLYFIN_LOG_DIRECTORY} --cachedir ${JELLYFIN_CACHE_DIRECTORY} --restartpath ${JELLYFIN_RESTART_SCRIPT} ${JELLYFIN_ADD_OPTS}
Restart = on-failure
TimeoutSec = 15
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.service b/deployment/fedora-package-x64/pkg-src/jellyfin.service
index 0c0867967f..56703a98ac 100644
--- a/deployment/fedora-package-x64/pkg-src/jellyfin.service
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.service
@@ -5,7 +5,7 @@ Description=Jellyfin is a free software media system that puts you in control of
[Service]
EnvironmentFile=/etc/sysconfig/jellyfin
WorkingDirectory=/var/lib/jellyfin
-ExecStart=/usr/bin/jellyfin --programdata ${JELLYFIN_DATA_DIRECTORY} --configdir ${JELLYFIN_CONFIG_DIRECTORY} --logdir ${JELLYFIN_LOG_DIRECTORY} --cachedir ${JELLYFIN_CACHE_DIRECTORY} ${JELLYFIN_RESTART_OPT} ${JELLYFIN_ADD_OPTS} ${JELLYFIN_FFMPEG}
+ExecStart=/usr/bin/jellyfin --datadir ${JELLYFIN_DATA_DIRECTORY} --configdir ${JELLYFIN_CONFIG_DIRECTORY} --logdir ${JELLYFIN_LOG_DIRECTORY} --cachedir ${JELLYFIN_CACHE_DIRECTORY} ${JELLYFIN_RESTART_OPT} ${JELLYFIN_ADD_OPTS} ${JELLYFIN_FFMPEG}
TimeoutSec=15
Restart=on-failure
User=jellyfin
diff --git a/deployment/win-generic/install-jellyfin.ps1 b/deployment/win-generic/install-jellyfin.ps1
index 3888f5255e..b6e00e0568 100644
--- a/deployment/win-generic/install-jellyfin.ps1
+++ b/deployment/win-generic/install-jellyfin.ps1
@@ -93,12 +93,12 @@ if($Quiet.IsPresent -or $Quiet -eq $true){
Copy-Item -Path $PSScriptRoot/* -DestinationPath "$Script:DefaultJellyfinInstallDirectory/" -Force -Recurse
if($Script:InstallAsService){
if($Script:InstallServiceAsUser){
- &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" --programdata `"$Script:JellyfinDataDir`"
+ &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" --datadir `"$Script:JellyfinDataDir`"
Start-Sleep -Milliseconds 500
&sc.exe config Jellyfin obj=".\$($Script:UserCredentials.UserName)" password="$($Script:UserCredentials.GetNetworkCredential().Password)"
&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin Start SERVICE_DELAYED_AUTO_START
}else{
- &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" --programdata `"$Script:JellyfinDataDir`"
+ &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" --datadir `"$Script:JellyfinDataDir`"
Start-Sleep -Milliseconds 500
#&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin ObjectName $Script:UserCredentials.UserName $Script:UserCredentials.GetNetworkCredential().Password
#Set-Service -Name Jellyfin -Credential $Script:UserCredentials
@@ -171,13 +171,13 @@ function InstallJellyfin {
if($Script:InstallAsService){
if($Script:InstallServiceAsUser){
Write-Host "Installing Service as user $($Script:UserCredentials.UserName)"
- &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" --programdata `"$Script:JellyfinDataDir`"
+ &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" --datadir `"$Script:JellyfinDataDir`"
Start-Sleep -Milliseconds 2000
&sc.exe config Jellyfin obj=".\$($Script:UserCredentials.UserName)" password="$($Script:UserCredentials.GetNetworkCredential().Password)"
&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin Start SERVICE_DELAYED_AUTO_START
}else{
Write-Host "Installing Service as LocalSystem"
- &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" --programdata `"$Script:JellyfinDataDir`"
+ &"$Script:DefaultJellyfinInstallDirectory\nssm.exe" install Jellyfin `"$Script:DefaultJellyfinInstallDirectory\jellyfin.exe`" --datadir `"$Script:JellyfinDataDir`"
Start-Sleep -Milliseconds 2000
&"$Script:DefaultJellyfinInstallDirectory\nssm.exe" set Jellyfin Start SERVICE_DELAYED_AUTO_START
}
From 45d8ace9bb05ec290bb2642d4e5b279f2eb3f65a Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Thu, 31 Jan 2019 22:06:03 -0500
Subject: [PATCH 17/93] Use good ideas from Fedora systemd in Debian
---
.../debian-package-x64/pkg-src/conf/jellyfin | 18 ++++++++++--------
.../pkg-src/jellyfin.service | 2 +-
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/deployment/debian-package-x64/pkg-src/conf/jellyfin b/deployment/debian-package-x64/pkg-src/conf/jellyfin
index 7626328c2c..ebc11ca5c6 100644
--- a/deployment/debian-package-x64/pkg-src/conf/jellyfin
+++ b/deployment/debian-package-x64/pkg-src/conf/jellyfin
@@ -1,4 +1,5 @@
# Jellyfin default configuration options
+# This is a POSIX shell fragment
# Use this file to override the default configurations; add additional
# options with JELLYFIN_ADD_OPTS.
@@ -7,10 +8,6 @@
# /etc/systemd/system/jellyfin.service.d/jellyfin.service.conf
# to override the user or this config file's location.
-#
-# This is a POSIX shell fragment
-#
-
#
# General options
#
@@ -20,10 +17,15 @@ JELLYFIN_DATA_DIRECTORY="/var/lib/jellyfin"
JELLYFIN_CONFIG_DIRECTORY="/etc/jellyfin"
JELLYFIN_LOG_DIRECTORY="/var/log/jellyfin"
JELLYFIN_CACHE_DIRECTORY="/var/cache/jellyfin"
+
# Restart script for in-app server control
-JELLYFIN_RESTART_SCRIPT="/usr/lib/jellyfin/restart.sh"
-# Additional options for the binary
-JELLYFIN_ADD_OPTS=""
+JELLYFIN_RESTART_OPT="--restartpath /usr/lib/jellyfin/restart.sh"
+
+# [OPTIONAL] ffmpeg binary paths
+#JELLYFIN_FFMPEG_OPTS="-ffmpeg /usr/bin/ffmpeg -ffprobe /usr/bin/ffprobe"
+
+# [OPTIONAL] Additional user-defined options for the binary
+#JELLYFIN_ADD_OPTS=""
#
# SysV init/Upstart options
@@ -32,4 +34,4 @@ JELLYFIN_ADD_OPTS=""
# Application username
JELLYFIN_USER="jellyfin"
# Full application command
-JELLYFIN_ARGS="--datadir $JELLYFIN_DATA_DIRECTORY --configdir $JELLYFIN_CONFIG_DIRECTORY --logdir $JELLYFIN_LOG_DIRECTORY --cachedir $JELLYFIN_CACHE_DIRECTORY --restartpath $JELLYFIN_RESTART_SCRIPT $JELLYFIN_ADD_OPTS"
+JELLYFIN_ARGS="--datadir $JELLYFIN_DATA_DIRECTORY --configdir $JELLYFIN_CONFIG_DIRECTORY --logdir $JELLYFIN_LOG_DIRECTORY --cachedir $JELLYFIN_CACHE_DIRECTORY $JELLYFIN_RESTART_OPT $JELLYFIN_FFMPEG_OPTS $JELLYFIN_ADD_OPTS"
diff --git a/deployment/debian-package-x64/pkg-src/jellyfin.service b/deployment/debian-package-x64/pkg-src/jellyfin.service
index b7ee4e1939..ee89d7d4b1 100644
--- a/deployment/debian-package-x64/pkg-src/jellyfin.service
+++ b/deployment/debian-package-x64/pkg-src/jellyfin.service
@@ -6,7 +6,7 @@ After = network.target
Type = simple
EnvironmentFile = /etc/default/jellyfin
User = jellyfin
-ExecStart = /usr/bin/jellyfin --datadir ${JELLYFIN_DATA_DIRECTORY} --configdir ${JELLYFIN_CONFIG_DIRECTORY} --logdir ${JELLYFIN_LOG_DIRECTORY} --cachedir ${JELLYFIN_CACHE_DIRECTORY} --restartpath ${JELLYFIN_RESTART_SCRIPT} ${JELLYFIN_ADD_OPTS}
+ExecStart = /usr/bin/jellyfin --datadir ${JELLYFIN_DATA_DIRECTORY} --configdir ${JELLYFIN_CONFIG_DIRECTORY} --logdir ${JELLYFIN_LOG_DIRECTORY} --cachedir ${JELLYFIN_CACHE_DIRECTORY} ${JELLYFIN_RESTART_OPT} ${JELLYFIN_FFMPEG_OPTS} ${JELLYFIN_ADD_OPTS}
Restart = on-failure
TimeoutSec = 15
From aad34e62ca32c822b69e81488729b8a1d3794fda Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Thu, 31 Jan 2019 22:28:12 -0500
Subject: [PATCH 18/93] Move jellyfin-sudoers to conf dir
---
.../debian-package-x64/pkg-src/{bin => conf}/jellyfin-sudoers | 0
deployment/debian-package-x64/pkg-src/install | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
rename deployment/debian-package-x64/pkg-src/{bin => conf}/jellyfin-sudoers (100%)
diff --git a/deployment/debian-package-x64/pkg-src/bin/jellyfin-sudoers b/deployment/debian-package-x64/pkg-src/conf/jellyfin-sudoers
similarity index 100%
rename from deployment/debian-package-x64/pkg-src/bin/jellyfin-sudoers
rename to deployment/debian-package-x64/pkg-src/conf/jellyfin-sudoers
diff --git a/deployment/debian-package-x64/pkg-src/install b/deployment/debian-package-x64/pkg-src/install
index adaff7b26f..994322d141 100644
--- a/deployment/debian-package-x64/pkg-src/install
+++ b/deployment/debian-package-x64/pkg-src/install
@@ -2,5 +2,5 @@ usr/lib/jellyfin usr/lib/
debian/conf/jellyfin etc/default/
debian/conf/logging.json etc/jellyfin/
debian/conf/jellyfin.service.conf etc/systemd/system/jellyfin.service.d/
-debian/bin/jellyfin-sudoers etc/sudoers.d/
+debian/conf/jellyfin-sudoers etc/sudoers.d/
debian/bin/restart.sh usr/lib/jellyfin/
From 885a000da74f3837dad044dce93054d65130e070 Mon Sep 17 00:00:00 2001
From: minegociomovil
Date: Sun, 27 Jan 2019 03:44:08 -0300
Subject: [PATCH 19/93] Update iso6392.txt
Add new es-MX option for the latin metadata search in www.themoviedb.org
Content add: spa||es-mx|Spanish; Latin|espagnol; Latin
---
Emby.Server.Implementations/Localization/iso6392.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/Emby.Server.Implementations/Localization/iso6392.txt b/Emby.Server.Implementations/Localization/iso6392.txt
index f2cea78b62..40f8614f1b 100644
--- a/Emby.Server.Implementations/Localization/iso6392.txt
+++ b/Emby.Server.Implementations/Localization/iso6392.txt
@@ -400,6 +400,7 @@ sog|||Sogdian|sogdien
som||so|Somali|somali
son|||Songhai languages|songhai, langues
sot||st|Sotho, Southern|sotho du Sud
+spa||es-mx|Spanish; Latin|espagnol; Latin
spa||es|Spanish; Castilian|espagnol; castillan
srd||sc|Sardinian|sarde
srn|||Sranan Tongo|sranan tongo
From 78324ff797758e0571052e1429d861cc0b561122 Mon Sep 17 00:00:00 2001
From: hawken
Date: Thu, 31 Jan 2019 22:17:18 +0000
Subject: [PATCH 20/93] Remove commented file
MediaBrowser.LocalMetadata.Savers.PersonXmlSaver
---
.../Savers/PersonXmlSaver.cs | 47 -------------------
1 file changed, 47 deletions(-)
delete mode 100644 MediaBrowser.LocalMetadata/Savers/PersonXmlSaver.cs
diff --git a/MediaBrowser.LocalMetadata/Savers/PersonXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/PersonXmlSaver.cs
deleted file mode 100644
index 7dd2c589fe..0000000000
--- a/MediaBrowser.LocalMetadata/Savers/PersonXmlSaver.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-namespace MediaBrowser.LocalMetadata.Savers
-{
- /////
- ///// Class PersonXmlSaver
- /////
- //public class PersonXmlSaver : BaseXmlSaver
- //{
- // public override bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
- // {
- // if (!item.SupportsLocalMetadata)
- // {
- // return false;
- // }
-
- // return item is Person && updateType >= ItemUpdateType.MetadataDownload;
- // }
-
- // protected override List GetTagsUsed()
- // {
- // var list = new List
- // {
- // "PlaceOfBirth"
- // };
-
- // return list;
- // }
-
- // protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)
- // {
- // var person = (Person)item;
-
- // if (person.ProductionLocations.Count > 0)
- // {
- // writer.WriteElementString("PlaceOfBirth", person.ProductionLocations[0]);
- // }
- // }
-
- // protected override string GetLocalSavePath(IHasMetadata item)
- // {
- // return Path.Combine(item.Path, "person.xml");
- // }
-
- // public PersonXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
- // {
- // }
- //}
-}
From cabb824f2a095115ebbe79ca7fdfbcbab4db1e5f Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Fri, 1 Feb 2019 18:11:46 +0100
Subject: [PATCH 21/93] Fix build error
---
.../Localization/LocalizationManager.cs | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs
index 3a70525954..c3a7e1e9af 100644
--- a/Emby.Server.Implementations/Localization/LocalizationManager.cs
+++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs
@@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.Localization
{
const string ratingsResource = "Emby.Server.Implementations.Ratings.";
- Directory.CreateDirectory(localizationPath);
+ Directory.CreateDirectory(LocalizationPath);
var existingFiles = GetRatingsFiles(LocalizationPath).Select(Path.GetFileName);
@@ -269,8 +269,6 @@ namespace Emby.Server.Implementations.Localization
}
return GetRatings(countryCode) ?? GetRatings("us");
-
- return ratings;
}
///
From 8af1e93cd4c9187ec46e2a6c7002791190be13fc Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Mon, 28 Jan 2019 17:52:56 +0100
Subject: [PATCH 22/93] Make cache dir configurable
---
.../AppBase/BaseApplicationPaths.cs | 4 ++-
.../ServerApplicationPaths.cs | 9 +++++--
Jellyfin.Server/Program.cs | 27 ++++++++++++++++++-
3 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs b/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs
index e4a2cd9dff..701c04f9e2 100644
--- a/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs
+++ b/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs
@@ -16,12 +16,14 @@ namespace Emby.Server.Implementations.AppBase
string programDataPath,
string appFolderPath,
string logDirectoryPath = null,
- string configurationDirectoryPath = null)
+ string configurationDirectoryPath = null,
+ string cacheDirectoryPath = null)
{
ProgramDataPath = programDataPath;
ProgramSystemPath = appFolderPath;
LogDirectoryPath = logDirectoryPath;
ConfigurationDirectoryPath = configurationDirectoryPath;
+ CachePath = cacheDirectoryPath;
}
public string ProgramDataPath { get; private set; }
diff --git a/Emby.Server.Implementations/ServerApplicationPaths.cs b/Emby.Server.Implementations/ServerApplicationPaths.cs
index 67389536bf..36975df50c 100644
--- a/Emby.Server.Implementations/ServerApplicationPaths.cs
+++ b/Emby.Server.Implementations/ServerApplicationPaths.cs
@@ -18,8 +18,13 @@ namespace Emby.Server.Implementations
string appFolderPath,
string applicationResourcesPath,
string logDirectoryPath = null,
- string configurationDirectoryPath = null)
- : base(programDataPath, appFolderPath, logDirectoryPath, configurationDirectoryPath)
+ string configurationDirectoryPath = null,
+ string cacheDirectoryPath = null)
+ : base(programDataPath,
+ appFolderPath,
+ logDirectoryPath,
+ configurationDirectoryPath,
+ cacheDirectoryPath)
{
ApplicationResourcesPath = applicationResourcesPath;
}
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 2f18283360..e0d5ed6239 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -202,6 +202,31 @@ namespace Jellyfin.Server
Directory.CreateDirectory(configDir);
}
+ string cacheDir = Environment.GetEnvironmentVariable("JELLYFIN_CACHE_DIR");
+ if (string.IsNullOrEmpty(cacheDir))
+ {
+ if (options.ContainsOption("-cachedir"))
+ {
+ cacheDir = options.GetOption("-cachedir");
+ }
+ else if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ // $XDG_CACHE_HOME defines the base directory relative to which user specific non-essential data files should be stored.
+ cacheDir = Environment.GetEnvironmentVariable("XDG_CACHE_HOME");
+ // If $XDG_CACHE_HOME is either not set or empty, $HOME/.cache should be used.
+ if (string.IsNullOrEmpty(cacheDir))
+ {
+ cacheDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".cache");
+ }
+ cacheDir = Path.Combine(cacheDir, "jellyfin");
+ }
+ }
+
+ if (cacheDir != null)
+ {
+ Directory.CreateDirectory(cacheDir);
+ }
+
string logDir = Environment.GetEnvironmentVariable("JELLYFIN_LOG_DIR");
if (string.IsNullOrEmpty(logDir))
{
@@ -223,7 +248,7 @@ namespace Jellyfin.Server
string appPath = AppContext.BaseDirectory;
- return new ServerApplicationPaths(programDataPath, appPath, appPath, logDir, configDir);
+ return new ServerApplicationPaths(programDataPath, appPath, appPath, logDir, configDir, cacheDir);
}
private static async Task createLogger(IApplicationPaths appPaths)
From 660f6174b32268edf7b9bdb4441eef83b187daaf Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Fri, 1 Feb 2019 18:15:35 +0100
Subject: [PATCH 23/93] Rebase on master
---
Jellyfin.Server/Program.cs | 4 ++--
Jellyfin.Server/StartupOptions.cs | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index e0d5ed6239..5c8608a928 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -205,9 +205,9 @@ namespace Jellyfin.Server
string cacheDir = Environment.GetEnvironmentVariable("JELLYFIN_CACHE_DIR");
if (string.IsNullOrEmpty(cacheDir))
{
- if (options.ContainsOption("-cachedir"))
+ if (options.CacheDir != null)
{
- cacheDir = options.GetOption("-cachedir");
+ cacheDir = options.CacheDir;
}
else if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
diff --git a/Jellyfin.Server/StartupOptions.cs b/Jellyfin.Server/StartupOptions.cs
index 6e6b617251..4908d86ed6 100644
--- a/Jellyfin.Server/StartupOptions.cs
+++ b/Jellyfin.Server/StartupOptions.cs
@@ -11,6 +11,9 @@ namespace Jellyfin.Server
[Option('d', "datadir", Required = false, HelpText = "Path to use for the data folder (database files, etc.).")]
public string DataDir { get; set; }
+ [Option('C', "configdir", Required = false, HelpText = "Path to use for caching.")]
+ public string CacheDir { get; set; }
+
[Option('c', "configdir", Required = false, HelpText = "Path to use for configuration data (user settings and pictures).")]
public string ConfigDir { get; set; }
From fa3a8108e5c215b3481306f1679432e6b337f6d3 Mon Sep 17 00:00:00 2001
From: Bond-009
Date: Fri, 1 Feb 2019 19:52:39 +0100
Subject: [PATCH 24/93] Update StartupOptions.cs
---
Jellyfin.Server/StartupOptions.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jellyfin.Server/StartupOptions.cs b/Jellyfin.Server/StartupOptions.cs
index 4908d86ed6..5d3f7b171b 100644
--- a/Jellyfin.Server/StartupOptions.cs
+++ b/Jellyfin.Server/StartupOptions.cs
@@ -11,7 +11,7 @@ namespace Jellyfin.Server
[Option('d', "datadir", Required = false, HelpText = "Path to use for the data folder (database files, etc.).")]
public string DataDir { get; set; }
- [Option('C', "configdir", Required = false, HelpText = "Path to use for caching.")]
+ [Option('C', "cachedir", Required = false, HelpText = "Path to use for caching.")]
public string CacheDir { get; set; }
[Option('c', "configdir", Required = false, HelpText = "Path to use for configuration data (user settings and pictures).")]
From 5ac6d0ae59731cdf9de0a5565d0cd894695bdc12 Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Fri, 1 Feb 2019 21:56:50 +0100
Subject: [PATCH 25/93] Fix more warnings
---
Emby.Server.Implementations/IO/LibraryMonitor.cs | 14 ++++++++++----
.../LiveTv/EmbyTV/EmbyTV.cs | 16 ++++++++--------
.../LiveTv/TunerHosts/SharedHttpStream.cs | 2 +-
.../Updates/InstallationManager.cs | 4 ++--
Jellyfin.Server/Program.cs | 8 ++++----
MediaBrowser.Api/PackageService.cs | 2 +-
MediaBrowser.Api/UserLibrary/PlaystateService.cs | 10 +++++-----
7 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs
index dad81c195c..ed5fddb52f 100644
--- a/Emby.Server.Implementations/IO/LibraryMonitor.cs
+++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs
@@ -601,20 +601,26 @@ namespace Emby.Server.Implementations.IO
///
public void Dispose()
{
- _disposed = true;
Dispose(true);
}
///
/// Releases unmanaged and - optionally - managed resources.
///
- /// true to release both managed and unmanaged resources; false to release only unmanaged resources.
- protected virtual void Dispose(bool dispose)
+ /// true to release both managed and unmanaged resources; false to release only unmanaged resources.
+ protected virtual void Dispose(bool disposing)
{
- if (dispose)
+ if (_disposed)
+ {
+ return;
+ }
+
+ if (disposing)
{
Stop();
}
+
+ _disposed = true;
}
}
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index 4e68bb545e..bce9c240d5 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -35,7 +35,6 @@ using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Reflection;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Model.System;
using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
@@ -275,7 +274,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
foreach (var timer in seriesTimers)
{
- await UpdateTimersForSeriesTimer(timer, false, true).ConfigureAwait(false);
+ UpdateTimersForSeriesTimer(timer, false, true);
}
}
@@ -763,12 +762,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_timerProvider.AddOrUpdate(timer, false);
}
- await UpdateTimersForSeriesTimer(info, true, false).ConfigureAwait(false);
+ UpdateTimersForSeriesTimer(info, true, false);
return info.Id;
}
- public async Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
+ public Task UpdateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken)
{
var instance = _seriesTimerProvider.GetAll().FirstOrDefault(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));
@@ -792,8 +791,10 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_seriesTimerProvider.Update(instance);
- await UpdateTimersForSeriesTimer(instance, true, true).ConfigureAwait(false);
+ UpdateTimersForSeriesTimer(instance, true, true);
}
+
+ return Task.CompletedTask;
}
public Task UpdateTimerAsync(TimerInfo updatedTimer, CancellationToken cancellationToken)
@@ -2346,10 +2347,9 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
}
- private async Task UpdateTimersForSeriesTimer(SeriesTimerInfo seriesTimer, bool updateTimerSettings, bool deleteInvalidTimers)
+ private void UpdateTimersForSeriesTimer(SeriesTimerInfo seriesTimer, bool updateTimerSettings, bool deleteInvalidTimers)
{
- var allTimers = GetTimersForSeries(seriesTimer)
- .ToList();
+ var allTimers = GetTimersForSeries(seriesTimer).ToList();
var enabledTimersForSeries = new List();
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
index 716417ccbc..4eff9252e4 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
@@ -94,7 +94,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
var now = DateTime.UtcNow;
- StartStreaming(response, taskCompletionSource, LiveStreamCancellationTokenSource.Token);
+ var _ = StartStreaming(response, taskCompletionSource, LiveStreamCancellationTokenSource.Token);
//OpenedMediaSource.Protocol = MediaProtocol.File;
//OpenedMediaSource.Path = tempFile;
diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs
index 5521556356..9a49b97c71 100644
--- a/Emby.Server.Implementations/Updates/InstallationManager.cs
+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs
@@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.Updates
/// Gets all available packages.
///
/// Task{List{PackageInfo}}.
- public async Task> GetAvailablePackages(CancellationToken cancellationToken,
+ public Task> GetAvailablePackages(CancellationToken cancellationToken,
bool withRegistration = true,
string packageType = null,
Version applicationVersion = null)
@@ -172,7 +172,7 @@ namespace Emby.Server.Implementations.Updates
// TODO cvium: when plugins get back this would need to be fixed
// var packages = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
- return new List(); //FilterPackages(packages, packageType, applicationVersion);
+ return Task.FromResult(new List()); //FilterPackages(packages, packageType, applicationVersion);
}
///
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 2f18283360..88b10cdbe4 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -62,7 +62,7 @@ namespace Jellyfin.Server
// $JELLYFIN_LOG_DIR needs to be set for the logger configuration manager
Environment.SetEnvironmentVariable("JELLYFIN_LOG_DIR", appPaths.LogDirectoryPath);
- await createLogger(appPaths);
+ await CreateLogger(appPaths);
_logger = _loggerFactory.CreateLogger("Main");
AppDomain.CurrentDomain.UnhandledException += (sender, e)
@@ -95,7 +95,7 @@ namespace Jellyfin.Server
_logger.LogInformation("Jellyfin version: {Version}", Assembly.GetEntryAssembly().GetName().Version);
- EnvironmentInfo environmentInfo = new EnvironmentInfo(getOperatingSystem());
+ EnvironmentInfo environmentInfo = new EnvironmentInfo(GetOperatingSystem());
ApplicationHost.LogEnvironmentInfo(_logger, appPaths, environmentInfo);
SQLitePCL.Batteries_V2.Init();
@@ -226,7 +226,7 @@ namespace Jellyfin.Server
return new ServerApplicationPaths(programDataPath, appPath, appPath, logDir, configDir);
}
- private static async Task createLogger(IApplicationPaths appPaths)
+ private static async Task CreateLogger(IApplicationPaths appPaths)
{
try
{
@@ -286,7 +286,7 @@ namespace Jellyfin.Server
return new NullImageEncoder();
}
- private static MediaBrowser.Model.System.OperatingSystem getOperatingSystem()
+ private static MediaBrowser.Model.System.OperatingSystem GetOperatingSystem()
{
switch (Environment.OSVersion.Platform)
{
diff --git a/MediaBrowser.Api/PackageService.cs b/MediaBrowser.Api/PackageService.cs
index 16819ee37f..fbb876deae 100644
--- a/MediaBrowser.Api/PackageService.cs
+++ b/MediaBrowser.Api/PackageService.cs
@@ -197,7 +197,7 @@ namespace MediaBrowser.Api
throw new ResourceNotFoundException(string.Format("Package not found: {0}", request.Name));
}
- Task.Run(() => _installationManager.InstallPackage(package, true, new SimpleProgress(), CancellationToken.None));
+ await _installationManager.InstallPackage(package, true, new SimpleProgress(), CancellationToken.None);
}
///
diff --git a/MediaBrowser.Api/UserLibrary/PlaystateService.cs b/MediaBrowser.Api/UserLibrary/PlaystateService.cs
index 72a9430921..a133bc8e90 100644
--- a/MediaBrowser.Api/UserLibrary/PlaystateService.cs
+++ b/MediaBrowser.Api/UserLibrary/PlaystateService.cs
@@ -247,14 +247,14 @@ namespace MediaBrowser.Api.UserLibrary
/// Posts the specified request.
///
/// The request.
- public async Task Post(MarkPlayedItem request)
+ public object Post(MarkPlayedItem request)
{
- var result = await MarkPlayed(request).ConfigureAwait(false);
+ var result = MarkPlayed(request);
return ToOptimizedResult(result);
}
- private async Task MarkPlayed(MarkPlayedItem request)
+ private UserItemDataDto MarkPlayed(MarkPlayedItem request)
{
var user = _userManager.GetUserById(request.UserId);
@@ -403,10 +403,10 @@ namespace MediaBrowser.Api.UserLibrary
{
var task = MarkUnplayed(request);
- return ToOptimizedResult(task.Result);
+ return ToOptimizedResult(task);
}
- private async Task MarkUnplayed(MarkUnplayedItem request)
+ private UserItemDataDto MarkUnplayed(MarkUnplayedItem request)
{
var user = _userManager.GetUserById(request.UserId);
From 7774977cdd3a8032e699be94badd1ed07265ba75 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Fri, 1 Feb 2019 19:12:12 -0500
Subject: [PATCH 26/93] Implement review feedback
---
deployment/debian-package-x64/pkg-src/conf/jellyfin | 2 +-
deployment/debian-package-x64/pkg-src/postinst | 6 ++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/deployment/debian-package-x64/pkg-src/conf/jellyfin b/deployment/debian-package-x64/pkg-src/conf/jellyfin
index ebc11ca5c6..c237e2d692 100644
--- a/deployment/debian-package-x64/pkg-src/conf/jellyfin
+++ b/deployment/debian-package-x64/pkg-src/conf/jellyfin
@@ -22,7 +22,7 @@ JELLYFIN_CACHE_DIRECTORY="/var/cache/jellyfin"
JELLYFIN_RESTART_OPT="--restartpath /usr/lib/jellyfin/restart.sh"
# [OPTIONAL] ffmpeg binary paths
-#JELLYFIN_FFMPEG_OPTS="-ffmpeg /usr/bin/ffmpeg -ffprobe /usr/bin/ffprobe"
+#JELLYFIN_FFMPEG_OPTS="--ffmpeg /usr/bin/ffmpeg --ffprobe /usr/bin/ffprobe"
# [OPTIONAL] Additional user-defined options for the binary
#JELLYFIN_ADD_OPTS=""
diff --git a/deployment/debian-package-x64/pkg-src/postinst b/deployment/debian-package-x64/pkg-src/postinst
index 44d944ccb5..a784028eb1 100644
--- a/deployment/debian-package-x64/pkg-src/postinst
+++ b/deployment/debian-package-x64/pkg-src/postinst
@@ -43,10 +43,8 @@ case "$1" in
mkdir $CACHEDATA
fi
# Ensure permissions are correct on all config directories
- chown -R jellyfin:jellyfin $PROGRAMDATA
- chown -R jellyfin:jellyfin $CONFIGDATA
- chown -R jellyfin:jellyfin $LOGDATA
- chown -R jellyfin:jellyfin $CACHEDATA
+ chown -R jellyfin:jellyfin $PROGRAMDATA $CONFIGDATA $LOGDATA $CACHEDATA
+ chmod 0750 $PROGRAMDATA $CONFIGDATA $LOGDATA $CACHEDATA
chmod +x /usr/lib/jellyfin/restart.sh > /dev/null 2>&1 || true
From b630e9de82587d3e336813cdc8a82ef316813f3e Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Fri, 1 Feb 2019 19:13:50 -0500
Subject: [PATCH 27/93] Allow adm group to view Jellyfin resources
This is pretty arbitrary and personal, but I detest services that
lock out global access (which is good), but don't simultaneously
make it easy for administrators to enter the directories. The adm
group should only have actual system administrators as members,
so this lets them view the secure directories.
---
deployment/debian-package-x64/pkg-src/postinst | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/deployment/debian-package-x64/pkg-src/postinst b/deployment/debian-package-x64/pkg-src/postinst
index a784028eb1..860222e051 100644
--- a/deployment/debian-package-x64/pkg-src/postinst
+++ b/deployment/debian-package-x64/pkg-src/postinst
@@ -43,7 +43,8 @@ case "$1" in
mkdir $CACHEDATA
fi
# Ensure permissions are correct on all config directories
- chown -R jellyfin:jellyfin $PROGRAMDATA $CONFIGDATA $LOGDATA $CACHEDATA
+ chown -R jellyfin $PROGRAMDATA $CONFIGDATA $LOGDATA $CACHEDATA
+ chgrp adm $PROGRAMDATA $CONFIGDATA $LOGDATA $CACHEDATA
chmod 0750 $PROGRAMDATA $CONFIGDATA $LOGDATA $CACHEDATA
chmod +x /usr/lib/jellyfin/restart.sh > /dev/null 2>&1 || true
From 6772ac56038af12e9b8c4c5f30cb349bd052f43d Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Fri, 1 Feb 2019 20:03:04 -0500
Subject: [PATCH 28/93] Fix double-dashes in Fedora environment file
---
deployment/fedora-package-x64/pkg-src/jellyfin.env | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.env b/deployment/fedora-package-x64/pkg-src/jellyfin.env
index 49e5650065..f7f041f756 100644
--- a/deployment/fedora-package-x64/pkg-src/jellyfin.env
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.env
@@ -15,7 +15,7 @@
#
# Tell jellyfin wich ffmpeg/ffprobe to use
-# JELLYFIN_FFMPEG="-ffmpeg /usr/bin/ffmpeg -ffprobe /usr/bin/ffprobe"
+# JELLYFIN_FFMPEG="--ffmpeg /usr/bin/ffmpeg --ffprobe /usr/bin/ffprobe"
# Program directories
JELLYFIN_DATA_DIRECTORY="/var/lib/jellyfin"
@@ -23,6 +23,6 @@ JELLYFIN_CONFIG_DIRECTORY="/etc/jellyfin"
JELLYFIN_LOG_DIRECTORY="/var/log/jellyfin"
JELLYFIN_CACHE_DIRECTORY="/var/log/jellyfin"
# In-App service control
-JELLYFIN_RESTART_OPT="-restartpath /usr/libexec/jellyfin/restart.sh"
+JELLYFIN_RESTART_OPT="--restartpath /usr/libexec/jellyfin/restart.sh"
# Additional options for the binary
JELLYFIN_ADD_OPTS=""
From 8b073e2ba5e4b1dafc7ef11554cd13ef59339a5c Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Sat, 2 Feb 2019 12:19:02 +0100
Subject: [PATCH 29/93] Remove unused field
---
Emby.Server.Implementations/ApplicationHost.cs | 2 +-
Emby.Server.Implementations/LiveTv/LiveTvManager.cs | 5 -----
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 87e3b45ab7..c59a648e59 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -904,7 +904,7 @@ namespace Emby.Server.Implementations
PlaylistManager = new PlaylistManager(LibraryManager, FileSystemManager, LibraryMonitor, LoggerFactory, UserManager, ProviderManager);
RegisterSingleInstance(PlaylistManager);
- LiveTvManager = new LiveTvManager(this, ServerConfigurationManager, LoggerFactory, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, ProviderManager, FileSystemManager, () => ChannelManager);
+ LiveTvManager = new LiveTvManager(this, ServerConfigurationManager, LoggerFactory, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, FileSystemManager, () => ChannelManager);
RegisterSingleInstance(LiveTvManager);
UserViewManager = new UserViewManager(LibraryManager, LocalizationManager, UserManager, ChannelManager, LiveTvManager, ServerConfigurationManager);
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
index 575cb1c77c..c0c91e3454 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Emby.Server.Implementations.Library;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
-using MediaBrowser.Common.Net;
using MediaBrowser.Common.Progress;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Channels;
@@ -24,7 +23,6 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.LiveTv;
@@ -48,7 +46,6 @@ namespace Emby.Server.Implementations.LiveTv
private readonly ILibraryManager _libraryManager;
private readonly ITaskManager _taskManager;
private readonly IJsonSerializer _jsonSerializer;
- private readonly IProviderManager _providerManager;
private readonly Func _channelManager;
private readonly IDtoService _dtoService;
@@ -85,7 +82,6 @@ namespace Emby.Server.Implementations.LiveTv
ITaskManager taskManager,
ILocalizationManager localization,
IJsonSerializer jsonSerializer,
- IProviderManager providerManager,
IFileSystem fileSystem,
Func channelManager)
{
@@ -97,7 +93,6 @@ namespace Emby.Server.Implementations.LiveTv
_taskManager = taskManager;
_localization = localization;
_jsonSerializer = jsonSerializer;
- _providerManager = providerManager;
_fileSystem = fileSystem;
_dtoService = dtoService;
_userDataManager = userDataManager;
From 1385d89df6d6af178dcfdfa1dee6346c6efcad2a Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Sat, 2 Feb 2019 12:27:06 +0100
Subject: [PATCH 30/93] Remove MoreLINQ
---
.../Collections/CollectionImageProvider.cs | 3 +-
Emby.Server.Implementations/Dto/DtoService.cs | 3 +-
.../EntryPoints/LibraryChangedNotifier.cs | 17 ++--
.../EntryPoints/UserDataChangeNotifier.cs | 3 +-
.../IO/FileRefresher.cs | 4 +-
.../LiveTv/LiveTvManager.cs | 3 +-
.../Networking/NetworkManager.cs | 6 +-
.../Playlists/PlaylistImageProvider.cs | 4 +-
.../UserViews/DynamicImageProvider.cs | 4 +-
MediaBrowser.Api/Library/LibraryService.cs | 15 ++--
MediaBrowser.Api/Movies/MoviesService.cs | 6 +-
.../Entities/CollectionFolder.cs | 6 +-
MediaBrowser.Controller/Entities/TV/Series.cs | 2 +-
.../Library/NameExtensions.cs | 8 +-
.../Extensions/LinqExtensions.cs | 85 -------------------
15 files changed, 53 insertions(+), 116 deletions(-)
delete mode 100644 MediaBrowser.Model/Extensions/LinqExtensions.cs
diff --git a/Emby.Server.Implementations/Collections/CollectionImageProvider.cs b/Emby.Server.Implementations/Collections/CollectionImageProvider.cs
index 6642d1ef4c..6aeadda2fb 100644
--- a/Emby.Server.Implementations/Collections/CollectionImageProvider.cs
+++ b/Emby.Server.Implementations/Collections/CollectionImageProvider.cs
@@ -70,7 +70,8 @@ namespace Emby.Server.Implementations.Collections
return null;
})
.Where(i => i != null)
- .DistinctBy(i => i.Id)
+ .GroupBy(x => x.Id)
+ .Select(x => x.First())
.OrderBy(i => Guid.NewGuid())
.ToList();
}
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index a3529fdb4a..f5634690fb 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -620,7 +620,8 @@ namespace Emby.Server.Implementations.Dto
}
}).Where(i => i != null)
- .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
+ .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
+ .Select(x => x.First())
.ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase);
for (var i = 0; i < people.Count; i++)
diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
index 7a8b09cf78..a670a289c8 100644
--- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
@@ -277,14 +277,21 @@ namespace Emby.Server.Implementations.EntryPoints
lock (_libraryChangedSyncLock)
{
// Remove dupes in case some were saved multiple times
- var foldersAddedTo = _foldersAddedTo.DistinctBy(i => i.Id).ToList();
+ var foldersAddedTo = _foldersAddedTo
+ .GroupBy(x => x.Id)
+ .Select(x => x.First())
+ .ToList();
- var foldersRemovedFrom = _foldersRemovedFrom.DistinctBy(i => i.Id).ToList();
+ var foldersRemovedFrom = _foldersRemovedFrom
+ .GroupBy(x => x.Id)
+ .Select(x => x.First())
+ .ToList();
var itemsUpdated = _itemsUpdated
- .Where(i => !_itemsAdded.Contains(i))
- .DistinctBy(i => i.Id)
- .ToList();
+ .Where(i => !_itemsAdded.Contains(i))
+ .GroupBy(x => x.Id)
+ .Select(x => x.First())
+ .ToList();
SendChangeNotifications(_itemsAdded.ToList(), itemsUpdated, _itemsRemoved.ToList(), foldersAddedTo, foldersRemovedFrom, CancellationToken.None);
diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
index 9e71ffceb7..69784e4106 100644
--- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
@@ -121,7 +121,8 @@ namespace Emby.Server.Implementations.EntryPoints
var user = _userManager.GetUserById(userId);
var dtoList = changedItems
- .DistinctBy(i => i.Id)
+ .GroupBy(x => x.Id)
+ .Select(x => x.First())
.Select(i =>
{
var dto = _userDataManager.GetUserDataDto(i, user);
diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.cs
index 12532a4971..1cac0ba5c4 100644
--- a/Emby.Server.Implementations/IO/FileRefresher.cs
+++ b/Emby.Server.Implementations/IO/FileRefresher.cs
@@ -146,8 +146,8 @@ namespace Emby.Server.Implementations.IO
.Distinct(StringComparer.OrdinalIgnoreCase)
.Select(GetAffectedBaseItem)
.Where(item => item != null)
- .DistinctBy(i => i.Id)
- .ToList();
+ .GroupBy(x => x.Id)
+ .Select(x => x.First());
foreach (var item in itemsToRefresh)
{
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
index c0c91e3454..c3437bcdaa 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -2464,7 +2464,8 @@ namespace Emby.Server.Implementations.LiveTv
.Where(i => i != null)
.Where(i => i.IsVisibleStandalone(user))
.SelectMany(i => _libraryManager.GetCollectionFolders(i))
- .DistinctBy(i => i.Id)
+ .GroupBy(x => x.Id)
+ .Select(x => x.First())
.OrderBy(i => i.SortName)
.ToList();
diff --git a/Emby.Server.Implementations/Networking/NetworkManager.cs b/Emby.Server.Implementations/Networking/NetworkManager.cs
index f4b9f84dc7..aa884664f2 100644
--- a/Emby.Server.Implementations/Networking/NetworkManager.cs
+++ b/Emby.Server.Implementations/Networking/NetworkManager.cs
@@ -111,7 +111,8 @@ namespace Emby.Server.Implementations.Networking
.OrderBy(i => i.AddressFamily == AddressFamily.InterNetwork ? 0 : 1)
.ThenBy(i => listClone.IndexOf(i))
.Where(FilterIpAddress)
- .DistinctBy(i => i.ToString())
+ .GroupBy(i => i.ToString())
+ .Select(x => x.First())
.ToList();
}
@@ -429,7 +430,8 @@ namespace Emby.Server.Implementations.Networking
return new List();
}
- }).DistinctBy(i => i.ToString())
+ }).GroupBy(i => i.ToString())
+ .Select(x => x.First())
.ToList();
}
diff --git a/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs b/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs
index 2231531647..8a7c1492d4 100644
--- a/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs
+++ b/Emby.Server.Implementations/Playlists/PlaylistImageProvider.cs
@@ -13,7 +13,6 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Playlists;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Querying;
@@ -64,7 +63,8 @@ namespace Emby.Server.Implementations.Playlists
})
.Where(i => i != null)
.OrderBy(i => Guid.NewGuid())
- .DistinctBy(i => i.Id)
+ .GroupBy(x => x.Id)
+ .Select(x => x.First())
.ToList();
}
}
diff --git a/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs b/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs
index 937db3f23e..4ec68e550d 100644
--- a/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs
+++ b/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs
@@ -12,7 +12,6 @@ using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.IO;
namespace Emby.Server.Implementations.UserViews
@@ -83,7 +82,8 @@ namespace Emby.Server.Implementations.UserViews
return i;
- }).DistinctBy(i => i.Id);
+ }).GroupBy(x => x.Id)
+ .Select(x => x.First());
if (isUsingCollectionStrip)
{
diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs
index 8e6d1febba..d44b07256d 100644
--- a/MediaBrowser.Api/Library/LibraryService.cs
+++ b/MediaBrowser.Api/Library/LibraryService.cs
@@ -551,7 +551,8 @@ namespace MediaBrowser.Api.Library
Name = i.Name,
DefaultEnabled = IsSaverEnabledByDefault(i.Name, types, isNewLibrary)
})
- .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
+ .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
+ .Select(x => x.First())
.ToArray();
result.MetadataReaders = plugins
@@ -561,7 +562,8 @@ namespace MediaBrowser.Api.Library
Name = i.Name,
DefaultEnabled = true
})
- .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
+ .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
+ .Select(x => x.First())
.ToArray();
result.SubtitleFetchers = plugins
@@ -571,7 +573,8 @@ namespace MediaBrowser.Api.Library
Name = i.Name,
DefaultEnabled = true
})
- .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
+ .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
+ .Select(x => x.First())
.ToArray();
var typeOptions = new List();
@@ -593,7 +596,8 @@ namespace MediaBrowser.Api.Library
Name = i.Name,
DefaultEnabled = IsMetadataFetcherEnabledByDefault(i.Name, type, isNewLibrary)
})
- .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
+ .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
+ .Select(x => x.First())
.ToArray(),
ImageFetchers = plugins
@@ -604,7 +608,8 @@ namespace MediaBrowser.Api.Library
Name = i.Name,
DefaultEnabled = IsImageFetcherEnabledByDefault(i.Name, type, isNewLibrary)
})
- .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
+ .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
+ .Select(x => x.First())
.ToArray(),
SupportedImageTypes = plugins
diff --git a/MediaBrowser.Api/Movies/MoviesService.cs b/MediaBrowser.Api/Movies/MoviesService.cs
index 996087018e..91766255fd 100644
--- a/MediaBrowser.Api/Movies/MoviesService.cs
+++ b/MediaBrowser.Api/Movies/MoviesService.cs
@@ -268,7 +268,8 @@ namespace MediaBrowser.Api.Movies
EnableGroupByMetadataKey = true,
DtoOptions = dtoOptions
- }).DistinctBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N"))
+ }).GroupBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N"))
+ .Select(x => x.First())
.Take(itemLimit)
.ToList();
@@ -308,7 +309,8 @@ namespace MediaBrowser.Api.Movies
EnableGroupByMetadataKey = true,
DtoOptions = dtoOptions
- }).DistinctBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N"))
+ }).GroupBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N"))
+ .Select(x => x.First())
.Take(itemLimit)
.ToList();
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index 91cfcd0cec..275052d48a 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -335,7 +335,11 @@ namespace MediaBrowser.Controller.Entities
.OfType()
.ToList();
- return PhysicalLocations.Where(i => !FileSystem.AreEqual(i, Path)).SelectMany(i => GetPhysicalParents(i, rootChildren)).DistinctBy(i => i.Id);
+ return PhysicalLocations
+ .Where(i => !FileSystem.AreEqual(i, Path))
+ .SelectMany(i => GetPhysicalParents(i, rootChildren))
+ .GroupBy(x => x.Id)
+ .Select(x => x.First());
}
private IEnumerable GetPhysicalParents(string path, List rootChildren)
diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs
index 4539ab0f26..570e9389e9 100644
--- a/MediaBrowser.Controller/Entities/TV/Series.cs
+++ b/MediaBrowser.Controller/Entities/TV/Series.cs
@@ -270,7 +270,7 @@ namespace MediaBrowser.Controller.Entities.TV
// This depends on settings for that series
// When this happens, remove the duplicate from season 0
- return allEpisodes.DistinctBy(i => i.Id).Reverse();
+ return allEpisodes.GroupBy(i => i.Id).Select(x => x.First()).Reverse();
}
public async Task RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress progress, CancellationToken cancellationToken)
diff --git a/MediaBrowser.Controller/Library/NameExtensions.cs b/MediaBrowser.Controller/Library/NameExtensions.cs
index e2988a8312..6b0b7e53ac 100644
--- a/MediaBrowser.Controller/Library/NameExtensions.cs
+++ b/MediaBrowser.Controller/Library/NameExtensions.cs
@@ -1,7 +1,7 @@
using System;
+using System.Linq;
using System.Collections.Generic;
using MediaBrowser.Controller.Extensions;
-using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.Library
{
@@ -14,13 +14,11 @@ namespace MediaBrowser.Controller.Library
return string.Empty;
}
- //return name;
return name.RemoveDiacritics();
}
public static IEnumerable DistinctNames(this IEnumerable names)
- {
- return names.DistinctBy(RemoveDiacritics, StringComparer.OrdinalIgnoreCase);
- }
+ => names.GroupBy(RemoveDiacritics, StringComparer.OrdinalIgnoreCase)
+ .Select(x => x.First());
}
}
diff --git a/MediaBrowser.Model/Extensions/LinqExtensions.cs b/MediaBrowser.Model/Extensions/LinqExtensions.cs
deleted file mode 100644
index f0febf1d0a..0000000000
--- a/MediaBrowser.Model/Extensions/LinqExtensions.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-// TODO: @bond Remove
-namespace MediaBrowser.Model.Extensions
-{
- // MoreLINQ - Extensions to LINQ to Objects
- // Copyright (c) 2008 Jonathan Skeet. All rights reserved.
- //
- // Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at
- //
- // http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
-
- public static class LinqExtensions
- {
- ///
- /// Returns all distinct elements of the given source, where "distinctness"
- /// is determined via a projection and the default equality comparer for the projected type.
- ///
- ///
- /// This operator uses deferred execution and streams the results, although
- /// a set of already-seen keys is retained. If a key is seen multiple times,
- /// only the first element with that key is returned.
- ///
- /// Type of the source sequence
- /// Type of the projected element
- /// Source sequence
- /// Projection for determining "distinctness"
- /// A sequence consisting of distinct elements from the source sequence,
- /// comparing them by the specified key projection.
-
- public static IEnumerable DistinctBy(this IEnumerable source,
- Func keySelector)
- {
- return source.DistinctBy(keySelector, null);
- }
-
- ///
- /// Returns all distinct elements of the given source, where "distinctness"
- /// is determined via a projection and the specified comparer for the projected type.
- ///
- ///
- /// This operator uses deferred execution and streams the results, although
- /// a set of already-seen keys is retained. If a key is seen multiple times,
- /// only the first element with that key is returned.
- ///
- /// Type of the source sequence
- /// Type of the projected element
- /// Source sequence
- /// Projection for determining "distinctness"
- /// The equality comparer to use to determine whether or not keys are equal.
- /// If null, the default equality comparer for TSource is used.
- /// A sequence consisting of distinct elements from the source sequence,
- /// comparing them by the specified key projection.
-
- public static IEnumerable DistinctBy(this IEnumerable source,
- Func keySelector, IEqualityComparer comparer)
- {
- if (source == null) throw new ArgumentNullException(nameof(source));
- if (keySelector == null) throw new ArgumentNullException(nameof(keySelector));
- return DistinctByImpl(source, keySelector, comparer);
- }
-
- private static IEnumerable DistinctByImpl(IEnumerable source,
- Func keySelector, IEqualityComparer comparer)
- {
- var knownKeys = new HashSet(comparer);
- foreach (var element in source)
- {
- if (knownKeys.Add(keySelector(element)))
- {
- yield return element;
- }
- }
- }
- }
-}
From 1d94607a306521860df44982d6bfeb1a139def52 Mon Sep 17 00:00:00 2001
From: Sparky
Date: Sat, 2 Feb 2019 09:00:04 -0500
Subject: [PATCH 31/93] Fix docker args
After the change to runtime args in #749 docker broke.
This fixes it.
---
Dockerfile | 2 +-
Dockerfile.arm | 2 +-
Dockerfile.arm64 | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index c79d6f8ee1..37388fda9d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -23,4 +23,4 @@ COPY --from=ffmpeg / /
COPY --from=builder /jellyfin /jellyfin
EXPOSE 8096
VOLUME /config /media
-ENTRYPOINT dotnet /jellyfin/jellyfin.dll -programdata /config
+ENTRYPOINT dotnet /jellyfin/jellyfin.dll --datadir /config
diff --git a/Dockerfile.arm b/Dockerfile.arm
index 657cb4ac62..039274197c 100644
--- a/Dockerfile.arm
+++ b/Dockerfile.arm
@@ -21,4 +21,4 @@ RUN apt-get update \
COPY --from=builder /jellyfin /jellyfin
EXPOSE 8096
VOLUME /config /media
-ENTRYPOINT dotnet /jellyfin/jellyfin.dll -programdata /config
+ENTRYPOINT dotnet /jellyfin/jellyfin.dll --datadir /config
diff --git a/Dockerfile.arm64 b/Dockerfile.arm64
index 979dfc1dc1..06ba21b918 100644
--- a/Dockerfile.arm64
+++ b/Dockerfile.arm64
@@ -30,4 +30,4 @@ COPY --from=qemu_extract qemu-* /usr/bin
COPY --from=builder /jellyfin /jellyfin
EXPOSE 8096
VOLUME /config /media
-ENTRYPOINT dotnet /jellyfin/jellyfin.dll -programdata /config
+ENTRYPOINT dotnet /jellyfin/jellyfin.dll --datadir /config
From 66eabcdd3906cb04dfc60767dea8328267a6f134 Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Tue, 29 Jan 2019 19:30:52 +0100
Subject: [PATCH 32/93] Minor changes to encoding code
* Don't wait in intervals of 100ms for the file to exist
---
.../Diagnostics/CommonProcess.cs | 2 +-
.../MediaEncoding/EncodingJobInfo.cs | 124 ++++++------------
.../Encoder/BaseEncoder.cs | 79 +++++++----
.../Encoder/EncodingJob.cs | 2 -
.../Encoder/EncodingJobFactory.cs | 106 ++-------------
5 files changed, 109 insertions(+), 204 deletions(-)
diff --git a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs
index 55539eafcf..78b22bda3f 100644
--- a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs
+++ b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs
@@ -105,7 +105,7 @@ namespace Emby.Server.Implementations.Diagnostics
{
return _process.WaitForExit(timeMs);
}
-
+
public Task WaitForExitAsync(int timeMs)
{
//Note: For this function to work correctly, the option EnableRisingEvents needs to be set to true.
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
index 1fe8856ccb..916d691b80 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
@@ -10,19 +10,13 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Session;
-using Microsoft.Extensions.Logging;
-using System.IO;
using MediaBrowser.Model.Net;
-using MediaBrowser.Controller.Library;
-using System.Threading.Tasks;
namespace MediaBrowser.Controller.MediaEncoding
{
// For now, a common base class until the API and MediaEncoding classes are unified
public class EncodingJobInfo
{
- protected readonly IMediaSourceManager MediaSourceManager;
-
public MediaStream VideoStream { get; set; }
public VideoType VideoType { get; set; }
public Dictionary RemoteHttpHeaders { get; set; }
@@ -49,7 +43,6 @@ namespace MediaBrowser.Controller.MediaEncoding
public string OutputFilePath { get; set; }
public string MimeType { get; set; }
- public long? EncodingDurationTicks { get; set; }
public string GetMimeType(string outputPath, bool enableStreamDefault = true)
{
@@ -68,7 +61,12 @@ namespace MediaBrowser.Controller.MediaEncoding
{
if (_transcodeReasons == null)
{
- _transcodeReasons = (BaseRequest.TranscodeReasons ?? string.Empty)
+ if (BaseRequest.TranscodeReasons == null)
+ {
+ return Array.Empty();
+ }
+
+ _transcodeReasons = BaseRequest.TranscodeReasons
.Split(',')
.Where(i => !string.IsNullOrEmpty(i))
.Select(v => (TranscodeReason)Enum.Parse(typeof(TranscodeReason), v, true))
@@ -98,7 +96,8 @@ namespace MediaBrowser.Controller.MediaEncoding
get
{
// For live tv + in progress recordings
- if (string.Equals(InputContainer, "mpegts", StringComparison.OrdinalIgnoreCase) || string.Equals(InputContainer, "ts", StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(InputContainer, "mpegts", StringComparison.OrdinalIgnoreCase)
+ || string.Equals(InputContainer, "ts", StringComparison.OrdinalIgnoreCase))
{
if (!MediaSource.RunTimeTicks.HasValue)
{
@@ -155,15 +154,7 @@ namespace MediaBrowser.Controller.MediaEncoding
}
}
- if (forceDeinterlaceIfSourceIsInterlaced)
- {
- if (isInputInterlaced)
- {
- return true;
- }
- }
-
- return false;
+ return forceDeinterlaceIfSourceIsInterlaced && isInputInterlaced;
}
public string[] GetRequestedProfiles(string codec)
@@ -211,7 +202,8 @@ namespace MediaBrowser.Controller.MediaEncoding
if (!string.IsNullOrEmpty(codec))
{
var value = BaseRequest.GetOption(codec, "maxrefframes");
- if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
+ if (!string.IsNullOrEmpty(value)
+ && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
{
return result;
}
@@ -230,7 +222,8 @@ namespace MediaBrowser.Controller.MediaEncoding
if (!string.IsNullOrEmpty(codec))
{
var value = BaseRequest.GetOption(codec, "videobitdepth");
- if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
+ if (!string.IsNullOrEmpty(value)
+ && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
{
return result;
}
@@ -249,7 +242,8 @@ namespace MediaBrowser.Controller.MediaEncoding
if (!string.IsNullOrEmpty(codec))
{
var value = BaseRequest.GetOption(codec, "audiobitdepth");
- if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
+ if (!string.IsNullOrEmpty(value)
+ && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
{
return result;
}
@@ -264,6 +258,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{
return BaseRequest.MaxAudioChannels;
}
+
if (BaseRequest.AudioChannels.HasValue)
{
return BaseRequest.AudioChannels;
@@ -272,7 +267,8 @@ namespace MediaBrowser.Controller.MediaEncoding
if (!string.IsNullOrEmpty(codec))
{
var value = BaseRequest.GetOption(codec, "audiochannels");
- if (!string.IsNullOrEmpty(value) && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
+ if (!string.IsNullOrEmpty(value)
+ && int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
{
return result;
}
@@ -294,7 +290,8 @@ namespace MediaBrowser.Controller.MediaEncoding
SupportedSubtitleCodecs = Array.Empty();
}
- public bool IsSegmentedLiveStream => TranscodingType != TranscodingJobType.Progressive && !RunTimeTicks.HasValue;
+ public bool IsSegmentedLiveStream
+ => TranscodingType != TranscodingJobType.Progressive && !RunTimeTicks.HasValue;
public bool EnableBreakOnNonKeyFrames(string videoCodec)
{
@@ -428,11 +425,12 @@ namespace MediaBrowser.Controller.MediaEncoding
{
if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
- return VideoStream == null ? null : VideoStream.Level;
+ return VideoStream?.Level;
}
var level = GetRequestedLevel(ActualOutputVideoCodec);
- if (!string.IsNullOrEmpty(level) && double.TryParse(level, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
+ if (!string.IsNullOrEmpty(level)
+ && double.TryParse(level, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
{
return result;
}
@@ -450,7 +448,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{
if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
- return VideoStream == null ? null : VideoStream.BitDepth;
+ return VideoStream?.BitDepth;
}
return null;
@@ -467,7 +465,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{
if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
- return VideoStream == null ? null : VideoStream.RefFrames;
+ return VideoStream?.RefFrames;
}
return null;
@@ -494,13 +492,14 @@ namespace MediaBrowser.Controller.MediaEncoding
{
get
{
- var defaultValue = string.Equals(OutputContainer, "m2ts", StringComparison.OrdinalIgnoreCase) ?
+ if (BaseRequest.Static)
+ {
+ return InputTimestamp;
+ }
+
+ return string.Equals(OutputContainer, "m2ts", StringComparison.OrdinalIgnoreCase) ?
TransportStreamTimestamp.Valid :
TransportStreamTimestamp.None;
-
- return !BaseRequest.Static
- ? defaultValue
- : InputTimestamp;
}
}
@@ -513,7 +512,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{
if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
- return VideoStream == null ? null : VideoStream.PacketLength;
+ return VideoStream?.PacketLength;
}
return null;
@@ -529,7 +528,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{
if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
- return VideoStream == null ? null : VideoStream.Profile;
+ return VideoStream?.Profile;
}
var requestedProfile = GetRequestedProfiles(ActualOutputVideoCodec).FirstOrDefault();
@@ -542,42 +541,13 @@ namespace MediaBrowser.Controller.MediaEncoding
}
}
- ///
- /// Predicts the audio sample rate that will be in the output stream
- ///
- public string TargetVideoRange
- {
- get
- {
- if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
- {
- return VideoStream == null ? null : VideoStream.VideoRange;
- }
-
- return "SDR";
- }
- }
-
- public string TargetAudioProfile
- {
- get
- {
- if (BaseRequest.Static || string.Equals(OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
- {
- return AudioStream == null ? null : AudioStream.Profile;
- }
-
- return null;
- }
- }
-
public string TargetVideoCodecTag
{
get
{
if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
- return VideoStream == null ? null : VideoStream.CodecTag;
+ return VideoStream?.CodecTag;
}
return null;
@@ -590,7 +560,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{
if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
- return VideoStream == null ? null : VideoStream.IsAnamorphic;
+ return VideoStream?.IsAnamorphic;
}
return false;
@@ -605,14 +575,7 @@ namespace MediaBrowser.Controller.MediaEncoding
if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
{
- var stream = VideoStream;
-
- if (stream != null)
- {
- return stream.Codec;
- }
-
- return null;
+ return VideoStream?.Codec;
}
return codec;
@@ -627,14 +590,7 @@ namespace MediaBrowser.Controller.MediaEncoding
if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
{
- var stream = AudioStream;
-
- if (stream != null)
- {
- return stream.Codec;
- }
-
- return null;
+ return AudioStream?.Codec;
}
return codec;
@@ -647,7 +603,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{
if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
- return VideoStream == null ? (bool?)null : VideoStream.IsInterlaced;
+ return VideoStream?.IsInterlaced;
}
if (DeInterlace(ActualOutputVideoCodec, true))
@@ -655,7 +611,7 @@ namespace MediaBrowser.Controller.MediaEncoding
return false;
}
- return VideoStream == null ? (bool?)null : VideoStream.IsInterlaced;
+ return VideoStream?.IsInterlaced;
}
}
@@ -665,7 +621,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{
if (BaseRequest.Static || string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
- return VideoStream == null ? null : VideoStream.IsAVC;
+ return VideoStream?.IsAVC;
}
return false;
diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
index 81f7c16d3e..b231938b5e 100644
--- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
@@ -1,5 +1,5 @@
using System;
-using System.Globalization;
+using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading;
@@ -31,11 +31,10 @@ namespace MediaBrowser.MediaEncoding.Encoder
protected readonly IMediaSourceManager MediaSourceManager;
protected IProcessFactory ProcessFactory;
- protected readonly CultureInfo UsCulture = new CultureInfo("en-US");
-
protected EncodingHelper EncodingHelper;
- protected BaseEncoder(MediaEncoder mediaEncoder,
+ protected BaseEncoder(
+ MediaEncoder mediaEncoder,
ILogger logger,
IServerConfigurationManager configurationManager,
IFileSystem fileSystem,
@@ -43,7 +42,8 @@ namespace MediaBrowser.MediaEncoding.Encoder
ILibraryManager libraryManager,
ISessionManager sessionManager,
ISubtitleEncoder subtitleEncoder,
- IMediaSourceManager mediaSourceManager, IProcessFactory processFactory)
+ IMediaSourceManager mediaSourceManager,
+ IProcessFactory processFactory)
{
MediaEncoder = mediaEncoder;
Logger = logger;
@@ -59,11 +59,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
EncodingHelper = new EncodingHelper(MediaEncoder, FileSystem, SubtitleEncoder);
}
- public async Task Start(EncodingJobOptions options,
+ public async Task Start(
+ EncodingJobOptions options,
IProgress progress,
CancellationToken cancellationToken)
{
- var encodingJob = await new EncodingJobFactory(Logger, LibraryManager, MediaSourceManager, ConfigurationManager, MediaEncoder)
+ var encodingJob = await new EncodingJobFactory(Logger, LibraryManager, MediaSourceManager, MediaEncoder)
.CreateJob(options, EncodingHelper, IsVideoEncoder, progress, cancellationToken).ConfigureAwait(false);
encodingJob.OutputFilePath = GetOutputFilePath(encodingJob);
@@ -75,8 +76,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
var commandLineArgs = GetCommandLineArguments(encodingJob);
- var process = ProcessFactory.Create(new ProcessOptions
+ Process process = Process.Start(new ProcessStartInfo
{
+ WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
UseShellExecute = false,
@@ -88,11 +90,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
FileName = MediaEncoder.EncoderPath,
Arguments = commandLineArgs,
- IsHidden = true,
- ErrorDialog = false,
- EnableRaisingEvents = true
+ ErrorDialog = false
});
+ process.EnableRaisingEvents = true;
+
var workingDirectory = GetWorkingDirectory(options);
if (!string.IsNullOrWhiteSpace(workingDirectory))
{
@@ -128,29 +130,60 @@ namespace MediaBrowser.MediaEncoding.Encoder
throw;
}
- cancellationToken.Register(() => Cancel(process, encodingJob));
+ cancellationToken.Register(async () => await Cancel(process, encodingJob));
- // MUST read both stdout and stderr asynchronously or a deadlock may occurr
+ // MUST read both stdout and stderr asynchronously or a deadlock may occur
//process.BeginOutputReadLine();
// Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
new JobLogger(Logger).StartStreamingLog(encodingJob, process.StandardError.BaseStream, encodingJob.LogFileStream);
- // Wait for the file to exist before proceeeding
- while (!File.Exists(encodingJob.OutputFilePath) && !encodingJob.HasExited)
+ // Wait for the file to or for the process to stop
+ Task file = WaitForFileAsync(encodingJob.OutputFilePath);
+ await Task.WhenAny(encodingJob.TaskCompletionSource.Task, file).ConfigureAwait(false);
+
+ return encodingJob;
+ }
+
+ public static Task WaitForFileAsync(string path)
+ {
+ if (File.Exists(path))
{
- await Task.Delay(100, cancellationToken).ConfigureAwait(false);
+ return Task.CompletedTask;
}
- return encodingJob;
+ var tcs = new TaskCompletionSource();
+ FileSystemWatcher watcher = new FileSystemWatcher(Path.GetDirectoryName(path));
+
+ watcher.Created += (s, e) =>
+ {
+ if (e.Name == Path.GetFileName(path))
+ {
+ watcher.Dispose();
+ tcs.TrySetResult(true);
+ }
+ };
+
+ watcher.Renamed += (s, e) =>
+ {
+ if (e.Name == Path.GetFileName(path))
+ {
+ watcher.Dispose();
+ tcs.TrySetResult(true);
+ }
+ };
+
+ watcher.EnableRaisingEvents = true;
+
+ return tcs.Task;
}
- private void Cancel(IProcess process, EncodingJob job)
+ private async Task Cancel(Process process, EncodingJob job)
{
Logger.LogInformation("Killing ffmpeg process for {0}", job.OutputFilePath);
//process.Kill();
- process.StandardInput.WriteLine("q");
+ await process.StandardInput.WriteLineAsync("q");
job.IsCancelled = true;
}
@@ -160,28 +193,28 @@ namespace MediaBrowser.MediaEncoding.Encoder
///
/// The process.
/// The job.
- private void OnFfMpegProcessExited(IProcess process, EncodingJob job)
+ private void OnFfMpegProcessExited(Process process, EncodingJob job)
{
job.HasExited = true;
Logger.LogDebug("Disposing stream resources");
job.Dispose();
- var isSuccesful = false;
+ var isSuccessful = false;
try
{
var exitCode = process.ExitCode;
Logger.LogInformation("FFMpeg exited with code {0}", exitCode);
- isSuccesful = exitCode == 0;
+ isSuccessful = exitCode == 0;
}
catch (Exception ex)
{
Logger.LogError(ex, "FFMpeg exited with an error.");
}
- if (isSuccesful && !job.IsCancelled)
+ if (isSuccessful && !job.IsCancelled)
{
job.TaskCompletionSource.TrySetResult(true);
}
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
index d4040cd317..cd7de94ce1 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
@@ -4,7 +4,6 @@ using System.Threading.Tasks;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Dlna;
-using MediaBrowser.Model.Net;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.MediaEncoding.Encoder
@@ -40,7 +39,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
_mediaSourceManager = mediaSourceManager;
Id = Guid.NewGuid();
- _logger = logger;
TaskCompletionSource = new TaskCompletionSource();
}
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
index 95454c4477..5f84a03223 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
@@ -1,13 +1,10 @@
using System;
-using System.Collections.Generic;
-using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
-using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Entities;
using Microsoft.Extensions.Logging;
@@ -19,17 +16,13 @@ namespace MediaBrowser.MediaEncoding.Encoder
private readonly ILogger _logger;
private readonly ILibraryManager _libraryManager;
private readonly IMediaSourceManager _mediaSourceManager;
- private readonly IConfigurationManager _config;
private readonly IMediaEncoder _mediaEncoder;
- protected static readonly CultureInfo UsCulture = new CultureInfo("en-US");
-
- public EncodingJobFactory(ILogger logger, ILibraryManager libraryManager, IMediaSourceManager mediaSourceManager, IConfigurationManager config, IMediaEncoder mediaEncoder)
+ public EncodingJobFactory(ILogger logger, ILibraryManager libraryManager, IMediaSourceManager mediaSourceManager, IMediaEncoder mediaEncoder)
{
_logger = logger;
_libraryManager = libraryManager;
_mediaSourceManager = mediaSourceManager;
- _config = config;
_mediaEncoder = mediaEncoder;
}
@@ -118,11 +111,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
if (state.OutputVideoBitrate.HasValue)
{
var resolution = ResolutionNormalizer.Normalize(
- state.VideoStream == null ? (int?)null : state.VideoStream.BitRate,
- state.VideoStream == null ? (int?)null : state.VideoStream.Width,
- state.VideoStream == null ? (int?)null : state.VideoStream.Height,
+ state.VideoStream?.BitRate,
+ state.VideoStream?.Width,
+ state.VideoStream?.Height,
state.OutputVideoBitrate.Value,
- state.VideoStream == null ? null : state.VideoStream.Codec,
+ state.VideoStream?.Codec,
state.OutputVideoCodec,
videoRequest.MaxWidth,
videoRequest.MaxHeight);
@@ -144,40 +137,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
return state;
}
- protected EncodingOptions GetEncodingOptions()
- {
- return _config.GetConfiguration("encoding");
- }
-
- ///
- /// Infers the video codec.
- ///
- /// The container.
- /// System.Nullable{VideoCodecs}.
- private static string InferVideoCodec(string container)
- {
- var ext = "." + (container ?? string.Empty);
-
- if (string.Equals(ext, ".asf", StringComparison.OrdinalIgnoreCase))
- {
- return "wmv";
- }
- if (string.Equals(ext, ".webm", StringComparison.OrdinalIgnoreCase))
- {
- return "vpx";
- }
- if (string.Equals(ext, ".ogg", StringComparison.OrdinalIgnoreCase) || string.Equals(ext, ".ogv", StringComparison.OrdinalIgnoreCase))
- {
- return "theora";
- }
- if (string.Equals(ext, ".m3u8", StringComparison.OrdinalIgnoreCase) || string.Equals(ext, ".ts", StringComparison.OrdinalIgnoreCase))
- {
- return "h264";
- }
-
- return "copy";
- }
-
private string InferAudioCodec(string container)
{
var ext = "." + (container ?? string.Empty);
@@ -186,31 +145,19 @@ namespace MediaBrowser.MediaEncoding.Encoder
{
return "mp3";
}
- if (string.Equals(ext, ".aac", StringComparison.OrdinalIgnoreCase))
+ else if (string.Equals(ext, ".aac", StringComparison.OrdinalIgnoreCase))
{
return "aac";
}
- if (string.Equals(ext, ".wma", StringComparison.OrdinalIgnoreCase))
+ else if (string.Equals(ext, ".wma", StringComparison.OrdinalIgnoreCase))
{
return "wma";
}
- if (string.Equals(ext, ".ogg", StringComparison.OrdinalIgnoreCase))
- {
- return "vorbis";
- }
- if (string.Equals(ext, ".oga", StringComparison.OrdinalIgnoreCase))
- {
- return "vorbis";
- }
- if (string.Equals(ext, ".ogv", StringComparison.OrdinalIgnoreCase))
- {
- return "vorbis";
- }
- if (string.Equals(ext, ".webm", StringComparison.OrdinalIgnoreCase))
- {
- return "vorbis";
- }
- if (string.Equals(ext, ".webma", StringComparison.OrdinalIgnoreCase))
+ else if (string.Equals(ext, ".ogg", StringComparison.OrdinalIgnoreCase)
+ || string.Equals(ext, ".oga", StringComparison.OrdinalIgnoreCase)
+ || string.Equals(ext, ".ogv", StringComparison.OrdinalIgnoreCase)
+ || string.Equals(ext, ".webm", StringComparison.OrdinalIgnoreCase)
+ || string.Equals(ext, ".webma", StringComparison.OrdinalIgnoreCase))
{
return "vorbis";
}
@@ -218,35 +165,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
return "copy";
}
- ///
- /// Determines whether the specified stream is H264.
- ///
- /// The stream.
- /// true if the specified stream is H264; otherwise, false.
- protected bool IsH264(MediaStream stream)
- {
- var codec = stream.Codec ?? string.Empty;
-
- return codec.IndexOf("264", StringComparison.OrdinalIgnoreCase) != -1 ||
- codec.IndexOf("avc", StringComparison.OrdinalIgnoreCase) != -1;
- }
-
- private static int GetVideoProfileScore(string profile)
- {
- var list = new List
- {
- "Constrained Baseline",
- "Baseline",
- "Extended",
- "Main",
- "High",
- "Progressive High",
- "Constrained High"
- };
-
- return Array.FindIndex(list.ToArray(), t => string.Equals(t, profile, StringComparison.OrdinalIgnoreCase));
- }
-
private void ApplyDeviceProfileSettings(EncodingJob state)
{
var profile = state.Options.DeviceProfile;
From 95ee3c72e3465ec8d958b87e6c339d94db4db45a Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Tue, 29 Jan 2019 21:39:12 +0100
Subject: [PATCH 33/93] Properly dispose Tasks
---
MediaBrowser.Api/ApiEntryPoint.cs | 32 +++----
.../UserLibrary/PlaystateService.cs | 16 ++--
.../Encoder/BaseEncoder.cs | 84 +++++++++----------
3 files changed, 64 insertions(+), 68 deletions(-)
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs
index 763535129a..a212d3f3a7 100644
--- a/MediaBrowser.Api/ApiEntryPoint.cs
+++ b/MediaBrowser.Api/ApiEntryPoint.cs
@@ -462,7 +462,7 @@ namespace MediaBrowser.Api
Logger.LogInformation("Transcoding kill timer stopped for JobId {0} PlaySessionId {1}. Killing transcoding", job.Id, job.PlaySessionId);
- KillTranscodingJob(job, true, path => true);
+ KillTranscodingJob(job, true, path => true).GetAwaiter().GetResult();
}
///
@@ -472,9 +472,9 @@ namespace MediaBrowser.Api
/// The play session identifier.
/// The delete files.
/// Task.
- internal void KillTranscodingJobs(string deviceId, string playSessionId, Func deleteFiles)
+ internal Task KillTranscodingJobs(string deviceId, string playSessionId, Func deleteFiles)
{
- KillTranscodingJobs(j =>
+ return KillTranscodingJobs(j =>
{
if (!string.IsNullOrWhiteSpace(playSessionId))
{
@@ -492,7 +492,7 @@ namespace MediaBrowser.Api
/// The kill job.
/// The delete files.
/// Task.
- private void KillTranscodingJobs(Func killJob, Func deleteFiles)
+ private Task KillTranscodingJobs(Func killJob, Func deleteFiles)
{
var jobs = new List();
@@ -505,13 +505,18 @@ namespace MediaBrowser.Api
if (jobs.Count == 0)
{
- return;
+ return Task.CompletedTask;
}
- foreach (var job in jobs)
+ IEnumerable GetKillJobs()
{
- KillTranscodingJob(job, false, deleteFiles);
+ foreach (var job in jobs)
+ {
+ yield return KillTranscodingJob(job, false, deleteFiles);
+ }
}
+
+ return Task.WhenAll(GetKillJobs());
}
///
@@ -520,7 +525,7 @@ namespace MediaBrowser.Api
/// The job.
/// if set to true [close live stream].
/// The delete.
- private async void KillTranscodingJob(TranscodingJob job, bool closeLiveStream, Func delete)
+ private async Task KillTranscodingJob(TranscodingJob job, bool closeLiveStream, Func delete)
{
job.DisposeKillTimer();
@@ -577,7 +582,7 @@ namespace MediaBrowser.Api
if (delete(job.Path))
{
- DeletePartialStreamFiles(job.Path, job.Type, 0, 1500);
+ await DeletePartialStreamFiles(job.Path, job.Type, 0, 1500).ConfigureAwait(false);
}
if (closeLiveStream && !string.IsNullOrWhiteSpace(job.LiveStreamId))
@@ -588,12 +593,12 @@ namespace MediaBrowser.Api
}
catch (Exception ex)
{
- Logger.LogError(ex, "Error closing live stream for {path}", job.Path);
+ Logger.LogError(ex, "Error closing live stream for {Path}", job.Path);
}
}
}
- private async void DeletePartialStreamFiles(string path, TranscodingJobType jobType, int retryCount, int delayMs)
+ private async Task DeletePartialStreamFiles(string path, TranscodingJobType jobType, int retryCount, int delayMs)
{
if (retryCount >= 10)
{
@@ -623,7 +628,7 @@ namespace MediaBrowser.Api
{
Logger.LogError(ex, "Error deleting partial stream file(s) {path}", path);
- DeletePartialStreamFiles(path, jobType, retryCount + 1, 500);
+ await DeletePartialStreamFiles(path, jobType, retryCount + 1, 500).ConfigureAwait(false);
}
catch (Exception ex)
{
@@ -650,8 +655,7 @@ namespace MediaBrowser.Api
var name = Path.GetFileNameWithoutExtension(outputFilePath);
var filesToDelete = _fileSystem.GetFilePaths(directory)
- .Where(f => f.IndexOf(name, StringComparison.OrdinalIgnoreCase) != -1)
- .ToList();
+ .Where(f => f.IndexOf(name, StringComparison.OrdinalIgnoreCase) != -1);
Exception e = null;
diff --git a/MediaBrowser.Api/UserLibrary/PlaystateService.cs b/MediaBrowser.Api/UserLibrary/PlaystateService.cs
index 72a9430921..5240144f11 100644
--- a/MediaBrowser.Api/UserLibrary/PlaystateService.cs
+++ b/MediaBrowser.Api/UserLibrary/PlaystateService.cs
@@ -366,9 +366,9 @@ namespace MediaBrowser.Api.UserLibrary
/// Posts the specified request.
///
/// The request.
- public void Delete(OnPlaybackStopped request)
+ public Task Delete(OnPlaybackStopped request)
{
- Post(new ReportPlaybackStopped
+ return Post(new ReportPlaybackStopped
{
ItemId = new Guid(request.Id),
PositionTicks = request.PositionTicks,
@@ -379,20 +379,18 @@ namespace MediaBrowser.Api.UserLibrary
});
}
- public void Post(ReportPlaybackStopped request)
+ public async Task Post(ReportPlaybackStopped request)
{
Logger.LogDebug("ReportPlaybackStopped PlaySessionId: {0}", request.PlaySessionId ?? string.Empty);
if (!string.IsNullOrWhiteSpace(request.PlaySessionId))
{
- ApiEntryPoint.Instance.KillTranscodingJobs(_authContext.GetAuthorizationInfo(Request).DeviceId, request.PlaySessionId, s => true);
+ await ApiEntryPoint.Instance.KillTranscodingJobs(_authContext.GetAuthorizationInfo(Request).DeviceId, request.PlaySessionId, s => true);
}
request.SessionId = GetSession(_sessionContext).Id;
- var task = _sessionManager.OnPlaybackStopped(request);
-
- Task.WaitAll(task);
+ await _sessionManager.OnPlaybackStopped(request);
}
///
@@ -403,10 +401,10 @@ namespace MediaBrowser.Api.UserLibrary
{
var task = MarkUnplayed(request);
- return ToOptimizedResult(task.Result);
+ return ToOptimizedResult(task);
}
- private async Task MarkUnplayed(MarkUnplayedItem request)
+ private UserItemDataDto MarkUnplayed(MarkUnplayedItem request)
{
var user = _userManager.GetUserById(request.UserId);
diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
index b231938b5e..cf239671fa 100644
--- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
@@ -76,24 +76,26 @@ namespace MediaBrowser.MediaEncoding.Encoder
var commandLineArgs = GetCommandLineArguments(encodingJob);
- Process process = Process.Start(new ProcessStartInfo
+ Process process = new Process
{
- WindowStyle = ProcessWindowStyle.Hidden,
- CreateNoWindow = true,
- UseShellExecute = false,
-
- // Must consume both stdout and stderr or deadlocks may occur
- //RedirectStandardOutput = true,
- RedirectStandardError = true,
- RedirectStandardInput = true,
+ StartInfo = new ProcessStartInfo
+ {
+ WindowStyle = ProcessWindowStyle.Hidden,
+ CreateNoWindow = true,
+ UseShellExecute = false,
- FileName = MediaEncoder.EncoderPath,
- Arguments = commandLineArgs,
+ // Must consume both stdout and stderr or deadlocks may occur
+ //RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ RedirectStandardInput = true,
- ErrorDialog = false
- });
+ FileName = MediaEncoder.EncoderPath,
+ Arguments = commandLineArgs,
- process.EnableRaisingEvents = true;
+ ErrorDialog = false
+ },
+ EnableRaisingEvents = true
+ };
var workingDirectory = GetWorkingDirectory(options);
if (!string.IsNullOrWhiteSpace(workingDirectory))
@@ -132,50 +134,42 @@ namespace MediaBrowser.MediaEncoding.Encoder
cancellationToken.Register(async () => await Cancel(process, encodingJob));
- // MUST read both stdout and stderr asynchronously or a deadlock may occur
- //process.BeginOutputReadLine();
-
// Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
new JobLogger(Logger).StartStreamingLog(encodingJob, process.StandardError.BaseStream, encodingJob.LogFileStream);
- // Wait for the file to or for the process to stop
- Task file = WaitForFileAsync(encodingJob.OutputFilePath);
- await Task.WhenAny(encodingJob.TaskCompletionSource.Task, file).ConfigureAwait(false);
-
- return encodingJob;
- }
+ Logger.LogInformation("test0");
- public static Task WaitForFileAsync(string path)
- {
- if (File.Exists(path))
+ if (File.Exists(encodingJob.OutputFilePath))
{
- return Task.CompletedTask;
+ return encodingJob;
}
- var tcs = new TaskCompletionSource();
- FileSystemWatcher watcher = new FileSystemWatcher(Path.GetDirectoryName(path));
+ Logger.LogInformation("test1");
- watcher.Created += (s, e) =>
+ using (var watcher = new FileSystemWatcher(Path.GetDirectoryName(encodingJob.OutputFilePath)))
{
- if (e.Name == Path.GetFileName(path))
- {
- watcher.Dispose();
- tcs.TrySetResult(true);
- }
- };
+ var tcs = new TaskCompletionSource();
+ string fileName = Path.GetFileName(encodingJob.OutputFilePath);
- watcher.Renamed += (s, e) =>
- {
- if (e.Name == Path.GetFileName(path))
+ watcher.Created += (s, e) =>
{
- watcher.Dispose();
- tcs.TrySetResult(true);
- }
- };
+ if (e.Name == fileName)
+ {
+ tcs.TrySetResult(true);
+ }
+ };
- watcher.EnableRaisingEvents = true;
+ watcher.EnableRaisingEvents = true;
- return tcs.Task;
+ Logger.LogInformation("test2");
+
+ // Wait for the file to or for the process to stop
+ await Task.WhenAny(encodingJob.TaskCompletionSource.Task, tcs.Task).ConfigureAwait(false);
+
+ Logger.LogInformation("test3");
+
+ return encodingJob;
+ }
}
private async Task Cancel(Process process, EncodingJob job)
From 1cdcace0618658d1e99e98c3f539baf3ae72ab14 Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Tue, 29 Jan 2019 22:06:04 +0100
Subject: [PATCH 34/93] Remove dead code
---
.../MediaEncoding/IMediaEncoder.cs | 22 -
.../Encoder/AudioEncoder.cs | 58 ---
.../Encoder/BaseEncoder.cs | 399 ------------------
.../Encoder/EncodingJob.cs | 147 -------
.../Encoder/EncodingJobFactory.cs | 225 ----------
.../Encoder/MediaEncoder.cs | 43 --
.../Encoder/VideoEncoder.cs | 59 ---
7 files changed, 953 deletions(-)
delete mode 100644 MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs
delete mode 100644 MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
delete mode 100644 MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
delete mode 100644 MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
delete mode 100644 MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs
diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs
index 48055a37e6..057e439104 100644
--- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs
+++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs
@@ -82,28 +82,6 @@ namespace MediaBrowser.Controller.MediaEncoding
/// System.String.
string GetTimeParameter(long ticks);
- ///
- /// Encodes the audio.
- ///
- /// The options.
- /// The progress.
- /// The cancellation token.
- /// Task.
- Task EncodeAudio(EncodingJobOptions options,
- IProgress progress,
- CancellationToken cancellationToken);
-
- ///
- /// Encodes the video.
- ///
- /// The options.
- /// The progress.
- /// The cancellation token.
- /// Task<System.String>.
- Task EncodeVideo(EncodingJobOptions options,
- IProgress progress,
- CancellationToken cancellationToken);
-
Task ConvertImage(string inputPath, string outputPath);
///
diff --git a/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs
deleted file mode 100644
index d5773fe315..0000000000
--- a/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System;
-using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.MediaEncoding;
-using MediaBrowser.Controller.Session;
-using MediaBrowser.Model.Diagnostics;
-using MediaBrowser.Model.IO;
-using Microsoft.Extensions.Logging;
-
-namespace MediaBrowser.MediaEncoding.Encoder
-{
- public class AudioEncoder : BaseEncoder
- {
- public AudioEncoder(MediaEncoder mediaEncoder, ILogger logger, IServerConfigurationManager configurationManager, IFileSystem fileSystem, IIsoManager isoManager, ILibraryManager libraryManager, ISessionManager sessionManager, ISubtitleEncoder subtitleEncoder, IMediaSourceManager mediaSourceManager, IProcessFactory processFactory) : base(mediaEncoder, logger, configurationManager, fileSystem, isoManager, libraryManager, sessionManager, subtitleEncoder, mediaSourceManager, processFactory)
- {
- }
-
- protected override string GetCommandLineArguments(EncodingJob state)
- {
- var encodingOptions = GetEncodingOptions();
-
- return EncodingHelper.GetProgressiveAudioFullCommandLine(state, encodingOptions, state.OutputFilePath);
- }
-
- protected override string GetOutputFileExtension(EncodingJob state)
- {
- var ext = base.GetOutputFileExtension(state);
-
- if (!string.IsNullOrEmpty(ext))
- {
- return ext;
- }
-
- var audioCodec = state.Options.AudioCodec;
-
- if (string.Equals("aac", audioCodec, StringComparison.OrdinalIgnoreCase))
- {
- return ".aac";
- }
- if (string.Equals("mp3", audioCodec, StringComparison.OrdinalIgnoreCase))
- {
- return ".mp3";
- }
- if (string.Equals("vorbis", audioCodec, StringComparison.OrdinalIgnoreCase))
- {
- return ".ogg";
- }
- if (string.Equals("wma", audioCodec, StringComparison.OrdinalIgnoreCase))
- {
- return ".wma";
- }
-
- return null;
- }
-
- protected override bool IsVideoEncoder => false;
- }
-}
diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
deleted file mode 100644
index cf239671fa..0000000000
--- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs
+++ /dev/null
@@ -1,399 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using MediaBrowser.Common.Configuration;
-using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.MediaEncoding;
-using MediaBrowser.Controller.Session;
-using MediaBrowser.Model.Configuration;
-using MediaBrowser.Model.Diagnostics;
-using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.IO;
-using MediaBrowser.Model.MediaInfo;
-using Microsoft.Extensions.Logging;
-
-namespace MediaBrowser.MediaEncoding.Encoder
-{
- public abstract class BaseEncoder
- {
- protected readonly MediaEncoder MediaEncoder;
- protected readonly ILogger Logger;
- protected readonly IServerConfigurationManager ConfigurationManager;
- protected readonly IFileSystem FileSystem;
- protected readonly IIsoManager IsoManager;
- protected readonly ILibraryManager LibraryManager;
- protected readonly ISessionManager SessionManager;
- protected readonly ISubtitleEncoder SubtitleEncoder;
- protected readonly IMediaSourceManager MediaSourceManager;
- protected IProcessFactory ProcessFactory;
-
- protected EncodingHelper EncodingHelper;
-
- protected BaseEncoder(
- MediaEncoder mediaEncoder,
- ILogger logger,
- IServerConfigurationManager configurationManager,
- IFileSystem fileSystem,
- IIsoManager isoManager,
- ILibraryManager libraryManager,
- ISessionManager sessionManager,
- ISubtitleEncoder subtitleEncoder,
- IMediaSourceManager mediaSourceManager,
- IProcessFactory processFactory)
- {
- MediaEncoder = mediaEncoder;
- Logger = logger;
- ConfigurationManager = configurationManager;
- FileSystem = fileSystem;
- IsoManager = isoManager;
- LibraryManager = libraryManager;
- SessionManager = sessionManager;
- SubtitleEncoder = subtitleEncoder;
- MediaSourceManager = mediaSourceManager;
- ProcessFactory = processFactory;
-
- EncodingHelper = new EncodingHelper(MediaEncoder, FileSystem, SubtitleEncoder);
- }
-
- public async Task Start(
- EncodingJobOptions options,
- IProgress progress,
- CancellationToken cancellationToken)
- {
- var encodingJob = await new EncodingJobFactory(Logger, LibraryManager, MediaSourceManager, MediaEncoder)
- .CreateJob(options, EncodingHelper, IsVideoEncoder, progress, cancellationToken).ConfigureAwait(false);
-
- encodingJob.OutputFilePath = GetOutputFilePath(encodingJob);
- Directory.CreateDirectory(Path.GetDirectoryName(encodingJob.OutputFilePath));
-
- encodingJob.ReadInputAtNativeFramerate = options.ReadInputAtNativeFramerate;
-
- await AcquireResources(encodingJob, cancellationToken).ConfigureAwait(false);
-
- var commandLineArgs = GetCommandLineArguments(encodingJob);
-
- Process process = new Process
- {
- StartInfo = new ProcessStartInfo
- {
- WindowStyle = ProcessWindowStyle.Hidden,
- CreateNoWindow = true,
- UseShellExecute = false,
-
- // Must consume both stdout and stderr or deadlocks may occur
- //RedirectStandardOutput = true,
- RedirectStandardError = true,
- RedirectStandardInput = true,
-
- FileName = MediaEncoder.EncoderPath,
- Arguments = commandLineArgs,
-
- ErrorDialog = false
- },
- EnableRaisingEvents = true
- };
-
- var workingDirectory = GetWorkingDirectory(options);
- if (!string.IsNullOrWhiteSpace(workingDirectory))
- {
- process.StartInfo.WorkingDirectory = workingDirectory;
- }
-
- OnTranscodeBeginning(encodingJob);
-
- var commandLineLogMessage = process.StartInfo.FileName + " " + process.StartInfo.Arguments;
- Logger.LogInformation(commandLineLogMessage);
-
- var logFilePath = Path.Combine(ConfigurationManager.CommonApplicationPaths.LogDirectoryPath, "transcode-" + Guid.NewGuid() + ".txt");
- Directory.CreateDirectory(Path.GetDirectoryName(logFilePath));
-
- // FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
- encodingJob.LogFileStream = FileSystem.GetFileStream(logFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true);
-
- var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(commandLineLogMessage + Environment.NewLine + Environment.NewLine);
- await encodingJob.LogFileStream.WriteAsync(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length, cancellationToken).ConfigureAwait(false);
-
- process.Exited += (sender, args) => OnFfMpegProcessExited(process, encodingJob);
-
- try
- {
- process.Start();
- }
- catch (Exception ex)
- {
- Logger.LogError(ex, "Error starting ffmpeg");
-
- OnTranscodeFailedToStart(encodingJob.OutputFilePath, encodingJob);
-
- throw;
- }
-
- cancellationToken.Register(async () => await Cancel(process, encodingJob));
-
- // Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
- new JobLogger(Logger).StartStreamingLog(encodingJob, process.StandardError.BaseStream, encodingJob.LogFileStream);
-
- Logger.LogInformation("test0");
-
- if (File.Exists(encodingJob.OutputFilePath))
- {
- return encodingJob;
- }
-
- Logger.LogInformation("test1");
-
- using (var watcher = new FileSystemWatcher(Path.GetDirectoryName(encodingJob.OutputFilePath)))
- {
- var tcs = new TaskCompletionSource();
- string fileName = Path.GetFileName(encodingJob.OutputFilePath);
-
- watcher.Created += (s, e) =>
- {
- if (e.Name == fileName)
- {
- tcs.TrySetResult(true);
- }
- };
-
- watcher.EnableRaisingEvents = true;
-
- Logger.LogInformation("test2");
-
- // Wait for the file to or for the process to stop
- await Task.WhenAny(encodingJob.TaskCompletionSource.Task, tcs.Task).ConfigureAwait(false);
-
- Logger.LogInformation("test3");
-
- return encodingJob;
- }
- }
-
- private async Task Cancel(Process process, EncodingJob job)
- {
- Logger.LogInformation("Killing ffmpeg process for {0}", job.OutputFilePath);
-
- //process.Kill();
- await process.StandardInput.WriteLineAsync("q");
-
- job.IsCancelled = true;
- }
-
- ///
- /// Processes the exited.
- ///
- /// The process.
- /// The job.
- private void OnFfMpegProcessExited(Process process, EncodingJob job)
- {
- job.HasExited = true;
-
- Logger.LogDebug("Disposing stream resources");
- job.Dispose();
-
- var isSuccessful = false;
-
- try
- {
- var exitCode = process.ExitCode;
- Logger.LogInformation("FFMpeg exited with code {0}", exitCode);
-
- isSuccessful = exitCode == 0;
- }
- catch (Exception ex)
- {
- Logger.LogError(ex, "FFMpeg exited with an error.");
- }
-
- if (isSuccessful && !job.IsCancelled)
- {
- job.TaskCompletionSource.TrySetResult(true);
- }
- else if (job.IsCancelled)
- {
- try
- {
- DeleteFiles(job);
- }
- catch
- {
- }
- try
- {
- job.TaskCompletionSource.TrySetException(new OperationCanceledException());
- }
- catch
- {
- }
- }
- else
- {
- try
- {
- DeleteFiles(job);
- }
- catch
- {
- }
- try
- {
- job.TaskCompletionSource.TrySetException(new Exception("Encoding failed"));
- }
- catch
- {
- }
- }
-
- // This causes on exited to be called twice:
- //try
- //{
- // // Dispose the process
- // process.Dispose();
- //}
- //catch (Exception ex)
- //{
- // Logger.LogError("Error disposing ffmpeg.", ex);
- //}
- }
-
- protected virtual void DeleteFiles(EncodingJob job)
- {
- FileSystem.DeleteFile(job.OutputFilePath);
- }
-
- private void OnTranscodeBeginning(EncodingJob job)
- {
- job.ReportTranscodingProgress(null, null, null, null, null);
- }
-
- private void OnTranscodeFailedToStart(string path, EncodingJob job)
- {
- if (!string.IsNullOrWhiteSpace(job.Options.DeviceId))
- {
- SessionManager.ClearTranscodingInfo(job.Options.DeviceId);
- }
- }
-
- protected abstract bool IsVideoEncoder { get; }
-
- protected virtual string GetWorkingDirectory(EncodingJobOptions options)
- {
- return null;
- }
-
- protected EncodingOptions GetEncodingOptions()
- {
- return ConfigurationManager.GetConfiguration("encoding");
- }
-
- protected abstract string GetCommandLineArguments(EncodingJob job);
-
- private string GetOutputFilePath(EncodingJob state)
- {
- var folder = string.IsNullOrWhiteSpace(state.Options.TempDirectory) ?
- ConfigurationManager.ApplicationPaths.TranscodingTempPath :
- state.Options.TempDirectory;
-
- var outputFileExtension = GetOutputFileExtension(state);
-
- var filename = state.Id + (outputFileExtension ?? string.Empty).ToLowerInvariant();
- return Path.Combine(folder, filename);
- }
-
- protected virtual string GetOutputFileExtension(EncodingJob state)
- {
- if (!string.IsNullOrWhiteSpace(state.Options.Container))
- {
- return "." + state.Options.Container;
- }
-
- return null;
- }
-
- ///
- /// Gets the name of the output video codec
- ///
- /// The state.
- /// System.String.
- protected string GetVideoDecoder(EncodingJob state)
- {
- if (string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
- {
- return null;
- }
-
- // Only use alternative encoders for video files.
- // When using concat with folder rips, if the mfx session fails to initialize, ffmpeg will be stuck retrying and will not exit gracefully
- // Since transcoding of folder rips is expiremental anyway, it's not worth adding additional variables such as this.
- if (state.VideoType != VideoType.VideoFile)
- {
- return null;
- }
-
- if (state.VideoStream != null && !string.IsNullOrWhiteSpace(state.VideoStream.Codec))
- {
- if (string.Equals(GetEncodingOptions().HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
- {
- switch (state.MediaSource.VideoStream.Codec.ToLowerInvariant())
- {
- case "avc":
- case "h264":
- if (MediaEncoder.SupportsDecoder("h264_qsv"))
- {
- // Seeing stalls and failures with decoding. Not worth it compared to encoding.
- return "-c:v h264_qsv ";
- }
- break;
- case "mpeg2video":
- if (MediaEncoder.SupportsDecoder("mpeg2_qsv"))
- {
- return "-c:v mpeg2_qsv ";
- }
- break;
- case "vc1":
- if (MediaEncoder.SupportsDecoder("vc1_qsv"))
- {
- return "-c:v vc1_qsv ";
- }
- break;
- }
- }
- }
-
- // leave blank so ffmpeg will decide
- return null;
- }
-
- private async Task AcquireResources(EncodingJob state, CancellationToken cancellationToken)
- {
- if (state.VideoType == VideoType.Iso && state.IsoType.HasValue && IsoManager.CanMount(state.MediaPath))
- {
- state.IsoMount = await IsoManager.Mount(state.MediaPath, cancellationToken).ConfigureAwait(false);
- }
-
- if (state.MediaSource.RequiresOpening && string.IsNullOrWhiteSpace(state.Options.LiveStreamId))
- {
- var liveStreamResponse = await MediaSourceManager.OpenLiveStream(new LiveStreamRequest
- {
- OpenToken = state.MediaSource.OpenToken
-
- }, cancellationToken).ConfigureAwait(false);
-
- EncodingHelper.AttachMediaSourceInfo(state, liveStreamResponse.MediaSource, null);
-
- if (state.IsVideoRequest)
- {
- EncodingHelper.TryStreamCopy(state);
- }
- }
-
- if (state.MediaSource.BufferMs.HasValue)
- {
- await Task.Delay(state.MediaSource.BufferMs.Value, cancellationToken).ConfigureAwait(false);
- }
- }
- }
-}
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
deleted file mode 100644
index cd7de94ce1..0000000000
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
+++ /dev/null
@@ -1,147 +0,0 @@
-using System;
-using System.IO;
-using System.Threading.Tasks;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.MediaEncoding;
-using MediaBrowser.Model.Dlna;
-using Microsoft.Extensions.Logging;
-
-namespace MediaBrowser.MediaEncoding.Encoder
-{
- public class EncodingJob : EncodingJobInfo, IDisposable
- {
- public bool HasExited { get; internal set; }
- public bool IsCancelled { get; internal set; }
-
- public Stream LogFileStream { get; set; }
- public TaskCompletionSource TaskCompletionSource;
-
- public EncodingJobOptions Options
- {
- get => (EncodingJobOptions)BaseRequest;
- set => BaseRequest = value;
- }
-
- public Guid Id { get; set; }
-
- public bool EstimateContentLength { get; set; }
- public TranscodeSeekInfo TranscodeSeekInfo { get; set; }
-
- public string ItemType { get; set; }
-
- private readonly ILogger _logger;
- private readonly IMediaSourceManager _mediaSourceManager;
-
- public EncodingJob(ILogger logger, IMediaSourceManager mediaSourceManager) :
- base(TranscodingJobType.Progressive)
- {
- _logger = logger;
- _mediaSourceManager = mediaSourceManager;
- Id = Guid.NewGuid();
-
- TaskCompletionSource = new TaskCompletionSource();
- }
-
- public override void Dispose()
- {
- DisposeLiveStream();
- DisposeLogStream();
- DisposeIsoMount();
- }
-
- private void DisposeLogStream()
- {
- if (LogFileStream != null)
- {
- try
- {
- LogFileStream.Dispose();
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error disposing log stream");
- }
-
- LogFileStream = null;
- }
- }
-
- private async void DisposeLiveStream()
- {
- if (MediaSource.RequiresClosing && string.IsNullOrWhiteSpace(Options.LiveStreamId) && !string.IsNullOrWhiteSpace(MediaSource.LiveStreamId))
- {
- try
- {
- await _mediaSourceManager.CloseLiveStream(MediaSource.LiveStreamId).ConfigureAwait(false);
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error closing media source");
- }
- }
- }
-
-
- private void DisposeIsoMount()
- {
- if (IsoMount != null)
- {
- try
- {
- IsoMount.Dispose();
- }
- catch (Exception ex)
- {
- _logger.LogError("Error disposing iso mount", ex);
- }
-
- IsoMount = null;
- }
- }
-
- public void ReportTranscodingProgress(TimeSpan? transcodingPosition, float? framerate, double? percentComplete, long? bytesTranscoded, int? bitRate)
- {
- var ticks = transcodingPosition.HasValue ? transcodingPosition.Value.Ticks : (long?)null;
-
- //job.Framerate = framerate;
-
- if (!percentComplete.HasValue && ticks.HasValue && RunTimeTicks.HasValue)
- {
- var pct = ticks.Value / RunTimeTicks.Value;
- percentComplete = pct * 100;
- }
-
- if (percentComplete.HasValue)
- {
- Progress.Report(percentComplete.Value);
- }
-
- /*
- job.TranscodingPositionTicks = ticks;
- job.BytesTranscoded = bytesTranscoded;
-
- var deviceId = Options.DeviceId;
-
- if (!string.IsNullOrWhiteSpace(deviceId))
- {
- var audioCodec = ActualOutputVideoCodec;
- var videoCodec = ActualOutputVideoCodec;
-
- SessionManager.ReportTranscodingInfo(deviceId, new TranscodingInfo
- {
- Bitrate = job.TotalOutputBitrate,
- AudioCodec = audioCodec,
- VideoCodec = videoCodec,
- Container = job.Options.OutputContainer,
- Framerate = framerate,
- CompletionPercentage = percentComplete,
- Width = job.OutputWidth,
- Height = job.OutputHeight,
- AudioChannels = job.OutputAudioChannels,
- IsAudioDirect = string.Equals(job.OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase),
- IsVideoDirect = string.Equals(job.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase)
- });
- }*/
- }
- }
-}
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
deleted file mode 100644
index 5f84a03223..0000000000
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
+++ /dev/null
@@ -1,225 +0,0 @@
-using System;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using MediaBrowser.Common.Configuration;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.MediaEncoding;
-using MediaBrowser.Model.Dlna;
-using MediaBrowser.Model.Entities;
-using Microsoft.Extensions.Logging;
-
-namespace MediaBrowser.MediaEncoding.Encoder
-{
- public class EncodingJobFactory
- {
- private readonly ILogger _logger;
- private readonly ILibraryManager _libraryManager;
- private readonly IMediaSourceManager _mediaSourceManager;
- private readonly IMediaEncoder _mediaEncoder;
-
- public EncodingJobFactory(ILogger logger, ILibraryManager libraryManager, IMediaSourceManager mediaSourceManager, IMediaEncoder mediaEncoder)
- {
- _logger = logger;
- _libraryManager = libraryManager;
- _mediaSourceManager = mediaSourceManager;
- _mediaEncoder = mediaEncoder;
- }
-
- public async Task CreateJob(EncodingJobOptions options, EncodingHelper encodingHelper, bool isVideoRequest, IProgress progress, CancellationToken cancellationToken)
- {
- var request = options;
-
- if (string.IsNullOrEmpty(request.AudioCodec))
- {
- request.AudioCodec = InferAudioCodec(request.Container);
- }
-
- var state = new EncodingJob(_logger, _mediaSourceManager)
- {
- Options = options,
- IsVideoRequest = isVideoRequest,
- Progress = progress
- };
-
- if (!string.IsNullOrWhiteSpace(request.VideoCodec))
- {
- state.SupportedVideoCodecs = request.VideoCodec.Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray();
- request.VideoCodec = state.SupportedVideoCodecs.FirstOrDefault();
- }
-
- if (!string.IsNullOrWhiteSpace(request.AudioCodec))
- {
- state.SupportedAudioCodecs = request.AudioCodec.Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray();
- request.AudioCodec = state.SupportedAudioCodecs.FirstOrDefault();
- }
-
- if (!string.IsNullOrWhiteSpace(request.SubtitleCodec))
- {
- state.SupportedSubtitleCodecs = request.SubtitleCodec.Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray();
- request.SubtitleCodec = state.SupportedSubtitleCodecs.FirstOrDefault(i => _mediaEncoder.CanEncodeToSubtitleCodec(i))
- ?? state.SupportedSubtitleCodecs.FirstOrDefault();
- }
-
- var item = _libraryManager.GetItemById(request.Id);
- state.ItemType = item.GetType().Name;
-
- state.IsInputVideo = string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase);
-
- // TODO
- // var primaryImage = item.GetImageInfo(ImageType.Primary, 0) ??
- // item.Parents.Select(i => i.GetImageInfo(ImageType.Primary, 0)).FirstOrDefault(i => i != null);
-
- // if (primaryImage != null)
- // {
- // state.AlbumCoverPath = primaryImage.Path;
- // }
-
- // TODO network path substition useful ?
- var mediaSources = await _mediaSourceManager.GetPlayackMediaSources(item, null, true, true, cancellationToken).ConfigureAwait(false);
-
- var mediaSource = string.IsNullOrEmpty(request.MediaSourceId)
- ? mediaSources.First()
- : mediaSources.First(i => string.Equals(i.Id, request.MediaSourceId));
-
- var videoRequest = state.Options;
-
- encodingHelper.AttachMediaSourceInfo(state, mediaSource, null);
-
- //var container = Path.GetExtension(state.RequestedUrl);
-
- //if (string.IsNullOrEmpty(container))
- //{
- // container = request.Static ?
- // state.InputContainer :
- // (Path.GetExtension(GetOutputFilePath(state)) ?? string.Empty).TrimStart('.');
- //}
-
- //state.OutputContainer = (container ?? string.Empty).TrimStart('.');
-
- state.OutputAudioBitrate = encodingHelper.GetAudioBitrateParam(state.Options, state.AudioStream);
-
- state.OutputAudioCodec = state.Options.AudioCodec;
-
- state.OutputAudioChannels = encodingHelper.GetNumAudioChannelsParam(state, state.AudioStream, state.OutputAudioCodec);
-
- if (videoRequest != null)
- {
- state.OutputVideoCodec = state.Options.VideoCodec;
- state.OutputVideoBitrate = encodingHelper.GetVideoBitrateParamValue(state.Options, state.VideoStream, state.OutputVideoCodec);
-
- if (state.OutputVideoBitrate.HasValue)
- {
- var resolution = ResolutionNormalizer.Normalize(
- state.VideoStream?.BitRate,
- state.VideoStream?.Width,
- state.VideoStream?.Height,
- state.OutputVideoBitrate.Value,
- state.VideoStream?.Codec,
- state.OutputVideoCodec,
- videoRequest.MaxWidth,
- videoRequest.MaxHeight);
-
- videoRequest.MaxWidth = resolution.MaxWidth;
- videoRequest.MaxHeight = resolution.MaxHeight;
- }
- }
-
- ApplyDeviceProfileSettings(state);
-
- if (videoRequest != null)
- {
- encodingHelper.TryStreamCopy(state);
- }
-
- //state.OutputFilePath = GetOutputFilePath(state);
-
- return state;
- }
-
- private string InferAudioCodec(string container)
- {
- var ext = "." + (container ?? string.Empty);
-
- if (string.Equals(ext, ".mp3", StringComparison.OrdinalIgnoreCase))
- {
- return "mp3";
- }
- else if (string.Equals(ext, ".aac", StringComparison.OrdinalIgnoreCase))
- {
- return "aac";
- }
- else if (string.Equals(ext, ".wma", StringComparison.OrdinalIgnoreCase))
- {
- return "wma";
- }
- else if (string.Equals(ext, ".ogg", StringComparison.OrdinalIgnoreCase)
- || string.Equals(ext, ".oga", StringComparison.OrdinalIgnoreCase)
- || string.Equals(ext, ".ogv", StringComparison.OrdinalIgnoreCase)
- || string.Equals(ext, ".webm", StringComparison.OrdinalIgnoreCase)
- || string.Equals(ext, ".webma", StringComparison.OrdinalIgnoreCase))
- {
- return "vorbis";
- }
-
- return "copy";
- }
-
- private void ApplyDeviceProfileSettings(EncodingJob state)
- {
- var profile = state.Options.DeviceProfile;
-
- if (profile == null)
- {
- // Don't use settings from the default profile.
- // Only use a specific profile if it was requested.
- return;
- }
-
- var audioCodec = state.ActualOutputAudioCodec;
-
- var videoCodec = state.ActualOutputVideoCodec;
- var outputContainer = state.Options.Container;
-
- var mediaProfile = state.IsVideoRequest ?
- profile.GetAudioMediaProfile(outputContainer, audioCodec, state.OutputAudioChannels, state.OutputAudioBitrate, state.OutputAudioSampleRate, state.OutputAudioBitDepth) :
- profile.GetVideoMediaProfile(outputContainer,
- audioCodec,
- videoCodec,
- state.OutputWidth,
- state.OutputHeight,
- state.TargetVideoBitDepth,
- state.OutputVideoBitrate,
- state.TargetVideoProfile,
- state.TargetVideoLevel,
- state.TargetFramerate,
- state.TargetPacketLength,
- state.TargetTimestamp,
- state.IsTargetAnamorphic,
- state.IsTargetInterlaced,
- state.TargetRefFrames,
- state.TargetVideoStreamCount,
- state.TargetAudioStreamCount,
- state.TargetVideoCodecTag,
- state.IsTargetAVC);
-
- if (mediaProfile != null)
- {
- state.MimeType = mediaProfile.MimeType;
- }
-
- var transcodingProfile = state.IsVideoRequest ?
- profile.GetAudioTranscodingProfile(outputContainer, audioCodec) :
- profile.GetVideoTranscodingProfile(outputContainer, audioCodec, videoCodec);
-
- if (transcodingProfile != null)
- {
- state.EstimateContentLength = transcodingProfile.EstimateContentLength;
- //state.EnableMpegtsM2TsMode = transcodingProfile.EnableMpegtsM2TsMode;
- state.TranscodeSeekInfo = transcodingProfile.TranscodeSeekInfo;
-
- state.Options.CopyTimestamps = transcodingProfile.CopyTimestamps;
- }
- }
- }
-}
diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
index 54344424de..d922f1068a 100644
--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
@@ -878,49 +878,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
}
- public async Task EncodeAudio(EncodingJobOptions options,
- IProgress progress,
- CancellationToken cancellationToken)
- {
- var job = await new AudioEncoder(this,
- _logger,
- ConfigurationManager,
- FileSystem,
- IsoManager,
- LibraryManager,
- SessionManager,
- SubtitleEncoder(),
- MediaSourceManager(),
- _processFactory)
- .Start(options, progress, cancellationToken).ConfigureAwait(false);
-
- await job.TaskCompletionSource.Task.ConfigureAwait(false);
-
- return job.OutputFilePath;
- }
-
- public async Task EncodeVideo(EncodingJobOptions options,
- IProgress progress,
- CancellationToken cancellationToken)
- {
- _logger.LogError("EncodeVideo");
- var job = await new VideoEncoder(this,
- _logger,
- ConfigurationManager,
- FileSystem,
- IsoManager,
- LibraryManager,
- SessionManager,
- SubtitleEncoder(),
- MediaSourceManager(),
- _processFactory)
- .Start(options, progress, cancellationToken).ConfigureAwait(false);
-
- await job.TaskCompletionSource.Task.ConfigureAwait(false);
-
- return job.OutputFilePath;
- }
-
private void StartProcess(ProcessWrapper process)
{
process.Process.Start();
diff --git a/MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs
deleted file mode 100644
index bf23a73bd4..0000000000
--- a/MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using System;
-using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.MediaEncoding;
-using MediaBrowser.Controller.Session;
-using MediaBrowser.Model.Diagnostics;
-using MediaBrowser.Model.IO;
-using Microsoft.Extensions.Logging;
-
-namespace MediaBrowser.MediaEncoding.Encoder
-{
- public class VideoEncoder : BaseEncoder
- {
- public VideoEncoder(MediaEncoder mediaEncoder, ILogger logger, IServerConfigurationManager configurationManager, IFileSystem fileSystem, IIsoManager isoManager, ILibraryManager libraryManager, ISessionManager sessionManager, ISubtitleEncoder subtitleEncoder, IMediaSourceManager mediaSourceManager, IProcessFactory processFactory) : base(mediaEncoder, logger, configurationManager, fileSystem, isoManager, libraryManager, sessionManager, subtitleEncoder, mediaSourceManager, processFactory)
- {
- }
-
- protected override string GetCommandLineArguments(EncodingJob state)
- {
- // Get the output codec name
- var encodingOptions = GetEncodingOptions();
-
- return EncodingHelper.GetProgressiveVideoFullCommandLine(state, encodingOptions, state.OutputFilePath, "superfast");
- }
-
- protected override string GetOutputFileExtension(EncodingJob state)
- {
- var ext = base.GetOutputFileExtension(state);
-
- if (!string.IsNullOrEmpty(ext))
- {
- return ext;
- }
-
- var videoCodec = state.Options.VideoCodec;
-
- if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
- {
- return ".ts";
- }
- if (string.Equals(videoCodec, "theora", StringComparison.OrdinalIgnoreCase))
- {
- return ".ogv";
- }
- if (string.Equals(videoCodec, "vpx", StringComparison.OrdinalIgnoreCase))
- {
- return ".webm";
- }
- if (string.Equals(videoCodec, "wmv", StringComparison.OrdinalIgnoreCase))
- {
- return ".asf";
- }
-
- return null;
- }
-
- protected override bool IsVideoEncoder => true;
- }
-}
From 78e4e2ed929155b433fc0cbb2ea6fc7f64411a72 Mon Sep 17 00:00:00 2001
From: Bond-009
Date: Sat, 2 Feb 2019 21:45:29 +0100
Subject: [PATCH 35/93] Fix all warnings
---
Emby.Drawing/ImageProcessor.cs | 9 -----
.../Library/UserManager.cs | 34 +++++++++----------
.../LiveTv/EmbyTV/EmbyTV.cs | 1 -
.../LiveTv/LiveTvManager.cs | 27 ++++++++-------
.../LiveTv/ILiveTvService.cs | 5 ---
5 files changed, 31 insertions(+), 45 deletions(-)
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs
index f229d9a0b4..097b4c40b7 100644
--- a/Emby.Drawing/ImageProcessor.cs
+++ b/Emby.Drawing/ImageProcessor.cs
@@ -261,15 +261,6 @@ namespace Emby.Drawing
return (cacheFilePath, GetMimeType(outputFormat, cacheFilePath), _fileSystem.GetLastWriteTimeUtc(cacheFilePath));
}
- catch (ArgumentOutOfRangeException ex)
- {
- // Decoder failed to decode it
-#if DEBUG
- _logger.LogError(ex, "Error encoding image");
-#endif
- // Just spit out the original file if all the options are default
- return (originalImagePath, MimeTypes.GetMimeType(originalImagePath), dateModified);
- }
catch (Exception ex)
{
// If it fails for whatever reason, return the original image
diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs
index b33ae72b70..215978341f 100644
--- a/Emby.Server.Implementations/Library/UserManager.cs
+++ b/Emby.Server.Implementations/Library/UserManager.cs
@@ -448,30 +448,30 @@ namespace Emby.Server.Implementations.Library
private void UpdateInvalidLoginAttemptCount(User user, int newValue)
{
- if (user.Policy.InvalidLoginAttemptCount != newValue || newValue > 0)
+ if (user.Policy.InvalidLoginAttemptCount == newValue || newValue <= 0)
{
- user.Policy.InvalidLoginAttemptCount = newValue;
+ return;
+ }
- var maxCount = user.Policy.IsAdministrator ? 3 : 5;
+ user.Policy.InvalidLoginAttemptCount = newValue;
- // TODO: Fix
- /*
- var fireLockout = false;
+ var maxCount = user.Policy.IsAdministrator ? 3 : 5;
- if (newValue >= maxCount)
- {
- _logger.LogDebug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue.ToString(CultureInfo.InvariantCulture));
- user.Policy.IsDisabled = true;
+ var fireLockout = false;
- fireLockout = true;
- }*/
+ if (newValue >= maxCount)
+ {
+ _logger.LogDebug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue);
+ user.Policy.IsDisabled = true;
- UpdateUserPolicy(user, user.Policy, false);
+ fireLockout = true;
+ }
- /* if (fireLockout)
- {
- UserLockedOut?.Invoke(this, new GenericEventArgs(user));
- }*/
+ UpdateUserPolicy(user, user.Policy, false);
+
+ if (fireLockout)
+ {
+ UserLockedOut?.Invoke(this, new GenericEventArgs(user));
}
}
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index bce9c240d5..c5c0ac4638 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -64,7 +64,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
public static EmbyTV Current;
- public event EventHandler DataSourceChanged;
public event EventHandler> TimerCreated;
public event EventHandler> TimerCancelled;
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
index c3437bcdaa..a363028760 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.LiveTv
private readonly LiveTvDtoService _tvDtoService;
- private ILiveTvService[] _services = new ILiveTvService[] { };
+ private ILiveTvService[] _services = Array.Empty();
private ITunerHost[] _tunerHosts = Array.Empty();
private IListingsProvider[] _listingProviders = Array.Empty();
@@ -127,8 +127,6 @@ namespace Emby.Server.Implementations.LiveTv
foreach (var service in _services)
{
- service.DataSourceChanged += service_DataSourceChanged;
-
if (service is EmbyTV.EmbyTV embyTv)
{
embyTv.TimerCreated += EmbyTv_TimerCreated;
@@ -184,14 +182,6 @@ namespace Emby.Server.Implementations.LiveTv
return EmbyTV.EmbyTV.Current.DiscoverTuners(newDevicesOnly, cancellationToken);
}
- void service_DataSourceChanged(object sender, EventArgs e)
- {
- if (!_isDisposed)
- {
- _taskManager.CancelIfRunningAndQueue();
- }
- }
-
public QueryResult GetInternalChannels(LiveTvChannelQuery query, DtoOptions dtoOptions, CancellationToken cancellationToken)
{
var user = query.UserId.Equals(Guid.Empty) ? null : _userManager.GetUserById(query.UserId);
@@ -2153,17 +2143,28 @@ namespace Emby.Server.Implementations.LiveTv
Dispose(true);
}
- private bool _isDisposed = false;
+ private bool _disposed = false;
///
/// Releases unmanaged and - optionally - managed resources.
///
/// true to release both managed and unmanaged resources; false to release only unmanaged resources.
protected virtual void Dispose(bool dispose)
{
+ if (_disposed)
+ {
+ return;
+ }
+
if (dispose)
{
- _isDisposed = true;
+ // TODO: Dispose stuff
}
+
+ _services = null;
+ _listingProviders = null;
+ _tunerHosts = null;
+
+ _disposed = true;
}
private LiveTvServiceInfo[] GetServiceInfos()
diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs
index ba3813d8a1..b71a766485 100644
--- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs
+++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs
@@ -12,11 +12,6 @@ namespace MediaBrowser.Controller.LiveTv
///
public interface ILiveTvService
{
- ///
- /// Occurs when [data source changed].
- ///
- event EventHandler DataSourceChanged;
-
///
/// Gets the name.
///
From ab0e851db987815ad3ab710fb76908c79ee93d13 Mon Sep 17 00:00:00 2001
From: Bond-009
Date: Sat, 2 Feb 2019 23:55:47 +0100
Subject: [PATCH 36/93] Cleanup streaming services
---
MediaBrowser.Api/ApiEntryPoint.cs | 81 ++++++++++++-----
MediaBrowser.Api/BaseApiService.cs | 22 +++--
.../Playback/BaseStreamingService.cs | 91 +++++++++++--------
.../Playback/Hls/BaseHlsService.cs | 39 +++++---
.../Playback/Hls/DynamicHlsService.cs | 27 +++++-
.../Playback/Hls/VideoHlsService.cs | 31 ++++++-
.../Playback/Progressive/AudioService.cs | 28 +++++-
.../BaseProgressiveStreamingService.cs | 29 +++++-
.../Playback/Progressive/VideoService.cs | 28 +++++-
.../Playback/TranscodingThrottler.cs | 19 ++--
.../Playback/UniversalAudioService.cs | 3 -
11 files changed, 297 insertions(+), 101 deletions(-)
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs
index a212d3f3a7..9e5e7f16b4 100644
--- a/MediaBrowser.Api/ApiEntryPoint.cs
+++ b/MediaBrowser.Api/ApiEntryPoint.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
@@ -58,6 +59,8 @@ namespace MediaBrowser.Api
private readonly Dictionary _transcodingLocks =
new Dictionary();
+ private bool _disposed = false;
+
///
/// Initializes a new instance of the class.
///
@@ -66,7 +69,15 @@ namespace MediaBrowser.Api
/// The configuration.
/// The file system.
/// The media source manager.
- public ApiEntryPoint(ILogger logger, ISessionManager sessionManager, IServerConfigurationManager config, IFileSystem fileSystem, IMediaSourceManager mediaSourceManager, ITimerFactory timerFactory, IProcessFactory processFactory, IHttpResultFactory resultFactory)
+ public ApiEntryPoint(
+ ILogger logger,
+ ISessionManager sessionManager,
+ IServerConfigurationManager config,
+ IFileSystem fileSystem,
+ IMediaSourceManager mediaSourceManager,
+ ITimerFactory timerFactory,
+ IProcessFactory processFactory,
+ IHttpResultFactory resultFactory)
{
Logger = logger;
_sessionManager = sessionManager;
@@ -77,9 +88,10 @@ namespace MediaBrowser.Api
ProcessFactory = processFactory;
ResultFactory = resultFactory;
- Instance = this;
_sessionManager.PlaybackProgress += _sessionManager_PlaybackProgress;
_sessionManager.PlaybackStart += _sessionManager_PlaybackStart;
+
+ Instance = this;
}
public static string[] Split(string value, char separator, bool removeEmpty)
@@ -162,8 +174,7 @@ namespace MediaBrowser.Api
{
var path = _config.ApplicationPaths.TranscodingTempPath;
- foreach (var file in _fileSystem.GetFilePaths(path, true)
- .ToList())
+ foreach (var file in _fileSystem.GetFilePaths(path, true))
{
_fileSystem.DeleteFile(file);
}
@@ -184,17 +195,40 @@ namespace MediaBrowser.Api
/// true to release both managed and unmanaged resources; false to release only unmanaged resources.
protected virtual void Dispose(bool dispose)
{
- var list = _activeTranscodingJobs.ToList();
- var jobCount = list.Count;
+ if (_disposed)
+ {
+ return;
+ }
+
+ if (dispose)
+ {
+ // TODO: dispose
+ }
- Parallel.ForEach(list, j => KillTranscodingJob(j, false, path => true));
+ var jobs = _activeTranscodingJobs.ToList();
+ var jobCount = jobs.Count;
- // Try to allow for some time to kill the ffmpeg processes and delete the partial stream files
+ IEnumerable GetKillJobs()
+ {
+ foreach (var job in jobs)
+ {
+ yield return KillTranscodingJob(job, false, path => true);
+ }
+ }
+
+ // Wait for all processes to be killed
if (jobCount > 0)
{
- var task = Task.Delay(1000);
- Task.WaitAll(task);
+ Task.WaitAll(GetKillJobs().ToArray());
}
+
+ _activeTranscodingJobs.Clear();
+ _transcodingLocks.Clear();
+
+ _sessionManager.PlaybackProgress -= _sessionManager_PlaybackProgress;
+ _sessionManager.PlaybackStart -= _sessionManager_PlaybackStart;
+
+ _disposed = true;
}
@@ -211,12 +245,13 @@ namespace MediaBrowser.Api
/// The state.
/// The cancellation token source.
/// TranscodingJob.
- public TranscodingJob OnTranscodeBeginning(string path,
+ public TranscodingJob OnTranscodeBeginning(
+ string path,
string playSessionId,
string liveStreamId,
string transcodingJobId,
TranscodingJobType type,
- IProcess process,
+ Process process,
string deviceId,
StreamState state,
CancellationTokenSource cancellationTokenSource)
@@ -445,7 +480,7 @@ namespace MediaBrowser.Api
/// Called when [transcode kill timer stopped].
///
/// The state.
- private void OnTranscodeKillTimerStopped(object state)
+ private async void OnTranscodeKillTimerStopped(object state)
{
var job = (TranscodingJob)state;
@@ -462,7 +497,7 @@ namespace MediaBrowser.Api
Logger.LogInformation("Transcoding kill timer stopped for JobId {0} PlaySessionId {1}. Killing transcoding", job.Id, job.PlaySessionId);
- KillTranscodingJob(job, true, path => true).GetAwaiter().GetResult();
+ await KillTranscodingJob(job, true, path => true);
}
///
@@ -550,7 +585,7 @@ namespace MediaBrowser.Api
{
if (job.TranscodingThrottler != null)
{
- job.TranscodingThrottler.Stop();
+ job.TranscodingThrottler.Stop().GetAwaiter().GetResult();
}
var process = job.Process;
@@ -561,7 +596,7 @@ namespace MediaBrowser.Api
{
try
{
- Logger.LogInformation("Stopping ffmpeg process with q command for {path}", job.Path);
+ Logger.LogInformation("Stopping ffmpeg process with q command for {Path}", job.Path);
//process.Kill();
process.StandardInput.WriteLine("q");
@@ -569,13 +604,13 @@ namespace MediaBrowser.Api
// Need to wait because killing is asynchronous
if (!process.WaitForExit(5000))
{
- Logger.LogInformation("Killing ffmpeg process for {path}", job.Path);
+ Logger.LogInformation("Killing ffmpeg process for {Path}", job.Path);
process.Kill();
}
}
catch (Exception ex)
{
- Logger.LogError(ex, "Error killing transcoding job for {path}", job.Path);
+ Logger.LogError(ex, "Error killing transcoding job for {Path}", job.Path);
}
}
}
@@ -605,7 +640,7 @@ namespace MediaBrowser.Api
return;
}
- Logger.LogInformation("Deleting partial stream file(s) {0}", path);
+ Logger.LogInformation("Deleting partial stream file(s) {Path}", path);
await Task.Delay(delayMs).ConfigureAwait(false);
@@ -626,13 +661,13 @@ namespace MediaBrowser.Api
}
catch (IOException ex)
{
- Logger.LogError(ex, "Error deleting partial stream file(s) {path}", path);
+ Logger.LogError(ex, "Error deleting partial stream file(s) {Path}", path);
await DeletePartialStreamFiles(path, jobType, retryCount + 1, 500).ConfigureAwait(false);
}
catch (Exception ex)
{
- Logger.LogError(ex, "Error deleting partial stream file(s) {path}", path);
+ Logger.LogError(ex, "Error deleting partial stream file(s) {Path}", path);
}
}
@@ -673,7 +708,7 @@ namespace MediaBrowser.Api
catch (IOException ex)
{
e = ex;
- Logger.LogError(ex, "Error deleting HLS file {path}", file);
+ Logger.LogError(ex, "Error deleting HLS file {Path}", file);
}
}
@@ -717,7 +752,7 @@ namespace MediaBrowser.Api
/// Gets or sets the process.
///
/// The process.
- public IProcess Process { get; set; }
+ public Process Process { get; set; }
public ILogger Logger { get; private set; }
///
/// Gets or sets the active request count.
diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs
index 4a484b7185..7b08a3c529 100644
--- a/MediaBrowser.Api/BaseApiService.cs
+++ b/MediaBrowser.Api/BaseApiService.cs
@@ -43,7 +43,7 @@ namespace MediaBrowser.Api
public static string[] SplitValue(string value, char delim)
{
- if (string.IsNullOrWhiteSpace(value))
+ if (value == null)
{
return Array.Empty();
}
@@ -53,8 +53,14 @@ namespace MediaBrowser.Api
public static Guid[] GetGuids(string value)
{
- // Unfortunately filtermenu.js was using |. This can be deprecated after a while.
- return (value ?? string.Empty).Split(new[] { ',', '|' }, StringSplitOptions.RemoveEmptyEntries).Select(i => new Guid(i)).ToArray();
+ if (value == null)
+ {
+ return Array.Empty();
+ }
+
+ return value.Split(new[] { ',', '|' }, StringSplitOptions.RemoveEmptyEntries)
+ .Select(i => new Guid(i))
+ .ToArray();
}
///
@@ -118,7 +124,8 @@ namespace MediaBrowser.Api
options.Fields = hasFields.GetItemFields();
}
- if (!options.ContainsField(Model.Querying.ItemFields.RecursiveItemCount) || !options.ContainsField(Model.Querying.ItemFields.ChildCount))
+ if (!options.ContainsField(Model.Querying.ItemFields.RecursiveItemCount)
+ || !options.ContainsField(Model.Querying.ItemFields.ChildCount))
{
var client = authContext.GetAuthorizationInfo(Request).Client ?? string.Empty;
if (client.IndexOf("kodi", StringComparison.OrdinalIgnoreCase) != -1 ||
@@ -145,8 +152,7 @@ namespace MediaBrowser.Api
}
}
- var hasDtoOptions = request as IHasDtoOptions;
- if (hasDtoOptions != null)
+ if (request is IHasDtoOptions hasDtoOptions)
{
options.EnableImages = hasDtoOptions.EnableImages ?? true;
@@ -294,7 +300,7 @@ namespace MediaBrowser.Api
return pathInfo[index];
}
- private List Parse(string pathUri)
+ private string[] Parse(string pathUri)
{
var actionParts = pathUri.Split(new[] { "://" }, StringSplitOptions.None);
@@ -308,7 +314,7 @@ namespace MediaBrowser.Api
var args = pathInfo.Split('/');
- return args.Skip(1).ToList();
+ return args.Skip(1).ToArray();
}
///
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index ec42cad33f..641d539f2b 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -68,10 +69,8 @@ namespace MediaBrowser.Api.Playback
protected IDeviceManager DeviceManager { get; private set; }
protected ISubtitleEncoder SubtitleEncoder { get; private set; }
protected IMediaSourceManager MediaSourceManager { get; private set; }
- protected IZipClient ZipClient { get; private set; }
protected IJsonSerializer JsonSerializer { get; private set; }
- public static IServerApplicationHost AppHost;
public static IHttpClient HttpClient;
protected IAuthorizationContext AuthorizationContext { get; private set; }
@@ -80,21 +79,33 @@ namespace MediaBrowser.Api.Playback
///
/// Initializes a new instance of the class.
///
- protected BaseStreamingService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IAuthorizationContext authorizationContext)
+ protected BaseStreamingService(
+ IServerConfigurationManager serverConfig,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IIsoManager isoManager,
+ IMediaEncoder mediaEncoder,
+ IFileSystem fileSystem,
+ IDlnaManager dlnaManager,
+ ISubtitleEncoder subtitleEncoder,
+ IDeviceManager deviceManager,
+ IMediaSourceManager mediaSourceManager,
+ IJsonSerializer jsonSerializer,
+ IAuthorizationContext authorizationContext)
{
- JsonSerializer = jsonSerializer;
- AuthorizationContext = authorizationContext;
- ZipClient = zipClient;
- MediaSourceManager = mediaSourceManager;
- DeviceManager = deviceManager;
- SubtitleEncoder = subtitleEncoder;
- DlnaManager = dlnaManager;
- FileSystem = fileSystem;
ServerConfigurationManager = serverConfig;
UserManager = userManager;
LibraryManager = libraryManager;
IsoManager = isoManager;
MediaEncoder = mediaEncoder;
+ FileSystem = fileSystem;
+ DlnaManager = dlnaManager;
+ SubtitleEncoder = subtitleEncoder;
+ DeviceManager = deviceManager;
+ MediaSourceManager = mediaSourceManager;
+ JsonSerializer = jsonSerializer;
+ AuthorizationContext = authorizationContext;
+
EncodingHelper = new EncodingHelper(MediaEncoder, FileSystem, SubtitleEncoder);
}
@@ -187,7 +198,8 @@ namespace MediaBrowser.Api.Playback
/// The cancellation token source.
/// The working directory.
/// Task.
- protected async Task StartFfMpeg(StreamState state,
+ protected async Task StartFfMpeg(
+ StreamState state,
string outputPath,
CancellationTokenSource cancellationTokenSource,
string workingDirectory = null)
@@ -215,24 +227,27 @@ namespace MediaBrowser.Api.Playback
var transcodingId = Guid.NewGuid().ToString("N");
var commandLineArgs = GetCommandLineArguments(outputPath, encodingOptions, state, true);
- var process = ApiEntryPoint.Instance.ProcessFactory.Create(new ProcessOptions
+ var process = new Process()
{
- CreateNoWindow = true,
- UseShellExecute = false,
-
- // Must consume both stdout and stderr or deadlocks may occur
- //RedirectStandardOutput = true,
- RedirectStandardError = true,
- RedirectStandardInput = true,
-
- FileName = MediaEncoder.EncoderPath,
- Arguments = commandLineArgs,
-
- IsHidden = true,
- ErrorDialog = false,
- EnableRaisingEvents = true,
- WorkingDirectory = !string.IsNullOrWhiteSpace(workingDirectory) ? workingDirectory : null
- });
+ StartInfo = new ProcessStartInfo()
+ {
+ WindowStyle = ProcessWindowStyle.Hidden,
+ CreateNoWindow = true,
+ UseShellExecute = false,
+
+ // Must consume both stdout and stderr or deadlocks may occur
+ //RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ RedirectStandardInput = true,
+
+ FileName = MediaEncoder.EncoderPath,
+ Arguments = commandLineArgs,
+ WorkingDirectory = string.IsNullOrWhiteSpace(workingDirectory) ? null : workingDirectory,
+
+ ErrorDialog = false
+ },
+ EnableRaisingEvents = true
+ };
var transcodingJob = ApiEntryPoint.Instance.OnTranscodeBeginning(outputPath,
state.Request.PlaySessionId,
@@ -248,13 +263,17 @@ namespace MediaBrowser.Api.Playback
Logger.LogInformation(commandLineLogMessage);
var logFilePrefix = "ffmpeg-transcode";
- if (state.VideoRequest != null && string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase) && string.Equals(state.OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
- {
- logFilePrefix = "ffmpeg-directstream";
- }
- else if (state.VideoRequest != null && string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+ if (state.VideoRequest != null)
{
- logFilePrefix = "ffmpeg-remux";
+ if (string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase)
+ && string.Equals(state.OutputAudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
+ {
+ logFilePrefix = "ffmpeg-directstream";
+ }
+ else if (string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
+ {
+ logFilePrefix = "ffmpeg-remux";
+ }
}
var logFilePath = Path.Combine(ServerConfigurationManager.ApplicationPaths.LogDirectoryPath, logFilePrefix + "-" + Guid.NewGuid() + ".txt");
@@ -341,7 +360,7 @@ namespace MediaBrowser.Api.Playback
/// The process.
/// The job.
/// The state.
- private void OnFfMpegProcessExited(IProcess process, TranscodingJob job, StreamState state)
+ private void OnFfMpegProcessExited(Process process, TranscodingJob job, StreamState state)
{
if (job != null)
{
diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
index 08a2183f83..1acc42ea52 100644
--- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
@@ -54,17 +54,6 @@ namespace MediaBrowser.Api.Playback.Hls
/// The type of the transcoding job.
protected override TranscodingJobType TranscodingJobType => TranscodingJobType.Hls;
- ///
- /// Processes the request.
- ///
- /// The request.
- /// if set to true [is live].
- /// System.Object.
- protected async Task ProcessRequest(StreamRequest request, bool isLive)
- {
- return await ProcessRequestAsync(request, isLive).ConfigureAwait(false);
- }
-
///
/// Processes the request async.
///
@@ -74,7 +63,7 @@ namespace MediaBrowser.Api.Playback.Hls
/// A video bitrate is required
/// or
/// An audio bitrate is required
- private async Task ProcessRequestAsync(StreamRequest request, bool isLive)
+ protected async Task ProcessRequestAsync(StreamRequest request, bool isLive)
{
var cancellationTokenSource = new CancellationTokenSource();
@@ -324,7 +313,31 @@ namespace MediaBrowser.Api.Playback.Hls
return 0;
}
- public BaseHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IAuthorizationContext authorizationContext) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer, authorizationContext)
+ public BaseHlsService(
+ IServerConfigurationManager serverConfig,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IIsoManager isoManager,
+ IMediaEncoder mediaEncoder,
+ IFileSystem fileSystem,
+ IDlnaManager dlnaManager,
+ ISubtitleEncoder subtitleEncoder,
+ IDeviceManager deviceManager,
+ IMediaSourceManager mediaSourceManager,
+ IJsonSerializer jsonSerializer,
+ IAuthorizationContext authorizationContext)
+ : base(serverConfig,
+ userManager,
+ libraryManager,
+ isoManager,
+ mediaEncoder,
+ fileSystem,
+ dlnaManager,
+ subtitleEncoder,
+ deviceManager,
+ mediaSourceManager,
+ jsonSerializer,
+ authorizationContext)
{
}
}
diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
index 30696ec979..771573d9a0 100644
--- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
@@ -95,7 +95,32 @@ namespace MediaBrowser.Api.Playback.Hls
public class DynamicHlsService : BaseHlsService
{
- public DynamicHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IAuthorizationContext authorizationContext, INetworkManager networkManager) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer, authorizationContext)
+ public DynamicHlsService(
+ IServerConfigurationManager serverConfig,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IIsoManager isoManager,
+ IMediaEncoder mediaEncoder,
+ IFileSystem fileSystem,
+ IDlnaManager dlnaManager,
+ ISubtitleEncoder subtitleEncoder,
+ IDeviceManager deviceManager,
+ IMediaSourceManager mediaSourceManager,
+ IJsonSerializer jsonSerializer,
+ IAuthorizationContext authorizationContext,
+ INetworkManager networkManager)
+ : base(serverConfig,
+ userManager,
+ libraryManager,
+ isoManager,
+ mediaEncoder,
+ fileSystem,
+ dlnaManager,
+ subtitleEncoder,
+ deviceManager,
+ mediaSourceManager,
+ jsonSerializer,
+ authorizationContext)
{
NetworkManager = networkManager;
}
diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
index 142dc2dfd4..eb1bbfb74b 100644
--- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
@@ -1,4 +1,5 @@
using System;
+using System.Threading.Tasks;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Devices;
using MediaBrowser.Controller.Dlna;
@@ -24,9 +25,9 @@ namespace MediaBrowser.Api.Playback.Hls
[Authenticated]
public class VideoHlsService : BaseHlsService
{
- public object Get(GetLiveHlsStream request)
+ public Task Get(GetLiveHlsStream request)
{
- return ProcessRequest(request, true);
+ return ProcessRequestAsync(request, true);
}
///
@@ -130,7 +131,31 @@ namespace MediaBrowser.Api.Playback.Hls
return args;
}
- public VideoHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IAuthorizationContext authorizationContext) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer, authorizationContext)
+ public VideoHlsService(
+ IServerConfigurationManager serverConfig,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IIsoManager isoManager,
+ IMediaEncoder mediaEncoder,
+ IFileSystem fileSystem,
+ IDlnaManager dlnaManager,
+ ISubtitleEncoder subtitleEncoder,
+ IDeviceManager deviceManager,
+ IMediaSourceManager mediaSourceManager,
+ IJsonSerializer jsonSerializer,
+ IAuthorizationContext authorizationContext)
+ : base(serverConfig,
+ userManager,
+ libraryManager,
+ isoManager,
+ mediaEncoder,
+ fileSystem,
+ dlnaManager,
+ subtitleEncoder,
+ deviceManager,
+ mediaSourceManager,
+ jsonSerializer,
+ authorizationContext)
{
}
}
diff --git a/MediaBrowser.Api/Playback/Progressive/AudioService.cs b/MediaBrowser.Api/Playback/Progressive/AudioService.cs
index 150571ce9a..208a5560d2 100644
--- a/MediaBrowser.Api/Playback/Progressive/AudioService.cs
+++ b/MediaBrowser.Api/Playback/Progressive/AudioService.cs
@@ -32,7 +32,33 @@ namespace MediaBrowser.Api.Playback.Progressive
//[Authenticated]
public class AudioService : BaseProgressiveStreamingService
{
- public AudioService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IAuthorizationContext authorizationContext, IImageProcessor imageProcessor, IEnvironmentInfo environmentInfo) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer, authorizationContext, imageProcessor, environmentInfo)
+ public AudioService(
+ IServerConfigurationManager serverConfig,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IIsoManager isoManager,
+ IMediaEncoder mediaEncoder,
+ IFileSystem fileSystem,
+ IDlnaManager dlnaManager,
+ ISubtitleEncoder subtitleEncoder,
+ IDeviceManager deviceManager,
+ IMediaSourceManager mediaSourceManager,
+ IJsonSerializer jsonSerializer,
+ IAuthorizationContext authorizationContext,
+ IEnvironmentInfo environmentInfo)
+ : base(serverConfig,
+ userManager,
+ libraryManager,
+ isoManager,
+ mediaEncoder,
+ fileSystem,
+ dlnaManager,
+ subtitleEncoder,
+ deviceManager,
+ mediaSourceManager,
+ jsonSerializer,
+ authorizationContext,
+ environmentInfo)
{
}
diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
index 621d1ff88d..c197de1739 100644
--- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
+++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs
@@ -25,12 +25,35 @@ namespace MediaBrowser.Api.Playback.Progressive
///
public abstract class BaseProgressiveStreamingService : BaseStreamingService
{
- protected readonly IImageProcessor ImageProcessor;
protected readonly IEnvironmentInfo EnvironmentInfo;
- public BaseProgressiveStreamingService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IAuthorizationContext authorizationContext, IImageProcessor imageProcessor, IEnvironmentInfo environmentInfo) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer, authorizationContext)
+ public BaseProgressiveStreamingService(
+ IServerConfigurationManager serverConfig,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IIsoManager isoManager,
+ IMediaEncoder mediaEncoder,
+ IFileSystem fileSystem,
+ IDlnaManager dlnaManager,
+ ISubtitleEncoder subtitleEncoder,
+ IDeviceManager deviceManager,
+ IMediaSourceManager mediaSourceManager,
+ IJsonSerializer jsonSerializer,
+ IAuthorizationContext authorizationContext,
+ IEnvironmentInfo environmentInfo)
+ : base(serverConfig,
+ userManager,
+ libraryManager,
+ isoManager,
+ mediaEncoder,
+ fileSystem,
+ dlnaManager,
+ subtitleEncoder,
+ deviceManager,
+ mediaSourceManager,
+ jsonSerializer,
+ authorizationContext)
{
- ImageProcessor = imageProcessor;
EnvironmentInfo = environmentInfo;
}
diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs
index 00b79ccdd2..a0ea5c62d9 100644
--- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs
+++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs
@@ -68,7 +68,33 @@ namespace MediaBrowser.Api.Playback.Progressive
//[Authenticated]
public class VideoService : BaseProgressiveStreamingService
{
- public VideoService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IAuthorizationContext authorizationContext, IImageProcessor imageProcessor, IEnvironmentInfo environmentInfo) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer, authorizationContext, imageProcessor, environmentInfo)
+ public VideoService(
+ IServerConfigurationManager serverConfig,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ IIsoManager isoManager,
+ IMediaEncoder mediaEncoder,
+ IFileSystem fileSystem,
+ IDlnaManager dlnaManager,
+ ISubtitleEncoder subtitleEncoder,
+ IDeviceManager deviceManager,
+ IMediaSourceManager mediaSourceManager,
+ IJsonSerializer jsonSerializer,
+ IAuthorizationContext authorizationContext,
+ IEnvironmentInfo environmentInfo)
+ : base(serverConfig,
+ userManager,
+ libraryManager,
+ isoManager,
+ mediaEncoder,
+ fileSystem,
+ dlnaManager,
+ subtitleEncoder,
+ deviceManager,
+ mediaSourceManager,
+ jsonSerializer,
+ authorizationContext,
+ environmentInfo)
{
}
diff --git a/MediaBrowser.Api/Playback/TranscodingThrottler.cs b/MediaBrowser.Api/Playback/TranscodingThrottler.cs
index 97f21c8f30..9f416098af 100644
--- a/MediaBrowser.Api/Playback/TranscodingThrottler.cs
+++ b/MediaBrowser.Api/Playback/TranscodingThrottler.cs
@@ -1,4 +1,5 @@
using System;
+using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.IO;
@@ -36,7 +37,7 @@ namespace MediaBrowser.Api.Playback
_timer = _timerFactory.Create(TimerCallback, null, 5000, 5000);
}
- private void TimerCallback(object state)
+ private async void TimerCallback(object state)
{
if (_job.HasExited)
{
@@ -48,15 +49,15 @@ namespace MediaBrowser.Api.Playback
if (options.EnableThrottling && IsThrottleAllowed(_job, options.ThrottleDelaySeconds))
{
- PauseTranscoding();
+ await PauseTranscoding();
}
else
{
- UnpauseTranscoding();
+ await UnpauseTranscoding();
}
}
- private void PauseTranscoding()
+ private async Task PauseTranscoding()
{
if (!_isPaused)
{
@@ -64,7 +65,7 @@ namespace MediaBrowser.Api.Playback
try
{
- _job.Process.StandardInput.Write("c");
+ await _job.Process.StandardInput.WriteAsync("c");
_isPaused = true;
}
catch (Exception ex)
@@ -74,7 +75,7 @@ namespace MediaBrowser.Api.Playback
}
}
- public void UnpauseTranscoding()
+ public async Task UnpauseTranscoding()
{
if (_isPaused)
{
@@ -82,7 +83,7 @@ namespace MediaBrowser.Api.Playback
try
{
- _job.Process.StandardInput.WriteLine();
+ await _job.Process.StandardInput.WriteLineAsync();
_isPaused = false;
}
catch (Exception ex)
@@ -153,10 +154,10 @@ namespace MediaBrowser.Api.Playback
return false;
}
- public void Stop()
+ public async Task Stop()
{
DisposeTimer();
- UnpauseTranscoding();
+ await UnpauseTranscoding();
}
public void Dispose()
diff --git a/MediaBrowser.Api/Playback/UniversalAudioService.cs b/MediaBrowser.Api/Playback/UniversalAudioService.cs
index 1aa77792ce..e07770a4c4 100644
--- a/MediaBrowser.Api/Playback/UniversalAudioService.cs
+++ b/MediaBrowser.Api/Playback/UniversalAudioService.cs
@@ -287,7 +287,6 @@ namespace MediaBrowser.Api.Playback
SubtitleEncoder,
DeviceManager,
MediaSourceManager,
- ZipClient,
JsonSerializer,
AuthorizationContext,
NetworkManager)
@@ -334,10 +333,8 @@ namespace MediaBrowser.Api.Playback
SubtitleEncoder,
DeviceManager,
MediaSourceManager,
- ZipClient,
JsonSerializer,
AuthorizationContext,
- ImageProcessor,
EnvironmentInfo)
{
Request = Request
From da2caa29027c2a0a3725c4fd3a08a6674ad374c8 Mon Sep 17 00:00:00 2001
From: Bond-009
Date: Sun, 3 Feb 2019 00:03:07 +0100
Subject: [PATCH 37/93] await async functions
---
MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs | 4 ++--
MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
index 771573d9a0..45f003cae8 100644
--- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
@@ -234,7 +234,7 @@ namespace MediaBrowser.Api.Playback.Hls
// If the playlist doesn't already exist, startup ffmpeg
try
{
- ApiEntryPoint.Instance.KillTranscodingJobs(request.DeviceId, request.PlaySessionId, p => false);
+ await ApiEntryPoint.Instance.KillTranscodingJobs(request.DeviceId, request.PlaySessionId, p => false);
if (currentTranscodingIndex.HasValue)
{
@@ -258,7 +258,7 @@ namespace MediaBrowser.Api.Playback.Hls
job = ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType);
if (job.TranscodingThrottler != null)
{
- job.TranscodingThrottler.UnpauseTranscoding();
+ await job.TranscodingThrottler.UnpauseTranscoding();
}
}
}
diff --git a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
index 02b8379123..6a2c7ae038 100644
--- a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
+++ b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
@@ -102,9 +102,9 @@ namespace MediaBrowser.Api.Playback.Hls
return GetFileResult(file, file);
}
- public void Delete(StopEncodingProcess request)
+ public Task Delete(StopEncodingProcess request)
{
- ApiEntryPoint.Instance.KillTranscodingJobs(request.DeviceId, request.PlaySessionId, path => true);
+ return ApiEntryPoint.Instance.KillTranscodingJobs(request.DeviceId, request.PlaySessionId, path => true);
}
///
From cb7bffc233bcdb1dfb2b6be629dc8f13e482cd3b Mon Sep 17 00:00:00 2001
From: Bond-009
Date: Sun, 3 Feb 2019 00:15:28 +0100
Subject: [PATCH 38/93] Remove unused string split
---
MediaBrowser.Api/BaseApiService.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs
index 7b08a3c529..451ee72dd9 100644
--- a/MediaBrowser.Api/BaseApiService.cs
+++ b/MediaBrowser.Api/BaseApiService.cs
@@ -58,7 +58,7 @@ namespace MediaBrowser.Api
return Array.Empty();
}
- return value.Split(new[] { ',', '|' }, StringSplitOptions.RemoveEmptyEntries)
+ return value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select(i => new Guid(i))
.ToArray();
}
From 548270772c8d868f6eac403d90741c0def977143 Mon Sep 17 00:00:00 2001
From: dkanada
Date: Thu, 31 Jan 2019 03:11:43 +0900
Subject: [PATCH 39/93] add PluginUpdateTask back into source
---
.../ScheduledTasks/PluginUpdateTask.cs | 142 ++++++++++++++++++
1 file changed, 142 insertions(+)
create mode 100644 Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs
diff --git a/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs
new file mode 100644
index 0000000000..fad49ee518
--- /dev/null
+++ b/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs
@@ -0,0 +1,142 @@
+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
+{
+ ///
+ /// Plugin Update Task
+ ///
+ public class PluginUpdateTask : IScheduledTask, IConfigurableScheduledTask
+ {
+ ///
+ /// The _logger
+ ///
+ 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;
+ }
+
+ ///
+ /// Creates the triggers that define when the task will run
+ ///
+ /// IEnumerable{BaseTaskTrigger}.
+ public IEnumerable 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"; }
+ }
+
+ ///
+ /// Update installed plugins
+ ///
+ /// The cancellation token.
+ /// The progress.
+ /// Task.
+ public async Task Execute(CancellationToken cancellationToken, IProgress 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(), 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);
+ }
+
+ ///
+ /// Gets the name of the task
+ ///
+ /// The name.
+ public string Name
+ {
+ get { return "Check for plugin updates"; }
+ }
+
+ ///
+ /// Gets the description.
+ ///
+ /// The description.
+ 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;
+ }
+}
From 7e3c45c917d707fcea048b2fe9621cf0774e3f98 Mon Sep 17 00:00:00 2001
From: dkanada
Date: Thu, 31 Jan 2019 03:16:31 +0900
Subject: [PATCH 40/93] fix build errors and update plugin manifest location
---
CONTRIBUTORS.md | 1 +
.../ScheduledTasks/PluginUpdateTask.cs | 8 ++++----
.../Updates/InstallationManager.cs | 12 ++++--------
3 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index eca16ad382..5e3455fba5 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -15,6 +15,7 @@
- [cvium](https://github.com/cvium)
- [wtayl0r](https://github.com/wtayl0r)
- [TtheCreator](https://github.com/Tthecreator)
+ - [dkanada](https://github.com/dkanada)
- [LogicalPhallacy](https://github.com/LogicalPhallacy/)
- [RazeLighter777](https://github.com/RazeLighter777)
diff --git a/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs
index fad49ee518..62533a0173 100644
--- a/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Common;
using MediaBrowser.Common.Updates;
-using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Net;
using System;
using System.Collections.Generic;
@@ -10,6 +9,7 @@ using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Progress;
using MediaBrowser.Model.Tasks;
+using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.ScheduledTasks
{
@@ -65,7 +65,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
progress.Report(0);
- var packagesToInstall = (await _installationManager.GetAvailablePluginUpdates(_appHost.ApplicationVersion, true, cancellationToken).ConfigureAwait(false)).ToList();
+ var packagesToInstall = (await _installationManager.GetAvailablePluginUpdates(typeof(PluginUpdateTask).Assembly.GetName().Version, true, cancellationToken).ConfigureAwait(false)).ToList();
progress.Report(10);
@@ -89,11 +89,11 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
catch (HttpException ex)
{
- _logger.ErrorException("Error downloading {0}", ex, package.name);
+ _logger.LogError(ex, "Error downloading {0}", package.name);
}
catch (IOException ex)
{
- _logger.ErrorException("Error updating {0}", ex, package.name);
+ _logger.LogError(ex, "Error updating {0}", package.name);
}
// Update progress
diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs
index 9a49b97c71..637c4d4f33 100644
--- a/Emby.Server.Implementations/Updates/InstallationManager.cs
+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs
@@ -169,10 +169,8 @@ namespace Emby.Server.Implementations.Updates
string packageType = null,
Version applicationVersion = null)
{
- // TODO cvium: when plugins get back this would need to be fixed
- // var packages = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
-
- return Task.FromResult(new List()); //FilterPackages(packages, packageType, applicationVersion);
+ var packages = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
+ return FilterPackages(packages, packageType, applicationVersion);
}
///
@@ -184,12 +182,10 @@ namespace Emby.Server.Implementations.Updates
{
using (var response = await _httpClient.SendAsync(new HttpRequestOptions
{
- Url = "https://www.mb3admin.local/admin/service/EmbyPackages.json",
+ Url = "https://repo.jellyfin.org/releases/plugin/manifest.json",
CancellationToken = cancellationToken,
Progress = new SimpleProgress(),
- CacheLength = GetCacheLength(),
- CacheMode = CacheMode.Unconditional
-
+ CacheLength = GetCacheLength()
}, "GET").ConfigureAwait(false))
{
using (var stream = response.Content)
From 07072d9f7bf269926a4d7aad580e2e78c444a2cd Mon Sep 17 00:00:00 2001
From: dkanada
Date: Thu, 31 Jan 2019 15:12:18 +0900
Subject: [PATCH 41/93] move all scheduled tasks and triggers into folders
---
Emby.Server.Implementations/Emby.Server.Implementations.csproj | 3 +++
.../ScheduledTasks/{ => Tasks}/ChapterImagesTask.cs | 0
.../ScheduledTasks/{ => Tasks}/PeopleValidationTask.cs | 0
.../ScheduledTasks/{ => Tasks}/PluginUpdateTask.cs | 0
.../ScheduledTasks/{ => Tasks}/RefreshMediaLibraryTask.cs | 0
.../ScheduledTasks/{ => Triggers}/DailyTrigger.cs | 0
.../ScheduledTasks/{ => Triggers}/IntervalTrigger.cs | 0
.../ScheduledTasks/{ => Triggers}/StartupTrigger.cs | 0
.../ScheduledTasks/{ => Triggers}/WeeklyTrigger.cs | 0
9 files changed, 3 insertions(+)
rename Emby.Server.Implementations/ScheduledTasks/{ => Tasks}/ChapterImagesTask.cs (100%)
rename Emby.Server.Implementations/ScheduledTasks/{ => Tasks}/PeopleValidationTask.cs (100%)
rename Emby.Server.Implementations/ScheduledTasks/{ => Tasks}/PluginUpdateTask.cs (100%)
rename Emby.Server.Implementations/ScheduledTasks/{ => Tasks}/RefreshMediaLibraryTask.cs (100%)
rename Emby.Server.Implementations/ScheduledTasks/{ => Triggers}/DailyTrigger.cs (100%)
rename Emby.Server.Implementations/ScheduledTasks/{ => Triggers}/IntervalTrigger.cs (100%)
rename Emby.Server.Implementations/ScheduledTasks/{ => Triggers}/StartupTrigger.cs (100%)
rename Emby.Server.Implementations/ScheduledTasks/{ => Triggers}/WeeklyTrigger.cs (100%)
diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
index 92e3172f14..daad6f287b 100644
--- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj
+++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
@@ -46,4 +46,7 @@
+
+
+
diff --git a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs
similarity index 100%
rename from Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs
rename to Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs
diff --git a/Emby.Server.Implementations/ScheduledTasks/PeopleValidationTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs
similarity index 100%
rename from Emby.Server.Implementations/ScheduledTasks/PeopleValidationTask.cs
rename to Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs
diff --git a/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs
similarity index 100%
rename from Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs
rename to Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs
diff --git a/Emby.Server.Implementations/ScheduledTasks/RefreshMediaLibraryTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.cs
similarity index 100%
rename from Emby.Server.Implementations/ScheduledTasks/RefreshMediaLibraryTask.cs
rename to Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.cs
diff --git a/Emby.Server.Implementations/ScheduledTasks/DailyTrigger.cs b/Emby.Server.Implementations/ScheduledTasks/Triggers/DailyTrigger.cs
similarity index 100%
rename from Emby.Server.Implementations/ScheduledTasks/DailyTrigger.cs
rename to Emby.Server.Implementations/ScheduledTasks/Triggers/DailyTrigger.cs
diff --git a/Emby.Server.Implementations/ScheduledTasks/IntervalTrigger.cs b/Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.cs
similarity index 100%
rename from Emby.Server.Implementations/ScheduledTasks/IntervalTrigger.cs
rename to Emby.Server.Implementations/ScheduledTasks/Triggers/IntervalTrigger.cs
diff --git a/Emby.Server.Implementations/ScheduledTasks/StartupTrigger.cs b/Emby.Server.Implementations/ScheduledTasks/Triggers/StartupTrigger.cs
similarity index 100%
rename from Emby.Server.Implementations/ScheduledTasks/StartupTrigger.cs
rename to Emby.Server.Implementations/ScheduledTasks/Triggers/StartupTrigger.cs
diff --git a/Emby.Server.Implementations/ScheduledTasks/WeeklyTrigger.cs b/Emby.Server.Implementations/ScheduledTasks/Triggers/WeeklyTrigger.cs
similarity index 100%
rename from Emby.Server.Implementations/ScheduledTasks/WeeklyTrigger.cs
rename to Emby.Server.Implementations/ScheduledTasks/Triggers/WeeklyTrigger.cs
From 08ca1337a92c62b68d5a901cdb372b9b6b0a6a02 Mon Sep 17 00:00:00 2001
From: dkanada
Date: Thu, 31 Jan 2019 15:20:34 +0900
Subject: [PATCH 42/93] unhide several scheduled tasks and add missing
properties
---
.../ScheduledTasks/Tasks/ChapterImagesTask.cs | 10 ++++++--
.../Tasks/DeleteCacheFileTask.cs | 6 ++---
.../ScheduledTasks/Tasks/DeleteLogFileTask.cs | 6 ++---
.../Tasks/PeopleValidationTask.cs | 10 ++++++--
.../ScheduledTasks/Tasks/PluginUpdateTask.cs | 24 +++++--------------
.../Tasks/RefreshMediaLibraryTask.cs | 6 +++++
6 files changed, 34 insertions(+), 28 deletions(-)
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs
index 5373b4392b..a6d43a69a1 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs
@@ -68,8 +68,6 @@ namespace Emby.Server.Implementations.ScheduledTasks
};
}
- public string Key => "RefreshChapterImages";
-
///
/// Returns the task to be executed
///
@@ -178,5 +176,13 @@ namespace Emby.Server.Implementations.ScheduledTasks
///
/// The category.
public string Category => "Library";
+
+ public string Key => "RefreshChapterImages";
+
+ public bool IsHidden => false;
+
+ public bool IsEnabled => true;
+
+ public bool IsLogged => true;
}
}
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
index 52077b242e..fc9d57e0b3 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
@@ -164,8 +164,6 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
/// The name.
public string Name => "Cache file cleanup";
- public string Key => "DeleteCacheFiles";
-
///
/// Gets the description.
///
@@ -178,11 +176,13 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
/// The category.
public string Category => "Maintenance";
+ public string Key => "DeleteCacheFiles";
+
///
/// Gets a value indicating whether this instance is hidden.
///
/// true if this instance is hidden; otherwise, false.
- public bool IsHidden => true;
+ public bool IsHidden => false;
public bool IsEnabled => true;
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
index a57fe49457..ddb74ef3e8 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
@@ -81,8 +81,6 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
return Task.CompletedTask;
}
- public string Key => "CleanLogFiles";
-
///
/// Gets the name of the task
///
@@ -101,11 +99,13 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
/// The category.
public string Category => "Maintenance";
+ public string Key => "CleanLogFiles";
+
///
/// Gets a value indicating whether this instance is hidden.
///
/// true if this instance is hidden; otherwise, false.
- public bool IsHidden => true;
+ public bool IsHidden => false;
public bool IsEnabled => true;
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs
index 68031170fd..ebdc6a13e4 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs
@@ -47,8 +47,6 @@ namespace Emby.Server.Implementations.ScheduledTasks
};
}
- public string Key => "RefreshPeople";
-
///
/// Returns the task to be executed
///
@@ -77,5 +75,13 @@ namespace Emby.Server.Implementations.ScheduledTasks
///
/// The category.
public string Category => "Library";
+
+ public string Key => "RefreshPeople";
+
+ public bool IsHidden => false;
+
+ public bool IsEnabled => true;
+
+ public bool IsLogged => true;
}
}
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs
index 62533a0173..8e27b0eb80 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs
@@ -50,11 +50,6 @@ namespace Emby.Server.Implementations.ScheduledTasks
};
}
- public string Key
- {
- get { return "PluginUpdates"; }
- }
-
///
/// Update installed plugins
///
@@ -114,26 +109,19 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// Gets the name of the task
///
/// The name.
- public string Name
- {
- get { return "Check for plugin updates"; }
- }
+ public string Name => "Check for plugin updates";
///
/// Gets the description.
///
/// The description.
- public string Description
- {
- get { return "Downloads and installs updates for plugins that are configured to update automatically."; }
- }
+ public string Description => "Downloads and installs updates for plugins that are configured to update automatically.";
- public string Category
- {
- get { return "Application"; }
- }
+ public string Category => "Application";
+
+ public string Key => "PluginUpdates";
- public bool IsHidden => true;
+ public bool IsHidden => false;
public bool IsEnabled => true;
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.cs
index f6fa64d136..618efd732b 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.cs
@@ -77,5 +77,11 @@ namespace Emby.Server.Implementations.ScheduledTasks
public string Category => "Library";
public string Key => "RefreshLibrary";
+
+ public bool IsHidden => false;
+
+ public bool IsEnabled => true;
+
+ public bool IsLogged => true;
}
}
From aadf7676d1d52b67272d5201ccc9835d02a77c0e Mon Sep 17 00:00:00 2001
From: dkanada
Date: Thu, 31 Jan 2019 15:23:34 +0900
Subject: [PATCH 43/93] remove useless comments
---
.../ScheduledTasks/Tasks/ChapterImagesTask.cs | 12 ------------
.../ScheduledTasks/Tasks/DeleteCacheFileTask.cs | 16 ----------------
.../ScheduledTasks/Tasks/DeleteLogFileTask.cs | 16 ----------------
.../ScheduledTasks/Tasks/PeopleValidationTask.cs | 12 ------------
.../ScheduledTasks/Tasks/PluginUpdateTask.cs | 8 --------
.../Tasks/RefreshMediaLibraryTask.cs | 12 ------------
6 files changed, 76 deletions(-)
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs
index a6d43a69a1..81fdb96d2f 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/ChapterImagesTask.cs
@@ -159,22 +159,10 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
}
- ///
- /// Gets the name of the task
- ///
- /// The name.
public string Name => "Chapter image extraction";
- ///
- /// Gets the description.
- ///
- /// The description.
public string Description => "Creates thumbnails for videos that have chapters.";
- ///
- /// Gets the category.
- ///
- /// The category.
public string Category => "Library";
public string Key => "RefreshChapterImages";
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
index fc9d57e0b3..6ec83b5c0c 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
@@ -158,30 +158,14 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
}
}
- ///
- /// Gets the name of the task
- ///
- /// The name.
public string Name => "Cache file cleanup";
- ///
- /// Gets the description.
- ///
- /// The description.
public string Description => "Deletes cache files no longer needed by the system";
- ///
- /// Gets the category.
- ///
- /// The category.
public string Category => "Maintenance";
public string Key => "DeleteCacheFiles";
- ///
- /// Gets a value indicating whether this instance is hidden.
- ///
- /// true if this instance is hidden; otherwise, false.
public bool IsHidden => false;
public bool IsEnabled => true;
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
index ddb74ef3e8..e468c301a9 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
@@ -81,30 +81,14 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
return Task.CompletedTask;
}
- ///
- /// Gets the name of the task
- ///
- /// The name.
public string Name => "Log file cleanup";
- ///
- /// Gets the description.
- ///
- /// The description.
public string Description => string.Format("Deletes log files that are more than {0} days old.", ConfigurationManager.CommonConfiguration.LogFileRetentionDays);
- ///
- /// Gets the category.
- ///
- /// The category.
public string Category => "Maintenance";
public string Key => "CleanLogFiles";
- ///
- /// Gets a value indicating whether this instance is hidden.
- ///
- /// true if this instance is hidden; otherwise, false.
public bool IsHidden => false;
public bool IsEnabled => true;
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs
index ebdc6a13e4..d70799c479 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/PeopleValidationTask.cs
@@ -58,22 +58,10 @@ namespace Emby.Server.Implementations.ScheduledTasks
return _libraryManager.ValidatePeople(cancellationToken, progress);
}
- ///
- /// Gets the name of the task
- ///
- /// The name.
public string Name => "Refresh people";
- ///
- /// Gets the description.
- ///
- /// The description.
public string Description => "Updates metadata for actors and directors in your media library.";
- ///
- /// Gets the category.
- ///
- /// The category.
public string Category => "Library";
public string Key => "RefreshPeople";
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs
index 8e27b0eb80..798dfb2aed 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs
@@ -105,16 +105,8 @@ namespace Emby.Server.Implementations.ScheduledTasks
progress.Report(100);
}
- ///
- /// Gets the name of the task
- ///
- /// The name.
public string Name => "Check for plugin updates";
- ///
- /// Gets the description.
- ///
- /// The description.
public string Description => "Downloads and installs updates for plugins that are configured to update automatically.";
public string Category => "Application";
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.cs
index 618efd732b..1a3d85ad7f 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/RefreshMediaLibraryTask.cs
@@ -58,22 +58,10 @@ namespace Emby.Server.Implementations.ScheduledTasks
return ((LibraryManager)_libraryManager).ValidateMediaLibraryInternal(progress, cancellationToken);
}
- ///
- /// Gets the name.
- ///
- /// The name.
public string Name => "Scan media library";
- ///
- /// Gets the description.
- ///
- /// The description.
public string Description => "Scans your media library and refreshes metatata based on configuration.";
- ///
- /// Gets the category.
- ///
- /// The category.
public string Category => "Library";
public string Key => "RefreshLibrary";
From 9faa68b26f6823d11c9533c5271a82790a0f2139 Mon Sep 17 00:00:00 2001
From: dkanada
Date: Thu, 31 Jan 2019 15:28:02 +0900
Subject: [PATCH 44/93] update subtitle task to match the other scheduled tasks
---
.../MediaInfo/SubtitleScheduledTask.cs | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs
index b7598ef22f..74f41f9df0 100644
--- a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs
+++ b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs
@@ -36,12 +36,6 @@ namespace MediaBrowser.Providers.MediaInfo
_json = json;
}
- public string Name => "Download missing subtitles";
-
- public string Description => "Searches the internet for missing subtitles based on metadata configuration.";
-
- public string Category => "Library";
-
private SubtitleOptions GetOptions()
{
return _config.GetConfiguration("subtitles");
@@ -204,6 +198,18 @@ namespace MediaBrowser.Providers.MediaInfo
};
}
+ public string Name => "Download missing subtitles";
+
+ public string Description => "Searches the internet for missing subtitles based on metadata configuration.";
+
+ public string Category => "Library";
+
public string Key => "DownloadSubtitles";
+
+ public bool IsHidden => false;
+
+ public bool IsEnabled => true;
+
+ public bool IsLogged => true;
}
}
From 52e91243e5e50bf42a7deb234365a1edd84649d1 Mon Sep 17 00:00:00 2001
From: dkanada
Date: Thu, 31 Jan 2019 15:33:39 +0900
Subject: [PATCH 45/93] merge progress calculation into a single line
---
.../ScheduledTasks/Tasks/PluginUpdateTask.cs | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs
index 798dfb2aed..dc3bebe9e9 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs
@@ -95,10 +95,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
lock (progress)
{
numComplete++;
- double percent = numComplete;
- percent /= packagesToInstall.Count;
-
- progress.Report(90 * percent + 10);
+ progress.Report(90 * numComplete / packagesToInstall.Count + 10);
}
}
From c118f111b6eb4d0f665886f294114071ebe051a6 Mon Sep 17 00:00:00 2001
From: dkanada
Date: Fri, 1 Feb 2019 14:45:43 +0900
Subject: [PATCH 46/93] add suggestions from code review
---
Emby.Server.Implementations/Emby.Server.Implementations.csproj | 3 ---
.../ScheduledTasks/Tasks/PluginUpdateTask.cs | 2 +-
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
index daad6f287b..92e3172f14 100644
--- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj
+++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
@@ -46,7 +46,4 @@
-
-
-
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs
index dc3bebe9e9..c6431c311c 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/PluginUpdateTask.cs
@@ -95,7 +95,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
lock (progress)
{
numComplete++;
- progress.Report(90 * numComplete / packagesToInstall.Count + 10);
+ progress.Report(90.0 * numComplete / packagesToInstall.Count + 10);
}
}
From 4d335d8f1394e186ca761c10237f93c85657adf2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20B=C3=BCttner?=
Date: Sat, 2 Feb 2019 18:20:04 +0100
Subject: [PATCH 47/93] Add CentOS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Thomas Büttner
---
deployment/centos-package-x64/Dockerfile | 15 +++++++++++++++
deployment/centos-package-x64/clean.sh | 1 +
deployment/centos-package-x64/package.sh | 1 +
deployment/centos-package-x64/pkg-src | 1 +
.../fedora-package-x64/pkg-src/jellyfin.spec | 13 +++++++------
5 files changed, 25 insertions(+), 6 deletions(-)
create mode 100644 deployment/centos-package-x64/Dockerfile
create mode 120000 deployment/centos-package-x64/clean.sh
create mode 120000 deployment/centos-package-x64/package.sh
create mode 120000 deployment/centos-package-x64/pkg-src
diff --git a/deployment/centos-package-x64/Dockerfile b/deployment/centos-package-x64/Dockerfile
new file mode 100644
index 0000000000..bbe5ffd277
--- /dev/null
+++ b/deployment/centos-package-x64/Dockerfile
@@ -0,0 +1,15 @@
+FROM centos:7
+ARG HOME=/build
+RUN mkdir /build && \
+ yum install -y @buildsys-build rpmdevtools yum-plugins-core && \
+ rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm && \
+ rpmdev-setuptree
+
+WORKDIR /build/rpmbuild
+COPY ./deployment/centos-package-x64/pkg-src/jellyfin.spec SPECS
+COPY ./deployment/centos-package-x64/pkg-src/ SOURCES
+
+RUN spectool -g -R SPECS/jellyfin.spec && \
+ rpmbuild -bs SPECS/jellyfin.spec && \
+ yum-builddep -y SRPMS/jellyfin-*.src.rpm && \
+ rpmbuild -bb SPECS/jellyfin.spec;
\ No newline at end of file
diff --git a/deployment/centos-package-x64/clean.sh b/deployment/centos-package-x64/clean.sh
new file mode 120000
index 0000000000..d6d2d1c091
--- /dev/null
+++ b/deployment/centos-package-x64/clean.sh
@@ -0,0 +1 @@
+../fedora-package-x64/clean.sh
\ No newline at end of file
diff --git a/deployment/centos-package-x64/package.sh b/deployment/centos-package-x64/package.sh
new file mode 120000
index 0000000000..a79de21eba
--- /dev/null
+++ b/deployment/centos-package-x64/package.sh
@@ -0,0 +1 @@
+../fedora-package-x64/package.sh
\ No newline at end of file
diff --git a/deployment/centos-package-x64/pkg-src b/deployment/centos-package-x64/pkg-src
new file mode 120000
index 0000000000..dfd6497cfd
--- /dev/null
+++ b/deployment/centos-package-x64/pkg-src
@@ -0,0 +1 @@
+../fedora-package-x64/pkg-src
\ No newline at end of file
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.spec b/deployment/fedora-package-x64/pkg-src/jellyfin.spec
index 6a4a5870b8..2cf10ef0c0 100644
--- a/deployment/fedora-package-x64/pkg-src/jellyfin.spec
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.spec
@@ -1,9 +1,10 @@
%global debug_package %{nil}
-# jellyfin tag to package
-%global gittag v10.1.0
-# Taglib-sharp commit of the submodule since github archive doesn't include submodules
-%global taglib_commit ee5ab21742b71fd1b87ee24895582327e9e04776
-%global taglib_shortcommit %(c=%{taglib_commit}; echo ${c:0:7})
+# Set the dotnet runtime
+%if 0%{?fedora}
+%global dotnet_runtime fedora-x64
+%else
+%global dotnet_runtime centos-x64
+%endif
AutoReq: no
Name: jellyfin
@@ -51,7 +52,7 @@ Jellyfin is a free software media system that puts you in control of managing an
%install
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
-dotnet publish --configuration Release --output='%{buildroot}%{_libdir}/jellyfin' --self-contained --runtime fedora-x64 Jellyfin.Server
+dotnet publish --configuration Release --output='%{buildroot}%{_libdir}/jellyfin' --self-contained --runtime %{dotnet_runtime} Jellyfin.Server
%{__install} -D -m 0644 LICENSE %{buildroot}%{_datadir}/licenses/%{name}/LICENSE
%{__install} -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d/override.conf
%{__install} -D -m 0644 Jellyfin.Server/Resources/Configuration/logging.json %{buildroot}%{_sysconfdir}/%{name}/logging.json
From 1ce59393625b7af05f4995bade42c6e63ef7288e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20B=C3=BCttner?=
Date: Sat, 2 Feb 2019 19:05:49 +0100
Subject: [PATCH 48/93] optimize rpm dependencies
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Thomas Büttner
---
deployment/fedora-package-x64/pkg-src/jellyfin.spec | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.spec b/deployment/fedora-package-x64/pkg-src/jellyfin.spec
index 2cf10ef0c0..80b0f5fa43 100644
--- a/deployment/fedora-package-x64/pkg-src/jellyfin.spec
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.spec
@@ -6,7 +6,6 @@
%global dotnet_runtime centos-x64
%endif
-AutoReq: no
Name: jellyfin
Version: 10.1.0
Release: 1%{?dist}
@@ -32,13 +31,11 @@ BuildRequires: dotnet-sdk-2.2
# RPMfusion free
Requires: ffmpeg
-# For the update-db-paths.sh script to fix emby paths to jellyfin
-%{?fedora:Recommends: sqlite}
-
# Fedora has openssl1.1 which is incompatible with dotnet
%{?fedora:Requires: compat-openssl10}
-# Disable Automatic Dependency Processing for Centos
-%{?el7:AutoReqProv: no}
+
+# Disable Automatic Dependency Processing
+AutoReqProv: no
%description
Jellyfin is a free software media system that puts you in control of managing and streaming your media.
From d573f2d67164803a1870dc85893ec3b81ea56525 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20B=C3=BCttner?=
Date: Sat, 2 Feb 2019 20:01:29 +0100
Subject: [PATCH 49/93] use cachedir option
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Thomas Büttner
---
deployment/fedora-package-x64/pkg-src/jellyfin.env | 2 +-
deployment/fedora-package-x64/pkg-src/jellyfin.spec | 11 +++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.env b/deployment/fedora-package-x64/pkg-src/jellyfin.env
index f7f041f756..c23bfd4701 100644
--- a/deployment/fedora-package-x64/pkg-src/jellyfin.env
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.env
@@ -21,7 +21,7 @@
JELLYFIN_DATA_DIRECTORY="/var/lib/jellyfin"
JELLYFIN_CONFIG_DIRECTORY="/etc/jellyfin"
JELLYFIN_LOG_DIRECTORY="/var/log/jellyfin"
-JELLYFIN_CACHE_DIRECTORY="/var/log/jellyfin"
+JELLYFIN_CACHE_DIRECTORY="/var/cache/jellyfin"
# In-App service control
JELLYFIN_RESTART_OPT="--restartpath /usr/libexec/jellyfin/restart.sh"
# Additional options for the binary
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.spec b/deployment/fedora-package-x64/pkg-src/jellyfin.spec
index 80b0f5fa43..851c400445 100644
--- a/deployment/fedora-package-x64/pkg-src/jellyfin.spec
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.spec
@@ -61,6 +61,7 @@ EOF
%{__mkdir} -p %{buildroot}%{_sharedstatedir}/jellyfin
%{__mkdir} -p %{buildroot}%{_sysconfdir}/%{name}
%{__mkdir} -p %{buildroot}%{_var}/log/jellyfin
+%{__mkdir} -p %{buildroot}%{_var}/cache/jellyfin
%{__install} -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
%{__install} -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
@@ -88,8 +89,9 @@ EOF
%config(noreplace) %attr(600,root,root) %{_sysconfdir}/sudoers.d/%{name}-sudoers
%config(noreplace) %{_sysconfdir}/systemd/system/%{name}.service.d/override.conf
%config(noreplace) %attr(644,jellyfin,jellyfin) %{_sysconfdir}/%{name}/logging.json
-%attr(-,jellyfin,jellyfin) %dir %{_sharedstatedir}/jellyfin
+%attr(750,jellyfin,jellyfin) %dir %{_sharedstatedir}/jellyfin
%attr(-,jellyfin,jellyfin) %dir %{_var}/log/jellyfin
+%attr(750,jellyfin,jellyfin) %dir %{_var}/cache/jellyfin
%if 0%{?fedora}
%license LICENSE
%else
@@ -104,7 +106,7 @@ getent passwd jellyfin >/dev/null || \
exit 0
%post
-# Move existing configuration to /etc/jellyfin and symlink config to /etc/jellyfin
+# Move existing configuration cache and logs to their new locations and symlink them.
if [ $1 -gt 1 ] ; then
service_state=$(systemctl is-active jellyfin.service)
if [ "${service_state}" = "active" ]; then
@@ -120,6 +122,11 @@ if [ $1 -gt 1 ] ; then
rmdir %{_sharedstatedir}/%{name}/logs
ln -sf %{_var}/log/jellyfin %{_sharedstatedir}/%{name}/logs
fi
+ if [ ! -L %{_sharedstatedir}/%{name}/cache ]; then
+ mv %{_sharedstatedir}/%{name}/cache/* %{_var}/cache/jellyfin
+ rmdir %{_sharedstatedir}/%{name}/cache
+ ln -sf %{_var}/cache/jellyfin %{_sharedstatedir}/%{name}/cache
+ fi
if [ "${service_state}" = "active" ]; then
systemctl start jellyfin.service
fi
From 593c6c071caf908460cb535cee20a8d94080c3b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20B=C3=BCttner?=
Date: Sat, 2 Feb 2019 20:03:05 +0100
Subject: [PATCH 50/93] keep trailing 0 in version
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Thomas Büttner
---
bump_version | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/bump_version b/bump_version
index c3f1a78d50..a63fbf7353 100755
--- a/bump_version
+++ b/bump_version
@@ -68,8 +68,7 @@ new_version="$1"
# Parse the version from the AssemblyVersion
old_version="$(
grep "AssemblyVersion" ${shared_version_file} \
- | sed -E 's/\[assembly: ?AssemblyVersion\("([0-9\.]+)"\)\]/\1/' \
- | sed -E 's/.0$//'
+ | sed -E 's/\[assembly: ?AssemblyVersion\("([0-9\.]+)"\)\]/\1/'
)"
# Set the shared version to the specified new_version
From cb1ff695852348e217b9fb065d94769bb9104953 Mon Sep 17 00:00:00 2001
From: Bond-009
Date: Sun, 3 Feb 2019 21:57:49 +0100
Subject: [PATCH 51/93] Fix build error
---
Emby.Server.Implementations/Updates/InstallationManager.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs
index 637c4d4f33..dc7f57f27d 100644
--- a/Emby.Server.Implementations/Updates/InstallationManager.cs
+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs
@@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.Updates
/// Gets all available packages.
///
/// Task{List{PackageInfo}}.
- public Task> GetAvailablePackages(CancellationToken cancellationToken,
+ public async Task> GetAvailablePackages(CancellationToken cancellationToken,
bool withRegistration = true,
string packageType = null,
Version applicationVersion = null)
From be89d53a9e16e16f434c35e22814f1d9fe3fc16d Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Sun, 3 Feb 2019 20:15:23 -0500
Subject: [PATCH 52/93] Handle new option parser properly
---
.../debian-package-x64/pkg-src/conf/jellyfin | 16 ++++++++++------
.../pkg-src/jellyfin.service | 2 +-
.../fedora-package-x64/pkg-src/jellyfin.env | 19 +++++++++++++------
.../pkg-src/jellyfin.service | 2 +-
4 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/deployment/debian-package-x64/pkg-src/conf/jellyfin b/deployment/debian-package-x64/pkg-src/conf/jellyfin
index c237e2d692..b052b2ec66 100644
--- a/deployment/debian-package-x64/pkg-src/conf/jellyfin
+++ b/deployment/debian-package-x64/pkg-src/conf/jellyfin
@@ -19,13 +19,17 @@ JELLYFIN_LOG_DIRECTORY="/var/log/jellyfin"
JELLYFIN_CACHE_DIRECTORY="/var/cache/jellyfin"
# Restart script for in-app server control
-JELLYFIN_RESTART_OPT="--restartpath /usr/lib/jellyfin/restart.sh"
+JELLYFIN_RESTART_OPT="--restartpath=/usr/lib/jellyfin/restart.sh"
-# [OPTIONAL] ffmpeg binary paths
-#JELLYFIN_FFMPEG_OPTS="--ffmpeg /usr/bin/ffmpeg --ffprobe /usr/bin/ffprobe"
+# [OPTIONAL] ffmpeg binary paths, overriding the UI-configured values
+#JELLYFIN_FFMPEG_OPT="--ffmpeg=/usr/bin/ffmpeg"
+#JELLYFIN_FFPROBE_OPT="--ffprobe=/usr/bin/ffprobe"
-# [OPTIONAL] Additional user-defined options for the binary
-#JELLYFIN_ADD_OPTS=""
+# [OPTIONAL] run Jellyfin as a headless service
+#JELLYFIN_SERVICE_OPT="--service"
+
+# [OPTIONAL] run Jellyfin without the web app
+#JELLYFIN_NOWEBAPP_OPT="--noautorunwebapp"
#
# SysV init/Upstart options
@@ -34,4 +38,4 @@ JELLYFIN_RESTART_OPT="--restartpath /usr/lib/jellyfin/restart.sh"
# Application username
JELLYFIN_USER="jellyfin"
# Full application command
-JELLYFIN_ARGS="--datadir $JELLYFIN_DATA_DIRECTORY --configdir $JELLYFIN_CONFIG_DIRECTORY --logdir $JELLYFIN_LOG_DIRECTORY --cachedir $JELLYFIN_CACHE_DIRECTORY $JELLYFIN_RESTART_OPT $JELLYFIN_FFMPEG_OPTS $JELLYFIN_ADD_OPTS"
+JELLYFIN_ARGS="--datadir=$JELLYFIN_DATA_DIRECTORY --configdir=$JELLYFIN_CONFIG_DIRECTORY --logdir=$JELLYFIN_LOG_DIRECTORY --cachedir=$JELLYFIN_CACHE_DIRECTORY $JELLYFIN_RESTART_OPT $JELLYFIN_FFMPEG_OPT $JELLYFIN_FFPROBE_OPT $JELLYFIN_SERVICE_OPT $JELLFIN_NOWEBAPP_OPT"
diff --git a/deployment/debian-package-x64/pkg-src/jellyfin.service b/deployment/debian-package-x64/pkg-src/jellyfin.service
index ee89d7d4b1..9c6c6667f1 100644
--- a/deployment/debian-package-x64/pkg-src/jellyfin.service
+++ b/deployment/debian-package-x64/pkg-src/jellyfin.service
@@ -6,7 +6,7 @@ After = network.target
Type = simple
EnvironmentFile = /etc/default/jellyfin
User = jellyfin
-ExecStart = /usr/bin/jellyfin --datadir ${JELLYFIN_DATA_DIRECTORY} --configdir ${JELLYFIN_CONFIG_DIRECTORY} --logdir ${JELLYFIN_LOG_DIRECTORY} --cachedir ${JELLYFIN_CACHE_DIRECTORY} ${JELLYFIN_RESTART_OPT} ${JELLYFIN_FFMPEG_OPTS} ${JELLYFIN_ADD_OPTS}
+ExecStart = /usr/bin/jellyfin --datadir=${JELLYFIN_DATA_DIRECTORY} --configdir=${JELLYFIN_CONFIG_DIRECTORY} --logdir=${JELLYFIN_LOG_DIRECTORY} --cachedir=${JELLYFIN_CACHE_DIRECTORY} ${JELLYFIN_RESTART_OPT} ${JELLYFIN_FFMPEG_OPT} ${JELLYFIN_FFPROBE_OPT} ${JELLYFIN_SERVICE_OPT} ${JELLYFIN_NOWEBAPP_OPT}
Restart = on-failure
TimeoutSec = 15
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.env b/deployment/fedora-package-x64/pkg-src/jellyfin.env
index f7f041f756..11d5b0ab04 100644
--- a/deployment/fedora-package-x64/pkg-src/jellyfin.env
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.env
@@ -14,15 +14,22 @@
# General options
#
-# Tell jellyfin wich ffmpeg/ffprobe to use
-# JELLYFIN_FFMPEG="--ffmpeg /usr/bin/ffmpeg --ffprobe /usr/bin/ffprobe"
-
# Program directories
JELLYFIN_DATA_DIRECTORY="/var/lib/jellyfin"
JELLYFIN_CONFIG_DIRECTORY="/etc/jellyfin"
JELLYFIN_LOG_DIRECTORY="/var/log/jellyfin"
JELLYFIN_CACHE_DIRECTORY="/var/log/jellyfin"
+
# In-App service control
-JELLYFIN_RESTART_OPT="--restartpath /usr/libexec/jellyfin/restart.sh"
-# Additional options for the binary
-JELLYFIN_ADD_OPTS=""
+JELLYFIN_RESTART_OPT="--restartpath=/usr/libexec/jellyfin/restart.sh"
+
+# [OPTIONAL] ffmpeg binary paths, overriding the UI-configured values
+#JELLYFIN_FFMPEG_OPT="--ffmpeg=/usr/bin/ffmpeg"
+#JELLYFIN_FFPROBE_OPT="--ffprobe=/usr/bin/ffprobe"
+
+# [OPTIONAL] run Jellyfin as a headless service
+#JELLYFIN_SERVICE_OPT="--service"
+
+# [OPTIONAL] run Jellyfin without the web app
+#JELLYFIN_NOWEBAPP_OPT="--noautorunwebapp"
+
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.service b/deployment/fedora-package-x64/pkg-src/jellyfin.service
index 56703a98ac..d58df9d949 100644
--- a/deployment/fedora-package-x64/pkg-src/jellyfin.service
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.service
@@ -5,7 +5,7 @@ Description=Jellyfin is a free software media system that puts you in control of
[Service]
EnvironmentFile=/etc/sysconfig/jellyfin
WorkingDirectory=/var/lib/jellyfin
-ExecStart=/usr/bin/jellyfin --datadir ${JELLYFIN_DATA_DIRECTORY} --configdir ${JELLYFIN_CONFIG_DIRECTORY} --logdir ${JELLYFIN_LOG_DIRECTORY} --cachedir ${JELLYFIN_CACHE_DIRECTORY} ${JELLYFIN_RESTART_OPT} ${JELLYFIN_ADD_OPTS} ${JELLYFIN_FFMPEG}
+ExecStart=/usr/bin/jellyfin --datadir=${JELLYFIN_DATA_DIRECTORY} --configdir=${JELLYFIN_CONFIG_DIRECTORY} --logdir=${JELLYFIN_LOG_DIRECTORY} --cachedir=${JELLYFIN_CACHE_DIRECTORY} ${JELLYFIN_RESTART_OPT} ${JELLYFIN_FFMPEG_OPT} ${JELLYFIN_FFPROBE_OPT} ${JELLYFIN_SERVICE_OPT} ${JELLYFIN_NOWEBAPP_OPT}
TimeoutSec=15
Restart=on-failure
User=jellyfin
From d351fa0c1e06862fd0cc7c68c0944ee0b8835809 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Sun, 3 Feb 2019 22:57:39 -0500
Subject: [PATCH 53/93] Make Fedora package.sh script use bash
---
deployment/fedora-package-x64/package.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/deployment/fedora-package-x64/package.sh b/deployment/fedora-package-x64/package.sh
index d459cdb243..1d1329b03a 100755
--- a/deployment/fedora-package-x64/package.sh
+++ b/deployment/fedora-package-x64/package.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env sh
+#!/usr/bin/env bash
source ../common.build.sh
From f0e74c2c6b3fa8c94f0da222cde20a6b173db0b0 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Mon, 4 Feb 2019 00:26:23 -0500
Subject: [PATCH 54/93] Fix restart script for Debian
---
.../debian-package-x64/pkg-src/bin/restart.sh | 10 ++++----
.../pkg-src/conf/jellyfin-sudoers | 24 +++++++++----------
2 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/deployment/debian-package-x64/pkg-src/bin/restart.sh b/deployment/debian-package-x64/pkg-src/bin/restart.sh
index a6f4632ba7..738f86727c 100644
--- a/deployment/debian-package-x64/pkg-src/bin/restart.sh
+++ b/deployment/debian-package-x64/pkg-src/bin/restart.sh
@@ -2,10 +2,12 @@
NAME=jellyfin
-restart_cmds=("s6-svc -t /var/run/s6/services/${NAME}" \
- "systemctl restart ${NAME}" \
- "service ${NAME} restart" \
- "/etc/init.d/${NAME} restart")
+restart_cmds=(
+ "systemctl restart ${NAME}"
+ "service ${NAME} restart"
+ "/etc/init.d/${NAME} restart"
+ "s6-svc -t /var/run/s6/services/${NAME}"
+)
for restart_cmd in "${restart_cmds[@]}"; do
cmd=$(echo "$restart_cmd" | awk '{print $1}')
diff --git a/deployment/debian-package-x64/pkg-src/conf/jellyfin-sudoers b/deployment/debian-package-x64/pkg-src/conf/jellyfin-sudoers
index 4eb91366b4..b481ba4ad4 100644
--- a/deployment/debian-package-x64/pkg-src/conf/jellyfin-sudoers
+++ b/deployment/debian-package-x64/pkg-src/conf/jellyfin-sudoers
@@ -10,15 +10,15 @@ Cmnd_Alias STARTSERVER_INITD = /etc/init.d/jellyfin start
Cmnd_Alias STOPSERVER_INITD = /etc/init.d/jellyfin stop
-%jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSV
-%jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSV
-%jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_SYSV
-%jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSTEMD
-%jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSTEMD
-%jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_SYSTEMD
-%jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_INITD
-%jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_INITD
-%jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_INITD
+jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSV
+jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSV
+jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_SYSV
+jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSTEMD
+jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSTEMD
+jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_SYSTEMD
+jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_INITD
+jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_INITD
+jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_INITD
Defaults!RESTARTSERVER_SYSV !requiretty
Defaults!STARTSERVER_SYSV !requiretty
@@ -31,7 +31,7 @@ Defaults!STARTSERVER_INITD !requiretty
Defaults!STOPSERVER_INITD !requiretty
#Allow the server to mount iso images
-%jellyfin ALL=(ALL) NOPASSWD: /bin/mount
-%jellyfin ALL=(ALL) NOPASSWD: /bin/umount
+jellyfin ALL=(ALL) NOPASSWD: /bin/mount
+jellyfin ALL=(ALL) NOPASSWD: /bin/umount
-Defaults:%jellyfin !requiretty
+Defaults:jellyfin !requiretty
From 72beadc74d524a5878feddb1769faab9296d38f7 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Mon, 4 Feb 2019 00:27:00 -0500
Subject: [PATCH 55/93] Fix restart script for Fedora/CentOS
---
.../fedora-package-x64/pkg-src/jellyfin.sudoers | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.sudoers b/deployment/fedora-package-x64/pkg-src/jellyfin.sudoers
index b31d52f7ec..ddd890ce16 100644
--- a/deployment/fedora-package-x64/pkg-src/jellyfin.sudoers
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.sudoers
@@ -4,16 +4,16 @@ Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemctl start jellyfin, /bin/systemc
Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemctl stop jellyfin, /bin/systemctl stop jellyfin
-%jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSTEMD
-%jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSTEMD
-%jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_SYSTEMD
+jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSTEMD
+jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSTEMD
+jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_SYSTEMD
Defaults!RESTARTSERVER_SYSTEMD !requiretty
Defaults!STARTSERVER_SYSTEMD !requiretty
Defaults!STOPSERVER_SYSTEMD !requiretty
# Uncomment to allow the server to mount iso images
-# %jellyfin ALL=(ALL) NOPASSWD: /bin/mount
-# %jellyfin ALL=(ALL) NOPASSWD: /bin/umount
+# jellyfin ALL=(ALL) NOPASSWD: /bin/mount
+# jellyfin ALL=(ALL) NOPASSWD: /bin/umount
-Defaults:%jellyfin !requiretty
+Defaults:jellyfin !requiretty
From ae5514afd62b8f0d4dd73bb9109961292f4dbd59 Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Mon, 4 Feb 2019 18:46:36 +0100
Subject: [PATCH 56/93] Fix loading of rating files
---
.../Emby.Server.Implementations.csproj | 2 +-
.../Localization/LocalizationManager.cs | 38 ++++++++++++-------
2 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
index 92e3172f14..af01001a58 100644
--- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj
+++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
@@ -43,7 +43,7 @@
-
+
diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs
index 262ca24ec5..8651a7dad4 100644
--- a/Emby.Server.Implementations/Localization/LocalizationManager.cs
+++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs
@@ -60,29 +60,35 @@ namespace Emby.Server.Implementations.Localization
public async Task LoadAll()
{
- const string ratingsResource = "Emby.Server.Implementations.Ratings.";
+ const string ratingsResource = "Emby.Server.Implementations.Localization.Ratings.";
Directory.CreateDirectory(LocalizationPath);
var existingFiles = GetRatingsFiles(LocalizationPath).Select(Path.GetFileName);
// Extract from the assembly
- foreach (var resource in _assembly.GetManifestResourceNames()
- .Where(i => i.StartsWith(ratingsResource)))
+ foreach (var resource in _assembly.GetManifestResourceNames())
{
+ if (!resource.StartsWith(ratingsResource))
+ {
+ continue;
+ }
+
string filename = "ratings-" + resource.Substring(ratingsResource.Length);
- if (!existingFiles.Contains(filename))
+ if (existingFiles.Contains(filename))
{
- using (var stream = _assembly.GetManifestResourceStream(resource))
- {
- string target = Path.Combine(LocalizationPath, filename);
- _logger.LogInformation("Extracting ratings to {0}", target);
+ continue;
+ }
- using (var fs = _fileSystem.GetFileStream(target, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
- {
- await stream.CopyToAsync(fs);
- }
+ using (var stream = _assembly.GetManifestResourceStream(resource))
+ {
+ string target = Path.Combine(LocalizationPath, filename);
+ _logger.LogInformation("Extracting ratings to {0}", target);
+
+ using (var fs = _fileSystem.GetFileStream(target, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
+ {
+ await stream.CopyToAsync(fs);
}
}
}
@@ -289,7 +295,8 @@ namespace Emby.Server.Implementations.Localization
/// Dictionary{System.StringParentalRating}.
private async Task LoadRatings(string file)
{
- Dictionary dict = new Dictionary(StringComparer.OrdinalIgnoreCase);
+ Dictionary dict
+ = new Dictionary(StringComparer.OrdinalIgnoreCase);
using (var str = File.OpenRead(file))
using (var reader = new StreamReader(str))
@@ -309,7 +316,10 @@ namespace Emby.Server.Implementations.Localization
dict.Add(parts[0], (new ParentalRating { Name = parts[0], Value = value }));
}
#if DEBUG
- _logger.LogWarning("Misformed line in {Path}", file);
+ else
+ {
+ _logger.LogWarning("Misformed line in {Path}", file);
+ }
#endif
}
}
From 73e8758d84503398a722b8202679b88d08753846 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Sun, 3 Feb 2019 20:28:17 -0500
Subject: [PATCH 57/93] Add weblate translation status to README
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index dfa8457de1..25d13a4777 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,7 @@
+
From 5e8a2db029006d438f9a177fd31c4843dde770ef Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Mon, 4 Feb 2019 18:27:27 -0500
Subject: [PATCH 58/93] Fix up the explicit docs links in the README
---
README.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 25d13a4777..d5eaa8ec23 100644
--- a/README.md
+++ b/README.md
@@ -25,13 +25,13 @@ For more information about the project, please see our [about page](https://jell
Want to get started?
-Choose from Prebuilt Packages or Build from Source, then see our Quickstart guide.
+Choose from Prebuilt Packages or Build from Source, then see our first-time setup guide.
Want to contribute?
-Check out our documentation for guidelines.
+Check out our documentation for guidelines.
New idea or improvement? Something not working right?
-Open an Issue.
+Open an Issue.
From 0ef2b46106937c8acbab8e2a6a1e08affb823d31 Mon Sep 17 00:00:00 2001
From: Claus Vium
Date: Tue, 5 Feb 2019 09:49:46 +0100
Subject: [PATCH 59/93] Remove custom Threading
---
Emby.Dlna/Main/DlnaEntryPoint.cs | 11 ++----
Emby.Dlna/PlayTo/Device.cs | 14 +++-----
Emby.Dlna/PlayTo/PlayToManager.cs | 7 ++--
Emby.Dlna/Ssdp/DeviceDiscovery.cs | 8 ++---
Emby.Notifications/Notifications.cs | 9 ++---
.../ApplicationHost.cs | 14 +++-----
.../EntryPoints/AutomaticRestartEntryPoint.cs | 9 ++---
.../EntryPoints/ExternalPortForwarding.cs | 9 ++---
.../EntryPoints/LibraryChangedNotifier.cs | 13 +++----
.../EntryPoints/UserDataChangeNotifier.cs | 9 ++---
.../IO/FileRefresher.cs | 10 +++---
.../IO/LibraryMonitor.cs | 6 +---
.../Library/MediaSourceManager.cs | 4 ---
.../LiveTv/EmbyTV/EmbyTV.cs | 4 +--
.../LiveTv/EmbyTV/TimerManager.cs | 10 +++---
.../Session/SessionManager.cs | 14 +++-----
.../Threading/CommonTimer.cs | 36 -------------------
.../Threading/TimerFactory.cs | 18 ----------
MediaBrowser.Api/ApiEntryPoint.cs | 15 +++-----
.../Playback/BaseStreamingService.cs | 2 +-
.../Playback/TranscodingThrottler.cs | 10 +++---
.../Net/BasePeriodicWebSocketListener.cs | 19 +++++-----
.../Session/SessionInfo.cs | 8 ++---
MediaBrowser.Model/Threading/ITimer.cs | 10 ------
MediaBrowser.Model/Threading/ITimerFactory.cs | 10 ------
RSSDP/SsdpDeviceLocator.cs | 9 ++---
RSSDP/SsdpDevicePublisher.cs | 9 ++---
27 files changed, 75 insertions(+), 222 deletions(-)
delete mode 100644 Emby.Server.Implementations/Threading/CommonTimer.cs
delete mode 100644 Emby.Server.Implementations/Threading/TimerFactory.cs
delete mode 100644 MediaBrowser.Model/Threading/ITimer.cs
delete mode 100644 MediaBrowser.Model/Threading/ITimerFactory.cs
diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs
index 7398b24cd8..a200065782 100644
--- a/Emby.Dlna/Main/DlnaEntryPoint.cs
+++ b/Emby.Dlna/Main/DlnaEntryPoint.cs
@@ -20,7 +20,6 @@ using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.System;
-using MediaBrowser.Model.Threading;
using MediaBrowser.Model.Xml;
using Microsoft.Extensions.Logging;
using Rssdp;
@@ -49,8 +48,7 @@ namespace Emby.Dlna.Main
private readonly IDeviceDiscovery _deviceDiscovery;
private SsdpDevicePublisher _Publisher;
-
- private readonly ITimerFactory _timerFactory;
+
private readonly ISocketFactory _socketFactory;
private readonly IEnvironmentInfo _environmentInfo;
private readonly INetworkManager _networkManager;
@@ -78,7 +76,6 @@ namespace Emby.Dlna.Main
IDeviceDiscovery deviceDiscovery,
IMediaEncoder mediaEncoder,
ISocketFactory socketFactory,
- ITimerFactory timerFactory,
IEnvironmentInfo environmentInfo,
INetworkManager networkManager,
IUserViewManager userViewManager,
@@ -99,7 +96,6 @@ namespace Emby.Dlna.Main
_deviceDiscovery = deviceDiscovery;
_mediaEncoder = mediaEncoder;
_socketFactory = socketFactory;
- _timerFactory = timerFactory;
_environmentInfo = environmentInfo;
_networkManager = networkManager;
_logger = loggerFactory.CreateLogger("Dlna");
@@ -233,7 +229,7 @@ namespace Emby.Dlna.Main
try
{
- _Publisher = new SsdpDevicePublisher(_communicationsServer, _timerFactory, _environmentInfo.OperatingSystemName, _environmentInfo.OperatingSystemVersion);
+ _Publisher = new SsdpDevicePublisher(_communicationsServer, _environmentInfo.OperatingSystemName, _environmentInfo.OperatingSystemVersion);
_Publisher.LogFunction = LogMessage;
_Publisher.SupportPnpRootDevice = false;
@@ -353,8 +349,7 @@ namespace Emby.Dlna.Main
_userDataManager,
_localization,
_mediaSourceManager,
- _mediaEncoder,
- _timerFactory);
+ _mediaEncoder);
_manager.Start();
}
diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.cs
index 85a522d1cc..e49168d34b 100644
--- a/Emby.Dlna/PlayTo/Device.cs
+++ b/Emby.Dlna/PlayTo/Device.cs
@@ -10,7 +10,6 @@ using Emby.Dlna.Server;
using Emby.Dlna.Ssdp;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace Emby.Dlna.PlayTo
@@ -19,7 +18,7 @@ namespace Emby.Dlna.PlayTo
{
#region Fields & Properties
- private ITimer _timer;
+ private Timer _timer;
public DeviceInfo Properties { get; set; }
@@ -64,21 +63,18 @@ namespace Emby.Dlna.PlayTo
public DateTime DateLastActivity { get; private set; }
public Action OnDeviceUnavailable { get; set; }
- private readonly ITimerFactory _timerFactory;
-
- public Device(DeviceInfo deviceProperties, IHttpClient httpClient, ILogger logger, IServerConfigurationManager config, ITimerFactory timerFactory)
+ public Device(DeviceInfo deviceProperties, IHttpClient httpClient, ILogger logger, IServerConfigurationManager config)
{
Properties = deviceProperties;
_httpClient = httpClient;
_logger = logger;
_config = config;
- _timerFactory = timerFactory;
}
public void Start()
{
_logger.LogDebug("Dlna Device.Start");
- _timer = _timerFactory.Create(TimerCallback, null, 1000, Timeout.Infinite);
+ _timer = new Timer(TimerCallback, null, 1000, Timeout.Infinite);
}
private DateTime _lastVolumeRefresh;
@@ -890,7 +886,7 @@ namespace Emby.Dlna.PlayTo
set;
}
- public static async Task CreateuPnpDeviceAsync(Uri url, IHttpClient httpClient, IServerConfigurationManager config, ILogger logger, ITimerFactory timerFactory, CancellationToken cancellationToken)
+ public static async Task CreateuPnpDeviceAsync(Uri url, IHttpClient httpClient, IServerConfigurationManager config, ILogger logger, CancellationToken cancellationToken)
{
var ssdpHttpClient = new SsdpHttpClient(httpClient, config);
@@ -1001,7 +997,7 @@ namespace Emby.Dlna.PlayTo
}
}
- var device = new Device(deviceProperties, httpClient, logger, config, timerFactory);
+ var device = new Device(deviceProperties, httpClient, logger, config);
return device;
}
diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.cs
index 790625705a..6cce312eef 100644
--- a/Emby.Dlna/PlayTo/PlayToManager.cs
+++ b/Emby.Dlna/PlayTo/PlayToManager.cs
@@ -16,7 +16,6 @@ using MediaBrowser.Model.Events;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Session;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace Emby.Dlna.PlayTo
@@ -39,13 +38,12 @@ namespace Emby.Dlna.PlayTo
private readonly IDeviceDiscovery _deviceDiscovery;
private readonly IMediaSourceManager _mediaSourceManager;
private readonly IMediaEncoder _mediaEncoder;
- private readonly ITimerFactory _timerFactory;
private bool _disposed;
private SemaphoreSlim _sessionLock = new SemaphoreSlim(1, 1);
private CancellationTokenSource _disposeCancellationTokenSource = new CancellationTokenSource();
- public PlayToManager(ILogger logger, ISessionManager sessionManager, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IServerApplicationHost appHost, IImageProcessor imageProcessor, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient, IServerConfigurationManager config, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IMediaEncoder mediaEncoder, ITimerFactory timerFactory)
+ public PlayToManager(ILogger logger, ISessionManager sessionManager, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IServerApplicationHost appHost, IImageProcessor imageProcessor, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient, IServerConfigurationManager config, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IMediaEncoder mediaEncoder)
{
_logger = logger;
_sessionManager = sessionManager;
@@ -61,7 +59,6 @@ namespace Emby.Dlna.PlayTo
_localization = localization;
_mediaSourceManager = mediaSourceManager;
_mediaEncoder = mediaEncoder;
- _timerFactory = timerFactory;
}
public void Start()
@@ -168,7 +165,7 @@ namespace Emby.Dlna.PlayTo
if (controller == null)
{
- var device = await Device.CreateuPnpDeviceAsync(uri, _httpClient, _config, _logger, _timerFactory, cancellationToken).ConfigureAwait(false);
+ var device = await Device.CreateuPnpDeviceAsync(uri, _httpClient, _config, _logger, cancellationToken).ConfigureAwait(false);
string deviceName = device.Properties.Name;
diff --git a/Emby.Dlna/Ssdp/DeviceDiscovery.cs b/Emby.Dlna/Ssdp/DeviceDiscovery.cs
index 89a88705f4..298f68a28e 100644
--- a/Emby.Dlna/Ssdp/DeviceDiscovery.cs
+++ b/Emby.Dlna/Ssdp/DeviceDiscovery.cs
@@ -5,7 +5,6 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Net;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
using Rssdp;
using Rssdp.Infrastructure;
@@ -48,20 +47,17 @@ namespace Emby.Dlna.Ssdp
private SsdpDeviceLocator _deviceLocator;
- private readonly ITimerFactory _timerFactory;
private readonly ISocketFactory _socketFactory;
private ISsdpCommunicationsServer _commsServer;
public DeviceDiscovery(
ILoggerFactory loggerFactory,
IServerConfigurationManager config,
- ISocketFactory socketFactory,
- ITimerFactory timerFactory)
+ ISocketFactory socketFactory)
{
_logger = loggerFactory.CreateLogger(nameof(DeviceDiscovery));
_config = config;
_socketFactory = socketFactory;
- _timerFactory = timerFactory;
}
// Call this method from somewhere in your code to start the search.
@@ -78,7 +74,7 @@ namespace Emby.Dlna.Ssdp
{
if (_listenerCount > 0 && _deviceLocator == null)
{
- _deviceLocator = new SsdpDeviceLocator(_commsServer, _timerFactory);
+ _deviceLocator = new SsdpDeviceLocator(_commsServer);
// (Optional) Set the filter so we only see notifications for devices we care about
// (can be any search target value i.e device type, uuid value etc - any value that appears in the
diff --git a/Emby.Notifications/Notifications.cs b/Emby.Notifications/Notifications.cs
index 045aa6f16d..d3290479f4 100644
--- a/Emby.Notifications/Notifications.cs
+++ b/Emby.Notifications/Notifications.cs
@@ -20,7 +20,6 @@ using MediaBrowser.Model.Events;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Notifications;
using MediaBrowser.Model.Tasks;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace Emby.Notifications
@@ -40,9 +39,8 @@ namespace Emby.Notifications
private readonly ILibraryManager _libraryManager;
private readonly ISessionManager _sessionManager;
private readonly IServerApplicationHost _appHost;
- private readonly ITimerFactory _timerFactory;
- private ITimer LibraryUpdateTimer { get; set; }
+ private Timer LibraryUpdateTimer { get; set; }
private readonly object _libraryChangedSyncLock = new object();
private readonly IConfigurationManager _config;
@@ -52,7 +50,7 @@ namespace Emby.Notifications
private string[] _coreNotificationTypes;
- public Notifications(IInstallationManager installationManager, IActivityManager activityManager, ILocalizationManager localization, IUserManager userManager, ILogger logger, ITaskManager taskManager, INotificationManager notificationManager, ILibraryManager libraryManager, ISessionManager sessionManager, IServerApplicationHost appHost, IConfigurationManager config, IDeviceManager deviceManager, ITimerFactory timerFactory)
+ public Notifications(IInstallationManager installationManager, IActivityManager activityManager, ILocalizationManager localization, IUserManager userManager, ILogger logger, ITaskManager taskManager, INotificationManager notificationManager, ILibraryManager libraryManager, ISessionManager sessionManager, IServerApplicationHost appHost, IConfigurationManager config, IDeviceManager deviceManager)
{
_installationManager = installationManager;
_userManager = userManager;
@@ -64,7 +62,6 @@ namespace Emby.Notifications
_appHost = appHost;
_config = config;
_deviceManager = deviceManager;
- _timerFactory = timerFactory;
_localization = localization;
_activityManager = activityManager;
@@ -159,7 +156,7 @@ namespace Emby.Notifications
{
if (LibraryUpdateTimer == null)
{
- LibraryUpdateTimer = _timerFactory.Create(LibraryUpdateTimerCallback, null, 5000,
+ LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, 5000,
Timeout.Infinite);
}
else
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 365eb58564..3808810cfa 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -43,7 +43,6 @@ using Emby.Server.Implementations.ScheduledTasks;
using Emby.Server.Implementations.Security;
using Emby.Server.Implementations.Serialization;
using Emby.Server.Implementations.Session;
-using Emby.Server.Implementations.Threading;
using Emby.Server.Implementations.TV;
using Emby.Server.Implementations.Updates;
using Emby.Server.Implementations.Xml;
@@ -99,7 +98,6 @@ using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Services;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks;
-using MediaBrowser.Model.Threading;
using MediaBrowser.Model.Updates;
using MediaBrowser.Model.Xml;
using MediaBrowser.Providers.Chapters;
@@ -347,7 +345,6 @@ namespace Emby.Server.Implementations
internal IImageEncoder ImageEncoder { get; private set; }
protected IProcessFactory ProcessFactory { get; private set; }
- protected ITimerFactory TimerFactory { get; private set; }
protected ICryptoProvider CryptographyProvider = new CryptographyProvider();
protected readonly IXmlSerializer XmlSerializer;
@@ -772,9 +769,6 @@ namespace Emby.Server.Implementations
ProcessFactory = new ProcessFactory();
RegisterSingleInstance(ProcessFactory);
- TimerFactory = new TimerFactory();
- RegisterSingleInstance(TimerFactory);
-
var streamHelper = CreateStreamHelper();
ApplicationHost.StreamHelper = streamHelper;
RegisterSingleInstance(streamHelper);
@@ -837,7 +831,7 @@ namespace Emby.Server.Implementations
var musicManager = new MusicManager(LibraryManager);
RegisterSingleInstance(new MusicManager(LibraryManager));
- LibraryMonitor = new LibraryMonitor(LoggerFactory, TaskManager, LibraryManager, ServerConfigurationManager, FileSystemManager, TimerFactory, EnvironmentInfo);
+ LibraryMonitor = new LibraryMonitor(LoggerFactory, TaskManager, LibraryManager, ServerConfigurationManager, FileSystemManager, EnvironmentInfo);
RegisterSingleInstance(LibraryMonitor);
RegisterSingleInstance(() => new SearchEngine(LoggerFactory, LibraryManager, UserManager));
@@ -869,7 +863,7 @@ namespace Emby.Server.Implementations
DeviceManager = new DeviceManager(AuthenticationRepository, JsonSerializer, LibraryManager, LocalizationManager, UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LoggerFactory, NetworkManager);
RegisterSingleInstance(DeviceManager);
- MediaSourceManager = new MediaSourceManager(ItemRepository, ApplicationPaths, LocalizationManager, UserManager, LibraryManager, LoggerFactory, JsonSerializer, FileSystemManager, UserDataManager, TimerFactory, () => MediaEncoder);
+ MediaSourceManager = new MediaSourceManager(ItemRepository, ApplicationPaths, LocalizationManager, UserManager, LibraryManager, LoggerFactory, JsonSerializer, FileSystemManager, UserDataManager, () => MediaEncoder);
RegisterSingleInstance(MediaSourceManager);
SubtitleManager = new SubtitleManager(LoggerFactory, FileSystemManager, LibraryMonitor, MediaSourceManager, LocalizationManager);
@@ -884,7 +878,7 @@ namespace Emby.Server.Implementations
ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, LoggerFactory, ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer, LocalizationManager, HttpClient, ProviderManager);
RegisterSingleInstance(ChannelManager);
- SessionManager = new SessionManager(UserDataManager, LoggerFactory, LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager, MediaSourceManager, TimerFactory);
+ SessionManager = new SessionManager(UserDataManager, LoggerFactory, LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager, MediaSourceManager);
RegisterSingleInstance(SessionManager);
var dlnaManager = new DlnaManager(XmlSerializer, FileSystemManager, ApplicationPaths, LoggerFactory, JsonSerializer, this, assemblyInfo);
@@ -905,7 +899,7 @@ namespace Emby.Server.Implementations
NotificationManager = new NotificationManager(LoggerFactory, UserManager, ServerConfigurationManager);
RegisterSingleInstance(NotificationManager);
- RegisterSingleInstance(new DeviceDiscovery(LoggerFactory, ServerConfigurationManager, SocketFactory, TimerFactory));
+ RegisterSingleInstance(new DeviceDiscovery(LoggerFactory, ServerConfigurationManager, SocketFactory));
ChapterManager = new ChapterManager(LibraryManager, LoggerFactory, ServerConfigurationManager, ItemRepository);
RegisterSingleInstance(ChapterManager);
diff --git a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
index 361656ff2f..19ea093594 100644
--- a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
+++ b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
@@ -9,7 +9,6 @@ using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Tasks;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.EntryPoints
@@ -22,11 +21,10 @@ namespace Emby.Server.Implementations.EntryPoints
private readonly ISessionManager _sessionManager;
private readonly IServerConfigurationManager _config;
private readonly ILiveTvManager _liveTvManager;
- private readonly ITimerFactory _timerFactory;
- private ITimer _timer;
+ private Timer _timer;
- public AutomaticRestartEntryPoint(IServerApplicationHost appHost, ILogger logger, ITaskManager iTaskManager, ISessionManager sessionManager, IServerConfigurationManager config, ILiveTvManager liveTvManager, ITimerFactory timerFactory)
+ public AutomaticRestartEntryPoint(IServerApplicationHost appHost, ILogger logger, ITaskManager iTaskManager, ISessionManager sessionManager, IServerConfigurationManager config, ILiveTvManager liveTvManager)
{
_appHost = appHost;
_logger = logger;
@@ -34,7 +32,6 @@ namespace Emby.Server.Implementations.EntryPoints
_sessionManager = sessionManager;
_config = config;
_liveTvManager = liveTvManager;
- _timerFactory = timerFactory;
}
public Task RunAsync()
@@ -53,7 +50,7 @@ namespace Emby.Server.Implementations.EntryPoints
if (_appHost.HasPendingRestart)
{
- _timer = _timerFactory.Create(TimerCallback, null, TimeSpan.FromMinutes(15), TimeSpan.FromMinutes(15));
+ _timer = new Timer(TimerCallback, null, TimeSpan.FromMinutes(15), TimeSpan.FromMinutes(15));
}
}
diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
index 56c730c800..f26a705867 100644
--- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
+++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
@@ -10,7 +10,6 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
using Mono.Nat;
@@ -24,19 +23,17 @@ namespace Emby.Server.Implementations.EntryPoints
private readonly IServerConfigurationManager _config;
private readonly IDeviceDiscovery _deviceDiscovery;
- private ITimer _timer;
- private readonly ITimerFactory _timerFactory;
+ private Timer _timer;
private NatManager _natManager;
- public ExternalPortForwarding(ILoggerFactory loggerFactory, IServerApplicationHost appHost, IServerConfigurationManager config, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient, ITimerFactory timerFactory)
+ public ExternalPortForwarding(ILoggerFactory loggerFactory, IServerApplicationHost appHost, IServerConfigurationManager config, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient)
{
_logger = loggerFactory.CreateLogger("PortMapper");
_appHost = appHost;
_config = config;
_deviceDiscovery = deviceDiscovery;
_httpClient = httpClient;
- _timerFactory = timerFactory;
_config.ConfigurationUpdated += _config_ConfigurationUpdated1;
}
@@ -94,7 +91,7 @@ namespace Emby.Server.Implementations.EntryPoints
_natManager.StartDiscovery();
}
- _timer = _timerFactory.Create(ClearCreatedRules, null, TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(10));
+ _timer = new Timer(ClearCreatedRules, null, TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(10));
_deviceDiscovery.DeviceDiscovered += _deviceDiscovery_DeviceDiscovered;
diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
index 9b61809c75..0389656477 100644
--- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
@@ -14,7 +14,6 @@ using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Extensions;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.EntryPoints
@@ -29,7 +28,6 @@ namespace Emby.Server.Implementations.EntryPoints
private readonly ISessionManager _sessionManager;
private readonly IUserManager _userManager;
private readonly ILogger _logger;
- private readonly ITimerFactory _timerFactory;
///
/// The _library changed sync lock
@@ -47,7 +45,7 @@ namespace Emby.Server.Implementations.EntryPoints
/// Gets or sets the library update timer.
///
/// The library update timer.
- private ITimer LibraryUpdateTimer { get; set; }
+ private Timer LibraryUpdateTimer { get; set; }
///
/// The library update duration
@@ -56,13 +54,12 @@ namespace Emby.Server.Implementations.EntryPoints
private readonly IProviderManager _providerManager;
- public LibraryChangedNotifier(ILibraryManager libraryManager, ISessionManager sessionManager, IUserManager userManager, ILogger logger, ITimerFactory timerFactory, IProviderManager providerManager)
+ public LibraryChangedNotifier(ILibraryManager libraryManager, ISessionManager sessionManager, IUserManager userManager, ILogger logger, IProviderManager providerManager)
{
_libraryManager = libraryManager;
_sessionManager = sessionManager;
_userManager = userManager;
_logger = logger;
- _timerFactory = timerFactory;
_providerManager = providerManager;
}
@@ -191,7 +188,7 @@ namespace Emby.Server.Implementations.EntryPoints
{
if (LibraryUpdateTimer == null)
{
- LibraryUpdateTimer = _timerFactory.Create(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
+ LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
Timeout.Infinite);
}
else
@@ -225,7 +222,7 @@ namespace Emby.Server.Implementations.EntryPoints
{
if (LibraryUpdateTimer == null)
{
- LibraryUpdateTimer = _timerFactory.Create(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
+ LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
Timeout.Infinite);
}
else
@@ -253,7 +250,7 @@ namespace Emby.Server.Implementations.EntryPoints
{
if (LibraryUpdateTimer == null)
{
- LibraryUpdateTimer = _timerFactory.Create(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
+ LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
Timeout.Infinite);
}
else
diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
index d91a2d5817..774ed09dab 100644
--- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
@@ -10,7 +10,6 @@ using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Session;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.EntryPoints
@@ -23,19 +22,17 @@ namespace Emby.Server.Implementations.EntryPoints
private readonly IUserManager _userManager;
private readonly object _syncLock = new object();
- private ITimer UpdateTimer { get; set; }
- private readonly ITimerFactory _timerFactory;
+ private Timer UpdateTimer { get; set; }
private const int UpdateDuration = 500;
private readonly Dictionary> _changedItems = new Dictionary>();
- public UserDataChangeNotifier(IUserDataManager userDataManager, ISessionManager sessionManager, ILogger logger, IUserManager userManager, ITimerFactory timerFactory)
+ public UserDataChangeNotifier(IUserDataManager userDataManager, ISessionManager sessionManager, ILogger logger, IUserManager userManager)
{
_userDataManager = userDataManager;
_sessionManager = sessionManager;
_logger = logger;
_userManager = userManager;
- _timerFactory = timerFactory;
}
public Task RunAsync()
@@ -56,7 +53,7 @@ namespace Emby.Server.Implementations.EntryPoints
{
if (UpdateTimer == null)
{
- UpdateTimer = _timerFactory.Create(UpdateTimerCallback, null, UpdateDuration,
+ UpdateTimer = new Timer(UpdateTimerCallback, null, UpdateDuration,
Timeout.Infinite);
}
else
diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.cs
index 1cac0ba5c4..3668f6a7ab 100644
--- a/Emby.Server.Implementations/IO/FileRefresher.cs
+++ b/Emby.Server.Implementations/IO/FileRefresher.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Threading;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
@@ -9,7 +10,6 @@ using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.IO
@@ -22,8 +22,7 @@ namespace Emby.Server.Implementations.IO
private IServerConfigurationManager ConfigurationManager { get; set; }
private readonly IFileSystem _fileSystem;
private readonly List _affectedPaths = new List();
- private ITimer _timer;
- private readonly ITimerFactory _timerFactory;
+ private Timer _timer;
private readonly object _timerLock = new object();
public string Path { get; private set; }
@@ -31,7 +30,7 @@ namespace Emby.Server.Implementations.IO
private readonly IEnvironmentInfo _environmentInfo;
private readonly ILibraryManager _libraryManager;
- public FileRefresher(string path, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, ITaskManager taskManager, ILogger logger, ITimerFactory timerFactory, IEnvironmentInfo environmentInfo, ILibraryManager libraryManager1)
+ public FileRefresher(string path, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, ITaskManager taskManager, ILogger logger, IEnvironmentInfo environmentInfo, ILibraryManager libraryManager1)
{
logger.LogDebug("New file refresher created for {0}", path);
Path = path;
@@ -41,7 +40,6 @@ namespace Emby.Server.Implementations.IO
LibraryManager = libraryManager;
TaskManager = taskManager;
Logger = logger;
- _timerFactory = timerFactory;
_environmentInfo = environmentInfo;
_libraryManager = libraryManager1;
AddPath(path);
@@ -90,7 +88,7 @@ namespace Emby.Server.Implementations.IO
if (_timer == null)
{
- _timer = _timerFactory.Create(OnTimerCallback, null, TimeSpan.FromSeconds(ConfigurationManager.Configuration.LibraryMonitorDelay), TimeSpan.FromMilliseconds(-1));
+ _timer = new Timer(OnTimerCallback, null, TimeSpan.FromSeconds(ConfigurationManager.Configuration.LibraryMonitorDelay), TimeSpan.FromMilliseconds(-1));
}
else
{
diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs
index 3a746ef603..11c684b128 100644
--- a/Emby.Server.Implementations/IO/LibraryMonitor.cs
+++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs
@@ -11,7 +11,6 @@ using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.IO
@@ -134,7 +133,6 @@ namespace Emby.Server.Implementations.IO
private IServerConfigurationManager ConfigurationManager { get; set; }
private readonly IFileSystem _fileSystem;
- private readonly ITimerFactory _timerFactory;
private readonly IEnvironmentInfo _environmentInfo;
///
@@ -146,7 +144,6 @@ namespace Emby.Server.Implementations.IO
ILibraryManager libraryManager,
IServerConfigurationManager configurationManager,
IFileSystem fileSystem,
- ITimerFactory timerFactory,
IEnvironmentInfo environmentInfo)
{
if (taskManager == null)
@@ -159,7 +156,6 @@ namespace Emby.Server.Implementations.IO
Logger = loggerFactory.CreateLogger(GetType().Name);
ConfigurationManager = configurationManager;
_fileSystem = fileSystem;
- _timerFactory = timerFactory;
_environmentInfo = environmentInfo;
}
@@ -545,7 +541,7 @@ namespace Emby.Server.Implementations.IO
}
}
- var newRefresher = new FileRefresher(path, _fileSystem, ConfigurationManager, LibraryManager, TaskManager, Logger, _timerFactory, _environmentInfo, LibraryManager);
+ var newRefresher = new FileRefresher(path, _fileSystem, ConfigurationManager, LibraryManager, TaskManager, Logger, _environmentInfo, LibraryManager);
newRefresher.Completed += NewRefresher_Completed;
_activeRefreshers.Add(newRefresher);
}
diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs
index 4f72651d49..24ab8e7619 100644
--- a/Emby.Server.Implementations/Library/MediaSourceManager.cs
+++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs
@@ -20,7 +20,6 @@ using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library
@@ -36,7 +35,6 @@ namespace Emby.Server.Implementations.Library
private IMediaSourceProvider[] _providers;
private readonly ILogger _logger;
private readonly IUserDataManager _userDataManager;
- private readonly ITimerFactory _timerFactory;
private readonly Func _mediaEncoder;
private ILocalizationManager _localizationManager;
private IApplicationPaths _appPaths;
@@ -51,7 +49,6 @@ namespace Emby.Server.Implementations.Library
IJsonSerializer jsonSerializer,
IFileSystem fileSystem,
IUserDataManager userDataManager,
- ITimerFactory timerFactory,
Func mediaEncoder)
{
_itemRepo = itemRepo;
@@ -61,7 +58,6 @@ namespace Emby.Server.Implementations.Library
_jsonSerializer = jsonSerializer;
_fileSystem = fileSystem;
_userDataManager = userDataManager;
- _timerFactory = timerFactory;
_mediaEncoder = mediaEncoder;
_localizationManager = localizationManager;
_appPaths = applicationPaths;
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index b9a42a6ff7..84ca130b76 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -35,7 +35,6 @@ using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Reflection;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
@@ -86,7 +85,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
ILibraryMonitor libraryMonitor,
IProviderManager providerManager,
IMediaEncoder mediaEncoder,
- ITimerFactory timerFactory,
IProcessFactory processFactory)
{
Current = this;
@@ -108,7 +106,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_streamHelper = streamHelper;
_seriesTimerProvider = new SeriesTimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "seriestimers"));
- _timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers"), _logger, timerFactory);
+ _timerProvider = new TimerManager(fileSystem, jsonSerializer, _logger, Path.Combine(DataPath, "timers"), _logger);
_timerProvider.TimerFired += _timerProvider_TimerFired;
_config.NamedConfigurationUpdated += _config_NamedConfigurationUpdated;
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
index 7f67d70a96..1dcb02f43e 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
@@ -2,29 +2,27 @@ using System;
using System.Collections.Concurrent;
using System.Globalization;
using System.Linq;
+using System.Threading;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
public class TimerManager : ItemDataProvider
{
- private readonly ConcurrentDictionary _timers = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase);
+ private readonly ConcurrentDictionary _timers = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase);
private readonly ILogger _logger;
public event EventHandler> TimerFired;
- private readonly ITimerFactory _timerFactory;
- public TimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath, ILogger logger1, ITimerFactory timerFactory)
+ public TimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath, ILogger logger1)
: base(fileSystem, jsonSerializer, logger, dataPath, (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase))
{
_logger = logger1;
- _timerFactory = timerFactory;
}
public void RestartTimers()
@@ -125,7 +123,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
private void StartTimer(TimerInfo item, TimeSpan dueTime)
{
- var timer = _timerFactory.Create(TimerCallback, item.Id, dueTime, TimeSpan.Zero);
+ var timer = new Timer(TimerCallback, item.Id, dueTime, TimeSpan.Zero);
if (_timers.TryAdd(item.Id, timer))
{
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
index b03345e03c..fa0ab62d32 100644
--- a/Emby.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -27,7 +27,6 @@ using MediaBrowser.Model.Library;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Session;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Session
@@ -60,7 +59,6 @@ namespace Emby.Server.Implementations.Session
private readonly IAuthenticationRepository _authRepo;
private readonly IDeviceManager _deviceManager;
- private readonly ITimerFactory _timerFactory;
///
/// The _active connections
@@ -103,8 +101,7 @@ namespace Emby.Server.Implementations.Session
IHttpClient httpClient,
IAuthenticationRepository authRepo,
IDeviceManager deviceManager,
- IMediaSourceManager mediaSourceManager,
- ITimerFactory timerFactory)
+ IMediaSourceManager mediaSourceManager)
{
_userDataManager = userDataManager;
_logger = loggerFactory.CreateLogger(nameof(SessionManager));
@@ -119,7 +116,6 @@ namespace Emby.Server.Implementations.Session
_authRepo = authRepo;
_deviceManager = deviceManager;
_mediaSourceManager = mediaSourceManager;
- _timerFactory = timerFactory;
_deviceManager.DeviceOptionsUpdated += _deviceManager_DeviceOptionsUpdated;
}
@@ -503,13 +499,13 @@ namespace Emby.Server.Implementations.Session
return users;
}
- private ITimer _idleTimer;
+ private Timer _idleTimer;
private void StartIdleCheckTimer()
{
if (_idleTimer == null)
{
- _idleTimer = _timerFactory.Create(CheckForIdlePlayback, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5));
+ _idleTimer = new Timer(CheckForIdlePlayback, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5));
}
}
private void StopIdleCheckTimer()
@@ -606,7 +602,7 @@ namespace Emby.Server.Implementations.Session
ClearTranscodingInfo(session.DeviceId);
}
- session.StartAutomaticProgress(_timerFactory, info);
+ session.StartAutomaticProgress(info);
var users = GetUsers(session);
@@ -717,7 +713,7 @@ namespace Emby.Server.Implementations.Session
if (!isAutomated)
{
- session.StartAutomaticProgress(_timerFactory, info);
+ session.StartAutomaticProgress(info);
}
StartIdleCheckTimer();
diff --git a/Emby.Server.Implementations/Threading/CommonTimer.cs b/Emby.Server.Implementations/Threading/CommonTimer.cs
deleted file mode 100644
index 5a05da564f..0000000000
--- a/Emby.Server.Implementations/Threading/CommonTimer.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using System.Threading;
-using MediaBrowser.Model.Threading;
-
-namespace Emby.Server.Implementations.Threading
-{
- public class CommonTimer : ITimer
- {
- private readonly Timer _timer;
-
- public CommonTimer(Action callback, object state, TimeSpan dueTime, TimeSpan period)
- {
- _timer = new Timer(new TimerCallback(callback), state, dueTime, period);
- }
-
- public CommonTimer(Action callback, object state, int dueTimeMs, int periodMs)
- {
- _timer = new Timer(new TimerCallback(callback), state, dueTimeMs, periodMs);
- }
-
- public void Change(TimeSpan dueTime, TimeSpan period)
- {
- _timer.Change(dueTime, period);
- }
-
- public void Change(int dueTimeMs, int periodMs)
- {
- _timer.Change(dueTimeMs, periodMs);
- }
-
- public void Dispose()
- {
- _timer.Dispose();
- }
- }
-}
diff --git a/Emby.Server.Implementations/Threading/TimerFactory.cs b/Emby.Server.Implementations/Threading/TimerFactory.cs
deleted file mode 100644
index ca50064c7a..0000000000
--- a/Emby.Server.Implementations/Threading/TimerFactory.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using MediaBrowser.Model.Threading;
-
-namespace Emby.Server.Implementations.Threading
-{
- public class TimerFactory : ITimerFactory
- {
- public ITimer Create(Action callback, object state, TimeSpan dueTime, TimeSpan period)
- {
- return new CommonTimer(callback, state, dueTime, period);
- }
-
- public ITimer Create(Action callback, object state, int dueTimeMs, int periodMs)
- {
- return new CommonTimer(callback, state, dueTimeMs, periodMs);
- }
- }
-}
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs
index c1f753190c..8dbc26356d 100644
--- a/MediaBrowser.Api/ApiEntryPoint.cs
+++ b/MediaBrowser.Api/ApiEntryPoint.cs
@@ -18,7 +18,6 @@ using MediaBrowser.Model.Diagnostics;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Session;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api
@@ -48,7 +47,6 @@ namespace MediaBrowser.Api
private readonly ISessionManager _sessionManager;
private readonly IFileSystem _fileSystem;
private readonly IMediaSourceManager _mediaSourceManager;
- public readonly ITimerFactory TimerFactory;
public readonly IProcessFactory ProcessFactory;
///
@@ -75,7 +73,6 @@ namespace MediaBrowser.Api
IServerConfigurationManager config,
IFileSystem fileSystem,
IMediaSourceManager mediaSourceManager,
- ITimerFactory timerFactory,
IProcessFactory processFactory,
IHttpResultFactory resultFactory)
{
@@ -84,7 +81,6 @@ namespace MediaBrowser.Api
_config = config;
_fileSystem = fileSystem;
_mediaSourceManager = mediaSourceManager;
- TimerFactory = timerFactory;
ProcessFactory = processFactory;
ResultFactory = resultFactory;
@@ -260,7 +256,7 @@ namespace MediaBrowser.Api
{
lock (_activeTranscodingJobs)
{
- var job = new TranscodingJob(Logger, TimerFactory)
+ var job = new TranscodingJob(Logger)
{
Type = type,
Path = path,
@@ -765,9 +761,7 @@ namespace MediaBrowser.Api
/// Gets or sets the kill timer.
///
/// The kill timer.
- private ITimer KillTimer { get; set; }
-
- private readonly ITimerFactory _timerFactory;
+ private Timer KillTimer { get; set; }
public string DeviceId { get; set; }
@@ -797,10 +791,9 @@ namespace MediaBrowser.Api
public DateTime LastPingDate { get; set; }
public int PingTimeout { get; set; }
- public TranscodingJob(ILogger logger, ITimerFactory timerFactory)
+ public TranscodingJob(ILogger logger)
{
Logger = logger;
- _timerFactory = timerFactory;
}
public void StopKillTimer()
@@ -843,7 +836,7 @@ namespace MediaBrowser.Api
if (KillTimer == null)
{
//Logger.LogDebug("Starting kill timer at {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId);
- KillTimer = _timerFactory.Create(callback, this, intervalMs, Timeout.Infinite);
+ KillTimer = new Timer(new TimerCallback(callback), this, intervalMs, Timeout.Infinite);
}
else
{
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 641d539f2b..0736862989 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -336,7 +336,7 @@ namespace MediaBrowser.Api.Playback
{
if (EnableThrottling(state))
{
- transcodingJob.TranscodingThrottler = state.TranscodingThrottler = new TranscodingThrottler(transcodingJob, Logger, ServerConfigurationManager, ApiEntryPoint.Instance.TimerFactory, FileSystem);
+ transcodingJob.TranscodingThrottler = state.TranscodingThrottler = new TranscodingThrottler(transcodingJob, Logger, ServerConfigurationManager, FileSystem);
state.TranscodingThrottler.Start();
}
}
diff --git a/MediaBrowser.Api/Playback/TranscodingThrottler.cs b/MediaBrowser.Api/Playback/TranscodingThrottler.cs
index 9f416098af..0e73d77efd 100644
--- a/MediaBrowser.Api/Playback/TranscodingThrottler.cs
+++ b/MediaBrowser.Api/Playback/TranscodingThrottler.cs
@@ -1,9 +1,9 @@
using System;
+using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.Playback
@@ -12,18 +12,16 @@ namespace MediaBrowser.Api.Playback
{
private readonly TranscodingJob _job;
private readonly ILogger _logger;
- private ITimer _timer;
+ private Timer _timer;
private bool _isPaused;
private readonly IConfigurationManager _config;
- private readonly ITimerFactory _timerFactory;
private readonly IFileSystem _fileSystem;
- public TranscodingThrottler(TranscodingJob job, ILogger logger, IConfigurationManager config, ITimerFactory timerFactory, IFileSystem fileSystem)
+ public TranscodingThrottler(TranscodingJob job, ILogger logger, IConfigurationManager config, IFileSystem fileSystem)
{
_job = job;
_logger = logger;
_config = config;
- _timerFactory = timerFactory;
_fileSystem = fileSystem;
}
@@ -34,7 +32,7 @@ namespace MediaBrowser.Api.Playback
public void Start()
{
- _timer = _timerFactory.Create(TimerCallback, null, 5000, 5000);
+ _timer = new Timer(TimerCallback, null, 5000, 5000);
}
private async void TimerCallback(object state)
diff --git a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs
index 4e7e1c8ed2..4242a00e21 100644
--- a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs
+++ b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs
@@ -6,7 +6,6 @@ using System.Net.WebSockets;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Net;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Controller.Net
@@ -23,8 +22,8 @@ namespace MediaBrowser.Controller.Net
///
/// The _active connections
///
- protected readonly List> ActiveConnections =
- new List>();
+ protected readonly List> ActiveConnections =
+ new List>();
///
/// Gets the name.
@@ -44,8 +43,6 @@ namespace MediaBrowser.Controller.Net
///
protected ILogger Logger;
- protected ITimerFactory TimerFactory { get; private set; }
-
protected BasePeriodicWebSocketListener(ILogger logger)
{
if (logger == null)
@@ -111,7 +108,7 @@ namespace MediaBrowser.Controller.Net
Logger.LogDebug("{1} Begin transmitting over websocket to {0}", message.Connection.RemoteEndPoint, GetType().Name);
var timer = SendOnTimer ?
- TimerFactory.Create(TimerCallback, message.Connection, Timeout.Infinite, Timeout.Infinite) :
+ new Timer(TimerCallback, message.Connection, Timeout.Infinite, Timeout.Infinite) :
null;
var state = new TStateType
@@ -122,7 +119,7 @@ namespace MediaBrowser.Controller.Net
lock (ActiveConnections)
{
- ActiveConnections.Add(new Tuple(message.Connection, cancellationTokenSource, timer, state));
+ ActiveConnections.Add(new Tuple(message.Connection, cancellationTokenSource, timer, state));
}
if (timer != null)
@@ -139,7 +136,7 @@ namespace MediaBrowser.Controller.Net
{
var connection = (IWebSocketConnection)state;
- Tuple tuple;
+ Tuple tuple;
lock (ActiveConnections)
{
@@ -162,7 +159,7 @@ namespace MediaBrowser.Controller.Net
protected void SendData(bool force)
{
- Tuple[] tuples;
+ Tuple[] tuples;
lock (ActiveConnections)
{
@@ -190,7 +187,7 @@ namespace MediaBrowser.Controller.Net
}
}
- private async void SendData(Tuple tuple)
+ private async void SendData(Tuple tuple)
{
var connection = tuple.Item1;
@@ -249,7 +246,7 @@ namespace MediaBrowser.Controller.Net
/// Disposes the connection.
///
/// The connection.
- private void DisposeConnection(Tuple connection)
+ private void DisposeConnection(Tuple connection)
{
Logger.LogDebug("{1} stop transmitting over websocket to {0}", connection.Item1.RemoteEndPoint, GetType().Name);
diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs
index d698795dd3..f0e81e8e7a 100644
--- a/MediaBrowser.Controller/Session/SessionInfo.cs
+++ b/MediaBrowser.Controller/Session/SessionInfo.cs
@@ -1,10 +1,10 @@
using System;
using System.Linq;
+using System.Threading;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Session;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Controller.Session
@@ -268,10 +268,10 @@ namespace MediaBrowser.Controller.Session
}
private readonly object _progressLock = new object();
- private ITimer _progressTimer;
+ private Timer _progressTimer;
private PlaybackProgressInfo _lastProgressInfo;
- public void StartAutomaticProgress(ITimerFactory timerFactory, PlaybackProgressInfo progressInfo)
+ public void StartAutomaticProgress(PlaybackProgressInfo progressInfo)
{
if (_disposed)
{
@@ -284,7 +284,7 @@ namespace MediaBrowser.Controller.Session
if (_progressTimer == null)
{
- _progressTimer = timerFactory.Create(OnProgressTimerCallback, null, 1000, 1000);
+ _progressTimer = new Timer(OnProgressTimerCallback, null, 1000, 1000);
}
else
{
diff --git a/MediaBrowser.Model/Threading/ITimer.cs b/MediaBrowser.Model/Threading/ITimer.cs
deleted file mode 100644
index 2bec222665..0000000000
--- a/MediaBrowser.Model/Threading/ITimer.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System;
-
-namespace MediaBrowser.Model.Threading
-{
- public interface ITimer : IDisposable
- {
- void Change(TimeSpan dueTime, TimeSpan period);
- void Change(int dueTimeMs, int periodMs);
- }
-}
diff --git a/MediaBrowser.Model/Threading/ITimerFactory.cs b/MediaBrowser.Model/Threading/ITimerFactory.cs
deleted file mode 100644
index 1161958a4b..0000000000
--- a/MediaBrowser.Model/Threading/ITimerFactory.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System;
-
-namespace MediaBrowser.Model.Threading
-{
- public interface ITimerFactory
- {
- ITimer Create(Action callback, object state, TimeSpan dueTime, TimeSpan period);
- ITimer Create(Action callback, object state, int dueTimeMs, int periodMs);
- }
-}
diff --git a/RSSDP/SsdpDeviceLocator.cs b/RSSDP/SsdpDeviceLocator.cs
index 1348cce8da..128bdfcbb4 100644
--- a/RSSDP/SsdpDeviceLocator.cs
+++ b/RSSDP/SsdpDeviceLocator.cs
@@ -8,7 +8,6 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Net;
-using MediaBrowser.Model.Threading;
namespace Rssdp.Infrastructure
{
@@ -23,8 +22,7 @@ namespace Rssdp.Infrastructure
private List _Devices;
private ISsdpCommunicationsServer _CommunicationsServer;
- private ITimer _BroadcastTimer;
- private ITimerFactory _timerFactory;
+ private Timer _BroadcastTimer;
private object _timerLock = new object();
private readonly TimeSpan DefaultSearchWaitTime = TimeSpan.FromSeconds(4);
@@ -37,12 +35,11 @@ namespace Rssdp.Infrastructure
///
/// Default constructor.
///
- public SsdpDeviceLocator(ISsdpCommunicationsServer communicationsServer, ITimerFactory timerFactory)
+ public SsdpDeviceLocator(ISsdpCommunicationsServer communicationsServer)
{
if (communicationsServer == null) throw new ArgumentNullException(nameof(communicationsServer));
_CommunicationsServer = communicationsServer;
- _timerFactory = timerFactory;
_CommunicationsServer.ResponseReceived += CommsServer_ResponseReceived;
_Devices = new List();
@@ -94,7 +91,7 @@ namespace Rssdp.Infrastructure
{
if (_BroadcastTimer == null)
{
- _BroadcastTimer = _timerFactory.Create(OnBroadcastTimerCallback, null, dueTime, period);
+ _BroadcastTimer = new Timer(OnBroadcastTimerCallback, null, dueTime, period);
}
else
{
diff --git a/RSSDP/SsdpDevicePublisher.cs b/RSSDP/SsdpDevicePublisher.cs
index 8a73e6a2d3..ce64ba1176 100644
--- a/RSSDP/SsdpDevicePublisher.cs
+++ b/RSSDP/SsdpDevicePublisher.cs
@@ -7,7 +7,6 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Net;
-using MediaBrowser.Model.Threading;
using Rssdp;
namespace Rssdp.Infrastructure
@@ -27,8 +26,7 @@ namespace Rssdp.Infrastructure
private IList _Devices;
private IReadOnlyList _ReadOnlyDevices;
- private ITimer _RebroadcastAliveNotificationsTimer;
- private ITimerFactory _timerFactory;
+ private Timer _RebroadcastAliveNotificationsTimer;
private IDictionary _RecentSearchRequests;
@@ -39,7 +37,7 @@ namespace Rssdp.Infrastructure
///
/// Default constructor.
///
- public SsdpDevicePublisher(ISsdpCommunicationsServer communicationsServer, ITimerFactory timerFactory, string osName, string osVersion)
+ public SsdpDevicePublisher(ISsdpCommunicationsServer communicationsServer, string osName, string osVersion)
{
if (communicationsServer == null) throw new ArgumentNullException(nameof(communicationsServer));
if (osName == null) throw new ArgumentNullException(nameof(osName));
@@ -48,7 +46,6 @@ namespace Rssdp.Infrastructure
if (osVersion.Length == 0) throw new ArgumentException("osVersion cannot be an empty string.", nameof(osName));
_SupportPnpRootDevice = true;
- _timerFactory = timerFactory;
_Devices = new List();
_ReadOnlyDevices = new ReadOnlyCollection(_Devices);
_RecentSearchRequests = new Dictionary(StringComparer.OrdinalIgnoreCase);
@@ -64,7 +61,7 @@ namespace Rssdp.Infrastructure
public void StartBroadcastingAliveMessages(TimeSpan interval)
{
- _RebroadcastAliveNotificationsTimer = _timerFactory.Create(SendAllAliveNotifications, null, TimeSpan.FromSeconds(5), interval);
+ _RebroadcastAliveNotificationsTimer = new Timer(SendAllAliveNotifications, null, TimeSpan.FromSeconds(5), interval);
}
///
From 84d56976ba4494408c5e312a4f98a24efabca441 Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Tue, 5 Feb 2019 17:37:38 +0100
Subject: [PATCH 60/93] Some small changes in Device.cs and DidlBuilder.cs
Device.cs:
* Improve dispose function
* Style fixes
* Remove unused field
DidlBuilder.cs:
* Remove unused field
* Replace giant if chain with a switch statement
---
Emby.Dlna/ContentDirectory/ControlHandler.cs | 2 +-
Emby.Dlna/Didl/DidlBuilder.cs | 149 ++++++----------
Emby.Dlna/PlayTo/Device.cs | 173 ++++++++++---------
Emby.Dlna/PlayTo/PlayToController.cs | 34 ++--
4 files changed, 170 insertions(+), 188 deletions(-)
diff --git a/Emby.Dlna/ContentDirectory/ControlHandler.cs b/Emby.Dlna/ContentDirectory/ControlHandler.cs
index bed4d885c2..1150afdbab 100644
--- a/Emby.Dlna/ContentDirectory/ControlHandler.cs
+++ b/Emby.Dlna/ContentDirectory/ControlHandler.cs
@@ -63,7 +63,7 @@ namespace Emby.Dlna.ContentDirectory
_profile = profile;
_config = config;
- _didlBuilder = new DidlBuilder(profile, user, imageProcessor, serverAddress, accessToken, userDataManager, localization, mediaSourceManager, _logger, libraryManager, mediaEncoder);
+ _didlBuilder = new DidlBuilder(profile, user, imageProcessor, serverAddress, accessToken, userDataManager, localization, mediaSourceManager, _logger, mediaEncoder);
}
protected override IEnumerable> GetResult(string methodName, IDictionary methodParams)
diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs
index f6d923a1f1..605f4f37b2 100644
--- a/Emby.Dlna/Didl/DidlBuilder.cs
+++ b/Emby.Dlna/Didl/DidlBuilder.cs
@@ -43,22 +43,30 @@ namespace Emby.Dlna.Didl
private readonly ILocalizationManager _localization;
private readonly IMediaSourceManager _mediaSourceManager;
private readonly ILogger _logger;
- private readonly ILibraryManager _libraryManager;
private readonly IMediaEncoder _mediaEncoder;
- public DidlBuilder(DeviceProfile profile, User user, IImageProcessor imageProcessor, string serverAddress, string accessToken, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, ILogger logger, ILibraryManager libraryManager, IMediaEncoder mediaEncoder)
+ public DidlBuilder(
+ DeviceProfile profile,
+ User user,
+ IImageProcessor imageProcessor,
+ string serverAddress,
+ string accessToken,
+ IUserDataManager userDataManager,
+ ILocalizationManager localization,
+ IMediaSourceManager mediaSourceManager,
+ ILogger logger,
+ IMediaEncoder mediaEncoder)
{
_profile = profile;
+ _user = user;
_imageProcessor = imageProcessor;
_serverAddress = serverAddress;
+ _accessToken = accessToken;
_userDataManager = userDataManager;
_localization = localization;
_mediaSourceManager = mediaSourceManager;
_logger = logger;
- _libraryManager = libraryManager;
_mediaEncoder = mediaEncoder;
- _accessToken = accessToken;
- _user = user;
}
public static string NormalizeDlnaMediaUrl(string url)
@@ -117,7 +125,8 @@ namespace Emby.Dlna.Didl
}
}
- public void WriteItemElement(DlnaOptions options,
+ public void WriteItemElement(
+ DlnaOptions options,
XmlWriter writer,
BaseItem item,
User user,
@@ -232,12 +241,15 @@ namespace Emby.Dlna.Didl
AddVideoResource(writer, video, deviceId, filter, contentFeature, streamInfo);
}
- var subtitleProfiles = streamInfo.GetSubtitleProfiles(_mediaEncoder, false, _serverAddress, _accessToken)
- .Where(subtitle => subtitle.DeliveryMethod == SubtitleDeliveryMethod.External)
- .ToList();
+ var subtitleProfiles = streamInfo.GetSubtitleProfiles(_mediaEncoder, false, _serverAddress, _accessToken);
foreach (var subtitle in subtitleProfiles)
{
+ if (subtitle.DeliveryMethod != SubtitleDeliveryMethod.External)
+ {
+ continue;
+ }
+
var subtitleAdded = AddSubtitleElement(writer, subtitle);
if (subtitleAdded && _profile.EnableSingleSubtitleLimit)
@@ -250,7 +262,8 @@ namespace Emby.Dlna.Didl
private bool AddSubtitleElement(XmlWriter writer, SubtitleStreamInfo info)
{
var subtitleProfile = _profile.SubtitleProfiles
- .FirstOrDefault(i => string.Equals(info.Format, i.Format, StringComparison.OrdinalIgnoreCase) && i.Method == SubtitleDeliveryMethod.External);
+ .FirstOrDefault(i => string.Equals(info.Format, i.Format, StringComparison.OrdinalIgnoreCase)
+ && i.Method == SubtitleDeliveryMethod.External);
if (subtitleProfile == null)
{
@@ -387,91 +400,39 @@ namespace Emby.Dlna.Didl
private string GetDisplayName(BaseItem item, StubType? itemStubType, BaseItem context)
{
- if (itemStubType.HasValue && itemStubType.Value == StubType.Latest)
- {
- return _localization.GetLocalizedString("Latest");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.Playlists)
+ if (itemStubType.HasValue)
{
- return _localization.GetLocalizedString("Playlists");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.AlbumArtists)
- {
- return _localization.GetLocalizedString("HeaderAlbumArtists");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.Albums)
- {
- return _localization.GetLocalizedString("Albums");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.Artists)
- {
- return _localization.GetLocalizedString("Artists");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.Songs)
- {
- return _localization.GetLocalizedString("Songs");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.Genres)
- {
- return _localization.GetLocalizedString("Genres");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.FavoriteAlbums)
- {
- return _localization.GetLocalizedString("HeaderFavoriteAlbums");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.FavoriteArtists)
- {
- return _localization.GetLocalizedString("HeaderFavoriteArtists");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.FavoriteSongs)
- {
- return _localization.GetLocalizedString("HeaderFavoriteSongs");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.ContinueWatching)
- {
- return _localization.GetLocalizedString("HeaderContinueWatching");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.Movies)
- {
- return _localization.GetLocalizedString("Movies");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.Collections)
- {
- return _localization.GetLocalizedString("Collections");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.Favorites)
- {
- return _localization.GetLocalizedString("Favorites");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.NextUp)
- {
- return _localization.GetLocalizedString("HeaderNextUp");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.FavoriteSeries)
- {
- return _localization.GetLocalizedString("HeaderFavoriteShows");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.FavoriteEpisodes)
- {
- return _localization.GetLocalizedString("HeaderFavoriteEpisodes");
- }
- if (itemStubType.HasValue && itemStubType.Value == StubType.Series)
- {
- return _localization.GetLocalizedString("Shows");
+ switch (itemStubType.Value)
+ {
+ case StubType.Latest: return _localization.GetLocalizedString("Latest");
+ case StubType.Playlists: return _localization.GetLocalizedString("Playlists");
+ case StubType.AlbumArtists: return _localization.GetLocalizedString("HeaderAlbumArtists");
+ case StubType.Albums: return _localization.GetLocalizedString("Albums");
+ case StubType.Artists: return _localization.GetLocalizedString("Artists");
+ case StubType.Songs: return _localization.GetLocalizedString("Songs");
+ case StubType.Genres: return _localization.GetLocalizedString("Genres");
+ case StubType.FavoriteAlbums: return _localization.GetLocalizedString("HeaderFavoriteAlbums");
+ case StubType.FavoriteArtists: return _localization.GetLocalizedString("HeaderFavoriteArtists");
+ case StubType.FavoriteSongs: return _localization.GetLocalizedString("HeaderFavoriteSongs");
+ case StubType.ContinueWatching: return _localization.GetLocalizedString("HeaderContinueWatching");
+ case StubType.Movies: return _localization.GetLocalizedString("Movies");
+ case StubType.Collections: return _localization.GetLocalizedString("Collections");
+ case StubType.Favorites: return _localization.GetLocalizedString("Favorites");
+ case StubType.NextUp: return _localization.GetLocalizedString("HeaderNextUp");
+ case StubType.FavoriteSeries: return _localization.GetLocalizedString("HeaderFavoriteShows");
+ case StubType.FavoriteEpisodes: return _localization.GetLocalizedString("HeaderFavoriteEpisodes");
+ case StubType.Series: return _localization.GetLocalizedString("Shows");
+ default: break;
+ }
}
- var episode = item as Episode;
- var season = context as Season;
-
- if (episode != null && season != null)
+ if (item is Episode episode && context is Season season)
{
// This is a special embedded within a season
- if (item.ParentIndexNumber.HasValue && item.ParentIndexNumber.Value == 0)
+ if (item.ParentIndexNumber.HasValue && item.ParentIndexNumber.Value == 0
+ && season.IndexNumber.HasValue && season.IndexNumber.Value != 0)
{
- if (season.IndexNumber.HasValue && season.IndexNumber.Value != 0)
- {
- return string.Format(_localization.GetLocalizedString("ValueSpecialEpisodeName"), item.Name);
- }
+ return string.Format(_localization.GetLocalizedString("ValueSpecialEpisodeName"), item.Name);
}
if (item.IndexNumber.HasValue)
@@ -585,10 +546,8 @@ namespace Emby.Dlna.Didl
public static bool IsIdRoot(string id)
{
- if (string.IsNullOrWhiteSpace(id) ||
-
- string.Equals(id, "0", StringComparison.OrdinalIgnoreCase)
-
+ if (string.IsNullOrWhiteSpace(id)
+ || string.Equals(id, "0", StringComparison.OrdinalIgnoreCase)
// Samsung sometimes uses 1 as root
|| string.Equals(id, "1", StringComparison.OrdinalIgnoreCase))
{
@@ -1112,7 +1071,7 @@ namespace Emby.Dlna.Didl
};
}
- class ImageDownloadInfo
+ private class ImageDownloadInfo
{
internal Guid ItemId;
internal string ImageTag;
@@ -1128,7 +1087,7 @@ namespace Emby.Dlna.Didl
internal ItemImageInfo ItemImageInfo;
}
- class ImageUrlInfo
+ private class ImageUrlInfo
{
internal string Url;
diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.cs
index e49168d34b..3663ba41a8 100644
--- a/Emby.Dlna/PlayTo/Device.cs
+++ b/Emby.Dlna/PlayTo/Device.cs
@@ -39,12 +39,7 @@ namespace Emby.Dlna.PlayTo
public TimeSpan? Duration { get; set; }
- private TimeSpan _position = TimeSpan.FromSeconds(0);
- public TimeSpan Position
- {
- get => _position;
- set => _position = value;
- }
+ public TimeSpan Position { get; set; } = TimeSpan.FromSeconds(0);
public TRANSPORTSTATE TransportState { get; private set; }
@@ -60,7 +55,6 @@ namespace Emby.Dlna.PlayTo
private readonly ILogger _logger;
private readonly IServerConfigurationManager _config;
- public DateTime DateLastActivity { get; private set; }
public Action OnDeviceUnavailable { get; set; }
public Device(DeviceInfo deviceProperties, IHttpClient httpClient, ILogger logger, IServerConfigurationManager config)
@@ -115,7 +109,9 @@ namespace Emby.Dlna.PlayTo
lock (_timerLock)
{
if (_disposed)
+ {
return;
+ }
_volumeRefreshActive = true;
@@ -132,7 +128,9 @@ namespace Emby.Dlna.PlayTo
lock (_timerLock)
{
if (_disposed)
+ {
return;
+ }
_volumeRefreshActive = false;
@@ -140,11 +138,6 @@ namespace Emby.Dlna.PlayTo
}
}
- public void OnPlaybackStartedExternally()
- {
- RestartTimer(true);
- }
-
#region Commanding
public Task VolumeDown(CancellationToken cancellationToken)
@@ -165,7 +158,7 @@ namespace Emby.Dlna.PlayTo
{
if (IsMuted)
{
- return Unmute(cancellationToken);
+ return UnMute(cancellationToken);
}
return Mute(cancellationToken);
@@ -181,7 +174,7 @@ namespace Emby.Dlna.PlayTo
}
}
- public async Task Unmute(CancellationToken cancellationToken)
+ public async Task UnMute(CancellationToken cancellationToken)
{
var success = await SetMute(false, cancellationToken).ConfigureAwait(true);
@@ -329,7 +322,9 @@ namespace Emby.Dlna.PlayTo
private string CreateDidlMeta(string value)
{
if (string.IsNullOrEmpty(value))
+ {
return string.Empty;
+ }
return DescriptionXmlBuilder.Escape(value);
}
@@ -338,10 +333,11 @@ namespace Emby.Dlna.PlayTo
{
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "Play");
if (command == null)
+ {
return Task.CompletedTask;
+ }
var service = GetAvTransportService();
-
if (service == null)
{
throw new InvalidOperationException("Unable to find service");
@@ -365,7 +361,9 @@ namespace Emby.Dlna.PlayTo
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "Stop");
if (command == null)
+ {
return;
+ }
var service = GetAvTransportService();
@@ -381,7 +379,9 @@ namespace Emby.Dlna.PlayTo
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "Pause");
if (command == null)
+ {
return;
+ }
var service = GetAvTransportService();
@@ -401,7 +401,9 @@ namespace Emby.Dlna.PlayTo
private async void TimerCallback(object sender)
{
if (_disposed)
+ {
return;
+ }
try
{
@@ -421,8 +423,6 @@ namespace Emby.Dlna.PlayTo
return;
}
- DateLastActivity = DateTime.UtcNow;
-
if (transportState.HasValue)
{
// If we're not playing anything no need to get additional data
@@ -501,7 +501,9 @@ namespace Emby.Dlna.PlayTo
var command = rendererCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetVolume");
if (command == null)
+ {
return;
+ }
var service = GetServiceRenderingControl();
@@ -514,13 +516,17 @@ namespace Emby.Dlna.PlayTo
.ConfigureAwait(false);
if (result == null || result.Document == null)
+ {
return;
+ }
var volume = result.Document.Descendants(uPnpNamespaces.RenderingControl + "GetVolumeResponse").Select(i => i.Element("CurrentVolume")).FirstOrDefault(i => i != null);
- var volumeValue = volume == null ? null : volume.Value;
+ var volumeValue = volume?.Value;
if (string.IsNullOrWhiteSpace(volumeValue))
+ {
return;
+ }
Volume = int.Parse(volumeValue, UsCulture);
@@ -541,7 +547,9 @@ namespace Emby.Dlna.PlayTo
var command = rendererCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetMute");
if (command == null)
+ {
return;
+ }
var service = GetServiceRenderingControl();
@@ -556,39 +564,44 @@ namespace Emby.Dlna.PlayTo
if (result == null || result.Document == null)
return;
- var valueNode = result.Document.Descendants(uPnpNamespaces.RenderingControl + "GetMuteResponse").Select(i => i.Element("CurrentMute")).FirstOrDefault(i => i != null);
- var value = valueNode == null ? null : valueNode.Value;
+ var valueNode = result.Document.Descendants(uPnpNamespaces.RenderingControl + "GetMuteResponse")
+ .Select(i => i.Element("CurrentMute"))
+ .FirstOrDefault(i => i != null);
- IsMuted = string.Equals(value, "1", StringComparison.OrdinalIgnoreCase);
+ IsMuted = string.Equals(valueNode?.Value, "1", StringComparison.OrdinalIgnoreCase);
}
private async Task GetTransportInfo(TransportCommands avCommands, CancellationToken cancellationToken)
{
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetTransportInfo");
if (command == null)
+ {
return null;
+ }
var service = GetAvTransportService();
if (service == null)
+ {
return null;
+ }
var result = await new SsdpHttpClient(_httpClient, _config).SendCommandAsync(Properties.BaseUrl, service, command.Name, avCommands.BuildPost(command, service.ServiceType), false)
.ConfigureAwait(false);
if (result == null || result.Document == null)
+ {
return null;
+ }
var transportState =
result.Document.Descendants(uPnpNamespaces.AvTransport + "GetTransportInfoResponse").Select(i => i.Element("CurrentTransportState")).FirstOrDefault(i => i != null);
var transportStateValue = transportState == null ? null : transportState.Value;
- if (transportStateValue != null)
+ if (transportStateValue != null
+ && Enum.TryParse(transportStateValue, true, out TRANSPORTSTATE state))
{
- if (Enum.TryParse(transportStateValue, true, out TRANSPORTSTATE state))
- {
- return state;
- }
+ return state;
}
return null;
@@ -598,10 +611,11 @@ namespace Emby.Dlna.PlayTo
{
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetMediaInfo");
if (command == null)
+ {
return null;
+ }
var service = GetAvTransportService();
-
if (service == null)
{
throw new InvalidOperationException("Unable to find service");
@@ -613,7 +627,9 @@ namespace Emby.Dlna.PlayTo
.ConfigureAwait(false);
if (result == null || result.Document == null)
+ {
return null;
+ }
var track = result.Document.Descendants("CurrentURIMetaData").FirstOrDefault();
@@ -653,11 +669,13 @@ namespace Emby.Dlna.PlayTo
return null;
}
- private async Task> GetPositionInfo(TransportCommands avCommands, CancellationToken cancellationToken)
+ private async Task<(bool, uBaseObject)> GetPositionInfo(TransportCommands avCommands, CancellationToken cancellationToken)
{
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetPositionInfo");
if (command == null)
- return new Tuple(false, null);
+ {
+ return (false, null);
+ }
var service = GetAvTransportService();
@@ -672,7 +690,9 @@ namespace Emby.Dlna.PlayTo
.ConfigureAwait(false);
if (result == null || result.Document == null)
- return new Tuple(false, null);
+ {
+ return (false, null);
+ }
var trackUriElem = result.Document.Descendants(uPnpNamespaces.AvTransport + "GetPositionInfoResponse").Select(i => i.Element("TrackURI")).FirstOrDefault(i => i != null);
var trackUri = trackUriElem == null ? null : trackUriElem.Value;
@@ -680,8 +700,8 @@ namespace Emby.Dlna.PlayTo
var durationElem = result.Document.Descendants(uPnpNamespaces.AvTransport + "GetPositionInfoResponse").Select(i => i.Element("TrackDuration")).FirstOrDefault(i => i != null);
var duration = durationElem == null ? null : durationElem.Value;
- if (!string.IsNullOrWhiteSpace(duration) &&
- !string.Equals(duration, "NOT_IMPLEMENTED", StringComparison.OrdinalIgnoreCase))
+ if (!string.IsNullOrWhiteSpace(duration)
+ && !string.Equals(duration, "NOT_IMPLEMENTED", StringComparison.OrdinalIgnoreCase))
{
Duration = TimeSpan.Parse(duration, UsCulture);
}
@@ -703,14 +723,14 @@ namespace Emby.Dlna.PlayTo
if (track == null)
{
//If track is null, some vendors do this, use GetMediaInfo instead
- return new Tuple(true, null);
+ return (true, null);
}
var trackString = (string)track;
if (string.IsNullOrWhiteSpace(trackString) || string.Equals(trackString, "NOT_IMPLEMENTED", StringComparison.OrdinalIgnoreCase))
{
- return new Tuple(true, null);
+ return (true, null);
}
XElement uPnpResponse;
@@ -731,7 +751,7 @@ namespace Emby.Dlna.PlayTo
catch (Exception ex)
{
_logger.LogError(ex, "Unable to parse xml {0}", trackString);
- return new Tuple(true, null);
+ return (true, null);
}
}
@@ -739,7 +759,7 @@ namespace Emby.Dlna.PlayTo
var uTrack = CreateUBaseObject(e, trackUri);
- return new Tuple(true, uTrack);
+ return (true, uTrack);
}
private static uBaseObject CreateUBaseObject(XElement container, string trackUri)
@@ -797,11 +817,9 @@ namespace Emby.Dlna.PlayTo
private async Task GetAVProtocolAsync(CancellationToken cancellationToken)
{
- var avCommands = AvCommands;
-
- if (avCommands != null)
+ if (AvCommands != null)
{
- return avCommands;
+ return AvCommands;
}
if (_disposed)
@@ -821,18 +839,15 @@ namespace Emby.Dlna.PlayTo
var document = await httpClient.GetDataAsync(url, cancellationToken).ConfigureAwait(false);
- avCommands = TransportCommands.Create(document);
- AvCommands = avCommands;
- return avCommands;
+ AvCommands = TransportCommands.Create(document);
+ return AvCommands;
}
private async Task GetRenderingProtocolAsync(CancellationToken cancellationToken)
{
- var rendererCommands = RendererCommands;
-
- if (rendererCommands != null)
+ if (RendererCommands != null)
{
- return rendererCommands;
+ return RendererCommands;
}
if (_disposed)
@@ -841,7 +856,6 @@ namespace Emby.Dlna.PlayTo
}
var avService = GetServiceRenderingControl();
-
if (avService == null)
{
throw new ArgumentException("Device AvService is null");
@@ -853,9 +867,8 @@ namespace Emby.Dlna.PlayTo
_logger.LogDebug("Dlna Device.GetRenderingProtocolAsync");
var document = await httpClient.GetDataAsync(url, cancellationToken).ConfigureAwait(false);
- rendererCommands = TransportCommands.Create(document);
- RendererCommands = rendererCommands;
- return rendererCommands;
+ RendererCommands = TransportCommands.Create(document);
+ return RendererCommands;
}
private string NormalizeUrl(string baseUrl, string url)
@@ -867,24 +880,21 @@ namespace Emby.Dlna.PlayTo
}
if (!url.Contains("/"))
+ {
url = "/dmr/" + url;
+ }
+
if (!url.StartsWith("/"))
+ {
url = "/" + url;
+ }
return baseUrl + url;
}
- private TransportCommands AvCommands
- {
- get;
- set;
- }
+ private TransportCommands AvCommands { get; set; }
- private TransportCommands RendererCommands
- {
- get;
- set;
- }
+ private TransportCommands RendererCommands { get; set; }
public static async Task CreateuPnpDeviceAsync(Uri url, IHttpClient httpClient, IServerConfigurationManager config, ILogger logger, CancellationToken cancellationToken)
{
@@ -892,8 +902,6 @@ namespace Emby.Dlna.PlayTo
var document = await ssdpHttpClient.GetDataAsync(url.ToString(), cancellationToken).ConfigureAwait(false);
- var deviceProperties = new DeviceInfo();
-
var friendlyNames = new List();
var name = document.Descendants(uPnpNamespaces.ud.GetName("friendlyName")).FirstOrDefault();
@@ -908,7 +916,11 @@ namespace Emby.Dlna.PlayTo
friendlyNames.Add(room.Value);
}
- deviceProperties.Name = string.Join(" ", friendlyNames);
+ var deviceProperties = new DeviceInfo()
+ {
+ Name = string.Join(" ", friendlyNames),
+ BaseUrl = string.Format("http://{0}:{1}", url.Host, url.Port)
+ };
var model = document.Descendants(uPnpNamespaces.ud.GetName("modelName")).FirstOrDefault();
if (model != null)
@@ -964,8 +976,6 @@ namespace Emby.Dlna.PlayTo
deviceProperties.ModelDescription = modelDescription.Value;
}
- deviceProperties.BaseUrl = string.Format("http://{0}:{1}", url.Host, url.Port);
-
var icon = document.Descendants(uPnpNamespaces.ud.GetName("icon")).FirstOrDefault();
if (icon != null)
{
@@ -980,7 +990,6 @@ namespace Emby.Dlna.PlayTo
}
var servicesList = services.Descendants(uPnpNamespaces.ud.GetName("service"));
-
if (servicesList == null)
{
continue;
@@ -997,9 +1006,7 @@ namespace Emby.Dlna.PlayTo
}
}
- var device = new Device(deviceProperties, httpClient, logger, config);
-
- return device;
+ return new Device(deviceProperties, httpClient, logger, config);
}
#endregion
@@ -1127,23 +1134,29 @@ namespace Emby.Dlna.PlayTo
#region IDisposable
bool _disposed;
+
public void Dispose()
{
- if (!_disposed)
- {
- _disposed = true;
-
- DisposeTimer();
- }
+ Dispose(true);
+ GC.SuppressFinalize(this);
}
- private void DisposeTimer()
+ protected virtual void Dispose(bool disposing)
{
- if (_timer != null)
+ if (_disposed)
{
- _timer.Dispose();
- _timer = null;
+ return;
}
+
+ if (disposing)
+ {
+ _timer?.Dispose();
+ }
+
+ _timer = null;
+ Properties = null;
+
+ _disposed = true;
}
#endregion
diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs
index 409b8442cd..64c4889f14 100644
--- a/Emby.Dlna/PlayTo/PlayToController.cs
+++ b/Emby.Dlna/PlayTo/PlayToController.cs
@@ -42,30 +42,43 @@ namespace Emby.Dlna.PlayTo
private readonly IDeviceDiscovery _deviceDiscovery;
private readonly string _serverAddress;
private readonly string _accessToken;
- private readonly DateTime _creationTime;
public bool IsSessionActive => !_disposed && _device != null;
public bool SupportsMediaControl => IsSessionActive;
- public PlayToController(SessionInfo session, ISessionManager sessionManager, ILibraryManager libraryManager, ILogger logger, IDlnaManager dlnaManager, IUserManager userManager, IImageProcessor imageProcessor, string serverAddress, string accessToken, IDeviceDiscovery deviceDiscovery, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IConfigurationManager config, IMediaEncoder mediaEncoder)
+ public PlayToController(
+ SessionInfo session,
+ ISessionManager sessionManager,
+ ILibraryManager libraryManager,
+ ILogger logger,
+ IDlnaManager dlnaManager,
+ IUserManager userManager,
+ IImageProcessor imageProcessor,
+ string serverAddress,
+ string accessToken,
+ IDeviceDiscovery deviceDiscovery,
+ IUserDataManager userDataManager,
+ ILocalizationManager localization,
+ IMediaSourceManager mediaSourceManager,
+ IConfigurationManager config,
+ IMediaEncoder mediaEncoder)
{
_session = session;
_sessionManager = sessionManager;
_libraryManager = libraryManager;
+ _logger = logger;
_dlnaManager = dlnaManager;
_userManager = userManager;
_imageProcessor = imageProcessor;
_serverAddress = serverAddress;
+ _accessToken = accessToken;
_deviceDiscovery = deviceDiscovery;
_userDataManager = userDataManager;
_localization = localization;
_mediaSourceManager = mediaSourceManager;
_config = config;
_mediaEncoder = mediaEncoder;
- _accessToken = accessToken;
- _logger = logger;
- _creationTime = DateTime.UtcNow;
}
public void Init(Device device)
@@ -374,9 +387,7 @@ namespace Emby.Dlna.PlayTo
return _device.IsPaused ? _device.SetPlay(CancellationToken.None) : _device.SetPause(CancellationToken.None);
case PlaystateCommand.Seek:
- {
- return Seek(command.SeekPositionTicks ?? 0);
- }
+ return Seek(command.SeekPositionTicks ?? 0);
case PlaystateCommand.NextTrack:
return SetPlaylistIndex(_currentPlaylistIndex + 1);
@@ -442,8 +453,7 @@ namespace Emby.Dlna.PlayTo
var profile = _dlnaManager.GetProfile(deviceInfo.ToDeviceIdentification()) ??
_dlnaManager.GetDefaultProfile();
- var hasMediaSources = item as IHasMediaSources;
- var mediaSources = hasMediaSources != null
+ var mediaSources = item is IHasMediaSources
? (_mediaSourceManager.GetStaticMediaSources(item, true, user))
: new List();
@@ -452,7 +462,7 @@ namespace Emby.Dlna.PlayTo
playlistItem.StreamUrl = DidlBuilder.NormalizeDlnaMediaUrl(playlistItem.StreamInfo.ToUrl(_serverAddress, _accessToken));
- var itemXml = new DidlBuilder(profile, user, _imageProcessor, _serverAddress, _accessToken, _userDataManager, _localization, _mediaSourceManager, _logger, _libraryManager, _mediaEncoder)
+ var itemXml = new DidlBuilder(profile, user, _imageProcessor, _serverAddress, _accessToken, _userDataManager, _localization, _mediaSourceManager, _logger, _mediaEncoder)
.GetItemDidl(_config.GetDlnaConfiguration(), item, user, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo);
playlistItem.Didl = itemXml;
@@ -631,7 +641,7 @@ namespace Emby.Dlna.PlayTo
case GeneralCommandType.Mute:
return _device.Mute(cancellationToken);
case GeneralCommandType.Unmute:
- return _device.Unmute(cancellationToken);
+ return _device.UnMute(cancellationToken);
case GeneralCommandType.ToggleMute:
return _device.ToggleMute(cancellationToken);
case GeneralCommandType.SetAudioStreamIndex:
From be89a5e71950dd1a82aa4538dfaf4215892beb26 Mon Sep 17 00:00:00 2001
From: Bond-009
Date: Tue, 5 Feb 2019 18:16:10 +0100
Subject: [PATCH 61/93] Don't rename method
---
Emby.Dlna/PlayTo/Device.cs | 4 ++--
Emby.Dlna/PlayTo/PlayToController.cs | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.cs
index 3663ba41a8..037cdd8aa7 100644
--- a/Emby.Dlna/PlayTo/Device.cs
+++ b/Emby.Dlna/PlayTo/Device.cs
@@ -158,7 +158,7 @@ namespace Emby.Dlna.PlayTo
{
if (IsMuted)
{
- return UnMute(cancellationToken);
+ return Unmute(cancellationToken);
}
return Mute(cancellationToken);
@@ -174,7 +174,7 @@ namespace Emby.Dlna.PlayTo
}
}
- public async Task UnMute(CancellationToken cancellationToken)
+ public async Task Unmute(CancellationToken cancellationToken)
{
var success = await SetMute(false, cancellationToken).ConfigureAwait(true);
diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs
index 64c4889f14..be86dde16a 100644
--- a/Emby.Dlna/PlayTo/PlayToController.cs
+++ b/Emby.Dlna/PlayTo/PlayToController.cs
@@ -641,7 +641,7 @@ namespace Emby.Dlna.PlayTo
case GeneralCommandType.Mute:
return _device.Mute(cancellationToken);
case GeneralCommandType.Unmute:
- return _device.UnMute(cancellationToken);
+ return _device.Unmute(cancellationToken);
case GeneralCommandType.ToggleMute:
return _device.ToggleMute(cancellationToken);
case GeneralCommandType.SetAudioStreamIndex:
From e216702bcfdf3d6a90f59e11984098990f069043 Mon Sep 17 00:00:00 2001
From: Bond-009
Date: Tue, 5 Feb 2019 19:53:50 +0100
Subject: [PATCH 62/93] Complete rename ImageSize -> ImageDimensions
---
Emby.Drawing/ImageProcessor.cs | 10 ++++----
Emby.Photos/PhotoProvider.cs | 2 +-
Emby.Server.Implementations/Dto/DtoService.cs | 2 +-
MediaBrowser.Api/Images/ImageService.cs | 2 +-
.../Drawing/IImageProcessor.cs | 23 +++++++++++++++----
.../{ImageSize.cs => ImageDimensions.cs} | 2 +-
6 files changed, 27 insertions(+), 14 deletions(-)
rename MediaBrowser.Model/Drawing/{ImageSize.cs => ImageDimensions.cs} (96%)
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs
index 097b4c40b7..2446c3953f 100644
--- a/Emby.Drawing/ImageProcessor.cs
+++ b/Emby.Drawing/ImageProcessor.cs
@@ -368,10 +368,10 @@ namespace Emby.Drawing
return GetCachePath(ResizedImageCachePath, filename, "." + format.ToString().ToLowerInvariant());
}
- public ImageDimensions GetImageSize(BaseItem item, ItemImageInfo info)
- => GetImageSize(item, info, true);
+ public ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info)
+ => GetImageDimensions(item, info, true);
- public ImageDimensions GetImageSize(BaseItem item, ItemImageInfo info, bool updateItem)
+ public ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info, bool updateItem)
{
int width = info.Width;
int height = info.Height;
@@ -384,7 +384,7 @@ namespace Emby.Drawing
string path = info.Path;
_logger.LogInformation("Getting image size for item {ItemType} {Path}", item.GetType().Name, path);
- ImageDimensions size = GetImageSize(path);
+ ImageDimensions size = GetImageDimensions(path);
info.Width = size.Width;
info.Height = size.Height;
@@ -399,7 +399,7 @@ namespace Emby.Drawing
///
/// Gets the size of the image.
///
- public ImageDimensions GetImageSize(string path)
+ public ImageDimensions GetImageDimensions(string path)
=> _imageEncoder.GetImageSize(path);
///
diff --git a/Emby.Photos/PhotoProvider.cs b/Emby.Photos/PhotoProvider.cs
index aaebe1a214..f3457d1055 100644
--- a/Emby.Photos/PhotoProvider.cs
+++ b/Emby.Photos/PhotoProvider.cs
@@ -181,7 +181,7 @@ namespace Emby.Photos
try
{
- var size = _imageProcessor.GetImageSize(item, img, false);
+ var size = _imageProcessor.GetImageDimensions(item, img, false);
if (size.Width > 0 && size.Height > 0)
{
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index f5634690fb..983eb51e63 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -1418,7 +1418,7 @@ namespace Emby.Server.Implementations.Dto
try
{
- size = _imageProcessor.GetImageSize(item, imageInfo);
+ size = _imageProcessor.GetImageDimensions(item, imageInfo);
if (size.Width <= 0 || size.Height <= 0)
{
diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs
index b5e23476ed..61db7b8d47 100644
--- a/MediaBrowser.Api/Images/ImageService.cs
+++ b/MediaBrowser.Api/Images/ImageService.cs
@@ -324,7 +324,7 @@ namespace MediaBrowser.Api.Images
var fileInfo = _fileSystem.GetFileInfo(info.Path);
length = fileInfo.Length;
- ImageDimensions size = _imageProcessor.GetImageSize(item, info, true);
+ ImageDimensions size = _imageProcessor.GetImageDimensions(item, info, true);
width = size.Width;
height = size.Height;
diff --git a/MediaBrowser.Controller/Drawing/IImageProcessor.cs b/MediaBrowser.Controller/Drawing/IImageProcessor.cs
index 7831827309..957be3cf8c 100644
--- a/MediaBrowser.Controller/Drawing/IImageProcessor.cs
+++ b/MediaBrowser.Controller/Drawing/IImageProcessor.cs
@@ -26,16 +26,29 @@ namespace MediaBrowser.Controller.Drawing
/// The image enhancers.
IImageEnhancer[] ImageEnhancers { get; }
- ImageDimensions GetImageSize(string path);
+ ///
+ /// Gets the dimensions of the image.
+ ///
+ /// Path to the image file.
+ /// ImageDimensions
+ ImageDimensions GetImageDimensions(string path);
///
- /// Gets the size of the image.
+ /// Gets the dimensions of the image.
///
+ /// The base item.
/// The information.
- /// ImageSize.
- ImageDimensions GetImageSize(BaseItem item, ItemImageInfo info);
+ /// ImageDimensions
+ ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info);
- ImageDimensions GetImageSize(BaseItem item, ItemImageInfo info, bool updateItem);
+ ///
+ /// Gets the dimensions of the image.
+ ///
+ /// The base item.
+ /// The information.
+ /// Whether or not the item info should be updated.
+ /// ImageDimensions
+ ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info, bool updateItem);
///
/// Adds the parts.
diff --git a/MediaBrowser.Model/Drawing/ImageSize.cs b/MediaBrowser.Model/Drawing/ImageDimensions.cs
similarity index 96%
rename from MediaBrowser.Model/Drawing/ImageSize.cs
rename to MediaBrowser.Model/Drawing/ImageDimensions.cs
index 75591d83d1..e7805ac494 100644
--- a/MediaBrowser.Model/Drawing/ImageSize.cs
+++ b/MediaBrowser.Model/Drawing/ImageDimensions.cs
@@ -1,7 +1,7 @@
namespace MediaBrowser.Model.Drawing
{
///
- /// Struct ImageSize
+ /// Struct ImageDimensions
///
public struct ImageDimensions
{
From 546f4cd46f21561d9f39ee695fdfa6809e0d9c29 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Tue, 5 Feb 2019 18:40:31 -0500
Subject: [PATCH 63/93] Add prerequisite keep_artifacts var
---
build | 23 +++++++++++++++++------
deployment/README.md | 2 ++
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/build b/build
index 7d49db72ab..7413b60e36 100755
--- a/build
+++ b/build
@@ -23,7 +23,7 @@ usage() {
echo -e "Usage:"
echo -e " $ build --list-platforms"
echo -e " $ build --list-actions "
- echo -e " $ build [-b/--web-branch ] "
+ echo -e " $ build [-k/--keep-artifacts] [-b/--web-branch ] "
echo -e ""
echo -e "The web_branch defaults to the same branch name as the current main branch."
echo -e "To build all platforms, use 'all'."
@@ -67,6 +67,14 @@ if [[ $1 == '--list-actions' ]]; then
exit 0
fi
+# Parse keep-artifacts option
+if [[ $1 == '-k' || $1 == '--keep-artifacts' ]]; then
+ keep_artifacts="y"
+ shift 1
+else
+ keep_artifacts="n"
+fi
+
# Parse branch option
if [[ $1 == '-b' || $1 == '--web-branch' ]]; then
web_branch="$2"
@@ -193,6 +201,13 @@ for target_platform in ${platform[@]}; do
echo -e "> Processing platform ${target_platform}"
date_start=$( date +%s )
pushd ${target_platform}
+ cleanup() {
+ echo -e ">> Processing action clean"
+ if [[ -f clean.sh && -x clean.sh ]]; then
+ ./clean.sh ${keep_artifacts}
+ fi
+ }
+ trap cleanup EXIT INT
for target_action in ${action[@]}; do
echo -e ">> Processing action ${target_action}"
if [[ -f ${target_action}.sh && -x ${target_action}.sh ]]; then
@@ -204,12 +219,8 @@ for target_platform in ${platform[@]}; do
target_dir="../../../jellyfin-build/${target_platform}"
mkdir -p ${target_dir}
mv pkg-dist/* ${target_dir}/
-
- echo -e ">> Processing action clean"
- if [[ -f clean.sh && -x clean.sh ]]; then
- ./clean.sh
- fi
fi
+ cleanup
date_end=$( date +%s )
echo -e "> Completed platform ${target_platform} in $( expr ${date_end} - ${date_start} ) seconds."
popd
diff --git a/deployment/README.md b/deployment/README.md
index 05b4ed51e9..608d80e58f 100644
--- a/deployment/README.md
+++ b/deployment/README.md
@@ -55,6 +55,8 @@ These builds are not necessarily run from the `build` script, but are present fo
* The `clean` action should always `exit 0` even if no work is done or it fails.
+* The `clean` action can be passed a variable as argument 1, named `keep_artifacts`. It is indended to handle situations when the user runs `build --keep-artifacts` and should be handled intelligently. Usually, this is used to preserve Docker images while still removing temporary directories.
+
### Output Files
* Upon completion of the defined actions, at least one output file must be created in the `/pkg-dist` directory.
From c846da4f9e7833252f209b2698c3b6359b20069d Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Tue, 5 Feb 2019 18:40:50 -0500
Subject: [PATCH 64/93] Update Debian package build
---
deployment/debian-package-x64/Dockerfile | 39 +++++++++----
deployment/debian-package-x64/clean.sh | 27 ++++++++-
deployment/debian-package-x64/docker-build.sh | 16 ++++++
deployment/debian-package-x64/package.sh | 55 ++++++++++---------
4 files changed, 97 insertions(+), 40 deletions(-)
create mode 100755 deployment/debian-package-x64/docker-build.sh
diff --git a/deployment/debian-package-x64/Dockerfile b/deployment/debian-package-x64/Dockerfile
index 2afe6c1d37..787f1d1824 100644
--- a/deployment/debian-package-x64/Dockerfile
+++ b/deployment/debian-package-x64/Dockerfile
@@ -1,23 +1,40 @@
FROM debian:9
-ARG SOURCEDIR=/repo
+# Docker build arguments
+ARG SOURCE_DIR=/jellyfin
+ARG PLATFORM_DIR=/jellyfin/deployment/debian-package-x64
+ARG ARTIFACT_DIR=/dist
+ARG SDK_VERSION=2.2
+# Docker run environment
+ENV SOURCE_DIR=/jellyfin
+ENV ARTIFACT_DIR=/dist
ENV DEB_BUILD_OPTIONS=noddebs
-# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current
+# Prepare Debian build environment
RUN apt-get update \
- && apt-get install -y apt-transport-https debhelper gnupg wget devscripts \
- && wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg \
+ && apt-get install -y apt-transport-https debhelper gnupg wget devscripts mmv libc6-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev
+
+# Install dotnet repository
+# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current
+RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg \
&& mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ \
&& wget -q https://packages.microsoft.com/config/debian/9/prod.list \
&& mv prod.list /etc/apt/sources.list.d/microsoft-prod.list \
&& chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg \
&& chown root:root /etc/apt/sources.list.d/microsoft-prod.list \
- && apt-get update
+ && apt-get update \
+ && apt-get install -y dotnet-sdk-${SDK_VERSION}
+
+# Link to docker-build script
+RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh
+
+# Link to Debian source dir; mkdir needed or it fails, can't force dest
+RUN mkdir -p ${SOURCE_DIR} && ln -sf ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/debian
-WORKDIR ${SOURCEDIR}
-COPY . .
-COPY ./deployment/debian-package-x64/pkg-src ./debian
+# Prepare artifact volume
+VOLUME ${ARTIFACT_DIR}/
-RUN yes | mk-build-deps -i debian/control \
- && dpkg-buildpackage -us -uc
+# Copy repository
+COPY . ${SOURCE_DIR}/
-WORKDIR /
+# Set docker-build entrypoint
+ENTRYPOINT ["/docker-build.sh"]
diff --git a/deployment/debian-package-x64/clean.sh b/deployment/debian-package-x64/clean.sh
index 3df2d7796e..101ba1fb6d 100755
--- a/deployment/debian-package-x64/clean.sh
+++ b/deployment/debian-package-x64/clean.sh
@@ -2,6 +2,29 @@
source ../common.build.sh
-VERSION=`get_version ../..`
+keep_artifacts="${1}"
-clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}
+WORKDIR="$( pwd )"
+VERSION="$( grep '^jellyfin' ${WORKDIR}/pkg-src/changelog | head -1 | awk -F '[()]' '{ print $2 }' )"
+
+package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
+output_dir="${WORKDIR}/pkg-dist"
+current_user="$( whoami )"
+image_name="jellyfin-debian-build"
+
+rm -rf "${package_temporary_dir}" &>/dev/null \
+ || sudo rm -rf "${package_temporary_dir}" &>/dev/null
+
+rm -rf "${output_dir}" &>/dev/null \
+ || sudo rm -rf "${output_dir}" &>/dev/null
+
+if [[ ${keep_artifacts} == 'n' ]]; then
+ docker_sudo=""
+ if [[ ! -z $(id -Gn | grep -q 'docker') ]] \
+ && [[ ! ${EUID:-1000} -eq 0 ]] \
+ && [[ ! ${USER} == "root" ]] \
+ && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then
+ docker_sudo=sudo
+ fi
+ ${docker_sudo} docker image rm ${image_name} --force
+fi
diff --git a/deployment/debian-package-x64/docker-build.sh b/deployment/debian-package-x64/docker-build.sh
new file mode 100755
index 0000000000..83654b8ce8
--- /dev/null
+++ b/deployment/debian-package-x64/docker-build.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# Builds the DEB inside the Docker container
+
+set -o errexit
+set -o xtrace
+
+# Move to source directory
+pushd ${SOURCE_DIR}
+
+# Build DEB
+dpkg-buildpackage -us -uc
+
+# Move the artifacts out
+mkdir -p ${ARTIFACT_DIR}/deb
+mv /jellyfin_* ${ARTIFACT_DIR}/deb/
diff --git a/deployment/debian-package-x64/package.sh b/deployment/debian-package-x64/package.sh
index dec953961f..11da66aaab 100755
--- a/deployment/debian-package-x64/package.sh
+++ b/deployment/debian-package-x64/package.sh
@@ -2,30 +2,31 @@
source ../common.build.sh
-VERSION=`get_version ../..`
-
-# TODO get the version in the package automatically. And using the changelog to decide the debian package suffix version.
-
-# Build a Jellyfin .deb file with Docker on Linux
-# Places the output .deb file in the parent directory
-
-package_temporary_dir="`pwd`/pkg-dist-tmp"
-output_dir="`pwd`/pkg-dist"
-current_user="`whoami`"
-image_name="jellyfin-debuild"
-
-cleanup() {
- set +o errexit
- docker image rm $image_name --force
- rm -rf "$package_temporary_dir"
-}
-trap cleanup EXIT INT
-
-docker build ../.. -t "$image_name" -f ./Dockerfile --build-arg SOURCEDIR="/jellyfin-${VERSION}"
-mkdir -p "$package_temporary_dir"
-mkdir -p "$output_dir"
-docker run --rm -v "$package_temporary_dir:/temp" "$image_name" sh -c 'find / -maxdepth 1 -type f -name "jellyfin*" -exec mv {} /temp \;'
-chown -R "$current_user" "$package_temporary_dir" \
-|| sudo chown -R "$current_user" "$package_temporary_dir"
-
-mv "$package_temporary_dir"/* "$output_dir"
+WORKDIR="$( pwd )"
+VERSION="$( grep '^jellyfin' ${WORKDIR}/pkg-src/changelog | head -1 | awk -F '[()]' '{ print $2 }' )"
+
+package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
+output_dir="${WORKDIR}/pkg-dist"
+current_user="$( whoami )"
+image_name="jellyfin-debian-build"
+
+# Determine if sudo should be used for Docker
+if [[ ! -z $(id -Gn | grep -q 'docker') ]] \
+ && [[ ! ${EUID:-1000} -eq 0 ]] \
+ && [[ ! ${USER} == "root" ]] \
+ && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then
+ docker_sudo="sudo"
+else
+ docker_sudo=""
+fi
+
+# Set up the build environment Docker image
+${docker_sudo} docker build ../.. -t "${image_name}" -f ./Dockerfile
+# Build the DEBs and copy out to ${package_temporary_dir}
+${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}"
+# Correct ownership on the DEBs (as current user, then as root if that fails)
+chown -R "${current_user}" "${package_temporary_dir}" &>/dev/null \
+ || sudo chown -R "${current_user}" "${package_temporary_dir}" &>/dev/null
+# Move the DEBs to the output directory
+mkdir -p "${output_dir}"
+mv "${package_temporary_dir}"/deb/* "${output_dir}"
From 88038d96448d57601e619572ed77d8c2f0fa4db9 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Tue, 5 Feb 2019 18:41:02 -0500
Subject: [PATCH 65/93] Update Fedora package build
---
deployment/fedora-package-x64/Dockerfile | 49 ++++++++----
deployment/fedora-package-x64/clean.sh | 42 +++++++----
deployment/fedora-package-x64/docker-build.sh | 20 +++++
deployment/fedora-package-x64/package.sh | 74 +++++++++----------
4 files changed, 118 insertions(+), 67 deletions(-)
create mode 100755 deployment/fedora-package-x64/docker-build.sh
diff --git a/deployment/fedora-package-x64/Dockerfile b/deployment/fedora-package-x64/Dockerfile
index e5deac29fb..7decba2e98 100644
--- a/deployment/fedora-package-x64/Dockerfile
+++ b/deployment/fedora-package-x64/Dockerfile
@@ -1,15 +1,36 @@
FROM fedora:29
-ARG HOME=/build
-RUN mkdir /build && \
- dnf install -y @buildsys-build rpmdevtools dnf-plugins-core && \
- dnf copr enable -y @dotnet-sig/dotnet && \
- rpmdev-setuptree
-
-WORKDIR /build/rpmbuild
-COPY ./deployment/fedora-package-x64/pkg-src/jellyfin.spec SPECS
-COPY ./deployment/fedora-package-x64/pkg-src/ SOURCES
-
-RUN spectool -g -R SPECS/jellyfin.spec && \
- rpmbuild -bs SPECS/jellyfin.spec && \
- dnf build-dep -y SRPMS/jellyfin-*.src.rpm && \
- rpmbuild -bb SPECS/jellyfin.spec;
\ No newline at end of file
+# Docker build arguments
+ARG SOURCE_DIR=/jellyfin
+ARG PLATFORM_DIR=/jellyfin/deployment/fedora-package-x64
+ARG ARTIFACT_DIR=/dist
+ARG SDK_VERSION=2.2
+# Docker run environment
+ENV SOURCE_DIR=/jellyfin
+ENV ARTIFACT_DIR=/dist
+
+# Prepare Fedora build environment
+RUN dnf update -y \
+ && dnf install -y @buildsys-build rpmdevtools dnf-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel \
+ && dnf copr enable -y @dotnet-sig/dotnet \
+ && rpmdev-setuptree \
+ && dnf install -y dotnet-sdk-${SDK_VERSION}
+
+# Link to docker-build script
+RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh
+
+# Link to RPM spec; mkdir needed or it fails, can't force dest
+RUN mkdir -p ${SOURCE_DIR}/SPECS \
+ && ln -s ${PLATFORM_DIR}/pkg-src/jellyfin.spec ${SOURCE_DIR}/SPECS/jellyfin.spec
+
+# Link to RPM sources; mkdir needed or it fails, can't force dest
+RUN mkdir -p ${SOURCE_DIR}/SOURCES \
+ && ln -s ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/SOURCES
+
+# Prepare artifact volume
+VOLUME ${ARTIFACT_DIR}/
+
+# Copy repository
+COPY . ${SOURCE_DIR}/
+
+# Set docker-build entrypoint
+ENTRYPOINT ["/docker-build.sh"]
diff --git a/deployment/fedora-package-x64/clean.sh b/deployment/fedora-package-x64/clean.sh
index d7233208ff..fbd4d276d6 100755
--- a/deployment/fedora-package-x64/clean.sh
+++ b/deployment/fedora-package-x64/clean.sh
@@ -2,17 +2,33 @@
source ../common.build.sh
-VERSION=`get_version ../..`
-
-package_temporary_dir="`pwd`/pkg-dist-tmp"
-pkg_src_dir="`pwd`/pkg-src"
-image_name="jellyfin-rpmbuild"
-docker_sudo=""
-if ! $(id -Gn | grep -q 'docker') && [ ! ${EUID:-1000} -eq 0 ] && \
- [ ! $USER == "root" ] && ! $(echo "$OSTYPE" | grep -q "darwin"); then
- docker_sudo=sudo
-fi
+keep_artifacts="${1}"
+
+WORKDIR="$( pwd )"
+VERSION="$( grep -A1 '^Version:' ${WORKDIR}/pkg-src/jellyfin.spec | awk '{ print $NF }' )"
+
+package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
+package_source_dir="${WORKDIR}/pkg-src"
+output_dir="${WORKDIR}/pkg-dist"
+current_user="$( whoami )"
+image_name="jellyfin-rpm-build"
+
+rm -f "${package_source_dir}/jellyfin-${VERSION}.tar.gz" &>/dev/null \
+ || sudo rm -f "${package_source_dir}/jellyfin-${VERSION}.tar.gz" &>/dev/null
-$docker_sudo docker image rm $image_name --force
-rm -rf "$package_temporary_dir"
-rm -rf "$pkg_src_dir/jellyfin-${VERSION}.tar.gz"
+rm -rf "${package_temporary_dir}" &>/dev/null \
+ || sudo rm -rf "${package_temporary_dir}" &>/dev/null
+
+rm -rf "${output_dir}" &>/dev/null \
+ || sudo rm -rf "${output_dir}" &>/dev/null
+
+if [[ ${keep_artifacts} == 'n' ]]; then
+ docker_sudo=""
+ if [[ ! -z $(id -Gn | grep -q 'docker') ]] \
+ && [[ ! ${EUID:-1000} -eq 0 ]] \
+ && [[ ! ${USER} == "root" ]] \
+ && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then
+ docker_sudo=sudo
+ fi
+ ${docker_sudo} docker image rm ${image_name} --force
+fi
diff --git a/deployment/fedora-package-x64/docker-build.sh b/deployment/fedora-package-x64/docker-build.sh
new file mode 100755
index 0000000000..3acf1ec0df
--- /dev/null
+++ b/deployment/fedora-package-x64/docker-build.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# Builds the RPM inside the Docker container
+
+set -o errexit
+set -o xtrace
+
+# Move to source directory
+pushd ${SOURCE_DIR}
+
+ls -al SOURCES/pkg-src/
+
+# Build RPM
+spectool -g -R SPECS/jellyfin.spec
+rpmbuild -bs SPECS/jellyfin.spec --define "_sourcedir ${SOURCE_DIR}/SOURCES/pkg-src/"
+rpmbuild -bb SPECS/jellyfin.spec --define "_sourcedir ${SOURCE_DIR}/SOURCES/pkg-src/"
+
+# Move the artifacts out
+mkdir -p ${ARTIFACT_DIR}/rpm
+mv /root/rpmbuild/RPMS/x86_64/jellyfin-*.rpm /root/rpmbuild/SRPMS/jellyfin-*.src.rpm ${ARTIFACT_DIR}/rpm/
diff --git a/deployment/fedora-package-x64/package.sh b/deployment/fedora-package-x64/package.sh
index 1d1329b03a..088a41a35f 100755
--- a/deployment/fedora-package-x64/package.sh
+++ b/deployment/fedora-package-x64/package.sh
@@ -2,37 +2,28 @@
source ../common.build.sh
-VERSION=`get_version ../..`
+WORKDIR="$( pwd )"
+VERSION="$( grep '^Version:' ${WORKDIR}/pkg-src/jellyfin.spec | awk '{ print $NF }' )"
-# TODO get the version in the package automatically. And using the changelog to decide the debian package suffix version.
+package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
+output_dir="${WORKDIR}/pkg-dist"
+pkg_src_dir="${WORKDIR}/pkg-src"
+current_user="$( whoami )"
+image_name="jellyfin-rpm-build"
-# Build a Jellyfin .rpm file with Docker on Linux
-# Places the output .rpm file in the parent directory
-
-set -o errexit
-set -o xtrace
-set -o nounset
-
-package_temporary_dir="`pwd`/pkg-dist-tmp"
-output_dir="`pwd`/pkg-dist"
-pkg_src_dir="`pwd`/pkg-src"
-current_user="`whoami`"
-image_name="jellyfin-rpmbuild"
-docker_sudo=""
-if ! $(id -Gn | grep -q 'docker') && [ ! ${EUID:-1000} -eq 0 ] && \
- [ ! $USER == "root" ] && ! $(echo "$OSTYPE" | grep -q "darwin"); then
- docker_sudo=sudo
+# Determine if sudo should be used for Docker
+if [[ ! -z $(id -Gn | grep -q 'docker') ]] \
+ && [[ ! ${EUID:-1000} -eq 0 ]] \
+ && [[ ! ${USER} == "root" ]] \
+ && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then
+ docker_sudo="sudo"
+else
+ docker_sudo=""
fi
-cleanup() {
- set +o errexit
- $docker_sudo docker image rm $image_name --force
- rm -rf "$package_temporary_dir"
- rm -rf "$pkg_src_dir/jellyfin-${VERSION}.tar.gz"
-}
-trap cleanup EXIT INT
+# Create RPM source archive
GNU_TAR=1
-mkdir -p "$package_temporary_dir"
+mkdir -p "${package_temporary_dir}"
echo "Bundling all sources for RPM build."
tar \
--transform "s,^\.,jellyfin-${VERSION}," \
@@ -47,12 +38,12 @@ tar \
--exclude='**/.nuget' \
--exclude='*.deb' \
--exclude='*.rpm' \
--zcf "$pkg_src_dir/jellyfin-${VERSION}.tar.gz" \
+-czf "${pkg_src_dir}/jellyfin-${VERSION}.tar.gz" \
-C "../.." ./ || GNU_TAR=0
if [ $GNU_TAR -eq 0 ]; then
echo "The installed tar binary did not support --transform. Using workaround."
- mkdir -p "$package_temporary_dir/jellyfin-${VERSION}"
+ mkdir -p "${package_temporary_dir}/jellyfin"
# Not GNU tar
tar \
--exclude='.git*' \
@@ -67,20 +58,23 @@ if [ $GNU_TAR -eq 0 ]; then
--exclude='*.deb' \
--exclude='*.rpm' \
-zcf \
- "$package_temporary_dir/jellyfin-${VERSION}/jellyfin.tar.gz" \
- -C "../.." \
- ./
+ "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" \
+ -C "../.." ./
echo "Extracting filtered package."
- tar -xzf "$package_temporary_dir/jellyfin-${VERSION}/jellyfin.tar.gz" -C "$package_temporary_dir/jellyfin-${VERSION}"
+ tar -xzf "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}/jellyfin-${VERSION}"
echo "Removing filtered package."
- rm "$package_temporary_dir/jellyfin-${VERSION}/jellyfin.tar.gz"
+ rm -f "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz"
echo "Repackaging package into final tarball."
- tar -zcf "$pkg_src_dir/jellyfin-${VERSION}.tar.gz" -C "$package_temporary_dir" "jellyfin-${VERSION}"
+ tar -czf "${pkg_src_dir}/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}" "jellyfin-${VERSION}"
fi
-$docker_sudo docker build ../.. -t "$image_name" -f ./Dockerfile
-mkdir -p "$output_dir"
-$docker_sudo docker run --rm -v "$package_temporary_dir:/temp" "$image_name" sh -c 'find /build/rpmbuild -maxdepth 3 -type f -name "jellyfin*.rpm" -exec mv {} /temp \;'
-chown -R "$current_user" "$package_temporary_dir" \
-|| sudo chown -R "$current_user" "$package_temporary_dir"
-mv "$package_temporary_dir"/*.rpm "$output_dir"
+# Set up the build environment Docker image
+${docker_sudo} docker build ../.. -t "${image_name}" -f ./Dockerfile
+# Build the RPMs and copy out to ${package_temporary_dir}
+${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}"
+# Correct ownership on the RPMs (as current user, then as root if that fails)
+chown -R "${current_user}" "${package_temporary_dir}" \
+ || sudo chown -R "${current_user}" "${package_temporary_dir}"
+# Move the RPMs to the output directory
+mkdir -p "${output_dir}"
+mv "${package_temporary_dir}"/rpm/* "${output_dir}"
From 8413c56392eb331bc319cddf135b671ec0a80123 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Tue, 5 Feb 2019 19:04:20 -0500
Subject: [PATCH 66/93] Update CentOS package build
---
deployment/centos-package-x64/Dockerfile | 49 +++++++++++++------
.../centos-package-x64/dependencies.txt | 1 +
deployment/centos-package-x64/docker-build.sh | 1 +
3 files changed, 37 insertions(+), 14 deletions(-)
create mode 100644 deployment/centos-package-x64/dependencies.txt
create mode 120000 deployment/centos-package-x64/docker-build.sh
diff --git a/deployment/centos-package-x64/Dockerfile b/deployment/centos-package-x64/Dockerfile
index bbe5ffd277..89799bca20 100644
--- a/deployment/centos-package-x64/Dockerfile
+++ b/deployment/centos-package-x64/Dockerfile
@@ -1,15 +1,36 @@
FROM centos:7
-ARG HOME=/build
-RUN mkdir /build && \
- yum install -y @buildsys-build rpmdevtools yum-plugins-core && \
- rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm && \
- rpmdev-setuptree
-
-WORKDIR /build/rpmbuild
-COPY ./deployment/centos-package-x64/pkg-src/jellyfin.spec SPECS
-COPY ./deployment/centos-package-x64/pkg-src/ SOURCES
-
-RUN spectool -g -R SPECS/jellyfin.spec && \
- rpmbuild -bs SPECS/jellyfin.spec && \
- yum-builddep -y SRPMS/jellyfin-*.src.rpm && \
- rpmbuild -bb SPECS/jellyfin.spec;
\ No newline at end of file
+# Docker build arguments
+ARG SOURCE_DIR=/jellyfin
+ARG PLATFORM_DIR=/jellyfin/deployment/centos-package-x64
+ARG ARTIFACT_DIR=/dist
+ARG SDK_VERSION=2.2
+# Docker run environment
+ENV SOURCE_DIR=/jellyfin
+ENV ARTIFACT_DIR=/dist
+
+# Prepare CentOS build environment
+RUN yum update -y \
+ && yum install -y @buildsys-build rpmdevtools yum-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel \
+ && rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm \
+ && rpmdev-setuptree \
+ && yum install -y dotnet-sdk-${SDK_VERSION}
+
+# Link to docker-build script
+RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh
+
+# Link to RPM spec; mkdir needed or it fails, can't force dest
+RUN mkdir -p ${SOURCE_DIR}/SPECS \
+ && ln -s ${PLATFORM_DIR}/pkg-src/jellyfin.spec ${SOURCE_DIR}/SPECS/jellyfin.spec
+
+# Link to RPM sources; mkdir needed or it fails, can't force dest
+RUN mkdir -p ${SOURCE_DIR}/SOURCES \
+ && ln -s ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/SOURCES
+
+# Prepare artifact volume
+VOLUME ${ARTIFACT_DIR}/
+
+# Copy repository
+COPY . ${SOURCE_DIR}/
+
+# Set docker-build entrypoint
+ENTRYPOINT ["/docker-build.sh"]
diff --git a/deployment/centos-package-x64/dependencies.txt b/deployment/centos-package-x64/dependencies.txt
new file mode 100644
index 0000000000..bdb9670965
--- /dev/null
+++ b/deployment/centos-package-x64/dependencies.txt
@@ -0,0 +1 @@
+docker
diff --git a/deployment/centos-package-x64/docker-build.sh b/deployment/centos-package-x64/docker-build.sh
new file mode 120000
index 0000000000..7adc32954d
--- /dev/null
+++ b/deployment/centos-package-x64/docker-build.sh
@@ -0,0 +1 @@
+../fedora-package-x64/docker-build.sh
\ No newline at end of file
From ceb8b9f74014060417ed55680038a2601c5e366a Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Tue, 5 Feb 2019 21:32:35 -0500
Subject: [PATCH 67/93] Add explanation to usage output
---
build | 1 +
1 file changed, 1 insertion(+)
diff --git a/build b/build
index 7413b60e36..3b4167dae4 100755
--- a/build
+++ b/build
@@ -25,6 +25,7 @@ usage() {
echo -e " $ build --list-actions "
echo -e " $ build [-k/--keep-artifacts] [-b/--web-branch ] "
echo -e ""
+ echo -e "The 'keep-artifacts' option preserves build artifacts, e.g. Docker images for system package builds."
echo -e "The web_branch defaults to the same branch name as the current main branch."
echo -e "To build all platforms, use 'all'."
echo -e "To perform all build actions, use 'all'."
From e1d523ee458d19ad412795b71d9dfb1c4fc7b688 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Tue, 5 Feb 2019 21:37:56 -0500
Subject: [PATCH 68/93] Improve description of keep_artifacts flag
---
deployment/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/deployment/README.md b/deployment/README.md
index 608d80e58f..a00cd3e6c2 100644
--- a/deployment/README.md
+++ b/deployment/README.md
@@ -55,7 +55,7 @@ These builds are not necessarily run from the `build` script, but are present fo
* The `clean` action should always `exit 0` even if no work is done or it fails.
-* The `clean` action can be passed a variable as argument 1, named `keep_artifacts`. It is indended to handle situations when the user runs `build --keep-artifacts` and should be handled intelligently. Usually, this is used to preserve Docker images while still removing temporary directories.
+* The `clean` action can be passed a variable as argument 1, named `keep_artifacts`, containing either the value `y` or `n`. It is indended to handle situations when the user runs `build --keep-artifacts` and should be handled intelligently. Usually, this is used to preserve Docker images while still removing temporary directories.
### Output Files
From b8b650540d604dce7f9066cae6765488f4138198 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Wed, 6 Feb 2019 09:33:14 -0500
Subject: [PATCH 69/93] Allow Fedora/CentOS mounting by default
---
deployment/fedora-package-x64/pkg-src/jellyfin.sudoers | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.sudoers b/deployment/fedora-package-x64/pkg-src/jellyfin.sudoers
index ddd890ce16..dd245af4b8 100644
--- a/deployment/fedora-package-x64/pkg-src/jellyfin.sudoers
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.sudoers
@@ -12,8 +12,8 @@ Defaults!RESTARTSERVER_SYSTEMD !requiretty
Defaults!STARTSERVER_SYSTEMD !requiretty
Defaults!STOPSERVER_SYSTEMD !requiretty
-# Uncomment to allow the server to mount iso images
-# jellyfin ALL=(ALL) NOPASSWD: /bin/mount
-# jellyfin ALL=(ALL) NOPASSWD: /bin/umount
+# Allow the server to mount iso images
+jellyfin ALL=(ALL) NOPASSWD: /bin/mount
+jellyfin ALL=(ALL) NOPASSWD: /bin/umount
Defaults:jellyfin !requiretty
From fcfe02ee7370b6462d995bb8c37aaebf3abd31e7 Mon Sep 17 00:00:00 2001
From: Claus Vium
Date: Wed, 6 Feb 2019 22:40:49 +0100
Subject: [PATCH 70/93] Add await to GetCountries in LocalizationService
---
MediaBrowser.Api/LocalizationService.cs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/MediaBrowser.Api/LocalizationService.cs b/MediaBrowser.Api/LocalizationService.cs
index 3b2e18852a..1524c8d26d 100644
--- a/MediaBrowser.Api/LocalizationService.cs
+++ b/MediaBrowser.Api/LocalizationService.cs
@@ -2,6 +2,7 @@ using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Services;
+using System.Threading.Tasks;
namespace MediaBrowser.Api
{
@@ -81,9 +82,9 @@ namespace MediaBrowser.Api
///
/// The request.
/// System.Object.
- public object Get(GetCountries request)
+ public async Task Get(GetCountries request)
{
- var result = _localization.GetCountries();
+ var result = await _localization.GetCountries();
return ToOptimizedResult(result);
}
From e44918264167f664702ee3f4910d93a14d3e07b6 Mon Sep 17 00:00:00 2001
From: Claus Vium
Date: Wed, 6 Feb 2019 22:54:57 +0100
Subject: [PATCH 71/93] Move import
---
MediaBrowser.Api/LocalizationService.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/MediaBrowser.Api/LocalizationService.cs b/MediaBrowser.Api/LocalizationService.cs
index 1524c8d26d..eeff67e13c 100644
--- a/MediaBrowser.Api/LocalizationService.cs
+++ b/MediaBrowser.Api/LocalizationService.cs
@@ -1,8 +1,8 @@
+using System.Threading.Tasks;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Services;
-using System.Threading.Tasks;
namespace MediaBrowser.Api
{
From 70c85925af31ee341f87fced39a67ab7fb4eed77 Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Wed, 6 Feb 2019 21:31:41 +0100
Subject: [PATCH 72/93] Move some arrays to generics
---
Emby.Drawing/ImageProcessor.cs | 18 +++++++++---------
Emby.Drawing/NullImageEncoder.cs | 15 ++++++---------
.../IO/LibraryMonitor.cs | 8 ++++----
.../Library/Resolvers/PhotoResolver.cs | 7 ++++---
.../Services/ResponseHelper.cs | 2 +-
.../Services/ServiceExec.cs | 2 --
Jellyfin.Drawing.Skia/SkiaEncoder.cs | 13 ++++++++-----
.../Drawing/IImageEncoder.cs | 5 +++--
.../Drawing/IImageProcessor.cs | 6 +++---
9 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs
index 097b4c40b7..1e4646227a 100644
--- a/Emby.Drawing/ImageProcessor.cs
+++ b/Emby.Drawing/ImageProcessor.cs
@@ -83,8 +83,8 @@ namespace Emby.Drawing
}
}
- public string[] SupportedInputFormats =>
- new string[]
+ public IReadOnlyCollection SupportedInputFormats =>
+ new HashSet(StringComparer.OrdinalIgnoreCase)
{
"tiff",
"tif",
@@ -137,14 +137,14 @@ namespace Emby.Drawing
}
}
- public ImageFormat[] GetSupportedImageOutputFormats()
- {
- return _imageEncoder.SupportedOutputFormats;
- }
+ public IReadOnlyCollection GetSupportedImageOutputFormats()
+ => _imageEncoder.SupportedOutputFormats;
+
+ private static readonly HashSet TransparentImageTypes
+ = new HashSet(StringComparer.OrdinalIgnoreCase) { ".png", ".webp", ".gif" };
- private static readonly string[] TransparentImageTypes = new string[] { ".png", ".webp", ".gif" };
public bool SupportsTransparency(string path)
- => TransparentImageTypes.Contains(Path.GetExtension(path).ToLowerInvariant());
+ => TransparentImageTypes.Contains(Path.GetExtension(path));
public async Task<(string path, string mimeType, DateTime dateModified)> ProcessImage(ImageProcessingOptions options)
{
@@ -472,7 +472,7 @@ namespace Emby.Drawing
return (originalImagePath, dateModified);
}
- if (!_imageEncoder.SupportedInputFormats.Contains(inputFormat, StringComparer.OrdinalIgnoreCase))
+ if (!_imageEncoder.SupportedInputFormats.Contains(inputFormat))
{
try
{
diff --git a/Emby.Drawing/NullImageEncoder.cs b/Emby.Drawing/NullImageEncoder.cs
index 14f0424ac7..fc4a5af9fc 100644
--- a/Emby.Drawing/NullImageEncoder.cs
+++ b/Emby.Drawing/NullImageEncoder.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Model.Drawing;
@@ -6,15 +7,11 @@ namespace Emby.Drawing
{
public class NullImageEncoder : IImageEncoder
{
- public string[] SupportedInputFormats =>
- new[]
- {
- "png",
- "jpeg",
- "jpg"
- };
-
- public ImageFormat[] SupportedOutputFormats => new[] { ImageFormat.Jpg, ImageFormat.Png };
+ public IReadOnlyCollection SupportedInputFormats
+ => new HashSet(StringComparer.OrdinalIgnoreCase) { "png", "jpeg", "jpg" };
+
+ public IReadOnlyCollection SupportedOutputFormats
+ => new HashSet() { ImageFormat.Jpg, ImageFormat.Png };
public void CropWhiteSpace(string inputPath, string outputPath)
{
diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs
index 11c684b128..607a4d333f 100644
--- a/Emby.Server.Implementations/IO/LibraryMonitor.cs
+++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs
@@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.IO
///
/// Any file name ending in any of these will be ignored by the watchers
///
- private readonly string[] _alwaysIgnoreFiles = new string[]
+ private readonly HashSet _alwaysIgnoreFiles = new HashSet(StringComparer.OrdinalIgnoreCase)
{
"small.jpg",
"albumart.jpg",
@@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.IO
".actors"
};
- private readonly string[] _alwaysIgnoreExtensions = new string[]
+ private readonly HashSet _alwaysIgnoreExtensions = new HashSet(StringComparer.OrdinalIgnoreCase)
{
// thumbs.db
".db",
@@ -456,8 +456,8 @@ namespace Emby.Server.Implementations.IO
var filename = Path.GetFileName(path);
var monitorPath = !string.IsNullOrEmpty(filename) &&
- !_alwaysIgnoreFiles.Contains(filename, StringComparer.OrdinalIgnoreCase) &&
- !_alwaysIgnoreExtensions.Contains(Path.GetExtension(path) ?? string.Empty, StringComparer.OrdinalIgnoreCase) &&
+ !_alwaysIgnoreFiles.Contains(filename) &&
+ !_alwaysIgnoreExtensions.Contains(Path.GetExtension(path)) &&
_alwaysIgnoreSubstrings.All(i => path.IndexOf(i, StringComparison.OrdinalIgnoreCase) == -1);
// Ignore certain files
diff --git a/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs b/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs
index 9de766767f..a3298c5803 100644
--- a/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
using MediaBrowser.Controller.Drawing;
@@ -85,7 +86,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
return false;
}
- private static readonly string[] IgnoreFiles =
+ private static readonly HashSet IgnoreFiles = new HashSet(StringComparer.OrdinalIgnoreCase)
{
"folder",
"thumb",
@@ -102,7 +103,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
{
var filename = Path.GetFileNameWithoutExtension(path) ?? string.Empty;
- if (IgnoreFiles.Contains(filename, StringComparer.OrdinalIgnoreCase))
+ if (IgnoreFiles.Contains(filename))
{
return false;
}
@@ -112,7 +113,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
return false;
}
- return imageProcessor.SupportedInputFormats.Contains((Path.GetExtension(path) ?? string.Empty).TrimStart('.'), StringComparer.OrdinalIgnoreCase);
+ return imageProcessor.SupportedInputFormats.Contains((Path.GetExtension(path) ?? string.Empty).TrimStart('.'));
}
}
diff --git a/Emby.Server.Implementations/Services/ResponseHelper.cs b/Emby.Server.Implementations/Services/ResponseHelper.cs
index 16de1a0833..dc99753477 100644
--- a/Emby.Server.Implementations/Services/ResponseHelper.cs
+++ b/Emby.Server.Implementations/Services/ResponseHelper.cs
@@ -70,7 +70,7 @@ namespace Emby.Server.Implementations.Services
response.ContentType = defaultContentType;
}
- if (new HashSet { "application/json", }.Contains(response.ContentType))
+ if (response.ContentType == "application/json")
{
response.ContentType += "; charset=utf-8";
}
diff --git a/Emby.Server.Implementations/Services/ServiceExec.cs b/Emby.Server.Implementations/Services/ServiceExec.cs
index aa67a36010..79f5c59e65 100644
--- a/Emby.Server.Implementations/Services/ServiceExec.cs
+++ b/Emby.Server.Implementations/Services/ServiceExec.cs
@@ -23,8 +23,6 @@ namespace Emby.Server.Implementations.Services
"POLL", "SUBSCRIBE", "UNSUBSCRIBE"
};
- public static HashSet AllVerbsSet = new HashSet(AllVerbs);
-
public static List GetActions(this Type serviceType)
{
var list = new List();
diff --git a/Jellyfin.Drawing.Skia/SkiaEncoder.cs b/Jellyfin.Drawing.Skia/SkiaEncoder.cs
index f1b886ec64..dc714ed187 100644
--- a/Jellyfin.Drawing.Skia/SkiaEncoder.cs
+++ b/Jellyfin.Drawing.Skia/SkiaEncoder.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -35,8 +36,8 @@ namespace Jellyfin.Drawing.Skia
LogVersion();
}
- public string[] SupportedInputFormats =>
- new[]
+ public IReadOnlyCollection SupportedInputFormats =>
+ new HashSet(StringComparer.OrdinalIgnoreCase)
{
"jpeg",
"jpg",
@@ -62,7 +63,8 @@ namespace Jellyfin.Drawing.Skia
"arw"
};
- public ImageFormat[] SupportedOutputFormats => new[] { ImageFormat.Webp, ImageFormat.Jpg, ImageFormat.Png };
+ public IReadOnlyCollection SupportedOutputFormats
+ => new HashSet() { ImageFormat.Webp, ImageFormat.Jpg, ImageFormat.Png };
private void LogVersion()
{
@@ -253,7 +255,8 @@ namespace Jellyfin.Drawing.Skia
}
}
- private static string[] TransparentImageTypes = new string[] { ".png", ".gif", ".webp" };
+ private static readonly HashSet TransparentImageTypes
+ = new HashSet(StringComparer.OrdinalIgnoreCase) { ".png", ".gif", ".webp" };
internal static SKBitmap Decode(string path, bool forceCleanBitmap, IFileSystem fileSystem, ImageOrientation? orientation, out SKEncodedOrigin origin)
{
@@ -262,7 +265,7 @@ namespace Jellyfin.Drawing.Skia
throw new FileNotFoundException("File not found", path);
}
- var requiresTransparencyHack = TransparentImageTypes.Contains(Path.GetExtension(path) ?? string.Empty);
+ var requiresTransparencyHack = TransparentImageTypes.Contains(Path.GetExtension(path));
if (requiresTransparencyHack || forceCleanBitmap)
{
diff --git a/MediaBrowser.Controller/Drawing/IImageEncoder.cs b/MediaBrowser.Controller/Drawing/IImageEncoder.cs
index 5b8c9da6fd..4eaecd0a0e 100644
--- a/MediaBrowser.Controller/Drawing/IImageEncoder.cs
+++ b/MediaBrowser.Controller/Drawing/IImageEncoder.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using MediaBrowser.Model.Drawing;
namespace MediaBrowser.Controller.Drawing
@@ -9,12 +10,12 @@ namespace MediaBrowser.Controller.Drawing
/// Gets the supported input formats.
///
/// The supported input formats.
- string[] SupportedInputFormats { get; }
+ IReadOnlyCollection SupportedInputFormats { get; }
///
/// Gets the supported output formats.
///
/// The supported output formats.
- ImageFormat[] SupportedOutputFormats { get; }
+ IReadOnlyCollection SupportedOutputFormats { get; }
///
/// Encodes the image.
diff --git a/MediaBrowser.Controller/Drawing/IImageProcessor.cs b/MediaBrowser.Controller/Drawing/IImageProcessor.cs
index 7831827309..b713d50b10 100644
--- a/MediaBrowser.Controller/Drawing/IImageProcessor.cs
+++ b/MediaBrowser.Controller/Drawing/IImageProcessor.cs
@@ -18,7 +18,7 @@ namespace MediaBrowser.Controller.Drawing
/// Gets the supported input formats.
///
/// The supported input formats.
- string[] SupportedInputFormats { get; }
+ IReadOnlyCollection SupportedInputFormats { get; }
///
/// Gets the image enhancers.
@@ -96,8 +96,8 @@ namespace MediaBrowser.Controller.Drawing
///
/// Gets the supported image output formats.
///
- /// ImageOutputFormat[].
- ImageFormat[] GetSupportedImageOutputFormats();
+ /// IReadOnlyCollection{ImageOutput}.
+ IReadOnlyCollection GetSupportedImageOutputFormats();
///
/// Creates the image collage.
From 9dd512df802a6829521bbf357244159d97bae7b5 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Wed, 6 Feb 2019 20:09:55 -0500
Subject: [PATCH 73/93] Add donation badge and reorganize badges
---
README.md | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index d5eaa8ec23..5d9a940eec 100644
--- a/README.md
+++ b/README.md
@@ -5,14 +5,16 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
---
From f60ad53393a126079d1a523de0f01f1ac01323c0 Mon Sep 17 00:00:00 2001
From: Bond-009
Date: Thu, 7 Feb 2019 23:36:44 +0100
Subject: [PATCH 74/93] Quick style fix
---
.../SocketSharp/WebSocketSharpRequest.cs | 26 ++++++++++++-------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs
index 2e8dd9185b..2863106f89 100644
--- a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs
+++ b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs
@@ -86,9 +86,7 @@ namespace Jellyfin.SocketSharp
private static readonly char[] HttpTrimCharacters = new char[] { (char)0x09, (char)0xA, (char)0xB, (char)0xC, (char)0xD, (char)0x20 };
- //
// CheckBadChars - throws on invalid chars to be not found in header name/value
- //
internal static string CheckBadChars(string name)
{
if (name == null || name.Length == 0)
@@ -97,11 +95,11 @@ namespace Jellyfin.SocketSharp
}
// VALUE check
- //Trim spaces from both ends
+ // Trim spaces from both ends
name = name.Trim(HttpTrimCharacters);
- //First, check for correctly formed multi-line value
- //Second, check for absenece of CTL characters
+ // First, check for correctly formed multi-line value
+ // Second, check for absenece of CTL characters
int crlf = 0;
for (int i = 0; i < name.Length; ++i)
{
@@ -198,7 +196,10 @@ namespace Jellyfin.SocketSharp
public static string GetResponseContentType(IRequest httpReq)
{
var specifiedContentType = GetQueryStringContentType(httpReq);
- if (!string.IsNullOrEmpty(specifiedContentType)) return specifiedContentType;
+ if (!string.IsNullOrEmpty(specifiedContentType))
+ {
+ return specifiedContentType;
+ }
var serverDefaultContentType = "application/json";
@@ -237,7 +238,7 @@ namespace Jellyfin.SocketSharp
return Soap11;
}
- //We could also send a '406 Not Acceptable', but this is allowed also
+ // We could also send a '406 Not Acceptable', but this is allowed also
return serverDefaultContentType;
}
@@ -252,7 +253,10 @@ namespace Jellyfin.SocketSharp
foreach (var contentType in contentTypes)
{
- if (IsContentType(request, contentType)) return true;
+ if (IsContentType(request, contentType))
+ {
+ return true;
+ }
}
return false;
@@ -274,10 +278,12 @@ namespace Jellyfin.SocketSharp
{
return null;
}
+
if (pi[0] == '/')
{
pi = pi.Substring(1);
}
+
format = LeftPart(pi, '/');
if (format.Length > formatMaxLength)
{
@@ -285,7 +291,7 @@ namespace Jellyfin.SocketSharp
}
}
- format = LeftPart(format, '.').ToLowerInvariant();
+ format = LeftPart(format, '.');
if (format.Contains("json", StringComparison.OrdinalIgnoreCase))
{
return "application/json";
@@ -349,7 +355,7 @@ namespace Jellyfin.SocketSharp
return pathInfo;
}
- //Wildcard mode relies on this to work out the handlerPath
+ // Wildcard mode relies on this to work out the handlerPath
pathInfo = ResolvePathInfoFromMappedPath(fullPath, appPath);
if (!string.IsNullOrEmpty(pathInfo))
{
From 38d9eeffbe2ddd5aa77efe4817129c391def28a8 Mon Sep 17 00:00:00 2001
From: Bond-009
Date: Fri, 8 Feb 2019 00:07:57 +0100
Subject: [PATCH 75/93] Fix more warnings
---
Jellyfin.Server/SocketSharp/RequestMono.cs | 59 ++++++++++---------
.../SocketSharp/WebSocketSharpRequest.cs | 17 +++---
2 files changed, 39 insertions(+), 37 deletions(-)
diff --git a/Jellyfin.Server/SocketSharp/RequestMono.cs b/Jellyfin.Server/SocketSharp/RequestMono.cs
index f09197fb35..e39ed30ea0 100644
--- a/Jellyfin.Server/SocketSharp/RequestMono.cs
+++ b/Jellyfin.Server/SocketSharp/RequestMono.cs
@@ -11,7 +11,7 @@ namespace Jellyfin.SocketSharp
{
public partial class WebSocketSharpRequest : IHttpRequest
{
- static internal string GetParameter(string header, string attr)
+ internal static string GetParameter(string header, string attr)
{
int ap = header.IndexOf(attr);
if (ap == -1)
@@ -40,7 +40,7 @@ namespace Jellyfin.SocketSharp
return header.Substring(ap + 1, end - ap - 1);
}
- async Task LoadMultiPart(WebROCollection form)
+ private async Task LoadMultiPart(WebROCollection form)
{
string boundary = GetParameter(ContentType, "; boundary=");
if (boundary == null)
@@ -50,8 +50,8 @@ namespace Jellyfin.SocketSharp
using (var requestStream = InputStream)
{
- //DB: 30/01/11 - Hack to get around non-seekable stream and received HTTP request
- //Not ending with \r\n?
+ // DB: 30/01/11 - Hack to get around non-seekable stream and received HTTP request
+ // Not ending with \r\n?
var ms = new MemoryStream(32 * 1024);
await requestStream.CopyToAsync(ms).ConfigureAwait(false);
@@ -62,9 +62,9 @@ namespace Jellyfin.SocketSharp
input.Position = 0;
// Uncomment to debug
- //var content = new StreamReader(ms).ReadToEnd();
- //Console.WriteLine(boundary + "::" + content);
- //input.Position = 0;
+ // var content = new StreamReader(ms).ReadToEnd();
+ // Console.WriteLine(boundary + "::" + content);
+ // input.Position = 0;
var multi_part = new HttpMultipart(input, boundary, ContentEncoding);
@@ -111,7 +111,7 @@ namespace Jellyfin.SocketSharp
// Setting this before calling the validator prevents
// possible endless recursion
checked_form = true;
- ValidateNameValueCollection ("Form", query_string_nvc, RequestValidationSource.Form);
+ ValidateNameValueCollection("Form", query_string_nvc, RequestValidationSource.Form);
} else
#endif
if (validate_form && !checked_form)
@@ -130,7 +130,7 @@ namespace Jellyfin.SocketSharp
protected bool validate_cookies, validate_query_string, validate_form;
protected bool checked_cookies, checked_query_string, checked_form;
- static void ThrowValidationException(string name, string key, string value)
+ private static void ThrowValidationException(string name, string key, string value)
{
string v = "\"" + value + "\"";
if (v.Length > 20)
@@ -144,7 +144,7 @@ namespace Jellyfin.SocketSharp
throw new Exception(msg);
}
- static void ValidateNameValueCollection(string name, QueryParamCollection coll)
+ private static void ValidateNameValueCollection(string name, QueryParamCollection coll)
{
if (coll == null)
{
@@ -209,7 +209,7 @@ namespace Jellyfin.SocketSharp
validate_form = true;
}
- bool IsContentType(string ct, bool starts_with)
+ private bool IsContentType(string ct, bool starts_with)
{
if (ct == null || ContentType == null)
{
@@ -224,7 +224,7 @@ namespace Jellyfin.SocketSharp
return string.Equals(ContentType, ct, StringComparison.OrdinalIgnoreCase);
}
- async Task LoadWwwForm(WebROCollection form)
+ private async Task LoadWwwForm(WebROCollection form)
{
using (var input = InputStream)
{
@@ -280,7 +280,7 @@ namespace Jellyfin.SocketSharp
}
}
- static void AddRawKeyValue(WebROCollection form, StringBuilder key, StringBuilder value)
+ private static void AddRawKeyValue(WebROCollection form, StringBuilder key, StringBuilder value)
{
form.Add(WebUtility.UrlDecode(key.ToString()), WebUtility.UrlDecode(value.ToString()));
@@ -288,9 +288,9 @@ namespace Jellyfin.SocketSharp
value.Length = 0;
}
- Dictionary files;
+ private Dictionary files;
- class WebROCollection : QueryParamCollection
+ private class WebROCollection : QueryParamCollection
{
public override string ToString()
{
@@ -317,16 +317,16 @@ namespace Jellyfin.SocketSharp
public sealed class HttpPostedFile
{
- string name;
- string content_type;
- Stream stream;
+ private string name;
+ private string content_type;
+ private Stream stream;
- class ReadSubStream : Stream
+ private class ReadSubStream : Stream
{
- Stream s;
- long offset;
- long end;
- long position;
+ private Stream s;
+ private long offset;
+ private long end;
+ private long position;
public ReadSubStream(Stream s, long offset, long length)
{
@@ -429,7 +429,7 @@ namespace Jellyfin.SocketSharp
real = position + d;
break;
default:
- throw new ArgumentException();
+ throw new ArgumentException(nameof(origin));
}
long virt = real - offset;
@@ -491,7 +491,7 @@ namespace Jellyfin.SocketSharp
public Stream InputStream => stream;
}
- class Helpers
+ private class Helpers
{
public static readonly CultureInfo InvariantCulture = CultureInfo.InvariantCulture;
}
@@ -614,7 +614,7 @@ namespace Jellyfin.SocketSharp
private static string GetContentDispositionAttribute(string l, string name)
{
- int idx = l.IndexOf(name + "=\"");
+ int idx = l.IndexOf(name + "=\"", StringComparison.Ordinal);
if (idx < 0)
{
return null;
@@ -637,7 +637,7 @@ namespace Jellyfin.SocketSharp
private string GetContentDispositionAttributeWithEncoding(string l, string name)
{
- int idx = l.IndexOf(name + "=\"");
+ int idx = l.IndexOf(name + "=\"", StringComparison.Ordinal);
if (idx < 0)
{
return null;
@@ -669,11 +669,12 @@ namespace Jellyfin.SocketSharp
{
try
{
- string line = ReadLine();
- while (line == string.Empty)
+ string line;
+ do
{
line = ReadLine();
}
+ while (line.Length == 0);
if (line[0] != '-' || line[1] != '-')
{
diff --git a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs
index 2863106f89..38e8d9699e 100644
--- a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs
+++ b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs
@@ -80,8 +80,8 @@ namespace Jellyfin.SocketSharp
private string remoteIp;
public string RemoteIp =>
remoteIp ??
- (remoteIp = (CheckBadChars(XForwardedFor)) ??
- (NormalizeIp(CheckBadChars(XRealIp)) ??
+ (remoteIp = CheckBadChars(XForwardedFor) ??
+ NormalizeIp(CheckBadChars(XRealIp) ??
(request.RemoteEndPoint != null ? NormalizeIp(request.RemoteEndPoint.Address.ToString()) : null)));
private static readonly char[] HttpTrimCharacters = new char[] { (char)0x09, (char)0xA, (char)0xB, (char)0xC, (char)0xD, (char)0x20 };
@@ -201,7 +201,7 @@ namespace Jellyfin.SocketSharp
return specifiedContentType;
}
- var serverDefaultContentType = "application/json";
+ const string serverDefaultContentType = "application/json";
var acceptContentTypes = httpReq.AcceptTypes;
string defaultContentType = null;
@@ -211,7 +211,7 @@ namespace Jellyfin.SocketSharp
}
var acceptsAnything = false;
- var hasDefaultContentType = !string.IsNullOrEmpty(defaultContentType);
+ var hasDefaultContentType = defaultContentType != null;
if (acceptContentTypes != null)
{
foreach (var acceptsType in acceptContentTypes)
@@ -311,7 +311,7 @@ namespace Jellyfin.SocketSharp
return null;
}
- var pos = strVal.IndexOf(needle);
+ var pos = strVal.IndexOf(needle, StringComparison.Ordinal);
return pos == -1 ? strVal : strVal.Substring(0, pos);
}
@@ -397,6 +397,7 @@ namespace Jellyfin.SocketSharp
}
}
}
+
if (!pathRootFound)
{
return null;
@@ -507,10 +508,10 @@ namespace Jellyfin.SocketSharp
public static string NormalizePathInfo(string pathInfo, string handlerPath)
{
- if (handlerPath != null && pathInfo.TrimStart('/').StartsWith(
- handlerPath, StringComparison.OrdinalIgnoreCase))
+ var trimmed = pathInfo.TrimStart('/');
+ if (handlerPath != null && trimmed.StartsWith(handlerPath, StringComparison.OrdinalIgnoreCase))
{
- return pathInfo.TrimStart('/').Substring(handlerPath.Length);
+ return trimmed.Substring(handlerPath.Length);
}
return pathInfo;
From aff740c596b7c2d4f28bb55458d8ddeb85a39d3d Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Thu, 7 Feb 2019 18:14:43 -0500
Subject: [PATCH 76/93] Fix OC badge to all and add forum badge
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 5d9a940eec..d869c89789 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,8 @@
-
+
+
From 22ffc5aee4f2f67c69a678217abc6a3171d6e329 Mon Sep 17 00:00:00 2001
From: Andrew Rabert
Date: Fri, 8 Feb 2019 00:19:31 -0500
Subject: [PATCH 77/93] Use VAAPI-enabled ffmpeg
---
Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index 37388fda9d..266b59f1c8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -10,7 +10,7 @@ RUN export DOTNET_CLI_TELEMETRY_OPTOUT=1 \
--output /jellyfin \
Jellyfin.Server
-FROM jrottenberg/ffmpeg:4.0-scratch as ffmpeg
+FROM jrottenberg/ffmpeg:4.0-vaapi as ffmpeg
FROM microsoft/dotnet:${DOTNET_VERSION}-runtime
# libfontconfig1 is required for Skia
RUN apt-get update \
From c3c52b66822d94c92e0f66603e868ba8f98df4b0 Mon Sep 17 00:00:00 2001
From: Claus Vium
Date: Fri, 8 Feb 2019 10:03:38 +0100
Subject: [PATCH 78/93] Default to en-US for missing core translations
---
.../Localization/LocalizationManager.cs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs
index 8651a7dad4..7cf42a50a7 100644
--- a/Emby.Server.Implementations/Localization/LocalizationManager.cs
+++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs
@@ -460,11 +460,15 @@ namespace Emby.Server.Implementations.Localization
{
using (var stream = _assembly.GetManifestResourceStream(resourcePath))
{
- var dict = await _jsonSerializer.DeserializeFromStreamAsync>(stream);
-
- foreach (var key in dict.Keys)
+ // If a Culture doesn't have a translation the stream will be null and it defaults to en-us further up the chain
+ if (stream != null)
{
- dictionary[key] = dict[key];
+ var dict = await _jsonSerializer.DeserializeFromStreamAsync>(stream);
+
+ foreach (var key in dict.Keys)
+ {
+ dictionary[key] = dict[key];
+ }
}
}
}
From 49923e50db60be989ffd252b29301f2db3356494 Mon Sep 17 00:00:00 2001
From: Claus Vium
Date: Fri, 8 Feb 2019 10:25:07 +0100
Subject: [PATCH 79/93] Remove missing languages from localization options
---
.../Localization/LocalizationManager.cs | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs
index 7cf42a50a7..2120a8461b 100644
--- a/Emby.Server.Implementations/Localization/LocalizationManager.cs
+++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs
@@ -493,29 +493,23 @@ namespace Emby.Server.Implementations.Localization
=> new LocalizationOption[]
{
new LocalizationOption("Arabic", "ar"),
- new LocalizationOption("Belarusian (Belarus)", "be-BY"),
new LocalizationOption("Bulgarian (Bulgaria)", "bg-BG"),
new LocalizationOption("Catalan", "ca"),
new LocalizationOption("Chinese Simplified", "zh-CN"),
new LocalizationOption("Chinese Traditional", "zh-TW"),
- new LocalizationOption("Chinese Traditional (Hong Kong)", "zh-HK"),
new LocalizationOption("Croatian", "hr"),
new LocalizationOption("Czech", "cs"),
new LocalizationOption("Danish", "da"),
new LocalizationOption("Dutch", "nl"),
new LocalizationOption("English (United Kingdom)", "en-GB"),
new LocalizationOption("English (United States)", "en-US"),
- new LocalizationOption("Finnish", "fi"),
new LocalizationOption("French", "fr"),
new LocalizationOption("French (Canada)", "fr-CA"),
new LocalizationOption("German", "de"),
new LocalizationOption("Greek", "el"),
new LocalizationOption("Hebrew", "he"),
- new LocalizationOption("Hindi (India)", "hi-IN"),
new LocalizationOption("Hungarian", "hu"),
- new LocalizationOption("Indonesian", "id"),
new LocalizationOption("Italian", "it"),
- new LocalizationOption("Japanese", "ja"),
new LocalizationOption("Kazakh", "kk"),
new LocalizationOption("Korean", "ko"),
new LocalizationOption("Lithuanian", "lt-LT"),
@@ -525,18 +519,15 @@ namespace Emby.Server.Implementations.Localization
new LocalizationOption("Polish", "pl"),
new LocalizationOption("Portuguese (Brazil)", "pt-BR"),
new LocalizationOption("Portuguese (Portugal)", "pt-PT"),
- new LocalizationOption("Romanian", "ro"),
new LocalizationOption("Russian", "ru"),
new LocalizationOption("Slovak", "sk"),
new LocalizationOption("Slovenian (Slovenia)", "sl-SI"),
new LocalizationOption("Spanish", "es"),
- new LocalizationOption("Spanish (Latin America)", "es-419"),
+ new LocalizationOption("Spanish (Argentina)", "es-AR"),
new LocalizationOption("Spanish (Mexico)", "es-MX"),
new LocalizationOption("Swedish", "sv"),
new LocalizationOption("Swiss German", "gsw"),
- new LocalizationOption("Turkish", "tr"),
- new LocalizationOption("Ukrainian", "uk"),
- new LocalizationOption("Vietnamese", "vi")
+ new LocalizationOption("Turkish", "tr")
};
}
}
From ce03662fa7149d7d5d607d102789994d5ee50d31 Mon Sep 17 00:00:00 2001
From: Claus Vium
Date: Fri, 8 Feb 2019 10:26:29 +0100
Subject: [PATCH 80/93] Add error logging when translation is missing from core
---
.../Localization/LocalizationManager.cs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs
index 2120a8461b..31217730bf 100644
--- a/Emby.Server.Implementations/Localization/LocalizationManager.cs
+++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs
@@ -470,6 +470,10 @@ namespace Emby.Server.Implementations.Localization
dictionary[key] = dict[key];
}
}
+ else
+ {
+ _logger.LogError("Missing translation/culture resource: {ResourcePath}", resourcePath);
+ }
}
}
From da860e6e54bb938741d264c58569f809129b3792 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Fri, 8 Feb 2019 20:35:50 -0500
Subject: [PATCH 81/93] Remove superfluous VERSION variables
---
deployment/debian-package-x64/clean.sh | 1 -
deployment/debian-package-x64/package.sh | 1 -
2 files changed, 2 deletions(-)
diff --git a/deployment/debian-package-x64/clean.sh b/deployment/debian-package-x64/clean.sh
index 101ba1fb6d..b2960fcb3a 100755
--- a/deployment/debian-package-x64/clean.sh
+++ b/deployment/debian-package-x64/clean.sh
@@ -5,7 +5,6 @@ source ../common.build.sh
keep_artifacts="${1}"
WORKDIR="$( pwd )"
-VERSION="$( grep '^jellyfin' ${WORKDIR}/pkg-src/changelog | head -1 | awk -F '[()]' '{ print $2 }' )"
package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
output_dir="${WORKDIR}/pkg-dist"
diff --git a/deployment/debian-package-x64/package.sh b/deployment/debian-package-x64/package.sh
index 11da66aaab..d7c3f5809c 100755
--- a/deployment/debian-package-x64/package.sh
+++ b/deployment/debian-package-x64/package.sh
@@ -3,7 +3,6 @@
source ../common.build.sh
WORKDIR="$( pwd )"
-VERSION="$( grep '^jellyfin' ${WORKDIR}/pkg-src/changelog | head -1 | awk -F '[()]' '{ print $2 }' )"
package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
output_dir="${WORKDIR}/pkg-dist"
From 139e3c19ee1216ea68d9c1d79c2cb890faeb7f53 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Fri, 8 Feb 2019 20:42:30 -0500
Subject: [PATCH 82/93] Replace symlinks with copies and update image name
---
deployment/centos-package-x64/clean.sh | 35 +++++++-
deployment/centos-package-x64/docker-build.sh | 21 ++++-
deployment/centos-package-x64/package.sh | 81 ++++++++++++++++++-
3 files changed, 134 insertions(+), 3 deletions(-)
mode change 120000 => 100755 deployment/centos-package-x64/clean.sh
mode change 120000 => 100755 deployment/centos-package-x64/docker-build.sh
mode change 120000 => 100755 deployment/centos-package-x64/package.sh
diff --git a/deployment/centos-package-x64/clean.sh b/deployment/centos-package-x64/clean.sh
deleted file mode 120000
index d6d2d1c091..0000000000
--- a/deployment/centos-package-x64/clean.sh
+++ /dev/null
@@ -1 +0,0 @@
-../fedora-package-x64/clean.sh
\ No newline at end of file
diff --git a/deployment/centos-package-x64/clean.sh b/deployment/centos-package-x64/clean.sh
new file mode 100755
index 0000000000..7278372e18
--- /dev/null
+++ b/deployment/centos-package-x64/clean.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+keep_artifacts="${1}"
+
+WORKDIR="$( pwd )"
+VERSION="$( grep -A1 '^Version:' ${WORKDIR}/pkg-src/jellyfin.spec | awk '{ print $NF }' )"
+
+package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
+package_source_dir="${WORKDIR}/pkg-src"
+output_dir="${WORKDIR}/pkg-dist"
+current_user="$( whoami )"
+image_name="jellyfin-centos-build"
+
+rm -f "${package_source_dir}/jellyfin-${VERSION}.tar.gz" &>/dev/null \
+ || sudo rm -f "${package_source_dir}/jellyfin-${VERSION}.tar.gz" &>/dev/null
+
+rm -rf "${package_temporary_dir}" &>/dev/null \
+ || sudo rm -rf "${package_temporary_dir}" &>/dev/null
+
+rm -rf "${output_dir}" &>/dev/null \
+ || sudo rm -rf "${output_dir}" &>/dev/null
+
+if [[ ${keep_artifacts} == 'n' ]]; then
+ docker_sudo=""
+ if [[ ! -z $(id -Gn | grep -q 'docker') ]] \
+ && [[ ! ${EUID:-1000} -eq 0 ]] \
+ && [[ ! ${USER} == "root" ]] \
+ && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then
+ docker_sudo=sudo
+ fi
+ ${docker_sudo} docker image rm ${image_name} --force
+fi
diff --git a/deployment/centos-package-x64/docker-build.sh b/deployment/centos-package-x64/docker-build.sh
deleted file mode 120000
index 7adc32954d..0000000000
--- a/deployment/centos-package-x64/docker-build.sh
+++ /dev/null
@@ -1 +0,0 @@
-../fedora-package-x64/docker-build.sh
\ No newline at end of file
diff --git a/deployment/centos-package-x64/docker-build.sh b/deployment/centos-package-x64/docker-build.sh
new file mode 100755
index 0000000000..3acf1ec0df
--- /dev/null
+++ b/deployment/centos-package-x64/docker-build.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# Builds the RPM inside the Docker container
+
+set -o errexit
+set -o xtrace
+
+# Move to source directory
+pushd ${SOURCE_DIR}
+
+ls -al SOURCES/pkg-src/
+
+# Build RPM
+spectool -g -R SPECS/jellyfin.spec
+rpmbuild -bs SPECS/jellyfin.spec --define "_sourcedir ${SOURCE_DIR}/SOURCES/pkg-src/"
+rpmbuild -bb SPECS/jellyfin.spec --define "_sourcedir ${SOURCE_DIR}/SOURCES/pkg-src/"
+
+# Move the artifacts out
+mkdir -p ${ARTIFACT_DIR}/rpm
+mv /root/rpmbuild/RPMS/x86_64/jellyfin-*.rpm /root/rpmbuild/SRPMS/jellyfin-*.src.rpm ${ARTIFACT_DIR}/rpm/
diff --git a/deployment/centos-package-x64/package.sh b/deployment/centos-package-x64/package.sh
deleted file mode 120000
index a79de21eba..0000000000
--- a/deployment/centos-package-x64/package.sh
+++ /dev/null
@@ -1 +0,0 @@
-../fedora-package-x64/package.sh
\ No newline at end of file
diff --git a/deployment/centos-package-x64/package.sh b/deployment/centos-package-x64/package.sh
new file mode 100755
index 0000000000..27d686e46f
--- /dev/null
+++ b/deployment/centos-package-x64/package.sh
@@ -0,0 +1,80 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+WORKDIR="$( pwd )"
+VERSION="$( grep '^Version:' ${WORKDIR}/pkg-src/jellyfin.spec | awk '{ print $NF }' )"
+
+package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
+output_dir="${WORKDIR}/pkg-dist"
+pkg_src_dir="${WORKDIR}/pkg-src"
+current_user="$( whoami )"
+image_name="jellyfin-centos-build"
+
+# Determine if sudo should be used for Docker
+if [[ ! -z $(id -Gn | grep -q 'docker') ]] \
+ && [[ ! ${EUID:-1000} -eq 0 ]] \
+ && [[ ! ${USER} == "root" ]] \
+ && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then
+ docker_sudo="sudo"
+else
+ docker_sudo=""
+fi
+
+# Create RPM source archive
+GNU_TAR=1
+mkdir -p "${package_temporary_dir}"
+echo "Bundling all sources for RPM build."
+tar \
+--transform "s,^\.,jellyfin-${VERSION}," \
+--exclude='.git*' \
+--exclude='**/.git' \
+--exclude='**/.hg' \
+--exclude='**/.vs' \
+--exclude='**/.vscode' \
+--exclude='deployment' \
+--exclude='**/bin' \
+--exclude='**/obj' \
+--exclude='**/.nuget' \
+--exclude='*.deb' \
+--exclude='*.rpm' \
+-czf "${pkg_src_dir}/jellyfin-${VERSION}.tar.gz" \
+-C "../.." ./ || GNU_TAR=0
+
+if [ $GNU_TAR -eq 0 ]; then
+ echo "The installed tar binary did not support --transform. Using workaround."
+ mkdir -p "${package_temporary_dir}/jellyfin"
+ # Not GNU tar
+ tar \
+ --exclude='.git*' \
+ --exclude='**/.git' \
+ --exclude='**/.hg' \
+ --exclude='**/.vs' \
+ --exclude='**/.vscode' \
+ --exclude='deployment' \
+ --exclude='**/bin' \
+ --exclude='**/obj' \
+ --exclude='**/.nuget' \
+ --exclude='*.deb' \
+ --exclude='*.rpm' \
+ -zcf \
+ "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" \
+ -C "../.." ./
+ echo "Extracting filtered package."
+ tar -xzf "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}/jellyfin-${VERSION}"
+ echo "Removing filtered package."
+ rm -f "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz"
+ echo "Repackaging package into final tarball."
+ tar -czf "${pkg_src_dir}/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}" "jellyfin-${VERSION}"
+fi
+
+# Set up the build environment Docker image
+${docker_sudo} docker build ../.. -t "${image_name}" -f ./Dockerfile
+# Build the RPMs and copy out to ${package_temporary_dir}
+${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}"
+# Correct ownership on the RPMs (as current user, then as root if that fails)
+chown -R "${current_user}" "${package_temporary_dir}" \
+ || sudo chown -R "${current_user}" "${package_temporary_dir}"
+# Move the RPMs to the output directory
+mkdir -p "${output_dir}"
+mv "${package_temporary_dir}"/rpm/* "${output_dir}"
From 37985c2e260a56c1512a56726afc136f264d8bbc Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Fri, 8 Feb 2019 20:44:41 -0500
Subject: [PATCH 83/93] Update image name
---
deployment/fedora-package-x64/clean.sh | 2 +-
deployment/fedora-package-x64/package.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/deployment/fedora-package-x64/clean.sh b/deployment/fedora-package-x64/clean.sh
index fbd4d276d6..408167e49b 100755
--- a/deployment/fedora-package-x64/clean.sh
+++ b/deployment/fedora-package-x64/clean.sh
@@ -11,7 +11,7 @@ package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
package_source_dir="${WORKDIR}/pkg-src"
output_dir="${WORKDIR}/pkg-dist"
current_user="$( whoami )"
-image_name="jellyfin-rpm-build"
+image_name="jellyfin-fedora-build"
rm -f "${package_source_dir}/jellyfin-${VERSION}.tar.gz" &>/dev/null \
|| sudo rm -f "${package_source_dir}/jellyfin-${VERSION}.tar.gz" &>/dev/null
diff --git a/deployment/fedora-package-x64/package.sh b/deployment/fedora-package-x64/package.sh
index 088a41a35f..74586417d9 100755
--- a/deployment/fedora-package-x64/package.sh
+++ b/deployment/fedora-package-x64/package.sh
@@ -9,7 +9,7 @@ package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
output_dir="${WORKDIR}/pkg-dist"
pkg_src_dir="${WORKDIR}/pkg-src"
current_user="$( whoami )"
-image_name="jellyfin-rpm-build"
+image_name="jellyfin-fedora-build"
# Determine if sudo should be used for Docker
if [[ ! -z $(id -Gn | grep -q 'docker') ]] \
From 3014866f65eb1573e189867b42f8892fc54a2019 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Fri, 8 Feb 2019 21:08:34 -0500
Subject: [PATCH 84/93] Add similar Ubuntu build package
---
deployment/ubuntu-package-x64/Dockerfile | 40 +++++++++++++++++++
deployment/ubuntu-package-x64/clean.sh | 29 ++++++++++++++
.../ubuntu-package-x64/dependencies.txt | 1 +
deployment/ubuntu-package-x64/docker-build.sh | 16 ++++++++
deployment/ubuntu-package-x64/package.sh | 31 ++++++++++++++
deployment/ubuntu-package-x64/pkg-src | 1 +
6 files changed, 118 insertions(+)
create mode 100644 deployment/ubuntu-package-x64/Dockerfile
create mode 100755 deployment/ubuntu-package-x64/clean.sh
create mode 100644 deployment/ubuntu-package-x64/dependencies.txt
create mode 100755 deployment/ubuntu-package-x64/docker-build.sh
create mode 100755 deployment/ubuntu-package-x64/package.sh
create mode 120000 deployment/ubuntu-package-x64/pkg-src
diff --git a/deployment/ubuntu-package-x64/Dockerfile b/deployment/ubuntu-package-x64/Dockerfile
new file mode 100644
index 0000000000..471f50c27d
--- /dev/null
+++ b/deployment/ubuntu-package-x64/Dockerfile
@@ -0,0 +1,40 @@
+FROM ubuntu:18.04
+# Docker build arguments
+ARG SOURCE_DIR=/jellyfin
+ARG PLATFORM_DIR=/jellyfin/deployment/ubuntu-package-x64
+ARG ARTIFACT_DIR=/dist
+ARG SDK_VERSION=2.2
+# Docker run environment
+ENV SOURCE_DIR=/jellyfin
+ENV ARTIFACT_DIR=/dist
+ENV DEB_BUILD_OPTIONS=noddebs
+
+# Prepare Debian build environment
+RUN apt-get update \
+ && apt-get install -y apt-transport-https debhelper gnupg wget devscripts mmv libc6-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev
+
+# Install dotnet repository
+# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current
+RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg \
+ && mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ \
+ && wget -q https://packages.microsoft.com/config/ubuntu/18.04/prod.list \
+ && mv prod.list /etc/apt/sources.list.d/microsoft-prod.list \
+ && chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg \
+ && chown root:root /etc/apt/sources.list.d/microsoft-prod.list \
+ && apt-get update \
+ && apt-get install -y dotnet-sdk-${SDK_VERSION}
+
+# Link to docker-build script
+RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh
+
+# Link to Debian source dir; mkdir needed or it fails, can't force dest
+RUN mkdir -p ${SOURCE_DIR} && ln -sf ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/debian
+
+# Prepare artifact volume
+VOLUME ${ARTIFACT_DIR}/
+
+# Copy repository
+COPY . ${SOURCE_DIR}/
+
+# Set docker-build entrypoint
+ENTRYPOINT ["/docker-build.sh"]
diff --git a/deployment/ubuntu-package-x64/clean.sh b/deployment/ubuntu-package-x64/clean.sh
new file mode 100755
index 0000000000..c92c7fdec6
--- /dev/null
+++ b/deployment/ubuntu-package-x64/clean.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+keep_artifacts="${1}"
+
+WORKDIR="$( pwd )"
+
+package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
+output_dir="${WORKDIR}/pkg-dist"
+current_user="$( whoami )"
+image_name="jellyfin-ubuntu-build"
+
+rm -rf "${package_temporary_dir}" &>/dev/null \
+ || sudo rm -rf "${package_temporary_dir}" &>/dev/null
+
+rm -rf "${output_dir}" &>/dev/null \
+ || sudo rm -rf "${output_dir}" &>/dev/null
+
+if [[ ${keep_artifacts} == 'n' ]]; then
+ docker_sudo=""
+ if [[ ! -z $(id -Gn | grep -q 'docker') ]] \
+ && [[ ! ${EUID:-1000} -eq 0 ]] \
+ && [[ ! ${USER} == "root" ]] \
+ && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then
+ docker_sudo=sudo
+ fi
+ ${docker_sudo} docker image rm ${image_name} --force
+fi
diff --git a/deployment/ubuntu-package-x64/dependencies.txt b/deployment/ubuntu-package-x64/dependencies.txt
new file mode 100644
index 0000000000..bdb9670965
--- /dev/null
+++ b/deployment/ubuntu-package-x64/dependencies.txt
@@ -0,0 +1 @@
+docker
diff --git a/deployment/ubuntu-package-x64/docker-build.sh b/deployment/ubuntu-package-x64/docker-build.sh
new file mode 100755
index 0000000000..83654b8ce8
--- /dev/null
+++ b/deployment/ubuntu-package-x64/docker-build.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# Builds the DEB inside the Docker container
+
+set -o errexit
+set -o xtrace
+
+# Move to source directory
+pushd ${SOURCE_DIR}
+
+# Build DEB
+dpkg-buildpackage -us -uc
+
+# Move the artifacts out
+mkdir -p ${ARTIFACT_DIR}/deb
+mv /jellyfin_* ${ARTIFACT_DIR}/deb/
diff --git a/deployment/ubuntu-package-x64/package.sh b/deployment/ubuntu-package-x64/package.sh
new file mode 100755
index 0000000000..6d4625a197
--- /dev/null
+++ b/deployment/ubuntu-package-x64/package.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+WORKDIR="$( pwd )"
+
+package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
+output_dir="${WORKDIR}/pkg-dist"
+current_user="$( whoami )"
+image_name="jellyfin-ubuntu-build"
+
+# Determine if sudo should be used for Docker
+if [[ ! -z $(id -Gn | grep -q 'docker') ]] \
+ && [[ ! ${EUID:-1000} -eq 0 ]] \
+ && [[ ! ${USER} == "root" ]] \
+ && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then
+ docker_sudo="sudo"
+else
+ docker_sudo=""
+fi
+
+# Set up the build environment Docker image
+${docker_sudo} docker build ../.. -t "${image_name}" -f ./Dockerfile
+# Build the DEBs and copy out to ${package_temporary_dir}
+${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}"
+# Correct ownership on the DEBs (as current user, then as root if that fails)
+chown -R "${current_user}" "${package_temporary_dir}" &>/dev/null \
+ || sudo chown -R "${current_user}" "${package_temporary_dir}" &>/dev/null
+# Move the DEBs to the output directory
+mkdir -p "${output_dir}"
+mv "${package_temporary_dir}"/deb/* "${output_dir}"
diff --git a/deployment/ubuntu-package-x64/pkg-src b/deployment/ubuntu-package-x64/pkg-src
new file mode 120000
index 0000000000..4c695fea17
--- /dev/null
+++ b/deployment/ubuntu-package-x64/pkg-src
@@ -0,0 +1 @@
+../debian-package-x64/pkg-src
\ No newline at end of file
From f1ef0b0b4c54b2c370704aacb13a37e9abd4a6a0 Mon Sep 17 00:00:00 2001
From: Erwin de Haan
Date: Sat, 9 Feb 2019 10:10:33 +0100
Subject: [PATCH 85/93] Fix namespacing so it lines up properly with file names
and paths (#715)
* Fix stupid namespacing so it lines up properly with file names and paths.
---
.../ApplicationHost.cs | 1 -
.../LiveTv/Listings/XmlTvListingsProvider.cs | 2 +-
.../Networking/IPNetwork/BigIntegerExt.cs | 9 ++++----
.../IPNetwork/IPAddressCollection.cs | 6 +++--
.../Networking/IPNetwork/IPNetwork.cs | 22 ++++++++++---------
.../IPNetwork/IPNetworkCollection.cs | 7 +++---
.../Networking/NetworkManager.cs | 2 +-
.../Serialization/JsonSerializer.cs | 3 +--
.../UserViews/FolderImageProvider.cs | 2 +-
Jellyfin.Server/CoreAppHost.cs | 2 +-
Jellyfin.Server/SocketSharp/HttpFile.cs | 2 +-
Jellyfin.Server/SocketSharp/RequestMono.cs | 2 +-
Jellyfin.Server/SocketSharp/SharpWebSocket.cs | 2 +-
.../SocketSharp/WebSocketSharpListener.cs | 2 +-
.../SocketSharp/WebSocketSharpRequest.cs | 2 +-
.../SocketSharp/WebSocketSharpResponse.cs | 2 +-
.../Manager/GenericPriorityQueue.cs | 1 +
.../Movies/FanartMovieImageProvider.cs | 1 +
.../Music/FanArtArtistProvider.cs | 1 +
.../People/TvdbPersonImageProvider.cs | 1 +
.../TV/FanArt/FanArtSeasonProvider.cs | 2 +-
.../TV/FanArt/FanartSeriesProvider.cs | 2 +-
.../TV/MissingEpisodeProvider.cs | 1 +
.../TV/Omdb/OmdbEpisodeProvider.cs | 2 +-
.../TheMovieDb/MovieDbEpisodeImageProvider.cs | 2 +-
.../TV/TheMovieDb/MovieDbEpisodeProvider.cs | 2 +-
.../TV/TheMovieDb/MovieDbProviderBase.cs | 2 +-
.../TV/TheMovieDb/MovieDbSeasonProvider.cs | 2 +-
.../TheMovieDb/MovieDbSeriesImageProvider.cs | 2 +-
.../TV/TheMovieDb/MovieDbSeriesProvider.cs | 2 +-
.../TV/TheTVDB/TvdbEpisodeImageProvider.cs | 2 +-
.../TV/TheTVDB/TvdbEpisodeProvider.cs | 2 +-
.../TV/TheTVDB/TvdbPrescanTask.cs | 2 +-
.../TV/TheTVDB/TvdbSeasonImageProvider.cs | 2 +-
.../TV/TheTVDB/TvdbSeriesImageProvider.cs | 2 +-
.../TV/TheTVDB/TvdbSeriesProvider.cs | 2 +-
MediaBrowser.Providers/TV/TvExternalIds.cs | 1 +
37 files changed, 56 insertions(+), 48 deletions(-)
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 3808810cfa..bb475eb2c7 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -12,7 +12,6 @@ using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using Emby.Common.Implementations.Serialization;
using Emby.Dlna;
using Emby.Dlna.Main;
using Emby.Dlna.Ssdp;
diff --git a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
index f152ac4652..69b10e6daa 100644
--- a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
+++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
@@ -17,7 +17,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.LiveTv;
using Microsoft.Extensions.Logging;
-namespace Jellyfin.Server.Implementations.LiveTv.Listings
+namespace Emby.Server.Implementations.LiveTv.Listings
{
public class XmlTvListingsProvider : IListingsProvider
{
diff --git a/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs b/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs
index 447cbf4034..e4e944839a 100644
--- a/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs
+++ b/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs
@@ -1,11 +1,10 @@
+using System;
using System.Collections.Generic;
+using System.Numerics;
+using System.Text;
-namespace System.Net
+namespace Emby.Server.Implementations.Networking.IPNetwork
{
- using System;
- using System.Numerics;
- using System.Text;
-
///
/// Extension methods to convert
/// instances to hexadecimal, octal, and binary strings.
diff --git a/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs b/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs
index c5853135cd..a0c5f73af2 100644
--- a/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs
+++ b/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs
@@ -1,8 +1,10 @@
+using System;
using System.Collections;
using System.Collections.Generic;
+using System.Net;
using System.Numerics;
-namespace System.Net
+namespace Emby.Server.Implementations.Networking.IPNetwork
{
public class IPAddressCollection : IEnumerable, IEnumerator
{
@@ -29,7 +31,7 @@ namespace System.Net
{
throw new ArgumentOutOfRangeException(nameof(i));
}
- byte width = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetwork ? (byte)32 : (byte)128;
+ byte width = this._ipnetwork.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork ? (byte)32 : (byte)128;
var ipn = this._ipnetwork.Subnet(width);
return ipn[i].Network;
}
diff --git a/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs b/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs
index 16f39daf7c..d6de61c0c9 100644
--- a/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs
+++ b/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs
@@ -1,10 +1,12 @@
+using System;
using System.Collections.Generic;
using System.IO;
+using System.Net;
using System.Net.Sockets;
using System.Numerics;
using System.Text.RegularExpressions;
-namespace System.Net
+namespace Emby.Server.Implementations.Networking.IPNetwork
{
///
/// IP Network utility class.
@@ -60,7 +62,7 @@ namespace System.Net
get
{
- int width = this._family == Sockets.AddressFamily.InterNetwork ? 4 : 16;
+ int width = this._family == System.Net.Sockets.AddressFamily.InterNetwork ? 4 : 16;
var uintBroadcast = this._network + this._netmask.PositiveReverse(width);
return uintBroadcast;
}
@@ -73,7 +75,7 @@ namespace System.Net
{
get
{
- if (this._family == Sockets.AddressFamily.InterNetworkV6)
+ if (this._family == System.Net.Sockets.AddressFamily.InterNetworkV6)
{
return null;
}
@@ -88,7 +90,7 @@ namespace System.Net
{
get
{
- var fisrt = this._family == Sockets.AddressFamily.InterNetworkV6
+ var fisrt = this._family == System.Net.Sockets.AddressFamily.InterNetworkV6
? this._network
: (this.Usable <= 0) ? this._network : this._network + 1;
return IPNetwork.ToIPAddress(fisrt, this._family);
@@ -102,7 +104,7 @@ namespace System.Net
{
get
{
- var last = this._family == Sockets.AddressFamily.InterNetworkV6
+ var last = this._family == System.Net.Sockets.AddressFamily.InterNetworkV6
? this._broadcast
: (this.Usable <= 0) ? this._network : this._broadcast - 1;
return IPNetwork.ToIPAddress(last, this._family);
@@ -117,7 +119,7 @@ namespace System.Net
get
{
- if (this._family == Sockets.AddressFamily.InterNetworkV6)
+ if (this._family == System.Net.Sockets.AddressFamily.InterNetworkV6)
{
return this.Total;
}
@@ -136,7 +138,7 @@ namespace System.Net
get
{
- int max = this._family == Sockets.AddressFamily.InterNetwork ? 32 : 128;
+ int max = this._family == System.Net.Sockets.AddressFamily.InterNetwork ? 32 : 128;
var count = BigInteger.Pow(2, (max - _cidr));
return count;
}
@@ -161,7 +163,7 @@ namespace System.Net
IPNetwork(BigInteger ipaddress, AddressFamily family, byte cidr)
{
- int maxCidr = family == Sockets.AddressFamily.InterNetwork ? 32 : 128;
+ int maxCidr = family == System.Net.Sockets.AddressFamily.InterNetwork ? 32 : 128;
if (cidr > maxCidr)
{
throw new ArgumentOutOfRangeException(nameof(cidr));
@@ -930,7 +932,7 @@ namespace System.Net
/// return;
/// }
- int maxCidr = family == Sockets.AddressFamily.InterNetwork ? 32 : 128;
+ int maxCidr = family == System.Net.Sockets.AddressFamily.InterNetwork ? 32 : 128;
if (cidr > maxCidr)
{
if (tryParse == false)
@@ -1303,7 +1305,7 @@ namespace System.Net
return;
}
- int maxCidr = network._family == Sockets.AddressFamily.InterNetwork ? 32 : 128;
+ int maxCidr = network._family == System.Net.Sockets.AddressFamily.InterNetwork ? 32 : 128;
if (cidr > maxCidr)
{
if (trySubnet == false)
diff --git a/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs b/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs
index 7d3106624a..4cda421e57 100644
--- a/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs
+++ b/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs
@@ -1,8 +1,9 @@
+using System;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
-namespace System.Net
+namespace Emby.Server.Implementations.Networking.IPNetwork
{
public class IPNetworkCollection : IEnumerable, IEnumerator
{
@@ -25,7 +26,7 @@ namespace System.Net
IPNetworkCollection(IPNetwork ipnetwork, byte cidrSubnet)
{
- int maxCidr = ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetwork ? 32 : 128;
+ int maxCidr = ipnetwork.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork ? 32 : 128;
if (cidrSubnet > maxCidr)
{
throw new ArgumentOutOfRangeException(nameof(cidrSubnet));
@@ -61,7 +62,7 @@ namespace System.Net
throw new ArgumentOutOfRangeException(nameof(i));
}
- var last = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetworkV6
+ var last = this._ipnetwork.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6
? this._lastUsable : this._broadcast;
var increment = (last - this._network) / this.Count;
var uintNetwork = this._network + ((increment + 1) * i);
diff --git a/Emby.Server.Implementations/Networking/NetworkManager.cs b/Emby.Server.Implementations/Networking/NetworkManager.cs
index aa884664f2..60cc9b88eb 100644
--- a/Emby.Server.Implementations/Networking/NetworkManager.cs
+++ b/Emby.Server.Implementations/Networking/NetworkManager.cs
@@ -281,7 +281,7 @@ namespace Emby.Server.Implementations.Networking
if (normalizedSubnet.IndexOf('/') != -1)
{
- var ipnetwork = IPNetwork.Parse(normalizedSubnet);
+ var ipnetwork = IPNetwork.IPNetwork.Parse(normalizedSubnet);
if (ipnetwork.Contains(address))
{
return true;
diff --git a/Emby.Server.Implementations/Serialization/JsonSerializer.cs b/Emby.Server.Implementations/Serialization/JsonSerializer.cs
index 53ef5d60cf..44898d4986 100644
--- a/Emby.Server.Implementations/Serialization/JsonSerializer.cs
+++ b/Emby.Server.Implementations/Serialization/JsonSerializer.cs
@@ -3,9 +3,8 @@ using System.IO;
using System.Threading.Tasks;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization;
-using Microsoft.Extensions.Logging;
-namespace Emby.Common.Implementations.Serialization
+namespace Emby.Server.Implementations.Serialization
{
///
/// Provides a wrapper around third party json serialization.
diff --git a/Emby.Server.Implementations/UserViews/FolderImageProvider.cs b/Emby.Server.Implementations/UserViews/FolderImageProvider.cs
index 7629f6039f..c810004ab2 100644
--- a/Emby.Server.Implementations/UserViews/FolderImageProvider.cs
+++ b/Emby.Server.Implementations/UserViews/FolderImageProvider.cs
@@ -11,7 +11,7 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Querying;
-namespace Emby.Server.Implementations.Photos
+namespace Emby.Server.Implementations.UserViews
{
public abstract class BaseFolderImageProvider : BaseDynamicImageProvider
where T : Folder, new()
diff --git a/Jellyfin.Server/CoreAppHost.cs b/Jellyfin.Server/CoreAppHost.cs
index 5182ab4d7e..315e34a04c 100644
--- a/Jellyfin.Server/CoreAppHost.cs
+++ b/Jellyfin.Server/CoreAppHost.cs
@@ -2,7 +2,7 @@ using System.Collections.Generic;
using System.Reflection;
using Emby.Server.Implementations;
using Emby.Server.Implementations.HttpServer;
-using Jellyfin.SocketSharp;
+using Jellyfin.Server.SocketSharp;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.System;
using Microsoft.Extensions.Logging;
diff --git a/Jellyfin.Server/SocketSharp/HttpFile.cs b/Jellyfin.Server/SocketSharp/HttpFile.cs
index 77ce035109..89c75e536c 100644
--- a/Jellyfin.Server/SocketSharp/HttpFile.cs
+++ b/Jellyfin.Server/SocketSharp/HttpFile.cs
@@ -1,7 +1,7 @@
using System.IO;
using MediaBrowser.Model.Services;
-namespace Jellyfin.SocketSharp
+namespace Jellyfin.Server.SocketSharp
{
public class HttpFile : IHttpFile
{
diff --git a/Jellyfin.Server/SocketSharp/RequestMono.cs b/Jellyfin.Server/SocketSharp/RequestMono.cs
index e39ed30ea0..a8ba4cdb59 100644
--- a/Jellyfin.Server/SocketSharp/RequestMono.cs
+++ b/Jellyfin.Server/SocketSharp/RequestMono.cs
@@ -7,7 +7,7 @@ using System.Text;
using System.Threading.Tasks;
using MediaBrowser.Model.Services;
-namespace Jellyfin.SocketSharp
+namespace Jellyfin.Server.SocketSharp
{
public partial class WebSocketSharpRequest : IHttpRequest
{
diff --git a/Jellyfin.Server/SocketSharp/SharpWebSocket.cs b/Jellyfin.Server/SocketSharp/SharpWebSocket.cs
index d0dcd86ebf..f371cb25a5 100644
--- a/Jellyfin.Server/SocketSharp/SharpWebSocket.cs
+++ b/Jellyfin.Server/SocketSharp/SharpWebSocket.cs
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
using Emby.Server.Implementations.Net;
using Microsoft.Extensions.Logging;
-namespace Jellyfin.SocketSharp
+namespace Jellyfin.Server.SocketSharp
{
public class SharpWebSocket : IWebSocket
{
diff --git a/Jellyfin.Server/SocketSharp/WebSocketSharpListener.cs b/Jellyfin.Server/SocketSharp/WebSocketSharpListener.cs
index c7f9f01b5d..a44343ab2f 100644
--- a/Jellyfin.Server/SocketSharp/WebSocketSharpListener.cs
+++ b/Jellyfin.Server/SocketSharp/WebSocketSharpListener.cs
@@ -15,7 +15,7 @@ using MediaBrowser.Model.System;
using Microsoft.Extensions.Logging;
using SocketHttpListener.Net;
-namespace Jellyfin.SocketSharp
+namespace Jellyfin.Server.SocketSharp
{
public class WebSocketSharpListener : IHttpListener
{
diff --git a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs
index 38e8d9699e..ebeb18ea06 100644
--- a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs
+++ b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs
@@ -11,7 +11,7 @@ using IHttpRequest = MediaBrowser.Model.Services.IHttpRequest;
using IHttpResponse = MediaBrowser.Model.Services.IHttpResponse;
using IResponse = MediaBrowser.Model.Services.IResponse;
-namespace Jellyfin.SocketSharp
+namespace Jellyfin.Server.SocketSharp
{
public partial class WebSocketSharpRequest : IHttpRequest
{
diff --git a/Jellyfin.Server/SocketSharp/WebSocketSharpResponse.cs b/Jellyfin.Server/SocketSharp/WebSocketSharpResponse.cs
index 21bfac55da..cabc96b237 100644
--- a/Jellyfin.Server/SocketSharp/WebSocketSharpResponse.cs
+++ b/Jellyfin.Server/SocketSharp/WebSocketSharpResponse.cs
@@ -14,7 +14,7 @@ using IHttpResponse = MediaBrowser.Model.Services.IHttpResponse;
using IRequest = MediaBrowser.Model.Services.IRequest;
-namespace Jellyfin.SocketSharp
+namespace Jellyfin.Server.SocketSharp
{
public class WebSocketSharpResponse : IHttpResponse
{
diff --git a/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs b/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs
index b87f688e16..10ff2515cb 100644
--- a/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs
+++ b/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs
@@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
+//TODO Fix namespace or replace
namespace Priority_Queue
{
///
diff --git a/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs b/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs
index 4a94bcb1a2..70d187bf55 100644
--- a/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs
+++ b/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs
@@ -20,6 +20,7 @@ using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Providers.Music;
using MediaBrowser.Providers.TV;
+using MediaBrowser.Providers.TV.FanArt;
namespace MediaBrowser.Providers.Movies
{
diff --git a/MediaBrowser.Providers/Music/FanArtArtistProvider.cs b/MediaBrowser.Providers/Music/FanArtArtistProvider.cs
index 2efeb69851..75b4213c52 100644
--- a/MediaBrowser.Providers/Music/FanArtArtistProvider.cs
+++ b/MediaBrowser.Providers/Music/FanArtArtistProvider.cs
@@ -20,6 +20,7 @@ using MediaBrowser.Model.Net;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Providers.TV;
+using MediaBrowser.Providers.TV.FanArt;
namespace MediaBrowser.Providers.Music
{
diff --git a/MediaBrowser.Providers/People/TvdbPersonImageProvider.cs b/MediaBrowser.Providers/People/TvdbPersonImageProvider.cs
index cf2acdf492..181e888201 100644
--- a/MediaBrowser.Providers/People/TvdbPersonImageProvider.cs
+++ b/MediaBrowser.Providers/People/TvdbPersonImageProvider.cs
@@ -18,6 +18,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Xml;
using MediaBrowser.Providers.TV;
+using MediaBrowser.Providers.TV.TheTVDB;
namespace MediaBrowser.Providers.People
{
diff --git a/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs b/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs
index 4937294460..58356910f6 100644
--- a/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs
+++ b/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs
@@ -19,7 +19,7 @@ using MediaBrowser.Model.Net;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
-namespace MediaBrowser.Providers.TV
+namespace MediaBrowser.Providers.TV.FanArt
{
public class FanArtSeasonProvider : IRemoteImageProvider, IHasOrder
{
diff --git a/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs b/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs
index 172a7d2b87..49cd9596e4 100644
--- a/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs
+++ b/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs
@@ -22,7 +22,7 @@ using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Providers.Music;
-namespace MediaBrowser.Providers.TV
+namespace MediaBrowser.Providers.TV.FanArt
{
public class FanartSeriesProvider : IRemoteImageProvider, IHasOrder
{
diff --git a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs
index 4ac0123999..25ad36620a 100644
--- a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs
+++ b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs
@@ -16,6 +16,7 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Xml;
+using MediaBrowser.Providers.TV.TheTVDB;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Providers.TV
diff --git a/MediaBrowser.Providers/TV/Omdb/OmdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/Omdb/OmdbEpisodeProvider.cs
index 6f7d9f791f..d0749405b4 100644
--- a/MediaBrowser.Providers/TV/Omdb/OmdbEpisodeProvider.cs
+++ b/MediaBrowser.Providers/TV/Omdb/OmdbEpisodeProvider.cs
@@ -14,7 +14,7 @@ using MediaBrowser.Model.Serialization;
using MediaBrowser.Providers.Omdb;
using Microsoft.Extensions.Logging;
-namespace MediaBrowser.Providers.TV
+namespace MediaBrowser.Providers.TV.Omdb
{
class OmdbEpisodeProvider :
IRemoteMetadataProvider,
diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeImageProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeImageProvider.cs
index 2482aa8d45..e4248afe1d 100644
--- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeImageProvider.cs
+++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeImageProvider.cs
@@ -16,7 +16,7 @@ using MediaBrowser.Model.Serialization;
using MediaBrowser.Providers.Movies;
using Microsoft.Extensions.Logging;
-namespace MediaBrowser.Providers.TV
+namespace MediaBrowser.Providers.TV.TheMovieDb
{
public class MovieDbEpisodeImageProvider :
MovieDbProviderBase,
diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs
index 347c91742a..44590515ee 100644
--- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs
+++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs
@@ -18,7 +18,7 @@ using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
using Microsoft.Extensions.Logging;
-namespace MediaBrowser.Providers.TV
+namespace MediaBrowser.Providers.TV.TheMovieDb
{
class MovieDbEpisodeProvider :
MovieDbProviderBase,
diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbProviderBase.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbProviderBase.cs
index 9f1102946b..6e438ebd86 100644
--- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbProviderBase.cs
+++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbProviderBase.cs
@@ -12,7 +12,7 @@ using MediaBrowser.Model.Serialization;
using MediaBrowser.Providers.Movies;
using Microsoft.Extensions.Logging;
-namespace MediaBrowser.Providers.TV
+namespace MediaBrowser.Providers.TV.TheMovieDb
{
public abstract class MovieDbProviderBase
{
diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs
index 790b38074f..6be1b101d8 100644
--- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs
+++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs
@@ -18,7 +18,7 @@ using MediaBrowser.Model.Serialization;
using MediaBrowser.Providers.Movies;
using Microsoft.Extensions.Logging;
-namespace MediaBrowser.Providers.TV
+namespace MediaBrowser.Providers.TV.TheMovieDb
{
public class MovieDbSeasonProvider : IRemoteMetadataProvider
{
diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesImageProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesImageProvider.cs
index fdc8cd7f12..26686356f6 100644
--- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesImageProvider.cs
+++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesImageProvider.cs
@@ -14,7 +14,7 @@ using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Providers.Movies;
-namespace MediaBrowser.Providers.TV
+namespace MediaBrowser.Providers.TV.TheMovieDb
{
public class MovieDbSeriesImageProvider : IRemoteImageProvider, IHasOrder
{
diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs
index 76031a7cdb..b51fb6af85 100644
--- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs
+++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs
@@ -20,7 +20,7 @@ using MediaBrowser.Model.Serialization;
using MediaBrowser.Providers.Movies;
using Microsoft.Extensions.Logging;
-namespace MediaBrowser.Providers.TV
+namespace MediaBrowser.Providers.TV.TheMovieDb
{
public class MovieDbSeriesProvider : IRemoteMetadataProvider, IHasOrder
{
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs
index 39d2fa77aa..102a3d4ec0 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs
@@ -14,7 +14,7 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Providers;
-namespace MediaBrowser.Providers.TV
+namespace MediaBrowser.Providers.TV.TheTVDB
{
public class TvdbEpisodeImageProvider : IRemoteImageProvider
{
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs
index 25fc214b54..be137e8792 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs
@@ -18,7 +18,7 @@ using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Xml;
using Microsoft.Extensions.Logging;
-namespace MediaBrowser.Providers.TV
+namespace MediaBrowser.Providers.TV.TheTVDB
{
///
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.cs
index 6f7cb72d33..d456960578 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbPrescanTask.cs
@@ -19,7 +19,7 @@ using MediaBrowser.Model.Net;
using MediaBrowser.Model.Xml;
using Microsoft.Extensions.Logging;
-namespace MediaBrowser.Providers.TV
+namespace MediaBrowser.Providers.TV.TheTVDB
{
///
/// Class TvdbPrescanTask
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs
index af36d1ebf1..01ede44bb2 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs
@@ -19,7 +19,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Xml;
-namespace MediaBrowser.Providers.TV
+namespace MediaBrowser.Providers.TV.TheTVDB
{
public class TvdbSeasonImageProvider : IRemoteImageProvider, IHasOrder
{
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs
index 82fa14f49b..2b4337ed1c 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs
@@ -19,7 +19,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Xml;
-namespace MediaBrowser.Providers.TV
+namespace MediaBrowser.Providers.TV.TheTVDB
{
public class TvdbSeriesImageProvider : IRemoteImageProvider, IHasOrder
{
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
index 6006ed0529..52e60a8eda 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
@@ -23,7 +23,7 @@ using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Xml;
using Microsoft.Extensions.Logging;
-namespace MediaBrowser.Providers.TV
+namespace MediaBrowser.Providers.TV.TheTVDB
{
public class TvdbSeriesProvider : IRemoteMetadataProvider, IHasOrder
{
diff --git a/MediaBrowser.Providers/TV/TvExternalIds.cs b/MediaBrowser.Providers/TV/TvExternalIds.cs
index 001ce14653..5c246e3000 100644
--- a/MediaBrowser.Providers/TV/TvExternalIds.cs
+++ b/MediaBrowser.Providers/TV/TvExternalIds.cs
@@ -1,6 +1,7 @@
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
+using MediaBrowser.Providers.TV.TheTVDB;
namespace MediaBrowser.Providers.TV
{
From a71040ba1b0f5f8ff78683971338704d9a9ff254 Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Sat, 9 Feb 2019 21:28:36 +0100
Subject: [PATCH 86/93] Chnage to own NuGet package
---
Emby.Server.Implementations/Emby.Server.Implementations.csproj | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
index af01001a58..8356a9501b 100644
--- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj
+++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj
@@ -25,8 +25,7 @@
-
-
+
From bee8f58265d68177bb4ee9be2e2ba86f57a4c42a Mon Sep 17 00:00:00 2001
From: Bond_009
Date: Sat, 9 Feb 2019 21:32:59 +0100
Subject: [PATCH 87/93] Upgrade package versions
---
Jellyfin.Server/Jellyfin.Server.csproj | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj
index 1f72de86d7..b1515df439 100644
--- a/Jellyfin.Server/Jellyfin.Server.csproj
+++ b/Jellyfin.Server/Jellyfin.Server.csproj
@@ -41,9 +41,8 @@
-
-
-
+
+
From 74d2698c5fd7f70b2409afc5be0e9825c5edeeda Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Sat, 9 Feb 2019 18:37:35 -0500
Subject: [PATCH 88/93] Fix poor handling of cache directories
---
.../AppBase/BaseConfigurationManager.cs | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
index 460809e936..cf07cb1ecf 100644
--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
@@ -171,16 +171,29 @@ namespace Emby.Server.Implementations.AppBase
private void UpdateCachePath()
{
string cachePath;
-
+ // If the configuration file has no entry (i.e. not set in UI)
if (string.IsNullOrWhiteSpace(CommonConfiguration.CachePath))
{
- cachePath = null;
+ // If the current live configuration has no entry (i.e. not set on CLI/envvars, during startup)
+ if (string.IsNullOrWhiteSpace(((BaseApplicationPaths)CommonApplicationPaths).CachePath))
+ {
+ // Set cachePath to a default value under ProgramDataPath
+ cachePath = (((BaseApplicationPaths)CommonApplicationPaths).ProgramDataPath + "/cache");
+ }
+ else
+ {
+ // Set cachePath to the existing live value; will require restart if UI value is removed (but not replaced)
+ // TODO: Figure out how to re-grab this from the CLI/envvars while running
+ cachePath = ((BaseApplicationPaths)CommonApplicationPaths).CachePath;
+ }
}
else
{
- cachePath = Path.Combine(CommonConfiguration.CachePath, "cache");
+ // Set cachePath to the new UI-set value
+ cachePath = CommonConfiguration.CachePath;
}
+ Logger.LogInformation("Setting cache path to " + cachePath);
((BaseApplicationPaths)CommonApplicationPaths).CachePath = cachePath;
}
From 7be4a8500c29d58dff9af5a3bf85edeb5d6b73b6 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Sat, 9 Feb 2019 19:02:27 -0500
Subject: [PATCH 89/93] Use Microsoft dotnet Docker images
---
deployment/debian-package-x64/Dockerfile | 24 ++++------------------
deployment/ubuntu-package-x64/Dockerfile | 26 +++++-------------------
2 files changed, 9 insertions(+), 41 deletions(-)
diff --git a/deployment/debian-package-x64/Dockerfile b/deployment/debian-package-x64/Dockerfile
index 787f1d1824..da66c9f944 100644
--- a/deployment/debian-package-x64/Dockerfile
+++ b/deployment/debian-package-x64/Dockerfile
@@ -1,9 +1,8 @@
-FROM debian:9
+FROM microsoft/dotnet:2.2-sdk-stretch
# Docker build arguments
ARG SOURCE_DIR=/jellyfin
ARG PLATFORM_DIR=/jellyfin/deployment/debian-package-x64
ARG ARTIFACT_DIR=/dist
-ARG SDK_VERSION=2.2
# Docker run environment
ENV SOURCE_DIR=/jellyfin
ENV ARTIFACT_DIR=/dist
@@ -11,24 +10,9 @@ ENV DEB_BUILD_OPTIONS=noddebs
# Prepare Debian build environment
RUN apt-get update \
- && apt-get install -y apt-transport-https debhelper gnupg wget devscripts mmv libc6-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev
-
-# Install dotnet repository
-# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current
-RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg \
- && mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ \
- && wget -q https://packages.microsoft.com/config/debian/9/prod.list \
- && mv prod.list /etc/apt/sources.list.d/microsoft-prod.list \
- && chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg \
- && chown root:root /etc/apt/sources.list.d/microsoft-prod.list \
- && apt-get update \
- && apt-get install -y dotnet-sdk-${SDK_VERSION}
-
-# Link to docker-build script
-RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh
-
-# Link to Debian source dir; mkdir needed or it fails, can't force dest
-RUN mkdir -p ${SOURCE_DIR} && ln -sf ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/debian
+ && apt-get install -y apt-transport-https debhelper gnupg wget devscripts mmv libc6-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev \
+ && ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \
+ && mkdir -p ${SOURCE_DIR} && ln -sf ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/debian
# Prepare artifact volume
VOLUME ${ARTIFACT_DIR}/
diff --git a/deployment/ubuntu-package-x64/Dockerfile b/deployment/ubuntu-package-x64/Dockerfile
index 471f50c27d..047d6a7a2f 100644
--- a/deployment/ubuntu-package-x64/Dockerfile
+++ b/deployment/ubuntu-package-x64/Dockerfile
@@ -1,34 +1,18 @@
-FROM ubuntu:18.04
+FROM microsoft/dotnet:2.2-sdk-bionic
# Docker build arguments
ARG SOURCE_DIR=/jellyfin
ARG PLATFORM_DIR=/jellyfin/deployment/ubuntu-package-x64
ARG ARTIFACT_DIR=/dist
-ARG SDK_VERSION=2.2
# Docker run environment
ENV SOURCE_DIR=/jellyfin
ENV ARTIFACT_DIR=/dist
ENV DEB_BUILD_OPTIONS=noddebs
-# Prepare Debian build environment
+# Prepare Ubuntu build environment
RUN apt-get update \
- && apt-get install -y apt-transport-https debhelper gnupg wget devscripts mmv libc6-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev
-
-# Install dotnet repository
-# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current
-RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg \
- && mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ \
- && wget -q https://packages.microsoft.com/config/ubuntu/18.04/prod.list \
- && mv prod.list /etc/apt/sources.list.d/microsoft-prod.list \
- && chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg \
- && chown root:root /etc/apt/sources.list.d/microsoft-prod.list \
- && apt-get update \
- && apt-get install -y dotnet-sdk-${SDK_VERSION}
-
-# Link to docker-build script
-RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh
-
-# Link to Debian source dir; mkdir needed or it fails, can't force dest
-RUN mkdir -p ${SOURCE_DIR} && ln -sf ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/debian
+ && apt-get install -y apt-transport-https debhelper gnupg wget devscripts mmv libc6-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev \
+ && ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \
+ && mkdir -p ${SOURCE_DIR} && ln -sf ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/debian
# Prepare artifact volume
VOLUME ${ARTIFACT_DIR}/
From 57cefb432a052eb3d10019cf219a0eb8a5dfe088 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Sat, 9 Feb 2019 19:06:27 -0500
Subject: [PATCH 90/93] Combine various RUNs in Fedora/CentOS
---
deployment/centos-package-x64/Dockerfile | 16 +++++-----------
deployment/fedora-package-x64/Dockerfile | 16 +++++-----------
2 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/deployment/centos-package-x64/Dockerfile b/deployment/centos-package-x64/Dockerfile
index 89799bca20..4cb288c84d 100644
--- a/deployment/centos-package-x64/Dockerfile
+++ b/deployment/centos-package-x64/Dockerfile
@@ -13,17 +13,11 @@ RUN yum update -y \
&& yum install -y @buildsys-build rpmdevtools yum-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel \
&& rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm \
&& rpmdev-setuptree \
- && yum install -y dotnet-sdk-${SDK_VERSION}
-
-# Link to docker-build script
-RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh
-
-# Link to RPM spec; mkdir needed or it fails, can't force dest
-RUN mkdir -p ${SOURCE_DIR}/SPECS \
- && ln -s ${PLATFORM_DIR}/pkg-src/jellyfin.spec ${SOURCE_DIR}/SPECS/jellyfin.spec
-
-# Link to RPM sources; mkdir needed or it fails, can't force dest
-RUN mkdir -p ${SOURCE_DIR}/SOURCES \
+ && yum install -y dotnet-sdk-${SDK_VERSION} \
+ && ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \
+ && mkdir -p ${SOURCE_DIR}/SPECS \
+ && ln -s ${PLATFORM_DIR}/pkg-src/jellyfin.spec ${SOURCE_DIR}/SPECS/jellyfin.spec \
+ && mkdir -p ${SOURCE_DIR}/SOURCES \
&& ln -s ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/SOURCES
# Prepare artifact volume
diff --git a/deployment/fedora-package-x64/Dockerfile b/deployment/fedora-package-x64/Dockerfile
index 7decba2e98..944f489b51 100644
--- a/deployment/fedora-package-x64/Dockerfile
+++ b/deployment/fedora-package-x64/Dockerfile
@@ -13,17 +13,11 @@ RUN dnf update -y \
&& dnf install -y @buildsys-build rpmdevtools dnf-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel \
&& dnf copr enable -y @dotnet-sig/dotnet \
&& rpmdev-setuptree \
- && dnf install -y dotnet-sdk-${SDK_VERSION}
-
-# Link to docker-build script
-RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh
-
-# Link to RPM spec; mkdir needed or it fails, can't force dest
-RUN mkdir -p ${SOURCE_DIR}/SPECS \
- && ln -s ${PLATFORM_DIR}/pkg-src/jellyfin.spec ${SOURCE_DIR}/SPECS/jellyfin.spec
-
-# Link to RPM sources; mkdir needed or it fails, can't force dest
-RUN mkdir -p ${SOURCE_DIR}/SOURCES \
+ && dnf install -y dotnet-sdk-${SDK_VERSION} \
+ && ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \
+ && mkdir -p ${SOURCE_DIR}/SPECS \
+ && ln -s ${PLATFORM_DIR}/pkg-src/jellyfin.spec ${SOURCE_DIR}/SPECS/jellyfin.spec \
+ && mkdir -p ${SOURCE_DIR}/SOURCES \
&& ln -s ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/SOURCES
# Prepare artifact volume
From 00234a5ece42126ec5039aa243d4a679589be33e Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Sat, 9 Feb 2019 19:12:55 -0500
Subject: [PATCH 91/93] Remove superfluous comments
---
deployment/centos-package-x64/Dockerfile | 3 ---
deployment/debian-package-x64/Dockerfile | 3 ---
deployment/fedora-package-x64/Dockerfile | 3 ---
deployment/ubuntu-package-x64/Dockerfile | 3 ---
4 files changed, 12 deletions(-)
diff --git a/deployment/centos-package-x64/Dockerfile b/deployment/centos-package-x64/Dockerfile
index 4cb288c84d..38853f1738 100644
--- a/deployment/centos-package-x64/Dockerfile
+++ b/deployment/centos-package-x64/Dockerfile
@@ -20,11 +20,8 @@ RUN yum update -y \
&& mkdir -p ${SOURCE_DIR}/SOURCES \
&& ln -s ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/SOURCES
-# Prepare artifact volume
VOLUME ${ARTIFACT_DIR}/
-# Copy repository
COPY . ${SOURCE_DIR}/
-# Set docker-build entrypoint
ENTRYPOINT ["/docker-build.sh"]
diff --git a/deployment/debian-package-x64/Dockerfile b/deployment/debian-package-x64/Dockerfile
index da66c9f944..9819cc20db 100644
--- a/deployment/debian-package-x64/Dockerfile
+++ b/deployment/debian-package-x64/Dockerfile
@@ -14,11 +14,8 @@ RUN apt-get update \
&& ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \
&& mkdir -p ${SOURCE_DIR} && ln -sf ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/debian
-# Prepare artifact volume
VOLUME ${ARTIFACT_DIR}/
-# Copy repository
COPY . ${SOURCE_DIR}/
-# Set docker-build entrypoint
ENTRYPOINT ["/docker-build.sh"]
diff --git a/deployment/fedora-package-x64/Dockerfile b/deployment/fedora-package-x64/Dockerfile
index 944f489b51..8bb1d527da 100644
--- a/deployment/fedora-package-x64/Dockerfile
+++ b/deployment/fedora-package-x64/Dockerfile
@@ -20,11 +20,8 @@ RUN dnf update -y \
&& mkdir -p ${SOURCE_DIR}/SOURCES \
&& ln -s ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/SOURCES
-# Prepare artifact volume
VOLUME ${ARTIFACT_DIR}/
-# Copy repository
COPY . ${SOURCE_DIR}/
-# Set docker-build entrypoint
ENTRYPOINT ["/docker-build.sh"]
diff --git a/deployment/ubuntu-package-x64/Dockerfile b/deployment/ubuntu-package-x64/Dockerfile
index 047d6a7a2f..485b6c42ce 100644
--- a/deployment/ubuntu-package-x64/Dockerfile
+++ b/deployment/ubuntu-package-x64/Dockerfile
@@ -14,11 +14,8 @@ RUN apt-get update \
&& ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \
&& mkdir -p ${SOURCE_DIR} && ln -sf ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/debian
-# Prepare artifact volume
VOLUME ${ARTIFACT_DIR}/
-# Copy repository
COPY . ${SOURCE_DIR}/
-# Set docker-build entrypoint
ENTRYPOINT ["/docker-build.sh"]
From 382b8bb509bbce34354a5d667c755b91d52c4fa4 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Sat, 9 Feb 2019 19:14:34 -0500
Subject: [PATCH 92/93] Use Path.Combine
---
Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
index cf07cb1ecf..5feac1adf9 100644
--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
@@ -178,7 +178,7 @@ namespace Emby.Server.Implementations.AppBase
if (string.IsNullOrWhiteSpace(((BaseApplicationPaths)CommonApplicationPaths).CachePath))
{
// Set cachePath to a default value under ProgramDataPath
- cachePath = (((BaseApplicationPaths)CommonApplicationPaths).ProgramDataPath + "/cache");
+ cachePath = Path.Combine(((BaseApplicationPaths)CommonApplicationPaths).ProgramDataPath, "cache");
}
else
{
From fb256b7aa0cf500c54fd1a1fa8295a0dac9520b1 Mon Sep 17 00:00:00 2001
From: Joshua Boniface
Date: Sat, 9 Feb 2019 19:32:06 -0500
Subject: [PATCH 93/93] Fix control file for Microsoft Docker setup
---
deployment/debian-package-x64/docker-build.sh | 3 +++
deployment/ubuntu-package-x64/docker-build.sh | 3 +++
2 files changed, 6 insertions(+)
diff --git a/deployment/debian-package-x64/docker-build.sh b/deployment/debian-package-x64/docker-build.sh
index 83654b8ce8..0590be0972 100755
--- a/deployment/debian-package-x64/docker-build.sh
+++ b/deployment/debian-package-x64/docker-build.sh
@@ -8,6 +8,9 @@ set -o xtrace
# Move to source directory
pushd ${SOURCE_DIR}
+# Remove build-dep for dotnet-sdk-2.2, since it's not a package in this image
+sed -i '/dotnet-sdk-2.2,/d' debian/control
+
# Build DEB
dpkg-buildpackage -us -uc
diff --git a/deployment/ubuntu-package-x64/docker-build.sh b/deployment/ubuntu-package-x64/docker-build.sh
index 83654b8ce8..0590be0972 100755
--- a/deployment/ubuntu-package-x64/docker-build.sh
+++ b/deployment/ubuntu-package-x64/docker-build.sh
@@ -8,6 +8,9 @@ set -o xtrace
# Move to source directory
pushd ${SOURCE_DIR}
+# Remove build-dep for dotnet-sdk-2.2, since it's not a package in this image
+sed -i '/dotnet-sdk-2.2,/d' debian/control
+
# Build DEB
dpkg-buildpackage -us -uc