diff options
139 files changed, 818 insertions, 452 deletions
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 2ec147ba2..99060d0b0 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -136,6 +136,7 @@ - [YouKnowBlom](https://github.com/YouKnowBlom) - [KristupasSavickas](https://github.com/KristupasSavickas) - [Pusta](https://github.com/pusta) + - [nielsvanvelzen](https://github.com/nielsvanvelzen) # Emby Contributors diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.cs index 5612376a5..1807ac6a1 100644 --- a/Emby.Dlna/DlnaManager.cs +++ b/Emby.Dlna/DlnaManager.cs @@ -126,14 +126,14 @@ namespace Emby.Dlna var builder = new StringBuilder(); builder.AppendLine("No matching device profile found. The default will need to be used."); - builder.AppendFormat(CultureInfo.InvariantCulture, "FriendlyName:{0}", profile.FriendlyName ?? string.Empty).AppendLine(); - builder.AppendFormat(CultureInfo.InvariantCulture, "Manufacturer:{0}", profile.Manufacturer ?? string.Empty).AppendLine(); - builder.AppendFormat(CultureInfo.InvariantCulture, "ManufacturerUrl:{0}", profile.ManufacturerUrl ?? string.Empty).AppendLine(); - builder.AppendFormat(CultureInfo.InvariantCulture, "ModelDescription:{0}", profile.ModelDescription ?? string.Empty).AppendLine(); - builder.AppendFormat(CultureInfo.InvariantCulture, "ModelName:{0}", profile.ModelName ?? string.Empty).AppendLine(); - builder.AppendFormat(CultureInfo.InvariantCulture, "ModelNumber:{0}", profile.ModelNumber ?? string.Empty).AppendLine(); - builder.AppendFormat(CultureInfo.InvariantCulture, "ModelUrl:{0}", profile.ModelUrl ?? string.Empty).AppendLine(); - builder.AppendFormat(CultureInfo.InvariantCulture, "SerialNumber:{0}", profile.SerialNumber ?? string.Empty).AppendLine(); + builder.Append("FriendlyName:").AppendLine(profile.FriendlyName); + builder.Append("Manufacturer:").AppendLine(profile.Manufacturer); + builder.Append("ManufacturerUrl:").AppendLine(profile.ManufacturerUrl); + builder.Append("ModelDescription:").AppendLine(profile.ModelDescription); + builder.Append("ModelName:").AppendLine(profile.ModelName); + builder.Append("ModelNumber:").AppendLine(profile.ModelNumber); + builder.Append("ModelUrl:").AppendLine(profile.ModelUrl); + builder.Append("SerialNumber:").AppendLine(profile.SerialNumber); _logger.LogInformation(builder.ToString()); } diff --git a/Emby.Dlna/Images/logo240.jpg b/Emby.Dlna/Images/logo240.jpg Binary files differindex da1cb5e07..78a27f1b5 100644 --- a/Emby.Dlna/Images/logo240.jpg +++ b/Emby.Dlna/Images/logo240.jpg diff --git a/Emby.Dlna/Images/people48.png b/Emby.Dlna/Images/people48.png Binary files differindex 7fb25e6b3..dae5f6057 100644 --- a/Emby.Dlna/Images/people48.png +++ b/Emby.Dlna/Images/people48.png diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs index 328759c5b..63fd8ce5a 100644 --- a/Emby.Dlna/PlayTo/PlayToController.cs +++ b/Emby.Dlna/PlayTo/PlayToController.cs @@ -669,62 +669,57 @@ namespace Emby.Dlna.PlayTo private Task SendGeneralCommand(GeneralCommand command, CancellationToken cancellationToken) { - if (Enum.TryParse(command.Name, true, out GeneralCommandType commandType)) - { - switch (commandType) - { - case GeneralCommandType.VolumeDown: - return _device.VolumeDown(cancellationToken); - case GeneralCommandType.VolumeUp: - return _device.VolumeUp(cancellationToken); - case GeneralCommandType.Mute: - return _device.Mute(cancellationToken); - case GeneralCommandType.Unmute: - return _device.Unmute(cancellationToken); - case GeneralCommandType.ToggleMute: - return _device.ToggleMute(cancellationToken); - case GeneralCommandType.SetAudioStreamIndex: - if (command.Arguments.TryGetValue("Index", out string index)) + switch (command.Name) + { + case GeneralCommandType.VolumeDown: + return _device.VolumeDown(cancellationToken); + case GeneralCommandType.VolumeUp: + return _device.VolumeUp(cancellationToken); + case GeneralCommandType.Mute: + return _device.Mute(cancellationToken); + case GeneralCommandType.Unmute: + return _device.Unmute(cancellationToken); + case GeneralCommandType.ToggleMute: + return _device.ToggleMute(cancellationToken); + case GeneralCommandType.SetAudioStreamIndex: + if (command.Arguments.TryGetValue("Index", out string index)) + { + if (int.TryParse(index, NumberStyles.Integer, _usCulture, out var val)) { - if (int.TryParse(index, NumberStyles.Integer, _usCulture, out var val)) - { - return SetAudioStreamIndex(val); - } - - throw new ArgumentException("Unsupported SetAudioStreamIndex value supplied."); + return SetAudioStreamIndex(val); } - throw new ArgumentException("SetAudioStreamIndex argument cannot be null"); - case GeneralCommandType.SetSubtitleStreamIndex: - if (command.Arguments.TryGetValue("Index", out index)) - { - if (int.TryParse(index, NumberStyles.Integer, _usCulture, out var val)) - { - return SetSubtitleStreamIndex(val); - } + throw new ArgumentException("Unsupported SetAudioStreamIndex value supplied."); + } - throw new ArgumentException("Unsupported SetSubtitleStreamIndex value supplied."); + throw new ArgumentException("SetAudioStreamIndex argument cannot be null"); + case GeneralCommandType.SetSubtitleStreamIndex: + if (command.Arguments.TryGetValue("Index", out index)) + { + if (int.TryParse(index, NumberStyles.Integer, _usCulture, out var val)) + { + return SetSubtitleStreamIndex(val); } - throw new ArgumentException("SetSubtitleStreamIndex argument cannot be null"); - case GeneralCommandType.SetVolume: - if (command.Arguments.TryGetValue("Volume", out string vol)) - { - if (int.TryParse(vol, NumberStyles.Integer, _usCulture, out var volume)) - { - return _device.SetVolume(volume, cancellationToken); - } + throw new ArgumentException("Unsupported SetSubtitleStreamIndex value supplied."); + } - throw new ArgumentException("Unsupported volume value supplied."); + throw new ArgumentException("SetSubtitleStreamIndex argument cannot be null"); + case GeneralCommandType.SetVolume: + if (command.Arguments.TryGetValue("Volume", out string vol)) + { + if (int.TryParse(vol, NumberStyles.Integer, _usCulture, out var volume)) + { + return _device.SetVolume(volume, cancellationToken); } - throw new ArgumentException("Volume argument cannot be null"); - default: - return Task.CompletedTask; - } - } + throw new ArgumentException("Unsupported volume value supplied."); + } - return Task.CompletedTask; + throw new ArgumentException("Volume argument cannot be null"); + default: + return Task.CompletedTask; + } } private async Task SetAudioStreamIndex(int? newIndex) @@ -886,7 +881,10 @@ namespace Emby.Dlna.PlayTo return null; } - mediaSource = await _mediaSourceManager.GetMediaSource(Item, MediaSourceId, LiveStreamId, false, cancellationToken).ConfigureAwait(false); + if (_mediaSourceManager != null) + { + mediaSource = await _mediaSourceManager.GetMediaSource(Item, MediaSourceId, LiveStreamId, false, cancellationToken).ConfigureAwait(false); + } return mediaSource; } diff --git a/Emby.Dlna/Server/DescriptionXmlBuilder.cs b/Emby.Dlna/Server/DescriptionXmlBuilder.cs index bca9e81cd..1f429d0de 100644 --- a/Emby.Dlna/Server/DescriptionXmlBuilder.cs +++ b/Emby.Dlna/Server/DescriptionXmlBuilder.cs @@ -235,13 +235,13 @@ namespace Emby.Dlna.Server .Append(SecurityElement.Escape(service.ServiceId ?? string.Empty)) .Append("</serviceId>"); builder.Append("<SCPDURL>") - .Append(BuildUrl(service.ScpdUrl)) + .Append(BuildUrl(service.ScpdUrl, true)) .Append("</SCPDURL>"); builder.Append("<controlURL>") - .Append(BuildUrl(service.ControlUrl)) + .Append(BuildUrl(service.ControlUrl, true)) .Append("</controlURL>"); builder.Append("<eventSubURL>") - .Append(BuildUrl(service.EventSubUrl)) + .Append(BuildUrl(service.EventSubUrl, true)) .Append("</eventSubURL>"); builder.Append("</service>"); @@ -250,7 +250,13 @@ namespace Emby.Dlna.Server builder.Append("</serviceList>"); } - private string BuildUrl(string url) + /// <summary> + /// Builds a valid url for inclusion in the xml. + /// </summary> + /// <param name="url">Url to include.</param> + /// <param name="absoluteUrl">Optional. When set to true, the absolute url is always used.</param> + /// <returns>The url to use for the element.</returns> + private string BuildUrl(string url, bool absoluteUrl = false) { if (string.IsNullOrEmpty(url)) { @@ -261,7 +267,7 @@ namespace Emby.Dlna.Server url = "/dlna/" + _serverUdn + "/" + url; - if (EnableAbsoluteUrls) + if (EnableAbsoluteUrls || absoluteUrl) { url = _serverAddress.TrimEnd('/') + url; } diff --git a/Emby.Naming/AudioBook/AudioBookFilePathParser.cs b/Emby.Naming/AudioBook/AudioBookFilePathParser.cs index eb9393b0b..14edd6492 100644 --- a/Emby.Naming/AudioBook/AudioBookFilePathParser.cs +++ b/Emby.Naming/AudioBook/AudioBookFilePathParser.cs @@ -1,6 +1,6 @@ +#nullable enable #pragma warning disable CS1591 -using System; using System.Globalization; using System.IO; using System.Text.RegularExpressions; @@ -19,12 +19,7 @@ namespace Emby.Naming.AudioBook public AudioBookFilePathParserResult Parse(string path) { - if (path == null) - { - throw new ArgumentNullException(nameof(path)); - } - - var result = new AudioBookFilePathParserResult(); + AudioBookFilePathParserResult result = default; var fileName = Path.GetFileNameWithoutExtension(path); foreach (var expression in _options.AudioBookPartsExpressions) { diff --git a/Emby.Naming/AudioBook/AudioBookFilePathParserResult.cs b/Emby.Naming/AudioBook/AudioBookFilePathParserResult.cs index e28a58db7..7bfc4479d 100644 --- a/Emby.Naming/AudioBook/AudioBookFilePathParserResult.cs +++ b/Emby.Naming/AudioBook/AudioBookFilePathParserResult.cs @@ -1,8 +1,9 @@ +#nullable enable #pragma warning disable CS1591 namespace Emby.Naming.AudioBook { - public class AudioBookFilePathParserResult + public struct AudioBookFilePathParserResult { public int? PartNumber { get; set; } diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 642e2fdbe..7a46fdf2e 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using System.IO; using System.Linq; using System.Net; @@ -37,6 +38,7 @@ using Emby.Server.Implementations.LiveTv; using Emby.Server.Implementations.Localization; using Emby.Server.Implementations.Net; using Emby.Server.Implementations.Playlists; +using Emby.Server.Implementations.Plugins; using Emby.Server.Implementations.QuickConnect; using Emby.Server.Implementations.ScheduledTasks; using Emby.Server.Implementations.Security; @@ -119,6 +121,7 @@ namespace Emby.Server.Implementations private readonly IFileSystem _fileSystemManager; private readonly INetworkManager _networkManager; private readonly IXmlSerializer _xmlSerializer; + private readonly IJsonSerializer _jsonSerializer; private readonly IStartupOptions _startupOptions; private IMediaEncoder _mediaEncoder; @@ -255,6 +258,8 @@ namespace Emby.Server.Implementations IServiceCollection serviceCollection) { _xmlSerializer = new MyXmlSerializer(); + _jsonSerializer = new JsonSerializer(); + ServiceCollection = serviceCollection; _networkManager = networkManager; @@ -1022,6 +1027,119 @@ namespace Emby.Server.Implementations protected abstract void RestartInternal(); /// <summary> + /// Comparison function used in <see cref="GetPlugins" />. + /// </summary> + /// <param name="a">Item to compare.</param> + /// <param name="b">Item to compare with.</param> + /// <returns>Boolean result of the operation.</returns> + private static int VersionCompare( + (Version PluginVersion, string Name, string Path) a, + (Version PluginVersion, string Name, string Path) b) + { + int compare = string.Compare(a.Name, b.Name, true, CultureInfo.InvariantCulture); + + if (compare == 0) + { + return a.PluginVersion.CompareTo(b.PluginVersion); + } + + return compare; + } + + /// <summary> + /// Returns a list of plugins to install. + /// </summary> + /// <param name="path">Path to check.</param> + /// <param name="cleanup">True if an attempt should be made to delete old plugs.</param> + /// <returns>Enumerable list of dlls to load.</returns> + private IEnumerable<string> GetPlugins(string path, bool cleanup = true) + { + var dllList = new List<string>(); + var versions = new List<(Version PluginVersion, string Name, string Path)>(); + var directories = Directory.EnumerateDirectories(path, "*.*", SearchOption.TopDirectoryOnly); + string metafile; + + foreach (var dir in directories) + { + try + { + metafile = Path.Combine(dir, "meta.json"); + if (File.Exists(metafile)) + { + var manifest = _jsonSerializer.DeserializeFromFile<PluginManifest>(metafile); + + if (!Version.TryParse(manifest.TargetAbi, out var targetAbi)) + { + targetAbi = new Version(0, 0, 0, 1); + } + + if (!Version.TryParse(manifest.Version, out var version)) + { + version = new Version(0, 0, 0, 1); + } + + if (ApplicationVersion >= targetAbi) + { + // Only load Plugins if the plugin is built for this version or below. + versions.Add((version, manifest.Name, dir)); + } + } + else + { + // No metafile, so lets see if the folder is versioned. + metafile = dir.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries)[^1]; + + int versionIndex = dir.LastIndexOf('_'); + if (versionIndex != -1 && Version.TryParse(dir.Substring(versionIndex + 1), out Version ver)) + { + // Versioned folder. + versions.Add((ver, metafile, dir)); + } + else + { + // Un-versioned folder - Add it under the path name and version 0.0.0.1. + versions.Add((new Version(0, 0, 0, 1), metafile, dir)); + } + } + } + catch + { + continue; + } + } + + string lastName = string.Empty; + versions.Sort(VersionCompare); + // Traverse backwards through the list. + // The first item will be the latest version. + for (int x = versions.Count - 1; x >= 0; x--) + { + if (!string.Equals(lastName, versions[x].Name, StringComparison.OrdinalIgnoreCase)) + { + dllList.AddRange(Directory.EnumerateFiles(versions[x].Path, "*.dll", SearchOption.AllDirectories)); + lastName = versions[x].Name; + continue; + } + + if (!string.IsNullOrEmpty(lastName) && cleanup) + { + // Attempt a cleanup of old folders. + try + { + Logger.LogDebug("Deleting {Path}", versions[x].Path); + Directory.Delete(versions[x].Path, true); + } + catch (Exception e) + { + Logger.LogWarning(e, "Unable to delete {Path}", versions[x].Path); + } + } + } + + return dllList; + } + + /// <summary> /// Gets the composable part assemblies. /// </summary> /// <returns>IEnumerable{Assembly}.</returns> @@ -1029,7 +1147,7 @@ namespace Emby.Server.Implementations { if (Directory.Exists(ApplicationPaths.PluginsPath)) { - foreach (var file in Directory.EnumerateFiles(ApplicationPaths.PluginsPath, "*.dll", SearchOption.AllDirectories)) + foreach (var file in GetPlugins(ApplicationPaths.PluginsPath)) { Assembly plugAss; try diff --git a/Emby.Server.Implementations/Data/SqliteExtensions.cs b/Emby.Server.Implementations/Data/SqliteExtensions.cs index 716e5071d..70a6df977 100644 --- a/Emby.Server.Implementations/Data/SqliteExtensions.cs +++ b/Emby.Server.Implementations/Data/SqliteExtensions.cs @@ -234,7 +234,9 @@ namespace Emby.Server.Implementations.Data { if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam)) { - bindParam.Bind(value.ToByteArray()); + Span<byte> byteValue = stackalloc byte[16]; + value.TryWriteBytes(byteValue); + bindParam.Bind(byteValue); } else { diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index ab60cee61..d09f84e17 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -2263,7 +2263,6 @@ namespace Emby.Server.Implementations.Data return query.IncludeItemTypes.Contains("Trailer", StringComparer.OrdinalIgnoreCase); } - private static readonly HashSet<string> _artistExcludeParentTypes = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "Series", @@ -3291,7 +3290,6 @@ namespace Emby.Server.Implementations.Data } } - var isReturningZeroItems = query.Limit.HasValue && query.Limit <= 0; var statementTexts = new List<string>(); @@ -6006,7 +6004,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type } } - /// <summary> /// Gets the chapter. /// </summary> diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index 57c1398e9..edb8753fd 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -468,7 +468,6 @@ namespace Emby.Server.Implementations.Dto IncludeItemTypes = new[] { typeof(MusicAlbum).Name }, Name = item.Album, Limit = 1 - }); if (parentAlbumIds.Count > 0) @@ -1139,6 +1138,7 @@ namespace Emby.Server.Implementations.Dto if (episodeSeries != null) { dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, episodeSeries, ImageType.Primary); + AttachPrimaryImageAspectRatio(dto, episodeSeries); } } @@ -1185,6 +1185,7 @@ namespace Emby.Server.Implementations.Dto if (series != null) { dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, series, ImageType.Primary); + AttachPrimaryImageAspectRatio(dto, series); } } } @@ -1431,7 +1432,7 @@ namespace Emby.Server.Implementations.Dto return null; } - return width / height; + return (double)width / height; } } } diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index 0a348f0d0..9ed3cca99 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -22,7 +22,7 @@ </ItemGroup> <ItemGroup> - <PackageReference Include="IPNetwork2" Version="2.5.224" /> + <PackageReference Include="IPNetwork2" Version="2.5.226" /> <PackageReference Include="Jellyfin.XmlTv" Version="10.6.2" /> <PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" /> <PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" /> @@ -32,11 +32,11 @@ <PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="2.2.1" /> - <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.7" /> - <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="3.1.7" /> - <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.7" /> - <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.1.7" /> - <PackageReference Include="Mono.Nat" Version="2.0.2" /> + <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.8" /> + <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="3.1.8" /> + <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.8" /> + <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.1.8" /> + <PackageReference Include="Mono.Nat" Version="3.0.0" /> <PackageReference Include="prometheus-net.DotNetRuntime" Version="3.4.0" /> <PackageReference Include="ServiceStack.Text.Core" Version="5.9.2" /> <PackageReference Include="sharpcompress" Version="0.26.0" /> diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs index 3618b88c5..1da717e75 100644 --- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs @@ -28,7 +28,6 @@ namespace Emby.Server.Implementations.EntryPoints private readonly object _syncLock = new object(); private Timer _updateTimer; - public UserDataChangeNotifier(IUserDataManager userDataManager, ISessionManager sessionManager, IUserManager userManager) { _userDataManager = userDataManager; diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index 655ff5853..28aabc159 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -874,7 +874,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings public List<Lineup> lineups { get; set; } } - public class Headends { public string headend { get; set; } @@ -886,8 +885,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings public List<Lineup> lineups { get; set; } } - - public class Map { public string stationID { get; set; } @@ -971,9 +968,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings public List<string> date { get; set; } } - - - public class Rating { public string body { get; set; } @@ -1017,8 +1011,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings public string isPremiereOrFinale { get; set; } } - - public class MetadataSchedule { public string modified { get; set; } diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index a898a564f..5bdd1c23c 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -2135,6 +2135,7 @@ namespace Emby.Server.Implementations.LiveTv } private bool _disposed = false; + /// <summary> /// Releases unmanaged and - optionally - managed resources. /// </summary> diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index 28e30fac8..2f4c60117 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -563,6 +563,19 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun protected override async Task<ILiveStream> GetChannelStream(TunerHostInfo info, ChannelInfo channelInfo, string streamId, List<ILiveStream> currentLiveStreams, CancellationToken cancellationToken) { + var tunerCount = info.TunerCount; + + if (tunerCount > 0) + { + var tunerHostId = info.Id; + var liveStreams = currentLiveStreams.Where(i => string.Equals(i.TunerHostId, tunerHostId, StringComparison.OrdinalIgnoreCase)); + + if (liveStreams.Count() >= tunerCount) + { + throw new LiveTvConflictException("HDHomeRun simultaneous stream limit has been reached."); + } + } + var profile = streamId.Split('_')[0]; Logger.LogInformation("GetChannelStream: channel id: {0}. stream id: {1} profile: {2}", channelInfo.Id, streamId, profile); diff --git a/Emby.Server.Implementations/Localization/Core/af.json b/Emby.Server.Implementations/Localization/Core/af.json index e587c37d5..d33e11893 100644 --- a/Emby.Server.Implementations/Localization/Core/af.json +++ b/Emby.Server.Implementations/Localization/Core/af.json @@ -1,19 +1,19 @@ { "Artists": "Kunstenare", "Channels": "Kanale", - "Folders": "Fouers", - "Favorites": "Gunstelinge", + "Folders": "Lêergidse", + "Favorites": "Gunstellinge", "HeaderFavoriteShows": "Gunsteling Vertonings", "ValueSpecialEpisodeName": "Spesiale - {0}", "HeaderAlbumArtists": "Album Kunstenaars", "Books": "Boeke", "HeaderNextUp": "Volgende", - "Movies": "Rolprente", - "Shows": "Program", - "HeaderContinueWatching": "Hou Aan Kyk", + "Movies": "Flieks", + "Shows": "Televisie Reekse", + "HeaderContinueWatching": "Kyk Verder", "HeaderFavoriteEpisodes": "Gunsteling Episodes", "Photos": "Fotos", - "Playlists": "Speellysse", + "Playlists": "Snitlyste", "HeaderFavoriteArtists": "Gunsteling Kunstenaars", "HeaderFavoriteAlbums": "Gunsteling Albums", "Sync": "Sinkroniseer", @@ -23,7 +23,7 @@ "DeviceOfflineWithName": "{0} is ontkoppel", "Collections": "Versamelings", "Inherit": "Ontvang", - "HeaderLiveTV": "Live TV", + "HeaderLiveTV": "Lewendige TV", "Application": "Program", "AppDeviceValues": "App: {0}, Toestel: {1}", "VersionNumber": "Weergawe {0}", @@ -95,5 +95,23 @@ "TasksChannelsCategory": "Internet kanale", "TasksApplicationCategory": "aansoek", "TasksLibraryCategory": "biblioteek", - "TasksMaintenanceCategory": "onderhoud" + "TasksMaintenanceCategory": "onderhoud", + "TaskCleanCacheDescription": "Vee kasregister lêers uit wat nie meer deur die stelsel benodig word nie.", + "TaskCleanCache": "Reinig Kasgeheue Lêergids", + "TaskDownloadMissingSubtitlesDescription": "Soek aanlyn vir vermiste onderskrifte gebasseer op metadata verstellings.", + "TaskDownloadMissingSubtitles": "Laai vermiste onderskrifte af", + "TaskRefreshChannelsDescription": "Vervris internet kanaal inligting.", + "TaskRefreshChannels": "Vervris Kanale", + "TaskCleanTranscodeDescription": "Vee transkodering lêers uit wat ouer is as een dag.", + "TaskCleanTranscode": "Reinig Transkoderings Leêrbinder", + "TaskUpdatePluginsDescription": "Laai opgedateerde inprop-sagteware af en installeer inprop-sagteware wat verstel is om outomaties op te dateer.", + "TaskUpdatePlugins": "Dateer Inprop-Sagteware Op", + "TaskRefreshPeopleDescription": "Vervris metadata oor akteurs en regisseurs in u media versameling.", + "TaskRefreshPeople": "Vervris Mense", + "TaskCleanLogsDescription": "Vee loglêers wat ouer as {0} dae is uit.", + "TaskCleanLogs": "Reinig Loglêer Lêervouer", + "TaskRefreshLibraryDescription": "Skandeer u media versameling vir nuwe lêers en verfris metadata.", + "TaskRefreshLibrary": "Skandeer Media Versameling", + "TaskRefreshChapterImagesDescription": "Maak kleinkiekeis (fotos) vir films wat hoofstukke het.", + "TaskRefreshChapterImages": "Verkry Hoofstuk Beelde" } diff --git a/Emby.Server.Implementations/Localization/Core/fr.json b/Emby.Server.Implementations/Localization/Core/fr.json index 47ebe1254..7fc996821 100644 --- a/Emby.Server.Implementations/Localization/Core/fr.json +++ b/Emby.Server.Implementations/Localization/Core/fr.json @@ -107,7 +107,7 @@ "TaskCleanLogsDescription": "Supprime les journaux de plus de {0} jours.", "TaskCleanLogs": "Nettoyer le répertoire des journaux", "TaskRefreshLibraryDescription": "Scanne toute les bibliothèques pour trouver les nouveaux fichiers et rafraîchit les métadonnées.", - "TaskRefreshLibrary": "Scanner toute les Bibliothèques", + "TaskRefreshLibrary": "Scanner toutes les Bibliothèques", "TaskRefreshChapterImagesDescription": "Crée des images de miniature pour les vidéos ayant des chapitres.", "TaskRefreshChapterImages": "Extraire les images de chapitre", "TaskCleanCacheDescription": "Supprime les fichiers de cache dont le système n'a plus besoin.", diff --git a/Emby.Server.Implementations/Localization/Core/gl.json b/Emby.Server.Implementations/Localization/Core/gl.json index 94034962d..faee2519a 100644 --- a/Emby.Server.Implementations/Localization/Core/gl.json +++ b/Emby.Server.Implementations/Localization/Core/gl.json @@ -1,3 +1,11 @@ { - "Albums": "Álbumes" + "Albums": "Álbumes", + "Collections": "Colecións", + "ChapterNameValue": "Capítulos {0}", + "Channels": "Canles", + "CameraImageUploadedFrom": "Cargouse unha nova imaxe da cámara desde {0}", + "Books": "Libros", + "AuthenticationSucceededWithUserName": "{0} autenticouse correctamente", + "Artists": "Artistas", + "Application": "Aplicativo" } diff --git a/Emby.Server.Implementations/Localization/Core/ko.json b/Emby.Server.Implementations/Localization/Core/ko.json index 9e3ecd5a8..a33953c27 100644 --- a/Emby.Server.Implementations/Localization/Core/ko.json +++ b/Emby.Server.Implementations/Localization/Core/ko.json @@ -84,8 +84,8 @@ "UserDeletedWithName": "사용자 {0} 삭제됨", "UserDownloadingItemWithValues": "{0}이(가) {1}을 다운로드 중입니다", "UserLockedOutWithName": "유저 {0} 은(는) 잠금처리 되었습니다", - "UserOfflineFromDevice": "{1}로부터 {0}의 연결이 끊겼습니다", - "UserOnlineFromDevice": "{0}은 {1}에서 온라인 상태입니다", + "UserOfflineFromDevice": "{1}에서 {0}의 연결이 끊킴", + "UserOnlineFromDevice": "{0}이 {1}으로 접속", "UserPasswordChangedWithName": "사용자 {0}의 비밀번호가 변경되었습니다", "UserPolicyUpdatedWithName": "{0}의 사용자 정책이 업데이트되었습니다", "UserStartedPlayingItemWithValues": "{2}에서 {0}이 {1} 재생 중", diff --git a/Emby.Server.Implementations/Localization/Core/nb.json b/Emby.Server.Implementations/Localization/Core/nb.json index a97c2e17a..07a599121 100644 --- a/Emby.Server.Implementations/Localization/Core/nb.json +++ b/Emby.Server.Implementations/Localization/Core/nb.json @@ -50,7 +50,7 @@ "NotificationOptionAudioPlayback": "Lydavspilling startet", "NotificationOptionAudioPlaybackStopped": "Lydavspilling stoppet", "NotificationOptionCameraImageUploaded": "Kamerabilde lastet opp", - "NotificationOptionInstallationFailed": "Installasjonsfeil", + "NotificationOptionInstallationFailed": "Installasjonen feilet", "NotificationOptionNewLibraryContent": "Nytt innhold lagt til", "NotificationOptionPluginError": "Pluginfeil", "NotificationOptionPluginInstalled": "Plugin installert", diff --git a/Emby.Server.Implementations/Localization/Core/ta.json b/Emby.Server.Implementations/Localization/Core/ta.json index ed6877f7d..810b1b9ab 100644 --- a/Emby.Server.Implementations/Localization/Core/ta.json +++ b/Emby.Server.Implementations/Localization/Core/ta.json @@ -26,7 +26,7 @@ "DeviceOnlineWithName": "{0} இணைக்கப்பட்டது", "DeviceOfflineWithName": "{0} துண்டிக்கப்பட்டது", "Collections": "தொகுப்புகள்", - "CameraImageUploadedFrom": "{0} இலிருந்து புதிய புகைப்படம் பதிவேற்றப்பட்டது", + "CameraImageUploadedFrom": "{0} இல் இருந்து புதிய புகைப்படம் பதிவேற்றப்பட்டது", "AppDeviceValues": "செயலி: {0}, சாதனம்: {1}", "TaskDownloadMissingSubtitles": "விடுபட்டுபோன வசன வரிகளைப் பதிவிறக்கு", "TaskRefreshChannels": "சேனல்களை புதுப்பி", diff --git a/Emby.Server.Implementations/Localization/Core/th.json b/Emby.Server.Implementations/Localization/Core/th.json index 3f6f3b23c..3b77215a3 100644 --- a/Emby.Server.Implementations/Localization/Core/th.json +++ b/Emby.Server.Implementations/Localization/Core/th.json @@ -20,8 +20,8 @@ "NotificationOptionCameraImageUploaded": "อัปโหลดภาพถ่ายแล้ว", "NotificationOptionAudioPlaybackStopped": "หยุดเล่นเสียง", "NotificationOptionAudioPlayback": "เริ่มเล่นเสียง", - "NotificationOptionApplicationUpdateInstalled": "ติดตั้งการอัปเดตแอพพลิเคชันแล้ว", - "NotificationOptionApplicationUpdateAvailable": "มีการอัปเดตแอพพลิเคชัน", + "NotificationOptionApplicationUpdateInstalled": "ติดตั้งการอัปเดตแอปพลิเคชันแล้ว", + "NotificationOptionApplicationUpdateAvailable": "มีการอัปเดตแอปพลิเคชัน", "NewVersionIsAvailable": "เวอร์ชันใหม่ของเซิร์ฟเวอร์ Jellyfin พร้อมให้ดาวน์โหลดแล้ว", "NameSeasonUnknown": "ไม่ทราบซีซัน", "NameSeasonNumber": "ซีซัน {0}", @@ -65,8 +65,8 @@ "Books": "หนังสือ", "AuthenticationSucceededWithUserName": "{0} ยืนยันตัวสำเร็จแล้ว", "Artists": "ศิลปิน", - "Application": "แอพพลิเคชัน", - "AppDeviceValues": "แอพ: {0}, อุปกรณ์: {1}", + "Application": "แอปพลิเคชัน", + "AppDeviceValues": "แอป: {0}, อุปกรณ์: {1}", "Albums": "อัลบั้ม", "ScheduledTaskStartedWithName": "{0} เริ่มต้น", "ScheduledTaskFailedWithName": "{0} ล้มเหลว", @@ -92,7 +92,7 @@ "TaskCleanCacheDescription": "ลบไฟล์แคชที่ระบบไม่ต้องการ", "TaskCleanCache": "ล้างไดเรกทอรีแคช", "TasksChannelsCategory": "ช่องอินเทอร์เน็ต", - "TasksApplicationCategory": "แอพพลิเคชัน", + "TasksApplicationCategory": "แอปพลิเคชัน", "TasksLibraryCategory": "ไลบรารี", "TasksMaintenanceCategory": "ปิดซ่อมบำรุง", "VersionNumber": "เวอร์ชัน {0}", diff --git a/Emby.Server.Implementations/Localization/Core/vi.json b/Emby.Server.Implementations/Localization/Core/vi.json index bf4cfe75c..2392c8347 100644 --- a/Emby.Server.Implementations/Localization/Core/vi.json +++ b/Emby.Server.Implementations/Localization/Core/vi.json @@ -1,21 +1,21 @@ { "Collections": "Bộ Sưu Tập", - "Favorites": "Sở Thích", + "Favorites": "Yêu Thích", "Folders": "Thư Mục", "Genres": "Thể Loại", "HeaderAlbumArtists": "Bộ Sưu Tập Nghệ sĩ", - "HeaderContinueWatching": "Tiếp Tục Xem Tiếp", + "HeaderContinueWatching": "Xem Tiếp", "HeaderLiveTV": "TV Trực Tiếp", "Movies": "Phim", "Photos": "Ảnh", - "Playlists": "Danh Sách Chơi", - "Shows": "Các Chương Trình", + "Playlists": "Danh sách phát", + "Shows": "Chương Trình TV", "Songs": "Các Bài Hát", "Sync": "Đồng Bộ", "ValueSpecialEpisodeName": "Đặc Biệt - {0}", - "Albums": "Bộ Sưu Tập", + "Albums": "Albums", "Artists": "Các Nghệ Sĩ", - "TaskDownloadMissingSubtitlesDescription": "Tìm kiếm phụ đề bị thiếu trên Internet dựa trên cấu hình thông tin chi tiết.", + "TaskDownloadMissingSubtitlesDescription": "Tìm kiếm phụ đề bị thiếu trên Internet dựa trên cấu hình dữ liệu mô tả.", "TaskDownloadMissingSubtitles": "Tải xuống phụ đề bị thiếu", "TaskRefreshChannelsDescription": "Làm mới thông tin kênh internet.", "TaskRefreshChannels": "Làm Mới Kênh", @@ -29,8 +29,8 @@ "TaskCleanLogs": "Làm sạch nhật ký", "TaskRefreshLibraryDescription": "Quét thư viện phương tiện của bạn để tìm các tệp mới và làm mới thông tin chi tiết.", "TaskRefreshLibrary": "Quét Thư viện Phương tiện", - "TaskRefreshChapterImagesDescription": "Tạo hình thu nhỏ cho các video có chương.", - "TaskRefreshChapterImages": "Trích xuất hình ảnh chương", + "TaskRefreshChapterImagesDescription": "Tạo hình thu nhỏ cho video có các phân cảnh.", + "TaskRefreshChapterImages": "Trích Xuất Ảnh Phân Cảnh", "TaskCleanCacheDescription": "Xóa các tệp cache không còn cần thiết của hệ thống.", "TaskCleanCache": "Làm Sạch Thư Mục Cache", "TasksChannelsCategory": "Kênh Internet", @@ -107,10 +107,10 @@ "FailedLoginAttemptWithUserName": "Nỗ lực đăng nhập thất bại từ {0}", "DeviceOnlineWithName": "{0} đã kết nối", "DeviceOfflineWithName": "{0} đã ngắt kết nối", - "ChapterNameValue": "Chương {0}", + "ChapterNameValue": "Phân Cảnh {0}", "Channels": "Các Kênh", "CameraImageUploadedFrom": "Một hình ảnh máy ảnh mới đã được tải lên từ {0}", - "Books": "Các Quyển Sách", + "Books": "Sách", "AuthenticationSucceededWithUserName": "{0} xác thực thành công", "Application": "Ứng Dụng", "AppDeviceValues": "Ứng Dụng: {0}, Thiết Bị: {1}" diff --git a/Emby.Server.Implementations/Localization/Core/zh-TW.json b/Emby.Server.Implementations/Localization/Core/zh-TW.json index 01108fe84..7b6540c3e 100644 --- a/Emby.Server.Implementations/Localization/Core/zh-TW.json +++ b/Emby.Server.Implementations/Localization/Core/zh-TW.json @@ -96,7 +96,7 @@ "TaskDownloadMissingSubtitles": "下載遺失的字幕", "TaskRefreshChannels": "重新整理頻道", "TaskUpdatePlugins": "更新外掛", - "TaskRefreshPeople": "重新整理人員", + "TaskRefreshPeople": "刷新用戶", "TaskCleanLogsDescription": "刪除超過 {0} 天的舊紀錄檔。", "TaskCleanLogs": "清空紀錄資料夾", "TaskRefreshLibraryDescription": "重新掃描媒體庫的新檔案並更新描述資料。", diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index 90e2766b8..30aaf3a05 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -413,6 +413,7 @@ namespace Emby.Server.Implementations.Localization yield return new LocalizationOption("Swedish", "sv"); yield return new LocalizationOption("Swiss German", "gsw"); yield return new LocalizationOption("Turkish", "tr"); + yield return new LocalizationOption("Tiếng Việt", "vi"); } } } diff --git a/Emby.Server.Implementations/Plugins/PluginManifest.cs b/Emby.Server.Implementations/Plugins/PluginManifest.cs new file mode 100644 index 000000000..33762791b --- /dev/null +++ b/Emby.Server.Implementations/Plugins/PluginManifest.cs @@ -0,0 +1,60 @@ +using System; + +namespace Emby.Server.Implementations.Plugins +{ + /// <summary> + /// Defines a Plugin manifest file. + /// </summary> + public class PluginManifest + { + /// <summary> + /// Gets or sets the category of the plugin. + /// </summary> + public string Category { get; set; } + + /// <summary> + /// Gets or sets the changelog information. + /// </summary> + public string Changelog { get; set; } + + /// <summary> + /// Gets or sets the description of the plugin. + /// </summary> + public string Description { get; set; } + + /// <summary> + /// Gets or sets the Global Unique Identifier for the plugin. + /// </summary> + public Guid Guid { get; set; } + + /// <summary> + /// Gets or sets the Name of the plugin. + /// </summary> + public string Name { get; set; } + + /// <summary> + /// Gets or sets an overview of the plugin. + /// </summary> + public string Overview { get; set; } + + /// <summary> + /// Gets or sets the owner of the plugin. + /// </summary> + public string Owner { get; set; } + + /// <summary> + /// Gets or sets the compatibility version for the plugin. + /// </summary> + public string TargetAbi { get; set; } + + /// <summary> + /// Gets or sets the timestamp of the plugin. + /// </summary> + public DateTime Timestamp { get; set; } + + /// <summary> + /// Gets or sets the Version number of the plugin. + /// </summary> + public string Version { get; set; } + } +} diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index ca8e0e29b..e42d47853 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -1037,7 +1037,7 @@ namespace Emby.Server.Implementations.Session var generalCommand = new GeneralCommand { - Name = GeneralCommandType.DisplayMessage.ToString() + Name = GeneralCommandType.DisplayMessage }; generalCommand.Arguments["Header"] = command.Header; @@ -1268,7 +1268,7 @@ namespace Emby.Server.Implementations.Session { var generalCommand = new GeneralCommand { - Name = GeneralCommandType.DisplayContent.ToString(), + Name = GeneralCommandType.DisplayContent, Arguments = { ["ItemId"] = command.ItemId, diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs index e19158f8e..003cf3c74 100644 --- a/Emby.Server.Implementations/Updates/InstallationManager.cs +++ b/Emby.Server.Implementations/Updates/InstallationManager.cs @@ -15,12 +15,14 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Net; using MediaBrowser.Common.Plugins; using MediaBrowser.Common.Updates; +using MediaBrowser.Common.System; using MediaBrowser.Controller.Configuration; using MediaBrowser.Model.IO; using MediaBrowser.Model.Net; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Updates; using Microsoft.Extensions.Logging; +using MediaBrowser.Model.System; namespace Emby.Server.Implementations.Updates { @@ -153,7 +155,12 @@ namespace Emby.Server.Implementations.Updates var result = new List<PackageInfo>(); foreach (RepositoryInfo repository in _config.Configuration.PluginRepositories) { - result.AddRange(await GetPackages(repository.Url, cancellationToken).ConfigureAwait(true)); + foreach (var package in await GetPackages(repository.Url, cancellationToken).ConfigureAwait(true)) + { + package.repositoryName = repository.Name; + package.repositoryUrl = repository.Url; + result.Add(package); + } } return result; @@ -377,9 +384,19 @@ namespace Emby.Server.Implementations.Updates throw new InvalidDataException("The checksum of the received data doesn't match."); } + // Version folder as they cannot be overwritten in Windows. + targetDir += "_" + package.Version; + if (Directory.Exists(targetDir)) { - Directory.Delete(targetDir, true); + try + { + Directory.Delete(targetDir, true); + } + catch + { + // Ignore any exceptions. + } } stream.Position = 0; @@ -423,15 +440,22 @@ namespace Emby.Server.Implementations.Updates path = file; } - if (isDirectory) + try { - _logger.LogInformation("Deleting plugin directory {0}", path); - Directory.Delete(path, true); + if (isDirectory) + { + _logger.LogInformation("Deleting plugin directory {0}", path); + Directory.Delete(path, true); + } + else + { + _logger.LogInformation("Deleting plugin file {0}", path); + _fileSystem.DeleteFile(path); + } } - else + catch { - _logger.LogInformation("Deleting plugin file {0}", path); - _fileSystem.DeleteFile(path); + // Ignore file errors. } var list = _config.Configuration.UninstalledPlugins.ToList(); diff --git a/Jellyfin.Api/Controllers/DynamicHlsController.cs b/Jellyfin.Api/Controllers/DynamicHlsController.cs index 670b41611..1153a601e 100644 --- a/Jellyfin.Api/Controllers/DynamicHlsController.cs +++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Diagnostics.CodeAnalysis; @@ -113,7 +113,6 @@ namespace Jellyfin.Api.Controllers /// Gets a video hls playlist stream. /// </summary> /// <param name="itemId">The item id.</param> - /// <param name="container">The video container. Possible values are: ts, webm, asf, wmv, ogv, mp4, m4v, mkv, mpeg, mpg, avi, 3gp, wmv, wtv, m2ts, mov, iso, flv. </param> /// <param name="static">Optional. If true, the original file will be streamed statically without any encoding. Use either no url extension or the original file extension. true/false.</param> /// <param name="params">The streaming parameters.</param> /// <param name="tag">The tag.</param> @@ -170,7 +169,6 @@ namespace Jellyfin.Api.Controllers [ProducesPlaylistFile] public async Task<ActionResult> GetMasterHlsVideoPlaylist( [FromRoute, Required] Guid itemId, - [FromRoute, Required] string container, [FromQuery] bool? @static, [FromQuery] string? @params, [FromQuery] string? tag, @@ -223,7 +221,6 @@ namespace Jellyfin.Api.Controllers var streamingRequest = new HlsVideoRequestDto { Id = itemId, - Container = container, Static = @static ?? true, Params = @params, Tag = tag, @@ -281,7 +278,6 @@ namespace Jellyfin.Api.Controllers /// Gets an audio hls playlist stream. /// </summary> /// <param name="itemId">The item id.</param> - /// <param name="container">The video container. Possible values are: ts, webm, asf, wmv, ogv, mp4, m4v, mkv, mpeg, mpg, avi, 3gp, wmv, wtv, m2ts, mov, iso, flv. </param> /// <param name="static">Optional. If true, the original file will be streamed statically without any encoding. Use either no url extension or the original file extension. true/false.</param> /// <param name="params">The streaming parameters.</param> /// <param name="tag">The tag.</param> @@ -338,7 +334,6 @@ namespace Jellyfin.Api.Controllers [ProducesPlaylistFile] public async Task<ActionResult> GetMasterHlsAudioPlaylist( [FromRoute, Required] Guid itemId, - [FromQuery, Required] string container, [FromQuery] bool? @static, [FromQuery] string? @params, [FromQuery] string? tag, @@ -391,7 +386,6 @@ namespace Jellyfin.Api.Controllers var streamingRequest = new HlsAudioRequestDto { Id = itemId, - Container = container, Static = @static ?? true, Params = @params, Tag = tag, @@ -449,7 +443,6 @@ namespace Jellyfin.Api.Controllers /// Gets a video stream using HTTP live streaming. /// </summary> /// <param name="itemId">The item id.</param> - /// <param name="container">The video container. Possible values are: ts, webm, asf, wmv, ogv, mp4, m4v, mkv, mpeg, mpg, avi, 3gp, wmv, wtv, m2ts, mov, iso, flv. </param> /// <param name="static">Optional. If true, the original file will be streamed statically without any encoding. Use either no url extension or the original file extension. true/false.</param> /// <param name="params">The streaming parameters.</param> /// <param name="tag">The tag.</param> @@ -504,7 +497,6 @@ namespace Jellyfin.Api.Controllers [ProducesPlaylistFile] public async Task<ActionResult> GetVariantHlsVideoPlaylist( [FromRoute, Required] Guid itemId, - [FromQuery, Required] string container, [FromQuery] bool? @static, [FromQuery] string? @params, [FromQuery] string? tag, @@ -557,7 +549,6 @@ namespace Jellyfin.Api.Controllers var streamingRequest = new VideoRequestDto { Id = itemId, - Container = container, Static = @static ?? true, Params = @params, Tag = tag, @@ -615,7 +606,6 @@ namespace Jellyfin.Api.Controllers /// Gets an audio stream using HTTP live streaming. /// </summary> /// <param name="itemId">The item id.</param> - /// <param name="container">The video container. Possible values are: ts, webm, asf, wmv, ogv, mp4, m4v, mkv, mpeg, mpg, avi, 3gp, wmv, wtv, m2ts, mov, iso, flv. </param> /// <param name="static">Optional. If true, the original file will be streamed statically without any encoding. Use either no url extension or the original file extension. true/false.</param> /// <param name="params">The streaming parameters.</param> /// <param name="tag">The tag.</param> @@ -670,7 +660,6 @@ namespace Jellyfin.Api.Controllers [ProducesPlaylistFile] public async Task<ActionResult> GetVariantHlsAudioPlaylist( [FromRoute, Required] Guid itemId, - [FromQuery, Required] string container, [FromQuery] bool? @static, [FromQuery] string? @params, [FromQuery] string? tag, @@ -723,7 +712,6 @@ namespace Jellyfin.Api.Controllers var streamingRequest = new StreamingRequestDto { Id = itemId, - Container = container, Static = @static ?? true, Params = @params, Tag = tag, @@ -841,7 +829,7 @@ namespace Jellyfin.Api.Controllers [FromRoute, Required] Guid itemId, [FromRoute, Required] string playlistId, [FromRoute, Required] int segmentId, - [FromRoute, Required] string container, + [FromRoute] string container, [FromQuery] bool? @static, [FromQuery] string? @params, [FromQuery] string? tag, @@ -1011,7 +999,7 @@ namespace Jellyfin.Api.Controllers [FromRoute, Required] Guid itemId, [FromRoute, Required] string playlistId, [FromRoute, Required] int segmentId, - [FromRoute, Required] string container, + [FromRoute] string container, [FromQuery] bool? @static, [FromQuery] string? @params, [FromQuery] string? tag, @@ -1144,30 +1132,30 @@ namespace Jellyfin.Api.Controllers var builder = new StringBuilder(); - builder.AppendLine("#EXTM3U"); - builder.AppendLine("#EXT-X-PLAYLIST-TYPE:VOD"); - builder.AppendLine("#EXT-X-VERSION:3"); - builder.AppendLine("#EXT-X-TARGETDURATION:" + Math.Ceiling(segmentLengths.Length > 0 ? segmentLengths.Max() : state.SegmentLength).ToString(CultureInfo.InvariantCulture)); - builder.AppendLine("#EXT-X-MEDIA-SEQUENCE:0"); + builder.AppendLine("#EXTM3U") + .AppendLine("#EXT-X-PLAYLIST-TYPE:VOD") + .AppendLine("#EXT-X-VERSION:3") + .Append("#EXT-X-TARGETDURATION:") + .Append(Math.Ceiling(segmentLengths.Length > 0 ? segmentLengths.Max() : state.SegmentLength)) + .AppendLine() + .AppendLine("#EXT-X-MEDIA-SEQUENCE:0"); - var queryString = Request.QueryString; var index = 0; - var segmentExtension = GetSegmentFileExtension(streamingRequest.SegmentContainer); + var queryString = Request.QueryString; foreach (var length in segmentLengths) { - builder.AppendLine("#EXTINF:" + length.ToString("0.0000", CultureInfo.InvariantCulture) + ", nodesc"); - builder.AppendLine( - string.Format( - CultureInfo.InvariantCulture, - "hls1/{0}/{1}{2}{3}", - name, - index.ToString(CultureInfo.InvariantCulture), - segmentExtension, - queryString)); - - index++; + builder.Append("#EXTINF:") + .Append(length.ToString("0.0000", CultureInfo.InvariantCulture)) + .AppendLine(", nodesc") + .Append("hls1/") + .Append(name) + .Append('/') + .Append(index++) + .Append(segmentExtension) + .Append(queryString) + .AppendLine(); } builder.AppendLine("#EXT-X-ENDLIST"); @@ -1465,7 +1453,7 @@ namespace Jellyfin.Api.Controllers var args = "-codec:v:0 " + codec; - // if (state.EnableMpegtsM2TsMode) + // if (state.EnableMpegtsM2TsMode) // { // args += " -mpegts_m2ts_mode 1"; // } diff --git a/Jellyfin.Api/Controllers/ItemLookupController.cs b/Jellyfin.Api/Controllers/ItemLookupController.cs index cf7038650..ab73aa428 100644 --- a/Jellyfin.Api/Controllers/ItemLookupController.cs +++ b/Jellyfin.Api/Controllers/ItemLookupController.cs @@ -292,7 +292,7 @@ namespace Jellyfin.Api.Controllers /// A <see cref="Task" /> that represents the asynchronous operation to get the remote search results. /// The task result contains an <see cref="NoContentResult"/>. /// </returns> - [HttpPost("Items/RemoteSearch/Apply/{id}")] + [HttpPost("Items/RemoteSearch/Apply/{itemId}")] [Authorize(Policy = Policies.RequiresElevation)] [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task<ActionResult> ApplySearchCriteria( diff --git a/Jellyfin.Api/Controllers/LiveTvController.cs b/Jellyfin.Api/Controllers/LiveTvController.cs index 32ebfbd98..3557e6304 100644 --- a/Jellyfin.Api/Controllers/LiveTvController.cs +++ b/Jellyfin.Api/Controllers/LiveTvController.cs @@ -1017,9 +1017,9 @@ namespace Jellyfin.Api.Controllers [FromQuery] bool validateListings = false, [FromQuery] bool validateLogin = false) { - using var sha = SHA1.Create(); if (!string.IsNullOrEmpty(pw)) { + using var sha = SHA1.Create(); listingsProviderInfo.Password = Hex.Encode(sha.ComputeHash(Encoding.UTF8.GetBytes(pw))); } diff --git a/Jellyfin.Api/Controllers/PackageController.cs b/Jellyfin.Api/Controllers/PackageController.cs index eaf56aa56..1d9de14d2 100644 --- a/Jellyfin.Api/Controllers/PackageController.cs +++ b/Jellyfin.Api/Controllers/PackageController.cs @@ -77,6 +77,7 @@ namespace Jellyfin.Api.Controllers /// <param name="name">Package name.</param> /// <param name="assemblyGuid">GUID of the associated assembly.</param> /// <param name="version">Optional version. Defaults to latest version.</param> + /// <param name="repositoryUrl">Optional. Specify the repository to install from.</param> /// <response code="204">Package found.</response> /// <response code="404">Package not found.</response> /// <returns>A <see cref="NoContentResult"/> on success, or a <see cref="NotFoundResult"/> if the package could not be found.</returns> @@ -87,9 +88,16 @@ namespace Jellyfin.Api.Controllers public async Task<ActionResult> InstallPackage( [FromRoute, Required] string name, [FromQuery] string? assemblyGuid, - [FromQuery] string? version) + [FromQuery] string? version, + [FromQuery] string? repositoryUrl) { var packages = await _installationManager.GetAvailablePackages().ConfigureAwait(false); + if (!string.IsNullOrEmpty(repositoryUrl)) + { + packages = packages.Where(p => p.repositoryUrl.Equals(repositoryUrl, StringComparison.OrdinalIgnoreCase)) + .ToList(); + } + var package = _installationManager.GetCompatibleVersions( packages, name, diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index b00675d67..39bf6e6dc 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -1,5 +1,3 @@ -#pragma warning disable CA1801 - using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -150,25 +148,25 @@ namespace Jellyfin.Api.Controllers /// Instructs a session to play an item. /// </summary> /// <param name="sessionId">The session id.</param> - /// <param name="command">The type of play command to issue (PlayNow, PlayNext, PlayLast). Clients who have not yet implemented play next and play last may play now.</param> + /// <param name="playCommand">The type of play command to issue (PlayNow, PlayNext, PlayLast). Clients who have not yet implemented play next and play last may play now.</param> /// <param name="itemIds">The ids of the items to play, comma delimited.</param> /// <param name="startPositionTicks">The starting position of the first item.</param> /// <response code="204">Instruction sent to session.</response> /// <returns>A <see cref="NoContentResult"/>.</returns> - [HttpPost("Sessions/{sessionId}/Playing/{command}")] + [HttpPost("Sessions/{sessionId}/Playing")] [Authorize(Policy = Policies.DefaultAuthorization)] [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult Play( [FromRoute, Required] string sessionId, - [FromRoute, Required] PlayCommand command, - [FromQuery] Guid[] itemIds, + [FromQuery, Required] PlayCommand playCommand, + [FromQuery, Required] string itemIds, [FromQuery] long? startPositionTicks) { var playRequest = new PlayRequest { - ItemIds = itemIds, + ItemIds = RequestHelpers.GetGuids(itemIds), StartPositionTicks = startPositionTicks, - PlayCommand = command + PlayCommand = playCommand }; _sessionManager.SendPlayCommand( @@ -184,20 +182,29 @@ namespace Jellyfin.Api.Controllers /// Issues a playstate command to a client. /// </summary> /// <param name="sessionId">The session id.</param> - /// <param name="playstateRequest">The <see cref="PlaystateRequest"/>.</param> + /// <param name="command">The <see cref="PlaystateCommand"/>.</param> + /// <param name="seekPositionTicks">The optional position ticks.</param> + /// <param name="controllingUserId">The optional controlling user id.</param> /// <response code="204">Playstate command sent to session.</response> /// <returns>A <see cref="NoContentResult"/>.</returns> - [HttpPost("Sessions/{sessionId}/Playing")] + [HttpPost("Sessions/{sessionId}/Playing/{command}")] [Authorize(Policy = Policies.DefaultAuthorization)] [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult SendPlaystateCommand( [FromRoute, Required] string sessionId, - [FromBody] PlaystateRequest playstateRequest) + [FromRoute, Required] PlaystateCommand command, + [FromQuery] long? seekPositionTicks, + [FromQuery] string? controllingUserId) { _sessionManager.SendPlaystateCommand( RequestHelpers.GetSession(_sessionManager, _authContext, Request).Id, sessionId, - playstateRequest, + new PlaystateRequest() + { + Command = command, + ControllingUserId = controllingUserId, + SeekPositionTicks = seekPositionTicks, + }, CancellationToken.None); return NoContent(); @@ -215,18 +222,12 @@ namespace Jellyfin.Api.Controllers [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult SendSystemCommand( [FromRoute, Required] string sessionId, - [FromRoute, Required] string command) + [FromRoute, Required] GeneralCommandType command) { - var name = command; - if (Enum.TryParse(name, true, out GeneralCommandType commandType)) - { - name = commandType.ToString(); - } - var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request); var generalCommand = new GeneralCommand { - Name = name, + Name = command, ControllingUserId = currentSession.UserId }; @@ -247,7 +248,7 @@ namespace Jellyfin.Api.Controllers [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult SendGeneralCommand( [FromRoute, Required] string sessionId, - [FromRoute, Required] string command) + [FromRoute, Required] GeneralCommandType command) { var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request); @@ -434,9 +435,9 @@ namespace Jellyfin.Api.Controllers [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult ReportViewing( [FromQuery] string? sessionId, - [FromQuery] string? itemId) + [FromQuery, Required] string? itemId) { - string session = RequestHelpers.GetSession(_sessionManager, _authContext, Request).Id; + string session = sessionId ?? RequestHelpers.GetSession(_sessionManager, _authContext, Request).Id; _sessionManager.ReportNowViewingItem(session, itemId); return NoContent(); diff --git a/Jellyfin.Api/Controllers/SubtitleController.cs b/Jellyfin.Api/Controllers/SubtitleController.cs index 78c9d4398..cc682ed54 100644 --- a/Jellyfin.Api/Controllers/SubtitleController.cs +++ b/Jellyfin.Api/Controllers/SubtitleController.cs @@ -281,7 +281,8 @@ namespace Jellyfin.Api.Controllers var builder = new StringBuilder(); builder.AppendLine("#EXTM3U") .Append("#EXT-X-TARGETDURATION:") - .AppendLine(segmentLength.ToString(CultureInfo.InvariantCulture)) + .Append(segmentLength) + .AppendLine() .AppendLine("#EXT-X-VERSION:3") .AppendLine("#EXT-X-MEDIA-SEQUENCE:0") .AppendLine("#EXT-X-PLAYLIST-TYPE:VOD"); @@ -296,8 +297,9 @@ namespace Jellyfin.Api.Controllers var lengthTicks = Math.Min(remaining, segmentLengthTicks); builder.Append("#EXTINF:") - .Append(TimeSpan.FromTicks(lengthTicks).TotalSeconds.ToString(CultureInfo.InvariantCulture)) - .AppendLine(","); + .Append(TimeSpan.FromTicks(lengthTicks).TotalSeconds) + .Append(',') + .AppendLine(); var endPositionTicks = Math.Min(runtime, positionTicks + segmentLengthTicks); diff --git a/Jellyfin.Api/Controllers/UserController.cs b/Jellyfin.Api/Controllers/UserController.cs index 630e9df6a..50bb8bb2a 100644 --- a/Jellyfin.Api/Controllers/UserController.cs +++ b/Jellyfin.Api/Controllers/UserController.cs @@ -505,17 +505,17 @@ namespace Jellyfin.Api.Controllers /// <summary> /// Initiates the forgot password process for a local user. /// </summary> - /// <param name="enteredUsername">The entered username.</param> + /// <param name="forgotPasswordRequest">The forgot password request containing the entered username.</param> /// <response code="200">Password reset process started.</response> /// <returns>A <see cref="Task"/> containing a <see cref="ForgotPasswordResult"/>.</returns> [HttpPost("ForgotPassword")] [ProducesResponseType(StatusCodes.Status200OK)] - public async Task<ActionResult<ForgotPasswordResult>> ForgotPassword([FromBody] string? enteredUsername) + public async Task<ActionResult<ForgotPasswordResult>> ForgotPassword([FromBody, Required] ForgotPasswordDto forgotPasswordRequest) { var isLocal = HttpContext.IsLocal() || _networkManager.IsInLocalNetwork(HttpContext.GetNormalizedRemoteIp()); - var result = await _userManager.StartForgotPasswordProcess(enteredUsername, isLocal).ConfigureAwait(false); + var result = await _userManager.StartForgotPasswordProcess(forgotPasswordRequest.EnteredUsername, isLocal).ConfigureAwait(false); return result; } diff --git a/Jellyfin.Api/Controllers/VideosController.cs b/Jellyfin.Api/Controllers/VideosController.cs index cce4cfbe3..4de7aac71 100644 --- a/Jellyfin.Api/Controllers/VideosController.cs +++ b/Jellyfin.Api/Controllers/VideosController.cs @@ -326,9 +326,9 @@ namespace Jellyfin.Api.Controllers /// <param name="streamOptions">Optional. The streaming options.</param> /// <response code="200">Video stream returned.</response> /// <returns>A <see cref="FileResult"/> containing the audio file.</returns> - [HttpGet("{itemId}/{stream=stream}.{container?}", Name = "GetVideoStream_2")] + [HttpGet("{itemId}/{stream=stream}.{container?}", Name = "GetVideoStreamWithExt")] [HttpGet("{itemId}/stream")] - [HttpHead("{itemId}/{stream=stream}.{container?}", Name = "HeadVideoStream_2")] + [HttpHead("{itemId}/{stream=stream}.{container?}", Name = "HeadVideoStreamWithExt")] [HttpHead("{itemId}/stream", Name = "HeadVideoStream")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesVideoFile] diff --git a/Jellyfin.Api/Helpers/StreamingHelpers.cs b/Jellyfin.Api/Helpers/StreamingHelpers.cs index 89ab2da62..f4ec29bde 100644 --- a/Jellyfin.Api/Helpers/StreamingHelpers.cs +++ b/Jellyfin.Api/Helpers/StreamingHelpers.cs @@ -169,7 +169,7 @@ namespace Jellyfin.Api.Helpers string? containerInternal = Path.GetExtension(state.RequestedUrl); - if (string.IsNullOrEmpty(streamingRequest.Container)) + if (!string.IsNullOrEmpty(streamingRequest.Container)) { containerInternal = streamingRequest.Container; } diff --git a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs index 67e450372..64d1227f7 100644 --- a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs +++ b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs @@ -504,6 +504,11 @@ namespace Jellyfin.Api.Helpers } } + if (string.IsNullOrEmpty(_mediaEncoder.EncoderPath)) + { + throw new ArgumentException("FFMPEG path not set."); + } + var process = new Process { StartInfo = new ProcessStartInfo diff --git a/Jellyfin.Api/Jellyfin.Api.csproj b/Jellyfin.Api/Jellyfin.Api.csproj index ca0542b03..6a00db4b1 100644 --- a/Jellyfin.Api/Jellyfin.Api.csproj +++ b/Jellyfin.Api/Jellyfin.Api.csproj @@ -14,11 +14,11 @@ <ItemGroup> <PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" /> - <PackageReference Include="Microsoft.AspNetCore.Authorization" Version="3.1.7" /> + <PackageReference Include="Microsoft.AspNetCore.Authorization" Version="3.1.8" /> <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" /> - <PackageReference Include="Microsoft.Extensions.Http" Version="3.1.7" /> - <PackageReference Include="Swashbuckle.AspNetCore" Version="5.5.1" /> - <PackageReference Include="Swashbuckle.AspNetCore.ReDoc" Version="5.5.1" /> + <PackageReference Include="Microsoft.Extensions.Http" Version="3.1.8" /> + <PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" /> + <PackageReference Include="Swashbuckle.AspNetCore.ReDoc" Version="5.6.3" /> </ItemGroup> <ItemGroup> diff --git a/Jellyfin.Api/Models/UserDtos/ForgotPasswordDto.cs b/Jellyfin.Api/Models/UserDtos/ForgotPasswordDto.cs new file mode 100644 index 000000000..b31c6539c --- /dev/null +++ b/Jellyfin.Api/Models/UserDtos/ForgotPasswordDto.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace Jellyfin.Api.Models.UserDtos +{ + /// <summary> + /// Forgot Password request body DTO. + /// </summary> + public class ForgotPasswordDto + { + /// <summary> + /// Gets or sets the entered username to have its password reset. + /// </summary> + [Required] + public string? EnteredUsername { get; set; } + } +} diff --git a/Jellyfin.Data/Jellyfin.Data.csproj b/Jellyfin.Data/Jellyfin.Data.csproj index 95343f91b..6bb0d8ce2 100644 --- a/Jellyfin.Data/Jellyfin.Data.csproj +++ b/Jellyfin.Data/Jellyfin.Data.csproj @@ -41,8 +41,8 @@ </ItemGroup> <ItemGroup> - <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.7" /> - <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.7" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.8" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.8" /> </ItemGroup> <ItemGroup> diff --git a/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj b/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj index 6b378034a..c11ac5fb3 100644 --- a/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj +++ b/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj @@ -18,10 +18,10 @@ </ItemGroup> <ItemGroup> - <PackageReference Include="BlurHashSharp" Version="1.1.0" /> - <PackageReference Include="BlurHashSharp.SkiaSharp" Version="1.1.0" /> + <PackageReference Include="BlurHashSharp" Version="1.1.1" /> + <PackageReference Include="BlurHashSharp.SkiaSharp" Version="1.1.1" /> <PackageReference Include="SkiaSharp" Version="2.80.2" /> - <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.80.1" /> + <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.80.2" /> </ItemGroup> <ItemGroup> diff --git a/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj b/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj index 30ed3e6af..4e79dd8d6 100644 --- a/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj +++ b/Jellyfin.Server.Implementations/Jellyfin.Server.Implementations.csproj @@ -24,11 +24,11 @@ </ItemGroup> <ItemGroup> - <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.7"> + <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.8"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> - <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.7"> + <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.8"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj index ffab18f86..761a92f6d 100644 --- a/Jellyfin.Server/Jellyfin.Server.csproj +++ b/Jellyfin.Server/Jellyfin.Server.csproj @@ -38,10 +38,10 @@ <ItemGroup> <PackageReference Include="CommandLineParser" Version="2.8.0" /> - <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.1.7" /> - <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.7" /> - <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="3.1.7" /> - <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="3.1.7" /> + <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.1.8" /> + <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.8" /> + <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="3.1.8" /> + <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="3.1.8" /> <PackageReference Include="prometheus-net" Version="3.6.0" /> <PackageReference Include="prometheus-net.AspNetCore" Version="3.6.0" /> <PackageReference Include="Serilog.AspNetCore" Version="3.4.0" /> @@ -50,7 +50,7 @@ <PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" /> <PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" /> <PackageReference Include="Serilog.Sinks.File" Version="4.1.0" /> - <PackageReference Include="Serilog.Sinks.Graylog" Version="2.1.3" /> + <PackageReference Include="Serilog.Sinks.Graylog" Version="2.2.1" /> <PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.4" /> <PackageReference Include="SQLitePCLRaw.provider.sqlite3.netstandard11" Version="1.1.14" /> </ItemGroup> diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index 70dcc2397..322740cca 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -18,8 +18,8 @@ </ItemGroup> <ItemGroup> - <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.7" /> - <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.7" /> + <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.8" /> + <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.8" /> <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/> <PackageReference Include="Microsoft.Net.Http.Headers" Version="2.2.8" /> </ItemGroup> diff --git a/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs b/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs index 1074ce435..137f5d095 100644 --- a/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs +++ b/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs @@ -42,6 +42,7 @@ namespace MediaBrowser.Controller.Channels /// Indicates if a sort ascending/descending toggle is supported or not. /// </summary> public bool SupportsSortOrderToggle { get; set; } + /// <summary> /// Gets or sets the automatic refresh levels. /// </summary> @@ -53,6 +54,7 @@ namespace MediaBrowser.Controller.Channels /// </summary> /// <value>The daily download limit.</value> public int? DailyDownloadLimit { get; set; } + /// <summary> /// Gets or sets a value indicating whether [supports downloading]. /// </summary> diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 2c6dea02c..8220464b3 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -90,7 +90,6 @@ namespace MediaBrowser.Controller.Entities.Audio var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty; - if (ParentIndexNumber.HasValue) { songKey = ParentIndexNumber.Value.ToString("0000") + "-" + songKey; diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 68126bd8a..2fc7d45c9 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -197,6 +197,7 @@ namespace MediaBrowser.Controller.Entities public virtual bool SupportsRemoteImageDownloading => true; private string _name; + /// <summary> /// Gets or sets the name. /// </summary> @@ -661,6 +662,7 @@ namespace MediaBrowser.Controller.Entities } private string _forcedSortName; + /// <summary> /// Gets or sets the name of the forced sort. /// </summary> diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 11542c1ca..901ea875b 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -1386,7 +1386,6 @@ namespace MediaBrowser.Controller.Entities } } - /// <summary> /// Gets the linked children. /// </summary> diff --git a/MediaBrowser.Controller/Entities/IHasMediaSources.cs b/MediaBrowser.Controller/Entities/IHasMediaSources.cs index a7b60d168..0f612262a 100644 --- a/MediaBrowser.Controller/Entities/IHasMediaSources.cs +++ b/MediaBrowser.Controller/Entities/IHasMediaSources.cs @@ -21,7 +21,5 @@ namespace MediaBrowser.Controller.Entities List<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution); List<MediaStream> GetMediaStreams(); - - } } diff --git a/MediaBrowser.Controller/Entities/Photo.cs b/MediaBrowser.Controller/Entities/Photo.cs index 1485d4c79..2fc66176f 100644 --- a/MediaBrowser.Controller/Entities/Photo.cs +++ b/MediaBrowser.Controller/Entities/Photo.cs @@ -16,7 +16,6 @@ namespace MediaBrowser.Controller.Entities [JsonIgnore] public override Folder LatestItemsIndexContainer => AlbumEntity; - [JsonIgnore] public PhotoAlbum AlbumEntity { diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index 72c696c1a..75a746bfb 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -450,7 +450,6 @@ namespace MediaBrowser.Controller.Entities.TV }); } - protected override bool GetBlockUnratedValue(User user) { return user.GetPreference(PreferenceKind.BlockUnratedItems).Contains(UnratedItem.Series.ToString()); diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs index b384b27d1..068a76769 100644 --- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs +++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs @@ -258,7 +258,6 @@ namespace MediaBrowser.Controller.Entities IncludeItemTypes = new[] { typeof(Movie).Name }, Recursive = true, EnableTotalRecordCount = false - }).Items .SelectMany(i => i.Genres) .DistinctNames() diff --git a/MediaBrowser.Controller/Extensions/StringExtensions.cs b/MediaBrowser.Controller/Extensions/StringExtensions.cs index 3cc1f328a..182c8ef65 100644 --- a/MediaBrowser.Controller/Extensions/StringExtensions.cs +++ b/MediaBrowser.Controller/Extensions/StringExtensions.cs @@ -1,3 +1,4 @@ +#nullable enable #pragma warning disable CS1591 using System; @@ -15,11 +16,6 @@ namespace MediaBrowser.Controller.Extensions { public static string RemoveDiacritics(this string text) { - if (text == null) - { - throw new ArgumentNullException(nameof(text)); - } - var chars = Normalize(text, NormalizationForm.FormD) .Where(ch => CharUnicodeInfo.GetUnicodeCategory(ch) != UnicodeCategory.NonSpacingMark); diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs index 9bc4cac39..3db60ae0b 100644 --- a/MediaBrowser.Controller/IO/FileData.cs +++ b/MediaBrowser.Controller/IO/FileData.cs @@ -111,5 +111,4 @@ namespace MediaBrowser.Controller.IO return returnResult; } } - } diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 804170d5c..332730bcc 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -77,6 +77,7 @@ namespace MediaBrowser.Controller.Library MusicArtist GetArtist(string name); MusicArtist GetArtist(string name, DtoOptions options); + /// <summary> /// Gets a Studio. /// </summary> @@ -234,6 +235,7 @@ namespace MediaBrowser.Controller.Library /// Occurs when [item updated]. /// </summary> event EventHandler<ItemChangeEventArgs> ItemUpdated; + /// <summary> /// Occurs when [item removed]. /// </summary> diff --git a/MediaBrowser.Controller/Library/IMediaSourceManager.cs b/MediaBrowser.Controller/Library/IMediaSourceManager.cs index 9e7b1e608..22bf9488f 100644 --- a/MediaBrowser.Controller/Library/IMediaSourceManager.cs +++ b/MediaBrowser.Controller/Library/IMediaSourceManager.cs @@ -28,12 +28,14 @@ namespace MediaBrowser.Controller.Library /// <param name="itemId">The item identifier.</param> /// <returns>IEnumerable<MediaStream>.</returns> List<MediaStream> GetMediaStreams(Guid itemId); + /// <summary> /// Gets the media streams. /// </summary> /// <param name="mediaSourceId">The media source identifier.</param> /// <returns>IEnumerable<MediaStream>.</returns> List<MediaStream> GetMediaStreams(string mediaSourceId); + /// <summary> /// Gets the media streams. /// </summary> diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs index 6a0dbeba2..12a311dc3 100644 --- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs @@ -156,6 +156,7 @@ namespace MediaBrowser.Controller.Library } // REVIEW: @bond + /// <summary> /// Gets the physical locations. /// </summary> diff --git a/MediaBrowser.Controller/Library/NameExtensions.cs b/MediaBrowser.Controller/Library/NameExtensions.cs index 21f33ad19..1c90bb4e0 100644 --- a/MediaBrowser.Controller/Library/NameExtensions.cs +++ b/MediaBrowser.Controller/Library/NameExtensions.cs @@ -1,3 +1,4 @@ +#nullable enable #pragma warning disable CS1591 using System; @@ -9,7 +10,7 @@ namespace MediaBrowser.Controller.Library { public static class NameExtensions { - private static string RemoveDiacritics(string name) + private static string RemoveDiacritics(string? name) { if (name == null) { diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index 55c330931..6c365caa4 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -231,6 +231,7 @@ namespace MediaBrowser.Controller.LiveTv /// Saves the tuner host. /// </summary> Task<TunerHostInfo> SaveTunerHost(TunerHostInfo info, bool dataSourceChanged = true); + /// <summary> /// Saves the listing provider. /// </summary> diff --git a/MediaBrowser.Controller/LiveTv/ITunerHost.cs b/MediaBrowser.Controller/LiveTv/ITunerHost.cs index ff92bf856..abca8f239 100644 --- a/MediaBrowser.Controller/LiveTv/ITunerHost.cs +++ b/MediaBrowser.Controller/LiveTv/ITunerHost.cs @@ -56,7 +56,6 @@ namespace MediaBrowser.Controller.LiveTv Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken); Task<List<TunerHostInfo>> DiscoverDevices(int discoveryDurationMs, CancellationToken cancellationToken); - } public interface IConfigurableTunerHost diff --git a/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs b/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs index 02178297b..b62974904 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs @@ -42,6 +42,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value>The tuners.</value> public List<LiveTvTunerInfo> Tuners { get; set; } + /// <summary> /// Gets or sets a value indicating whether this instance is visible. /// </summary> diff --git a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs index bdcffd5ca..f9f559ee9 100644 --- a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs @@ -35,6 +35,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value>The overview.</value> public string Overview { get; set; } + /// <summary> /// Gets or sets the short overview. /// </summary> @@ -169,31 +170,37 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value>The production year.</value> public int? ProductionYear { get; set; } + /// <summary> /// Gets or sets the home page URL. /// </summary> /// <value>The home page URL.</value> public string HomePageUrl { get; set; } + /// <summary> /// Gets or sets the series identifier. /// </summary> /// <value>The series identifier.</value> public string SeriesId { get; set; } + /// <summary> /// Gets or sets the show identifier. /// </summary> /// <value>The show identifier.</value> public string ShowId { get; set; } + /// <summary> /// Gets or sets the season number. /// </summary> /// <value>The season number.</value> public int? SeasonNumber { get; set; } + /// <summary> /// Gets or sets the episode number. /// </summary> /// <value>The episode number.</value> public int? EpisodeNumber { get; set; } + /// <summary> /// Gets or sets the etag. /// </summary> diff --git a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs index 303882b7e..69190694f 100644 --- a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs +++ b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs @@ -187,6 +187,7 @@ namespace MediaBrowser.Controller.LiveTv /// </summary> /// <value><c>null</c> if [has image] contains no value, <c>true</c> if [has image]; otherwise, <c>false</c>.</value> public bool? HasImage { get; set; } + /// <summary> /// Gets or sets the show identifier. /// </summary> diff --git a/MediaBrowser.Controller/LiveTv/TimerInfo.cs b/MediaBrowser.Controller/LiveTv/TimerInfo.cs index bcef4666d..aa5170617 100644 --- a/MediaBrowser.Controller/LiveTv/TimerInfo.cs +++ b/MediaBrowser.Controller/LiveTv/TimerInfo.cs @@ -113,6 +113,7 @@ namespace MediaBrowser.Controller.LiveTv // Program properties public int? SeasonNumber { get; set; } + /// <summary> /// Gets or sets the episode number. /// </summary> diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 9854ec520..654470406 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -14,8 +14,8 @@ </PropertyGroup> <ItemGroup> - <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.7" /> - <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.7" /> + <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.8" /> + <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.8" /> <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/> </ItemGroup> diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 2c30ca458..c5529ad5b 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -109,7 +109,6 @@ namespace MediaBrowser.Controller.MediaEncoding } return _mediaEncoder.SupportsHwaccel("vaapi"); - } /// <summary> @@ -508,6 +507,7 @@ namespace MediaBrowser.Controller.MediaEncoding arg.Append("-hwaccel qsv "); } } + // While using SW decoder else { @@ -1441,7 +1441,6 @@ namespace MediaBrowser.Controller.MediaEncoding var codec = outputAudioCodec ?? string.Empty; - int? transcoderChannelLimit; if (codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1) { @@ -2511,7 +2510,6 @@ namespace MediaBrowser.Controller.MediaEncoding return inputModifier; } - public void AttachMediaSourceInfo( EncodingJobInfo state, MediaSourceInfo mediaSource, diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs index 68bc502a0..c7ec878d2 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs @@ -697,10 +697,12 @@ namespace MediaBrowser.Controller.MediaEncoding /// The progressive. /// </summary> Progressive, + /// <summary> /// The HLS. /// </summary> Hls, + /// <summary> /// The dash. /// </summary> diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs index ebc37bd1f..45c6805f0 100644 --- a/MediaBrowser.Controller/Persistence/IItemRepository.cs +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -100,6 +100,7 @@ namespace MediaBrowser.Controller.Persistence /// <param name="query">The query.</param> /// <returns>IEnumerable<Guid>.</returns> QueryResult<Guid> GetItemIds(InternalItemsQuery query); + /// <summary> /// Gets the items. /// </summary> diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index f77455485..16fd1d42b 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -1,6 +1,7 @@ #pragma warning disable CS1591 using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using MediaBrowser.Model.IO; @@ -11,11 +12,11 @@ namespace MediaBrowser.Controller.Providers { private readonly IFileSystem _fileSystem; - private readonly Dictionary<string, FileSystemMetadata[]> _cache = new Dictionary<string, FileSystemMetadata[]>(StringComparer.OrdinalIgnoreCase); + private readonly ConcurrentDictionary<string, FileSystemMetadata[]> _cache = new ConcurrentDictionary<string, FileSystemMetadata[]>(StringComparer.OrdinalIgnoreCase); - private readonly Dictionary<string, FileSystemMetadata> _fileCache = new Dictionary<string, FileSystemMetadata>(StringComparer.OrdinalIgnoreCase); + private readonly ConcurrentDictionary<string, FileSystemMetadata> _fileCache = new ConcurrentDictionary<string, FileSystemMetadata>(StringComparer.OrdinalIgnoreCase); - private readonly Dictionary<string, List<string>> _filePathCache = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase); + private readonly ConcurrentDictionary<string, List<string>> _filePathCache = new ConcurrentDictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase); public DirectoryService(IFileSystem fileSystem) { @@ -24,14 +25,7 @@ namespace MediaBrowser.Controller.Providers public FileSystemMetadata[] GetFileSystemEntries(string path) { - if (!_cache.TryGetValue(path, out FileSystemMetadata[] entries)) - { - entries = _fileSystem.GetFileSystemEntries(path).ToArray(); - - _cache[path] = entries; - } - - return entries; + return _cache.GetOrAdd(path, p => _fileSystem.GetFileSystemEntries(p).ToArray()); } public List<FileSystemMetadata> GetFiles(string path) @@ -51,21 +45,19 @@ namespace MediaBrowser.Controller.Providers public FileSystemMetadata GetFile(string path) { - if (!_fileCache.TryGetValue(path, out FileSystemMetadata file)) + var result = _fileCache.GetOrAdd(path, p => { - file = _fileSystem.GetFileInfo(path); + var file = _fileSystem.GetFileInfo(p); + return file != null && file.Exists ? file : null; + }); - if (file != null && file.Exists) - { - _fileCache[path] = file; - } - else - { - return null; - } + if (result == null) + { + // lets not store null results in the cache + _fileCache.TryRemove(path, out _); } - return file; + return result; } public IReadOnlyList<string> GetFilePaths(string path) @@ -73,14 +65,12 @@ namespace MediaBrowser.Controller.Providers public IReadOnlyList<string> GetFilePaths(string path, bool clearCache) { - if (clearCache || !_filePathCache.TryGetValue(path, out List<string> result)) + if (clearCache) { - result = _fileSystem.GetFilePaths(path).ToList(); - - _filePathCache[path] = result; + _filePathCache.TryRemove(path, out _); } - return result; + return _filePathCache.GetOrAdd(path, p => _fileSystem.GetFilePaths(p).ToList()); } } } diff --git a/MediaBrowser.Controller/Resolvers/IItemResolver.cs b/MediaBrowser.Controller/Resolvers/IItemResolver.cs index b99c46843..eb7fb793a 100644 --- a/MediaBrowser.Controller/Resolvers/IItemResolver.cs +++ b/MediaBrowser.Controller/Resolvers/IItemResolver.cs @@ -19,6 +19,7 @@ namespace MediaBrowser.Controller.Resolvers /// <param name="args">The args.</param> /// <returns>BaseItem.</returns> BaseItem ResolvePath(ItemResolveArgs args); + /// <summary> /// Gets the priority. /// </summary> diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index 054fd33d9..55e44c19d 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -22,7 +22,6 @@ namespace MediaBrowser.Controller.Session private readonly ISessionManager _sessionManager; private readonly ILogger _logger; - private readonly object _progressLock = new object(); private Timer _progressTimer; private PlaybackProgressInfo _lastProgressInfo; diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index c8bf5557b..3287f9814 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -212,7 +212,10 @@ namespace MediaBrowser.MediaEncoding.Encoder if (match.Success) { - return new Version(match.Groups[1].Value); + if (Version.TryParse(match.Groups[1].Value, out var result)) + { + return result; + } } var versionMap = GetFFmpegLibraryVersions(output); diff --git a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs index 102db3b44..a4305c810 100644 --- a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs +++ b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs @@ -15,6 +15,7 @@ namespace MediaBrowser.Model.Dlna new ResolutionConfiguration(720, 950000), new ResolutionConfiguration(1280, 2500000), new ResolutionConfiguration(1920, 4000000), + new ResolutionConfiguration(2560, 8000000), new ResolutionConfiguration(3840, 35000000) }; diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index cfe862f5a..d9e7e4fbb 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -498,7 +498,6 @@ namespace MediaBrowser.Model.Dlna } } - if (playMethods.Count > 0) { transcodeReasons.Clear(); @@ -1431,6 +1430,7 @@ namespace MediaBrowser.Model.Dlna break; } + case ProfileConditionValue.AudioChannels: { if (string.IsNullOrEmpty(qualifier)) @@ -1466,6 +1466,7 @@ namespace MediaBrowser.Model.Dlna break; } + case ProfileConditionValue.IsAvc: { if (!enableNonQualifiedConditions) @@ -1487,6 +1488,7 @@ namespace MediaBrowser.Model.Dlna break; } + case ProfileConditionValue.IsAnamorphic: { if (!enableNonQualifiedConditions) @@ -1508,6 +1510,7 @@ namespace MediaBrowser.Model.Dlna break; } + case ProfileConditionValue.IsInterlaced: { if (string.IsNullOrEmpty(qualifier)) @@ -1539,6 +1542,7 @@ namespace MediaBrowser.Model.Dlna break; } + case ProfileConditionValue.AudioProfile: case ProfileConditionValue.Has64BitOffsets: case ProfileConditionValue.PacketLength: @@ -1550,6 +1554,7 @@ namespace MediaBrowser.Model.Dlna // Not supported yet break; } + case ProfileConditionValue.RefFrames: { if (string.IsNullOrEmpty(qualifier)) @@ -1585,6 +1590,7 @@ namespace MediaBrowser.Model.Dlna break; } + case ProfileConditionValue.VideoBitDepth: { if (string.IsNullOrEmpty(qualifier)) @@ -1620,6 +1626,7 @@ namespace MediaBrowser.Model.Dlna break; } + case ProfileConditionValue.VideoProfile: { if (string.IsNullOrEmpty(qualifier)) @@ -1643,6 +1650,7 @@ namespace MediaBrowser.Model.Dlna break; } + case ProfileConditionValue.Height: { if (!enableNonQualifiedConditions) @@ -1668,6 +1676,7 @@ namespace MediaBrowser.Model.Dlna break; } + case ProfileConditionValue.VideoBitrate: { if (!enableNonQualifiedConditions) @@ -1693,6 +1702,7 @@ namespace MediaBrowser.Model.Dlna break; } + case ProfileConditionValue.VideoFramerate: { if (!enableNonQualifiedConditions) @@ -1718,6 +1728,7 @@ namespace MediaBrowser.Model.Dlna break; } + case ProfileConditionValue.VideoLevel: { if (string.IsNullOrEmpty(qualifier)) @@ -1743,6 +1754,7 @@ namespace MediaBrowser.Model.Dlna break; } + case ProfileConditionValue.Width: { if (!enableNonQualifiedConditions) diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index 94d53ab70..9399d21f1 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -276,7 +276,6 @@ namespace MediaBrowser.Model.Dlna list.Add(new NameValuePair("SubtitleMethod", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? item.SubtitleDeliveryMethod.ToString() : string.Empty)); - if (!item.IsDirectStream) { if (item.RequireNonAnamorphic) diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index af3d83ade..fac754177 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -429,6 +429,7 @@ namespace MediaBrowser.Model.Dto /// </summary> /// <value>The album id.</value> public Guid AlbumId { get; set; } + /// <summary> /// Gets or sets the album image tag. /// </summary> @@ -599,11 +600,13 @@ namespace MediaBrowser.Model.Dto /// </summary> /// <value>The trailer count.</value> public int? TrailerCount { get; set; } + /// <summary> /// Gets or sets the movie count. /// </summary> /// <value>The movie count.</value> public int? MovieCount { get; set; } + /// <summary> /// Gets or sets the series count. /// </summary> @@ -611,16 +614,19 @@ namespace MediaBrowser.Model.Dto public int? SeriesCount { get; set; } public int? ProgramCount { get; set; } + /// <summary> /// Gets or sets the episode count. /// </summary> /// <value>The episode count.</value> public int? EpisodeCount { get; set; } + /// <summary> /// Gets or sets the song count. /// </summary> /// <value>The song count.</value> public int? SongCount { get; set; } + /// <summary> /// Gets or sets the album count. /// </summary> @@ -628,6 +634,7 @@ namespace MediaBrowser.Model.Dto public int? AlbumCount { get; set; } public int? ArtistCount { get; set; } + /// <summary> /// Gets or sets the music video count. /// </summary> @@ -768,6 +775,7 @@ namespace MediaBrowser.Model.Dto /// </summary> /// <value>The timer identifier.</value> public string TimerId { get; set; } + /// <summary> /// Gets or sets the current program. /// </summary> diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index 2d37618c2..fa3c9aaa2 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -451,11 +451,13 @@ namespace MediaBrowser.Model.Entities /// </summary> /// <value>The method.</value> public SubtitleDeliveryMethod? DeliveryMethod { get; set; } + /// <summary> /// Gets or sets the delivery URL. /// </summary> /// <value>The delivery URL.</value> public string DeliveryUrl { get; set; } + /// <summary> /// Gets or sets a value indicating whether this instance is external URL. /// </summary> diff --git a/MediaBrowser.Model/Entities/MetadataProvider.cs b/MediaBrowser.Model/Entities/MetadataProvider.cs index 7fecf67b8..e9c098021 100644 --- a/MediaBrowser.Model/Entities/MetadataProvider.cs +++ b/MediaBrowser.Model/Entities/MetadataProvider.cs @@ -11,18 +11,22 @@ namespace MediaBrowser.Model.Entities /// The imdb. /// </summary> Imdb = 2, + /// <summary> /// The TMDB. /// </summary> Tmdb = 3, + /// <summary> /// The TVDB. /// </summary> Tvdb = 4, + /// <summary> /// The tvcom. /// </summary> Tvcom = 5, + /// <summary> /// Tmdb Collection Id. /// </summary> diff --git a/MediaBrowser.Model/LiveTv/LiveTvChannelQuery.cs b/MediaBrowser.Model/LiveTv/LiveTvChannelQuery.cs index ab74aff28..bcba344cc 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvChannelQuery.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvChannelQuery.cs @@ -84,6 +84,7 @@ namespace MediaBrowser.Model.LiveTv /// </summary> /// <value><c>null</c> if [is kids] contains no value, <c>true</c> if [is kids]; otherwise, <c>false</c>.</value> public bool? IsKids { get; set; } + /// <summary> /// Gets or sets a value indicating whether this instance is sports. /// </summary> diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index c0a75009a..264681090 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -34,7 +34,7 @@ <ItemGroup> <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/> <PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" /> - <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.7" /> + <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.8" /> <PackageReference Include="System.Globalization" Version="4.3.0" /> <PackageReference Include="System.Text.Json" Version="5.0.0-preview.8.20407.11" /> </ItemGroup> diff --git a/MediaBrowser.Model/Providers/RemoteImageInfo.cs b/MediaBrowser.Model/Providers/RemoteImageInfo.cs index 78ab6c706..fb25999e0 100644 --- a/MediaBrowser.Model/Providers/RemoteImageInfo.cs +++ b/MediaBrowser.Model/Providers/RemoteImageInfo.cs @@ -68,5 +68,4 @@ namespace MediaBrowser.Model.Providers /// <value>The type of the rating.</value> public RatingType RatingType { get; set; } } - } diff --git a/MediaBrowser.Model/Providers/RemoteSearchResult.cs b/MediaBrowser.Model/Providers/RemoteSearchResult.cs index 989741c01..a29e7ad1c 100644 --- a/MediaBrowser.Model/Providers/RemoteSearchResult.cs +++ b/MediaBrowser.Model/Providers/RemoteSearchResult.cs @@ -50,6 +50,5 @@ namespace MediaBrowser.Model.Providers public RemoteSearchResult AlbumArtist { get; set; } public RemoteSearchResult[] Artists { get; set; } - } } diff --git a/MediaBrowser.Model/Querying/ItemFields.cs b/MediaBrowser.Model/Querying/ItemFields.cs index 731d22aaf..ef4698f3f 100644 --- a/MediaBrowser.Model/Querying/ItemFields.cs +++ b/MediaBrowser.Model/Querying/ItemFields.cs @@ -168,6 +168,7 @@ namespace MediaBrowser.Model.Querying Studios, BasicSyncInfo, + /// <summary> /// The synchronize information. /// </summary> diff --git a/MediaBrowser.Model/Querying/UpcomingEpisodesQuery.cs b/MediaBrowser.Model/Querying/UpcomingEpisodesQuery.cs index 2ef6f7c60..eb6239460 100644 --- a/MediaBrowser.Model/Querying/UpcomingEpisodesQuery.cs +++ b/MediaBrowser.Model/Querying/UpcomingEpisodesQuery.cs @@ -37,16 +37,19 @@ namespace MediaBrowser.Model.Querying /// </summary> /// <value>The fields.</value> public ItemFields[] Fields { get; set; } + /// <summary> /// Gets or sets a value indicating whether [enable images]. /// </summary> /// <value><c>null</c> if [enable images] contains no value, <c>true</c> if [enable images]; otherwise, <c>false</c>.</value> public bool? EnableImages { get; set; } + /// <summary> /// Gets or sets the image type limit. /// </summary> /// <value>The image type limit.</value> public int? ImageTypeLimit { get; set; } + /// <summary> /// Gets or sets the enable image types. /// </summary> diff --git a/MediaBrowser.Model/Session/GeneralCommand.cs b/MediaBrowser.Model/Session/GeneralCommand.cs index 9794bd292..77bb6bcf7 100644 --- a/MediaBrowser.Model/Session/GeneralCommand.cs +++ b/MediaBrowser.Model/Session/GeneralCommand.cs @@ -8,7 +8,7 @@ namespace MediaBrowser.Model.Session { public class GeneralCommand { - public string Name { get; set; } + public GeneralCommandType Name { get; set; } public Guid ControllingUserId { get; set; } diff --git a/MediaBrowser.Model/Session/PlaybackProgressInfo.cs b/MediaBrowser.Model/Session/PlaybackProgressInfo.cs index 21bcabf1d..73dbe6a2d 100644 --- a/MediaBrowser.Model/Session/PlaybackProgressInfo.cs +++ b/MediaBrowser.Model/Session/PlaybackProgressInfo.cs @@ -88,16 +88,19 @@ namespace MediaBrowser.Model.Session /// </summary> /// <value>The play method.</value> public PlayMethod PlayMethod { get; set; } + /// <summary> /// Gets or sets the live stream identifier. /// </summary> /// <value>The live stream identifier.</value> public string LiveStreamId { get; set; } + /// <summary> /// Gets or sets the play session identifier. /// </summary> /// <value>The play session identifier.</value> public string PlaySessionId { get; set; } + /// <summary> /// Gets or sets the repeat mode. /// </summary> diff --git a/MediaBrowser.Model/Sync/SyncCategory.cs b/MediaBrowser.Model/Sync/SyncCategory.cs index 80ad5f56e..1248c2f73 100644 --- a/MediaBrowser.Model/Sync/SyncCategory.cs +++ b/MediaBrowser.Model/Sync/SyncCategory.cs @@ -8,10 +8,12 @@ namespace MediaBrowser.Model.Sync /// The latest. /// </summary> Latest = 0, + /// <summary> /// The next up. /// </summary> NextUp = 1, + /// <summary> /// The resume. /// </summary> diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs index 18ca74ee3..4b83fb7e6 100644 --- a/MediaBrowser.Model/System/SystemInfo.cs +++ b/MediaBrowser.Model/System/SystemInfo.cs @@ -14,13 +14,16 @@ namespace MediaBrowser.Model.System { /// <summary>No path to FFmpeg found.</summary> NotFound, + /// <summary>Path supplied via command line using switch --ffmpeg.</summary> SetByArgument, + /// <summary>User has supplied path via Transcoding UI page.</summary> Custom, + /// <summary>FFmpeg tool found on system $PATH.</summary> System - }; + } /// <summary> /// Class SystemInfo. diff --git a/MediaBrowser.Model/Tasks/IConfigurableScheduledTask.cs b/MediaBrowser.Model/Tasks/IConfigurableScheduledTask.cs index fbfaed22e..6212d76f7 100644 --- a/MediaBrowser.Model/Tasks/IConfigurableScheduledTask.cs +++ b/MediaBrowser.Model/Tasks/IConfigurableScheduledTask.cs @@ -9,6 +9,7 @@ namespace MediaBrowser.Model.Tasks /// </summary> /// <value><c>true</c> if this instance is hidden; otherwise, <c>false</c>.</value> bool IsHidden { get; } + /// <summary> /// Gets a value indicating whether this instance is enabled. /// </summary> diff --git a/MediaBrowser.Model/Updates/PackageInfo.cs b/MediaBrowser.Model/Updates/PackageInfo.cs index d9eb1386e..98b151d55 100644 --- a/MediaBrowser.Model/Updates/PackageInfo.cs +++ b/MediaBrowser.Model/Updates/PackageInfo.cs @@ -53,6 +53,16 @@ namespace MediaBrowser.Model.Updates public IReadOnlyList<VersionInfo> versions { get; set; } /// <summary> + /// Gets or sets the repository name. + /// </summary> + public string repositoryName { get; set; } + + /// <summary> + /// Gets or sets the repository url. + /// </summary> + public string repositoryUrl { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="PackageInfo"/> class. /// </summary> public PackageInfo() diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index 42785b057..f110eafa5 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -297,7 +297,7 @@ namespace MediaBrowser.Providers.Manager } /// <summary> - /// Befores the save. + /// Before the save. /// </summary> /// <param name="item">The item.</param> /// <param name="isFullRefresh">if set to <c>true</c> [is full refresh].</param> @@ -355,13 +355,12 @@ namespace MediaBrowser.Providers.Manager protected virtual IList<BaseItem> GetChildrenForMetadataUpdates(TItemType item) { - var folder = item as Folder; - if (folder != null) + if (item is Folder folder) { return folder.GetRecursiveChildren(); } - return new List<BaseItem>(); + return Array.Empty<BaseItem>(); } protected virtual ItemUpdateType UpdateMetadataFromChildren(TItemType item, IList<BaseItem> children, bool isFullRefresh, ItemUpdateType currentUpdateType) @@ -814,7 +813,7 @@ namespace MediaBrowser.Providers.Manager try { - refreshResult.UpdateType = refreshResult.UpdateType | await provider.FetchAsync(item, options, cancellationToken).ConfigureAwait(false); + refreshResult.UpdateType |= await provider.FetchAsync(item, options, cancellationToken).ConfigureAwait(false); } catch (OperationCanceledException) { @@ -882,16 +881,6 @@ namespace MediaBrowser.Providers.Manager return refreshResult; } - private string NormalizeLanguage(string language) - { - if (string.IsNullOrWhiteSpace(language)) - { - return "en"; - } - - return language; - } - private void MergeNewData(TItemType source, TIdType lookupInfo) { // Copy new provider id's that may have been obtained diff --git a/MediaBrowser.Providers/MediaBrowser.Providers.csproj b/MediaBrowser.Providers/MediaBrowser.Providers.csproj index 39f93c479..813dd441f 100644 --- a/MediaBrowser.Providers/MediaBrowser.Providers.csproj +++ b/MediaBrowser.Providers/MediaBrowser.Providers.csproj @@ -16,12 +16,12 @@ </ItemGroup> <ItemGroup> - <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.7" /> - <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="3.1.7" /> - <PackageReference Include="Microsoft.Extensions.Http" Version="3.1.7" /> + <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.8" /> + <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="3.1.8" /> + <PackageReference Include="Microsoft.Extensions.Http" Version="3.1.8" /> <PackageReference Include="OptimizedPriorityQueue" Version="4.2.0" /> <PackageReference Include="PlaylistsNET" Version="1.1.2" /> - <PackageReference Include="TvDbSharper" Version="3.2.1" /> + <PackageReference Include="TvDbSharper" Version="3.2.2" /> </ItemGroup> <PropertyGroup> diff --git a/MediaBrowser.Providers/Plugins/MusicBrainz/ArtistProvider.cs b/MediaBrowser.Providers/Plugins/MusicBrainz/ArtistProvider.cs index 781b71640..f27da7ce6 100644 --- a/MediaBrowser.Providers/Plugins/MusicBrainz/ArtistProvider.cs +++ b/MediaBrowser.Providers/Plugins/MusicBrainz/ArtistProvider.cs @@ -198,6 +198,7 @@ namespace MediaBrowser.Providers.Music result.Name = reader.ReadElementContentAsString(); break; } + case "annotation": { result.Overview = reader.ReadElementContentAsString(); diff --git a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs index 46f8988f2..abfa1c6e7 100644 --- a/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs +++ b/MediaBrowser.Providers/Plugins/MusicBrainz/MusicBrainzAlbumProvider.cs @@ -444,6 +444,7 @@ namespace MediaBrowser.Providers.Music result.Title = reader.ReadElementContentAsString(); break; } + case "date": { var val = reader.ReadElementContentAsString(); @@ -454,17 +455,20 @@ namespace MediaBrowser.Providers.Music break; } + case "annotation": { result.Overview = reader.ReadElementContentAsString(); break; } + case "release-group": { result.ReleaseGroupId = reader.GetAttribute("id"); reader.Skip(); break; } + case "artist-credit": { using (var subReader = reader.ReadSubtree()) diff --git a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbEpisodeImageProvider.cs b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbEpisodeImageProvider.cs index de2f6875f..50a876d6c 100644 --- a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbEpisodeImageProvider.cs +++ b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbEpisodeImageProvider.cs @@ -57,21 +57,28 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb // Process images try { - var episodeInfo = new EpisodeInfo + string episodeTvdbId = null; + + if (episode.IndexNumber.HasValue && episode.ParentIndexNumber.HasValue) { - IndexNumber = episode.IndexNumber.Value, - ParentIndexNumber = episode.ParentIndexNumber.Value, - SeriesProviderIds = series.ProviderIds, - SeriesDisplayOrder = series.DisplayOrder - }; - string episodeTvdbId = await _tvdbClientManager - .GetEpisodeTvdbId(episodeInfo, language, cancellationToken).ConfigureAwait(false); + var episodeInfo = new EpisodeInfo + { + IndexNumber = episode.IndexNumber.Value, + ParentIndexNumber = episode.ParentIndexNumber.Value, + SeriesProviderIds = series.ProviderIds, + SeriesDisplayOrder = series.DisplayOrder + }; + + episodeTvdbId = await _tvdbClientManager + .GetEpisodeTvdbId(episodeInfo, language, cancellationToken).ConfigureAwait(false); + } + if (string.IsNullOrEmpty(episodeTvdbId)) { _logger.LogError( "Episode {SeasonNumber}x{EpisodeNumber} not found for series {SeriesTvdbId}", - episodeInfo.ParentIndexNumber, - episodeInfo.IndexNumber, + episode.ParentIndexNumber, + episode.IndexNumber, series.GetProviderId(MetadataProvider.Tvdb)); return imageResult; } diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Models/General/Videos.cs b/MediaBrowser.Providers/Plugins/Tmdb/Models/General/Videos.cs index 241dcab4d..1c673fdbd 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/Models/General/Videos.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/Models/General/Videos.cs @@ -6,6 +6,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Models.General { public class Videos { - public List<Video> Results { get; set; } + public IReadOnlyList<Video> Results { get; set; } } } diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Models/Movies/Trailers.cs b/MediaBrowser.Providers/Plugins/Tmdb/Models/Movies/Trailers.cs index 166860f51..057177294 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/Models/Movies/Trailers.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/Models/Movies/Trailers.cs @@ -6,6 +6,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Models.Movies { public class Trailers { - public List<Youtube> Youtube { get; set; } + public IReadOnlyList<Youtube> Youtube { get; set; } } } diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Models/People/PersonImages.cs b/MediaBrowser.Providers/Plugins/Tmdb/Models/People/PersonImages.cs index 3ea12334e..d82e0fc6d 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/Models/People/PersonImages.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/Models/People/PersonImages.cs @@ -7,6 +7,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Models.People { public class PersonImages { - public List<Profile> Profiles { get; set; } + public IReadOnlyList<Profile> Profiles { get; set; } } } diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Movies/GenericTmdbMovieInfo.cs b/MediaBrowser.Providers/Plugins/Tmdb/Movies/GenericTmdbMovieInfo.cs index 01a887eed..3c626f9eb 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/Movies/GenericTmdbMovieInfo.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/Movies/GenericTmdbMovieInfo.cs @@ -302,7 +302,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies { Url = string.Format(CultureInfo.InvariantCulture, "https://www.youtube.com/watch?v={0}", i.Source), Name = i.Name - }).ToArray(); } } diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbImageProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbImageProvider.cs index a975fb8f6..9db7e0997 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbImageProvider.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbImageProvider.cs @@ -38,6 +38,9 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies public static string ProviderName => TmdbUtils.ProviderName; + /// <inheritdoc /> + public int Order => 0; + public bool Supports(BaseItem item) { return item is Movie || item is MusicVideo || item is Trailer; @@ -201,8 +204,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies return null; } - public int Order => 0; - public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken) { return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken); diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbSettings.cs b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbImageSettings.cs index 128258ab3..1ba8f9072 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbSettings.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbImageSettings.cs @@ -6,22 +6,17 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies { internal class TmdbImageSettings { - public List<string> backdrop_sizes { get; set; } + public IReadOnlyList<string> backdrop_sizes { get; set; } public string secure_base_url { get; set; } - public List<string> poster_sizes { get; set; } + public IReadOnlyList<string> poster_sizes { get; set; } - public List<string> profile_sizes { get; set; } + public IReadOnlyList<string> profile_sizes { get; set; } public string GetImageUrl(string image) { return secure_base_url + image; } } - - internal class TmdbSettingsResult - { - public TmdbImageSettings images { get; set; } - } } diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs index 5d383722a..31cfd8649 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs @@ -34,7 +34,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies private const string TmdbConfigUrl = TmdbUtils.BaseTmdbApiUrl + "3/configuration?api_key={0}"; private const string GetMovieInfo3 = TmdbUtils.BaseTmdbApiUrl + @"3/movie/{0}?api_key={1}&append_to_response=casts,releases,images,keywords,trailers"; - internal static TmdbMovieProvider Current { get; private set; } + private readonly CultureInfo _usCulture = new CultureInfo("en-US"); private readonly IJsonSerializer _jsonSerializer; private readonly IHttpClientFactory _httpClientFactory; @@ -44,7 +44,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies private readonly ILibraryManager _libraryManager; private readonly IApplicationHost _appHost; - private readonly CultureInfo _usCulture = new CultureInfo("en-US"); + /// <summary> + /// The _TMDB settings task. + /// </summary> + private TmdbSettingsResult _tmdbSettings; public TmdbMovieProvider( IJsonSerializer jsonSerializer, @@ -65,6 +68,14 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies Current = this; } + internal static TmdbMovieProvider Current { get; private set; } + + /// <inheritdoc /> + public string Name => TmdbUtils.ProviderName; + + /// <inheritdoc /> + public int Order => 1; + public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(MovieInfo searchInfo, CancellationToken cancellationToken) { return GetMovieSearchResults(searchInfo, cancellationToken); @@ -131,13 +142,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies return movieDb.GetMetadata(id, cancellationToken); } - public string Name => TmdbUtils.ProviderName; - - /// <summary> - /// The _TMDB settings task. - /// </summary> - private TmdbSettingsResult _tmdbSettings; - /// <summary> /// Gets the TMDB settings. /// </summary> @@ -272,7 +276,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies languages.Add("en"); } - return string.Join(",", languages); + return string.Join(',', languages); } public static string NormalizeLanguage(string language) @@ -381,6 +385,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies /// <summary> /// Gets the movie db response. /// </summary> + /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> internal Task<HttpResponseMessage> GetMovieDbResponse(HttpRequestMessage message, CancellationToken cancellationToken = default) { message.Headers.UserAgent.ParseAdd(_appHost.ApplicationUserAgent); @@ -388,9 +393,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies } /// <inheritdoc /> - public int Order => 1; - - /// <inheritdoc /> public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken) { return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken); diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbSearch.cs b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbSearch.cs index d885cd90b..36a4eef8a 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbSearch.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbSearch.cs @@ -207,7 +207,12 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies return results .Select(i => { - var remoteResult = new RemoteSearchResult {SearchProviderName = TmdbMovieProvider.Current.Name, Name = i.Title ?? i.Name ?? i.Original_Title, ImageUrl = string.IsNullOrWhiteSpace(i.Poster_Path) ? null : baseImageUrl + i.Poster_Path}; + var remoteResult = new RemoteSearchResult + { + SearchProviderName = TmdbMovieProvider.Current.Name, + Name = i.Title ?? i.Name ?? i.Original_Title, + ImageUrl = string.IsNullOrWhiteSpace(i.Poster_Path) ? null : baseImageUrl + i.Poster_Path + }; if (!string.IsNullOrWhiteSpace(i.Release_Date)) { diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbSettingsResult.cs b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbSettingsResult.cs new file mode 100644 index 000000000..c7ba97438 --- /dev/null +++ b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbSettingsResult.cs @@ -0,0 +1,9 @@ +#pragma warning disable CS1591 + +namespace MediaBrowser.Providers.Plugins.Tmdb.Movies +{ + internal class TmdbSettingsResult + { + public TmdbImageSettings images { get; set; } + } +} diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Music/TmdbMusicVideoProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/Music/TmdbMusicVideoProvider.cs index 73e49ba5b..b88ecce87 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/Music/TmdbMusicVideoProvider.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/Music/TmdbMusicVideoProvider.cs @@ -14,6 +14,8 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Music { public class TmdbMusicVideoProvider : IRemoteMetadataProvider<MusicVideo, MusicVideoInfo> { + public string Name => TmdbMovieProvider.Current.Name; + public Task<MetadataResult<MusicVideo>> GetMetadata(MusicVideoInfo info, CancellationToken cancellationToken) { return TmdbMovieProvider.Current.GetItemMetadata<MusicVideo>(info, cancellationToken); @@ -24,8 +26,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Music return Task.FromResult((IEnumerable<RemoteSearchResult>)new List<RemoteSearchResult>()); } - public string Name => TmdbMovieProvider.Current.Name; - public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken) { throw new NotImplementedException(); diff --git a/MediaBrowser.Providers/Plugins/Tmdb/People/TmdbPersonProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/People/TmdbPersonProvider.cs index 8d1a854d6..777ebce49 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/People/TmdbPersonProvider.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/People/TmdbPersonProvider.cs @@ -31,7 +31,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.People { public class TmdbPersonProvider : IRemoteMetadataProvider<Person, PersonLookupInfo> { - const string DataFileName = "info.json"; + private const string DataFileName = "info.json"; private readonly CultureInfo _usCulture = new CultureInfo("en-US"); @@ -39,20 +39,17 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.People private readonly IFileSystem _fileSystem; private readonly IServerConfigurationManager _configurationManager; private readonly IHttpClientFactory _httpClientFactory; - private readonly ILogger<TmdbPersonProvider> _logger; public TmdbPersonProvider( IFileSystem fileSystem, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, - IHttpClientFactory httpClientFactory, - ILogger<TmdbPersonProvider> logger) + IHttpClientFactory httpClientFactory) { _fileSystem = fileSystem; _configurationManager = configurationManager; _jsonSerializer = jsonSerializer; _httpClientFactory = httpClientFactory; - _logger = logger; Current = this; } @@ -75,7 +72,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.People var dataFilePath = GetPersonDataFilePath(_configurationManager.ApplicationPaths, tmdbId); var info = _jsonSerializer.DeserializeFromFile<PersonResult>(dataFilePath); - var images = (info.Images ?? new PersonImages()).Profiles ?? new List<Profile>(); + IReadOnlyList<Profile> images = info.Images?.Profiles ?? Array.Empty<Profile>(); var result = new RemoteSearchResult { @@ -95,7 +92,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.People if (searchInfo.IsAutomated) { // Don't hammer moviedb searching by name - return new List<RemoteSearchResult>(); + return Array.Empty<RemoteSearchResult>(); } var url = string.Format( diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeImageProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeImageProvider.cs index eebecdac6..c56774f8e 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeImageProvider.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeImageProvider.cs @@ -28,7 +28,13 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV { public TmdbEpisodeImageProvider(IHttpClientFactory httpClientFactory, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ILocalizationManager localization, ILoggerFactory loggerFactory) : base(httpClientFactory, configurationManager, jsonSerializer, fileSystem, localization, loggerFactory) - { } + { + } + + public string Name => TmdbUtils.ProviderName; + + // After TheTvDb + public int Order => 1; public IEnumerable<ImageType> GetSupportedImages(BaseItem item) { @@ -43,7 +49,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV var episode = (Controller.Entities.TV.Episode)item; var series = episode.Series; - var seriesId = series != null ? series.GetProviderId(MetadataProvider.Tmdb) : null; + var seriesId = series?.GetProviderId(MetadataProvider.Tmdb); var list = new List<RemoteImageInfo>(); @@ -62,8 +68,12 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV var language = item.GetPreferredMetadataLanguage(); - var response = await GetEpisodeInfo(seriesId, seasonNumber.Value, episodeNumber.Value, - language, cancellationToken).ConfigureAwait(false); + var response = await GetEpisodeInfo( + seriesId, + seasonNumber.Value, + episodeNumber.Value, + language, + cancellationToken).ConfigureAwait(false); var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false); @@ -120,14 +130,9 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV return GetResponse(url, cancellationToken); } - public string Name => TmdbUtils.ProviderName; - public bool Supports(BaseItem item) { return item is Controller.Entities.TV.Episode; } - - // After TheTvDb - public int Order => 1; } } diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.cs index ed4739acb..a7e3a03fe 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.cs @@ -29,7 +29,13 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV { public TmdbEpisodeProvider(IHttpClientFactory httpClientFactory, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ILocalizationManager localization, ILoggerFactory loggerFactory) : base(httpClientFactory, configurationManager, jsonSerializer, fileSystem, localization, loggerFactory) - { } + { + } + + // After TheTvDb + public int Order => 1; + + public string Name => TmdbUtils.ProviderName; public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(EpisodeInfo searchInfo, CancellationToken cancellationToken) { @@ -41,7 +47,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV return list; } - var metadataResult = await GetMetadata(searchInfo, cancellationToken); + var metadataResult = await GetMetadata(searchInfo, cancellationToken).ConfigureAwait(false); if (metadataResult.HasMetadata) { @@ -205,10 +211,5 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV { return GetResponse(url, cancellationToken); } - - // After TheTvDb - public int Order => 1; - - public string Name => TmdbUtils.ProviderName; } } diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProviderBase.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProviderBase.cs index 55b0f0409..34d2424a3 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProviderBase.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProviderBase.cs @@ -21,11 +21,11 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV public abstract class TmdbEpisodeProviderBase { private const string EpisodeUrlPattern = TmdbUtils.BaseTmdbApiUrl + @"3/tv/{0}/season/{1}/episode/{2}?api_key={3}&append_to_response=images,external_ids,credits,videos"; + private readonly IHttpClientFactory _httpClientFactory; private readonly IServerConfigurationManager _configurationManager; private readonly IJsonSerializer _jsonSerializer; private readonly IFileSystem _fileSystem; - private readonly ILocalizationManager _localization; private readonly ILogger<TmdbEpisodeProviderBase> _logger; protected TmdbEpisodeProviderBase(IHttpClientFactory httpClientFactory, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ILocalizationManager localization, ILoggerFactory loggerFactory) @@ -34,13 +34,16 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV _configurationManager = configurationManager; _jsonSerializer = jsonSerializer; _fileSystem = fileSystem; - _localization = localization; _logger = loggerFactory.CreateLogger<TmdbEpisodeProviderBase>(); } protected ILogger Logger => _logger; - protected async Task<EpisodeResult> GetEpisodeInfo(string seriesTmdbId, int season, int episodeNumber, string preferredMetadataLanguage, + protected async Task<EpisodeResult> GetEpisodeInfo( + string seriesTmdbId, + int season, + int episodeNumber, + string preferredMetadataLanguage, CancellationToken cancellationToken) { await EnsureEpisodeInfo(seriesTmdbId, season, episodeNumber, preferredMetadataLanguage, cancellationToken) @@ -93,7 +96,9 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV var path = TmdbSeriesProvider.GetSeriesDataPath(_configurationManager.ApplicationPaths, tmdbId); - var filename = string.Format(CultureInfo.InvariantCulture, "season-{0}-episode-{1}-{2}.json", + var filename = string.Format( + CultureInfo.InvariantCulture, + "season-{0}-episode-{1}-{2}.json", seasonNumber.ToString(CultureInfo.InvariantCulture), episodeNumber.ToString(CultureInfo.InvariantCulture), preferredLanguage); diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonImageProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonImageProvider.cs index e7e2fd05b..dcc7f8700 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonImageProvider.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonImageProvider.cs @@ -112,9 +112,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV private async Task<List<Poster>> FetchImages(Season item, string tmdbId, string language, CancellationToken cancellationToken) { - await TmdbSeasonProvider.Current.EnsureSeasonInfo(tmdbId, item.IndexNumber.GetValueOrDefault(), language, cancellationToken).ConfigureAwait(false); + var seasonNumber = item.IndexNumber.GetValueOrDefault(); + await TmdbSeasonProvider.Current.EnsureSeasonInfo(tmdbId, seasonNumber, language, cancellationToken).ConfigureAwait(false); - var path = TmdbSeriesProvider.Current.GetDataFilePath(tmdbId, language); + var path = TmdbSeasonProvider.Current.GetDataFilePath(tmdbId, seasonNumber, language); if (!string.IsNullOrEmpty(path)) { diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonProvider.cs index 40f1c4e69..c9b257fcc 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonProvider.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeasonProvider.cs @@ -28,26 +28,32 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV public class TmdbSeasonProvider : IRemoteMetadataProvider<Season, SeasonInfo> { private const string GetTvInfo3 = TmdbUtils.BaseTmdbApiUrl + @"3/tv/{0}/season/{1}?api_key={2}&append_to_response=images,keywords,external_ids,credits,videos"; + private readonly IHttpClientFactory _httpClientFactory; private readonly IServerConfigurationManager _configurationManager; private readonly IJsonSerializer _jsonSerializer; private readonly IFileSystem _fileSystem; - private readonly ILocalizationManager _localization; private readonly ILogger<TmdbSeasonProvider> _logger; internal static TmdbSeasonProvider Current { get; private set; } - public TmdbSeasonProvider(IHttpClientFactory httpClientFactory, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ILocalizationManager localization, IJsonSerializer jsonSerializer, ILogger<TmdbSeasonProvider> logger) + public TmdbSeasonProvider( + IHttpClientFactory httpClientFactory, + IServerConfigurationManager configurationManager, + IFileSystem fileSystem, + IJsonSerializer jsonSerializer, + ILogger<TmdbSeasonProvider> logger) { _httpClientFactory = httpClientFactory; _configurationManager = configurationManager; _fileSystem = fileSystem; - _localization = localization; _jsonSerializer = jsonSerializer; _logger = logger; Current = this; } + public string Name => TmdbUtils.ProviderName; + public async Task<MetadataResult<Season>> GetMetadata(SeasonInfo info, CancellationToken cancellationToken) { var result = new MetadataResult<Season>(); @@ -116,8 +122,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV return result; } - public string Name => TmdbUtils.ProviderName; - public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeasonInfo searchInfo, CancellationToken cancellationToken) { return Task.FromResult<IEnumerable<RemoteSearchResult>>(new List<RemoteSearchResult>()); @@ -128,7 +132,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken); } - private async Task<SeasonResult> GetSeasonInfo(string seriesTmdbId, int season, string preferredMetadataLanguage, + private async Task<SeasonResult> GetSeasonInfo( + string seriesTmdbId, + int season, + string preferredMetadataLanguage, CancellationToken cancellationToken) { await EnsureSeasonInfo(seriesTmdbId, season, preferredMetadataLanguage, cancellationToken) @@ -181,7 +188,9 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV var path = TmdbSeriesProvider.GetSeriesDataPath(_configurationManager.ApplicationPaths, tmdbId); - var filename = string.Format(CultureInfo.InvariantCulture, "season-{0}-{1}.json", + var filename = string.Format( + CultureInfo.InvariantCulture, + "season-{0}-{1}.json", seasonNumber.ToString(CultureInfo.InvariantCulture), preferredLanguage); diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesImageProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesImageProvider.cs index 125560175..179ceb825 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesImageProvider.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesImageProvider.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Net.Http; using System.Threading; @@ -12,7 +13,6 @@ using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.IO; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; using MediaBrowser.Providers.Plugins.Tmdb.Models.General; @@ -25,19 +25,20 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV { private readonly IJsonSerializer _jsonSerializer; private readonly IHttpClientFactory _httpClientFactory; - private readonly IFileSystem _fileSystem; - public TmdbSeriesImageProvider(IJsonSerializer jsonSerializer, IHttpClientFactory httpClientFactory, IFileSystem fileSystem) + public TmdbSeriesImageProvider(IJsonSerializer jsonSerializer, IHttpClientFactory httpClientFactory) { _jsonSerializer = jsonSerializer; _httpClientFactory = httpClientFactory; - _fileSystem = fileSystem; } public string Name => ProviderName; public static string ProviderName => TmdbUtils.ProviderName; + // After tvdb and fanart + public int Order => 2; + public bool Supports(BaseItem item) { return item is Series; @@ -56,7 +57,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV { var list = new List<RemoteImageInfo>(); - var results = await FetchImages(item, null, _jsonSerializer, cancellationToken).ConfigureAwait(false); + var results = await FetchImages(item, null, cancellationToken).ConfigureAwait(false); if (results == null) { @@ -148,10 +149,11 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV /// </summary> /// <param name="item">The item.</param> /// <param name="language">The language.</param> - /// <param name="jsonSerializer">The json serializer.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task{MovieImages}.</returns> - private async Task<Images> FetchImages(BaseItem item, string language, IJsonSerializer jsonSerializer, + private async Task<Images> FetchImages( + BaseItem item, + string language, CancellationToken cancellationToken) { var tmdbId = item.GetProviderId(MetadataProvider.Tmdb); @@ -165,22 +167,14 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV var path = TmdbSeriesProvider.Current.GetDataFilePath(tmdbId, language); - if (!string.IsNullOrEmpty(path)) + if (!string.IsNullOrEmpty(path) && File.Exists(path)) { - var fileInfo = _fileSystem.GetFileInfo(path); - - if (fileInfo.Exists) - { - return jsonSerializer.DeserializeFromFile<SeriesResult>(path).Images; - } + return _jsonSerializer.DeserializeFromFile<SeriesResult>(path).Images; } return null; } - // After tvdb and fanart - public int Order => 2; - public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken) { return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken); diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesProvider.cs index fa0873b9d..287ebca8c 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesProvider.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbSeriesProvider.cs @@ -17,8 +17,6 @@ using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Globalization; -using MediaBrowser.Model.IO; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; using MediaBrowser.Providers.Plugins.Tmdb.Models.Search; @@ -33,38 +31,35 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV private const string GetTvInfo3 = TmdbUtils.BaseTmdbApiUrl + @"3/tv/{0}?api_key={1}&append_to_response=credits,images,keywords,external_ids,videos,content_ratings"; private readonly IJsonSerializer _jsonSerializer; - private readonly IFileSystem _fileSystem; private readonly IServerConfigurationManager _configurationManager; private readonly ILogger<TmdbSeriesProvider> _logger; - private readonly ILocalizationManager _localization; private readonly IHttpClientFactory _httpClientFactory; private readonly ILibraryManager _libraryManager; private readonly CultureInfo _usCulture = new CultureInfo("en-US"); - internal static TmdbSeriesProvider Current { get; private set; } - public TmdbSeriesProvider( IJsonSerializer jsonSerializer, - IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILogger<TmdbSeriesProvider> logger, - ILocalizationManager localization, IHttpClientFactory httpClientFactory, ILibraryManager libraryManager) { _jsonSerializer = jsonSerializer; - _fileSystem = fileSystem; _configurationManager = configurationManager; _logger = logger; - _localization = localization; _httpClientFactory = httpClientFactory; _libraryManager = libraryManager; Current = this; } + internal static TmdbSeriesProvider Current { get; private set; } + public string Name => TmdbUtils.ProviderName; + // After TheTVDB + public int Order => 1; + public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken) { var tmdbId = searchInfo.GetProviderId(MetadataProvider.Tmdb); @@ -129,8 +124,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo info, CancellationToken cancellationToken) { - var result = new MetadataResult<Series>(); - result.QueriedById = true; + var result = new MetadataResult<Series> + { + QueriedById = true + }; var tmdbId = info.GetProviderId(MetadataProvider.Tmdb); @@ -206,9 +203,11 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV await EnsureSeriesInfo(tmdbId, language, cancellationToken).ConfigureAwait(false); - var result = new MetadataResult<Series>(); - result.Item = new Series(); - result.ResultLanguage = seriesInfo.ResultLanguage; + var result = new MetadataResult<Series> + { + Item = new Series(), + ResultLanguage = seriesInfo.ResultLanguage + }; var settings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false); @@ -474,12 +473,11 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV var path = GetDataFilePath(tmdbId, language); - var fileInfo = _fileSystem.GetFileSystemInfo(path); - + var fileInfo = new FileInfo(path); if (fileInfo.Exists) { // If it's recent or automatic updates are enabled, don't re-download - if ((DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(fileInfo)).TotalDays <= 2) + if ((DateTime.UtcNow - fileInfo.LastWriteTimeUtc).TotalDays <= 2) { return Task.CompletedTask; } @@ -549,9 +547,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV return null; } - // After TheTVDB - public int Order => 1; - public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken) { return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken); diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Trailers/TmdbTrailerProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/Trailers/TmdbTrailerProvider.cs index 25296387b..613dc17e3 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/Trailers/TmdbTrailerProvider.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/Trailers/TmdbTrailerProvider.cs @@ -21,6 +21,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Trailers _httpClientFactory = httpClientFactory; } + public string Name => TmdbMovieProvider.Current.Name; + + public int Order => 0; + public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(TrailerInfo searchInfo, CancellationToken cancellationToken) { return TmdbMovieProvider.Current.GetMovieSearchResults(searchInfo, cancellationToken); @@ -31,10 +35,6 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Trailers return TmdbMovieProvider.Current.GetItemMetadata<Trailer>(info, cancellationToken); } - public string Name => TmdbMovieProvider.Current.Name; - - public int Order => 0; - public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken) { return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken); diff --git a/MediaBrowser.Providers/Studios/StudiosImageProvider.cs b/MediaBrowser.Providers/Studios/StudiosImageProvider.cs index 76dc7df7f..90e13f12f 100644 --- a/MediaBrowser.Providers/Studios/StudiosImageProvider.cs +++ b/MediaBrowser.Providers/Studios/StudiosImageProvider.cs @@ -33,6 +33,8 @@ namespace MediaBrowser.Providers.Studios public string Name => "Emby Designs"; + public int Order => 0; + public bool Supports(BaseItem item) { return item is Studio; @@ -119,8 +121,6 @@ namespace MediaBrowser.Providers.Studios return EnsureList(url, file, _fileSystem, cancellationToken); } - public int Order => 0; - public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken) { var httpClient = _httpClientFactory.CreateClient(NamedClient.Default); @@ -161,12 +161,12 @@ namespace MediaBrowser.Providers.Studios private string GetComparableName(string name) { - return name.Replace(" ", string.Empty) - .Replace(".", string.Empty) - .Replace("&", string.Empty) - .Replace("!", string.Empty) - .Replace(",", string.Empty) - .Replace("/", string.Empty); + return name.Replace(" ", string.Empty, StringComparison.Ordinal) + .Replace(".", string.Empty, StringComparison.Ordinal) + .Replace("&", string.Empty, StringComparison.Ordinal) + .Replace("!", string.Empty, StringComparison.Ordinal) + .Replace(",", string.Empty, StringComparison.Ordinal) + .Replace("/", string.Empty, StringComparison.Ordinal); } public IEnumerable<string> GetAvailableImages(string file) diff --git a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs index 0f7cb3f8f..f25d3d5ee 100644 --- a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs +++ b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs @@ -303,7 +303,7 @@ namespace MediaBrowser.Providers.Subtitles private ISubtitleProvider GetProvider(string id) { - return _subtitleProviders.First(i => string.Equals(id, GetProviderId(i.Name))); + return _subtitleProviders.First(i => string.Equals(id, GetProviderId(i.Name), StringComparison.Ordinal)); } /// <inheritdoc /> diff --git a/MediaBrowser.Providers/TV/DummySeasonProvider.cs b/MediaBrowser.Providers/TV/DummySeasonProvider.cs index a0f7f6cfd..905cbefd3 100644 --- a/MediaBrowser.Providers/TV/DummySeasonProvider.cs +++ b/MediaBrowser.Providers/TV/DummySeasonProvider.cs @@ -217,7 +217,6 @@ namespace MediaBrowser.Providers.TV new DeleteOptions { DeleteFileLocation = true - }, false); diff --git a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs index 616c61ec0..c833b1227 100644 --- a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs @@ -48,18 +48,25 @@ namespace MediaBrowser.Providers.TV public async Task<bool> Run(Series series, bool addNewItems, CancellationToken cancellationToken) { - var tvdbId = series.GetProviderId(MetadataProvider.Tvdb); - if (string.IsNullOrEmpty(tvdbId)) + var tvdbIdString = series.GetProviderId(MetadataProvider.Tvdb); + if (string.IsNullOrEmpty(tvdbIdString)) { return false; } - var episodes = await _tvdbClientManager.GetAllEpisodesAsync(Convert.ToInt32(tvdbId), series.GetPreferredMetadataLanguage(), cancellationToken); + var episodes = await _tvdbClientManager.GetAllEpisodesAsync( + int.Parse(tvdbIdString, CultureInfo.InvariantCulture), + series.GetPreferredMetadataLanguage(), + cancellationToken).ConfigureAwait(false); var episodeLookup = episodes .Select(i => { - DateTime.TryParse(i.FirstAired, out var firstAired); + if (!DateTime.TryParse(i.FirstAired, out var firstAired)) + { + firstAired = default; + } + var seasonNumber = i.AiredSeason.GetValueOrDefault(-1); var episodeNumber = i.AiredEpisodeNumber.GetValueOrDefault(-1); return (seasonNumber, episodeNumber, firstAired); diff --git a/MediaBrowser.Providers/TV/SeasonMetadataService.cs b/MediaBrowser.Providers/TV/SeasonMetadataService.cs index 5431de623..4e59f78bc 100644 --- a/MediaBrowser.Providers/TV/SeasonMetadataService.cs +++ b/MediaBrowser.Providers/TV/SeasonMetadataService.cs @@ -28,6 +28,9 @@ namespace MediaBrowser.Providers.TV } /// <inheritdoc /> + protected override bool EnableUpdatingPremiereDateFromChildren => true; + + /// <inheritdoc /> protected override ItemUpdateType BeforeSaveInternal(Season item, bool isFullRefresh, ItemUpdateType currentUpdateType) { var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType); @@ -68,9 +71,6 @@ namespace MediaBrowser.Providers.TV } /// <inheritdoc /> - protected override bool EnableUpdatingPremiereDateFromChildren => true; - - /// <inheritdoc /> protected override IList<BaseItem> GetChildrenForMetadataUpdates(Season item) => item.GetEpisodes(); @@ -53,18 +53,19 @@ Jellyfin is a Free Software Media System that puts you in control of managing an For further details, please see [our documentation page](https://docs.jellyfin.org/). To receive the latest updates, get help with Jellyfin, and join the community, please visit [one of our communication channels](https://docs.jellyfin.org/general/getting-help.html). For more information about the project, please see our [about page](https://docs.jellyfin.org/general/about.html). <strong>Want to get started?</strong><br/> -Choose from <a href="https://docs.jellyfin.org/general/administration/installing.html">Prebuilt Packages</a> or <a href="https://docs.jellyfin.org/general/administration/building.html">Build from Source</a>, then see our <a href="https://docs.jellyfin.org/general/quick-start.html">quick start guide</a>.<br/> +Check out our <a href="https://jellyfin.org/downloads">downloads page</a> or our <a href="https://docs.jellyfin.org/general/administration/installing.html">installation guide</a>, then see our <a href="https://docs.jellyfin.org/general/quick-start.html">quick start guide</a>. You can also <a href="https://docs.jellyfin.org/general/administration/building.html">build from source</a>.<br/> <strong>Something not working right?</strong><br/> Open an <a href="https://docs.jellyfin.org/general/contributing/issues.html">Issue</a> on GitHub.<br/> <strong>Want to contribute?</strong><br/> -Check out <a href="https://docs.jellyfin.org/general/contributing/index.html">our documentation for guidelines</a>.<br/> +Check out our <a href="https://jellyfin.org/contribute">contributing choose-your-own-adventure</a> to see where you can help, then see our <a href="https://docs.jellyfin.org/general/contributing/index.html">contributing guide</a> and our <a href="https://jellyfin.org/docs/general/community-standards">community standards</a>.<br/> <strong>New idea or improvement?</strong><br/> Check out our <a href="https://features.jellyfin.org/?view=most-wanted">feature request hub</a>.<br/> -Most of the translations can be found in the web client but we have several other clients that have missing strings. Translations can be improved very easily from our <a href="https://translate.jellyfin.org/projects/jellyfin/jellyfin-core">Weblate</a> instance. Look through the following graphic to see if your native language could use some work! +<strong>Don't see Jellyfin in your language?</strong><br/> +Check out our <a href="https://translate.jellyfin.org">Weblate instance</a> to help translate Jellyfin and its subprojects.<br/> <a href="https://translate.jellyfin.org/engage/jellyfin/?utm_source=widget"> <img src="https://translate.jellyfin.org/widgets/jellyfin/-/jellyfin-web/multi-auto.svg" alt="Detailed Translation Status"/> diff --git a/RSSDP/DisposableManagedObjectBase.cs b/RSSDP/DisposableManagedObjectBase.cs index 66a0c5ec4..745ec359c 100644 --- a/RSSDP/DisposableManagedObjectBase.cs +++ b/RSSDP/DisposableManagedObjectBase.cs @@ -43,13 +43,13 @@ namespace Rssdp.Infrastructure { var builder = new StringBuilder(); - const string argFormat = "{0}: {1}\r\n"; + const string ArgFormat = "{0}: {1}\r\n"; builder.AppendFormat("{0}\r\n", header); foreach (var pair in values) { - builder.AppendFormat(argFormat, pair.Key, pair.Value); + builder.AppendFormat(ArgFormat, pair.Key, pair.Value); } builder.Append("\r\n"); diff --git a/deployment/Dockerfile.debian.amd64 b/deployment/Dockerfile.debian.amd64 index 1ac5f76d6..7202c5883 100644 --- a/deployment/Dockerfile.debian.amd64 +++ b/deployment/Dockerfile.debian.amd64 @@ -16,7 +16,7 @@ RUN apt-get update \ # Install dotnet repository # https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current -RUN wget https://download.visualstudio.microsoft.com/download/pr/4f9b8a64-5e09-456c-a087-527cfc8b4cd2/15e14ec06eab947432de139f172f7a98/dotnet-sdk-3.1.401-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ +RUN wget https://download.visualstudio.microsoft.com/download/pr/f01e3d97-c1c3-4635-bc77-0c893be36820/6ec6acabc22468c6cc68b61625b14a7d/dotnet-sdk-3.1.402-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ && mkdir -p dotnet-sdk \ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet diff --git a/deployment/Dockerfile.debian.arm64 b/deployment/Dockerfile.debian.arm64 index 68381e7bf..e9f30213f 100644 --- a/deployment/Dockerfile.debian.arm64 +++ b/deployment/Dockerfile.debian.arm64 @@ -16,7 +16,7 @@ RUN apt-get update \ # Install dotnet repository # https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current -RUN wget https://download.visualstudio.microsoft.com/download/pr/4f9b8a64-5e09-456c-a087-527cfc8b4cd2/15e14ec06eab947432de139f172f7a98/dotnet-sdk-3.1.401-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ +RUN wget https://download.visualstudio.microsoft.com/download/pr/f01e3d97-c1c3-4635-bc77-0c893be36820/6ec6acabc22468c6cc68b61625b14a7d/dotnet-sdk-3.1.402-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ && mkdir -p dotnet-sdk \ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet diff --git a/deployment/Dockerfile.debian.armhf b/deployment/Dockerfile.debian.armhf index ce1b100c1..91a8a6e7a 100644 --- a/deployment/Dockerfile.debian.armhf +++ b/deployment/Dockerfile.debian.armhf @@ -16,7 +16,7 @@ RUN apt-get update \ # Install dotnet repository # https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current -RUN wget https://download.visualstudio.microsoft.com/download/pr/4f9b8a64-5e09-456c-a087-527cfc8b4cd2/15e14ec06eab947432de139f172f7a98/dotnet-sdk-3.1.401-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ +RUN wget https://download.visualstudio.microsoft.com/download/pr/f01e3d97-c1c3-4635-bc77-0c893be36820/6ec6acabc22468c6cc68b61625b14a7d/dotnet-sdk-3.1.402-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ && mkdir -p dotnet-sdk \ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet diff --git a/deployment/Dockerfile.linux.amd64 b/deployment/Dockerfile.linux.amd64 index b4a3c1b76..828d5c2cf 100644 --- a/deployment/Dockerfile.linux.amd64 +++ b/deployment/Dockerfile.linux.amd64 @@ -16,7 +16,7 @@ RUN apt-get update \ # Install dotnet repository # https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current -RUN wget https://download.visualstudio.microsoft.com/download/pr/4f9b8a64-5e09-456c-a087-527cfc8b4cd2/15e14ec06eab947432de139f172f7a98/dotnet-sdk-3.1.401-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ +RUN wget https://download.visualstudio.microsoft.com/download/pr/f01e3d97-c1c3-4635-bc77-0c893be36820/6ec6acabc22468c6cc68b61625b14a7d/dotnet-sdk-3.1.402-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ && mkdir -p dotnet-sdk \ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet diff --git a/deployment/Dockerfile.macos b/deployment/Dockerfile.macos index 7912e018e..0b2a0fe5f 100644 --- a/deployment/Dockerfile.macos +++ b/deployment/Dockerfile.macos @@ -16,7 +16,7 @@ RUN apt-get update \ # Install dotnet repository # https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current -RUN wget https://download.visualstudio.microsoft.com/download/pr/4f9b8a64-5e09-456c-a087-527cfc8b4cd2/15e14ec06eab947432de139f172f7a98/dotnet-sdk-3.1.401-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ +RUN wget https://download.visualstudio.microsoft.com/download/pr/f01e3d97-c1c3-4635-bc77-0c893be36820/6ec6acabc22468c6cc68b61625b14a7d/dotnet-sdk-3.1.402-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ && mkdir -p dotnet-sdk \ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet diff --git a/deployment/Dockerfile.portable b/deployment/Dockerfile.portable index 949f1ef8f..7d5de230f 100644 --- a/deployment/Dockerfile.portable +++ b/deployment/Dockerfile.portable @@ -15,7 +15,7 @@ RUN apt-get update \ # Install dotnet repository # https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current -RUN wget https://download.visualstudio.microsoft.com/download/pr/4f9b8a64-5e09-456c-a087-527cfc8b4cd2/15e14ec06eab947432de139f172f7a98/dotnet-sdk-3.1.401-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ +RUN wget https://download.visualstudio.microsoft.com/download/pr/f01e3d97-c1c3-4635-bc77-0c893be36820/6ec6acabc22468c6cc68b61625b14a7d/dotnet-sdk-3.1.402-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ && mkdir -p dotnet-sdk \ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet diff --git a/deployment/Dockerfile.ubuntu.amd64 b/deployment/Dockerfile.ubuntu.amd64 index 9518d8493..9c63f43df 100644 --- a/deployment/Dockerfile.ubuntu.amd64 +++ b/deployment/Dockerfile.ubuntu.amd64 @@ -16,7 +16,7 @@ RUN apt-get update \ # Install dotnet repository # https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current -RUN wget https://download.visualstudio.microsoft.com/download/pr/4f9b8a64-5e09-456c-a087-527cfc8b4cd2/15e14ec06eab947432de139f172f7a98/dotnet-sdk-3.1.401-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ +RUN wget https://download.visualstudio.microsoft.com/download/pr/f01e3d97-c1c3-4635-bc77-0c893be36820/6ec6acabc22468c6cc68b61625b14a7d/dotnet-sdk-3.1.402-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ && mkdir -p dotnet-sdk \ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet diff --git a/deployment/Dockerfile.ubuntu.arm64 b/deployment/Dockerfile.ubuntu.arm64 index 0174f2f2a..51612dd44 100644 --- a/deployment/Dockerfile.ubuntu.arm64 +++ b/deployment/Dockerfile.ubuntu.arm64 @@ -16,7 +16,7 @@ RUN apt-get update \ # Install dotnet repository # https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current -RUN wget https://download.visualstudio.microsoft.com/download/pr/4f9b8a64-5e09-456c-a087-527cfc8b4cd2/15e14ec06eab947432de139f172f7a98/dotnet-sdk-3.1.401-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ +RUN wget https://download.visualstudio.microsoft.com/download/pr/f01e3d97-c1c3-4635-bc77-0c893be36820/6ec6acabc22468c6cc68b61625b14a7d/dotnet-sdk-3.1.402-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ && mkdir -p dotnet-sdk \ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet diff --git a/deployment/Dockerfile.ubuntu.armhf b/deployment/Dockerfile.ubuntu.armhf index 0e02240c8..4ed7f8687 100644 --- a/deployment/Dockerfile.ubuntu.armhf +++ b/deployment/Dockerfile.ubuntu.armhf @@ -16,7 +16,7 @@ RUN apt-get update \ # Install dotnet repository # https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current -RUN wget https://download.visualstudio.microsoft.com/download/pr/4f9b8a64-5e09-456c-a087-527cfc8b4cd2/15e14ec06eab947432de139f172f7a98/dotnet-sdk-3.1.401-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ +RUN wget https://download.visualstudio.microsoft.com/download/pr/f01e3d97-c1c3-4635-bc77-0c893be36820/6ec6acabc22468c6cc68b61625b14a7d/dotnet-sdk-3.1.402-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ && mkdir -p dotnet-sdk \ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet diff --git a/deployment/Dockerfile.windows.amd64 b/deployment/Dockerfile.windows.amd64 index d1f2f9e48..5671cc598 100644 --- a/deployment/Dockerfile.windows.amd64 +++ b/deployment/Dockerfile.windows.amd64 @@ -15,7 +15,7 @@ RUN apt-get update \ # Install dotnet repository # https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current -RUN wget https://download.visualstudio.microsoft.com/download/pr/4f9b8a64-5e09-456c-a087-527cfc8b4cd2/15e14ec06eab947432de139f172f7a98/dotnet-sdk-3.1.401-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ +RUN wget https://download.visualstudio.microsoft.com/download/pr/f01e3d97-c1c3-4635-bc77-0c893be36820/6ec6acabc22468c6cc68b61625b14a7d/dotnet-sdk-3.1.402-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ && mkdir -p dotnet-sdk \ && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet diff --git a/fedora/jellyfin.spec b/fedora/jellyfin.spec index 37b573e50..bfb2b3be2 100644 --- a/fedora/jellyfin.spec +++ b/fedora/jellyfin.spec @@ -84,6 +84,10 @@ EOF %{_libdir}/jellyfin/*.so %{_libdir}/jellyfin/*.a %{_libdir}/jellyfin/createdump +%{_libdir}/jellyfin/*.xml +%{_libdir}/jellyfin/wwwroot/api-docs/* +%{_libdir}/jellyfin/wwwroot/api-docs/redoc/* +%{_libdir}/jellyfin/wwwroot/api-docs/swagger/* # Needs 755 else only root can run it since binary build by dotnet is 722 %attr(755,root,root) %{_libdir}/jellyfin/jellyfin %{_libdir}/jellyfin/SOS_README.md diff --git a/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj b/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj index bcba3a203..e3a7a5428 100644 --- a/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj +++ b/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj @@ -16,8 +16,8 @@ <PackageReference Include="AutoFixture" Version="4.13.0" /> <PackageReference Include="AutoFixture.AutoMoq" Version="4.13.0" /> <PackageReference Include="AutoFixture.Xunit2" Version="4.13.0" /> - <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.7" /> - <PackageReference Include="Microsoft.Extensions.Options" Version="3.1.7" /> + <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.8" /> + <PackageReference Include="Microsoft.Extensions.Options" Version="3.1.8" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" /> <PackageReference Include="xunit" Version="2.4.1" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" /> diff --git a/tests/Jellyfin.Naming.Tests/AudioBook/AudioBookFileInfoTests.cs b/tests/Jellyfin.Naming.Tests/AudioBook/AudioBookFileInfoTests.cs new file mode 100644 index 000000000..a214bc57c --- /dev/null +++ b/tests/Jellyfin.Naming.Tests/AudioBook/AudioBookFileInfoTests.cs @@ -0,0 +1,30 @@ +using Emby.Naming.AudioBook; +using Xunit; + +namespace Jellyfin.Naming.Tests.AudioBook +{ + public class AudioBookFileInfoTests + { + [Fact] + public void CompareTo_Same_Success() + { + var info = new AudioBookFileInfo(); + Assert.Equal(0, info.CompareTo(info)); + } + + [Fact] + public void CompareTo_Null_Success() + { + var info = new AudioBookFileInfo(); + Assert.Equal(1, info.CompareTo(null)); + } + + [Fact] + public void CompareTo_Empty_Success() + { + var info1 = new AudioBookFileInfo(); + var info2 = new AudioBookFileInfo(); + Assert.Equal(0, info1.CompareTo(info2)); + } + } +} diff --git a/tests/Jellyfin.Naming.Tests/Video/ExtraTests.cs b/tests/Jellyfin.Naming.Tests/Video/ExtraTests.cs index a2722a175..8dfb8f859 100644 --- a/tests/Jellyfin.Naming.Tests/Video/ExtraTests.cs +++ b/tests/Jellyfin.Naming.Tests/Video/ExtraTests.cs @@ -44,14 +44,14 @@ namespace Jellyfin.Naming.Tests.Video } [Theory] - [InlineData(ExtraType.BehindTheScenes, "behind the scenes" )] - [InlineData(ExtraType.DeletedScene, "deleted scenes" )] - [InlineData(ExtraType.Interview, "interviews" )] - [InlineData(ExtraType.Scene, "scenes" )] - [InlineData(ExtraType.Sample, "samples" )] - [InlineData(ExtraType.Clip, "shorts" )] - [InlineData(ExtraType.Clip, "featurettes" )] - [InlineData(ExtraType.Unknown, "extras" )] + [InlineData(ExtraType.BehindTheScenes, "behind the scenes")] + [InlineData(ExtraType.DeletedScene, "deleted scenes")] + [InlineData(ExtraType.Interview, "interviews")] + [InlineData(ExtraType.Scene, "scenes")] + [InlineData(ExtraType.Sample, "samples")] + [InlineData(ExtraType.Clip, "shorts")] + [InlineData(ExtraType.Clip, "featurettes")] + [InlineData(ExtraType.Unknown, "extras")] public void TestDirectories(ExtraType type, string dirName) { Test(dirName + "/300.mp4", type, _videoOptions); diff --git a/tests/Jellyfin.Server.Implementations.Tests/Library/PathExtensionsTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Library/PathExtensionsTests.cs index c771f5f4a..6d768af89 100644 --- a/tests/Jellyfin.Server.Implementations.Tests/Library/PathExtensionsTests.cs +++ b/tests/Jellyfin.Server.Implementations.Tests/Library/PathExtensionsTests.cs @@ -10,6 +10,7 @@ namespace Jellyfin.Server.Implementations.Tests.Library [InlineData("Superman: Red Son [imdbid=tt10985510]", "imdbid", "tt10985510")] [InlineData("Superman: Red Son - tt10985510", "imdbid", "tt10985510")] [InlineData("Superman: Red Son", "imdbid", null)] + [InlineData("Superman: Red Son", "something", null)] public void GetAttributeValue_ValidArgs_Correct(string input, string attribute, string? expectedResult) { Assert.Equal(expectedResult, PathExtensions.GetAttributeValue(input, attribute)); |
