diff --git a/.github/workflows/automation.yml b/.github/workflows/automation.yml
index 2dc7fb5a3e..4b5571c774 100644
--- a/.github/workflows/automation.yml
+++ b/.github/workflows/automation.yml
@@ -27,7 +27,7 @@ jobs:
if: ${{ github.repository == 'jellyfin/jellyfin' }}
steps:
- name: Remove from 'Current Release' project
- uses: alex-page/github-project-automation-plus@1f8873e97e3c8f58161a323b7c568c1f623a1c4d # tag=v0.8.2
+ uses: alex-page/github-project-automation-plus@7ffb872c64bd809d23563a130a0a97d01dfa8f43 # v0.8.3
if: (github.event.pull_request || github.event.issue.pull_request) && !contains(github.event.*.labels.*.name, 'stable backport')
continue-on-error: true
with:
@@ -36,7 +36,7 @@ jobs:
repo-token: ${{ secrets.JF_BOT_TOKEN }}
- name: Add to 'Release Next' project
- uses: alex-page/github-project-automation-plus@1f8873e97e3c8f58161a323b7c568c1f623a1c4d # tag=v0.8.2
+ uses: alex-page/github-project-automation-plus@7ffb872c64bd809d23563a130a0a97d01dfa8f43 # v0.8.3
if: (github.event.pull_request || github.event.issue.pull_request) && github.event.action == 'opened'
continue-on-error: true
with:
@@ -45,7 +45,7 @@ jobs:
repo-token: ${{ secrets.JF_BOT_TOKEN }}
- name: Add to 'Current Release' project
- uses: alex-page/github-project-automation-plus@1f8873e97e3c8f58161a323b7c568c1f623a1c4d # tag=v0.8.2
+ uses: alex-page/github-project-automation-plus@7ffb872c64bd809d23563a130a0a97d01dfa8f43 # v0.8.3
if: (github.event.pull_request || github.event.issue.pull_request) && !contains(github.event.*.labels.*.name, 'stable backport')
continue-on-error: true
with:
@@ -59,7 +59,7 @@ jobs:
run: echo "::set-output name=number::$(curl -s ${{ github.event.issue.comments_url }} | jq '.[] | select(.author_association == "MEMBER") | .author_association' | wc -l)"
- name: Move issue to needs triage
- uses: alex-page/github-project-automation-plus@1f8873e97e3c8f58161a323b7c568c1f623a1c4d # tag=v0.8.2
+ uses: alex-page/github-project-automation-plus@7ffb872c64bd809d23563a130a0a97d01dfa8f43 # v0.8.3
if: github.event.issue.pull_request == '' && github.event.comment.author_association == 'MEMBER' && steps.member_comments.outputs.number <= 1
continue-on-error: true
with:
@@ -68,7 +68,7 @@ jobs:
repo-token: ${{ secrets.JF_BOT_TOKEN }}
- name: Add issue to triage project
- uses: alex-page/github-project-automation-plus@1f8873e97e3c8f58161a323b7c568c1f623a1c4d # tag=v0.8.2
+ uses: alex-page/github-project-automation-plus@7ffb872c64bd809d23563a130a0a97d01dfa8f43 # v0.8.3
if: github.event.issue.pull_request == '' && github.event.action == 'opened'
continue-on-error: true
with:
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 6a04d13264..41d59e2435 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -27,11 +27,11 @@ jobs:
dotnet-version: '7.0.x'
- name: Initialize CodeQL
- uses: github/codeql-action/init@a34ca99b4610d924e04c68db79e503e1f79f9f02 # v2
+ uses: github/codeql-action/init@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2
with:
languages: ${{ matrix.language }}
queries: +security-extended
- name: Autobuild
- uses: github/codeql-action/autobuild@a34ca99b4610d924e04c68db79e503e1f79f9f02 # v2
+ uses: github/codeql-action/autobuild@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@a34ca99b4610d924e04c68db79e503e1f79f9f02 # v2
+ uses: github/codeql-action/analyze@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2
diff --git a/.github/workflows/commands.yml b/.github/workflows/commands.yml
index 5d945c001b..75227c57b9 100644
--- a/.github/workflows/commands.yml
+++ b/.github/workflows/commands.yml
@@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Notify as seen
- uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808 # tag=v2
+ uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d # v2
with:
token: ${{ secrets.JF_BOT_TOKEN }}
comment-id: ${{ github.event.comment.id }}
@@ -43,7 +43,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Notify as seen
- uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808 # tag=v2
+ uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d # v2
if: ${{ github.event.comment != null }}
with:
token: ${{ secrets.JF_BOT_TOKEN }}
@@ -58,7 +58,7 @@ jobs:
- name: Notify as running
id: comment_running
- uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808 # tag=v2
+ uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d # v2
if: ${{ github.event.comment != null }}
with:
token: ${{ secrets.JF_BOT_TOKEN }}
@@ -93,7 +93,7 @@ jobs:
exit ${retcode}
- name: Notify with result success
- uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808 # tag=v2
+ uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d # v2
if: ${{ github.event.comment != null && success() }}
with:
token: ${{ secrets.JF_BOT_TOKEN }}
@@ -108,7 +108,7 @@ jobs:
reactions: hooray
- name: Notify with result failure
- uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808 # tag=v2
+ uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d # v2
if: ${{ github.event.comment != null && failure() }}
with:
token: ${{ secrets.JF_BOT_TOKEN }}
diff --git a/.github/workflows/openapi.yml b/.github/workflows/openapi.yml
index 4577ff5251..5ba53af865 100644
--- a/.github/workflows/openapi.yml
+++ b/.github/workflows/openapi.yml
@@ -103,14 +103,14 @@ jobs:
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Find difference comment
- uses: peter-evans/find-comment@81e2da3af01c92f83cb927cf3ace0e085617c556 # v2
+ uses: peter-evans/find-comment@85a676a52594b4481e0532825a2d8906ef96dac2 # v2
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
direction: last
body-includes: openapi-diff-workflow-comment
- name: Reply or edit difference comment (changed)
- uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808 # tag=v2
+ uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d # v2
if: ${{ steps.read-diff.outputs.body != '' }}
with:
issue-number: ${{ github.event.pull_request.number }}
@@ -125,7 +125,7 @@ jobs:
- name: Edit difference comment (unchanged)
- uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808 # tag=v2
+ uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d # v2
if: ${{ steps.read-diff.outputs.body == '' && steps.find-comment.outputs.comment-id != '' }}
with:
issue-number: ${{ github.event.pull_request.number }}
diff --git a/.npmrc b/.npmrc
deleted file mode 100644
index b7a317000b..0000000000
--- a/.npmrc
+++ /dev/null
@@ -1,3 +0,0 @@
-registry=https://registry.npmjs.org/
-@jellyfin:registry=https://pkgs.dev.azure.com/jellyfin-project/jellyfin/_packaging/unstable/npm/registry/
-always-auth=true
\ No newline at end of file
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index ec3c6fd2af..20ea7a4ab7 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -58,6 +58,7 @@
- [HelloWorld017](https://github.com/HelloWorld017)
- [ikomhoog](https://github.com/ikomhoog)
- [jftuga](https://github.com/jftuga)
+ - [jmshrv](https://github.com/jmshrv)
- [joern-h](https://github.com/joern-h)
- [joshuaboniface](https://github.com/joshuaboniface)
- [JustAMan](https://github.com/JustAMan)
@@ -231,3 +232,4 @@
- [Matthew Jones](https://github.com/matthew-jones-uk)
- [Jakob Kukla](https://github.com/jakobkukla)
- [Utku Özdemir](https://github.com/utkuozdemir)
+ - [JPUC1143](https://github.com/Jpuc1143/)
diff --git a/Directory.Packages.props b/Directory.Packages.props
new file mode 100644
index 0000000000..b72bb90709
--- /dev/null
+++ b/Directory.Packages.props
@@ -0,0 +1,90 @@
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Dockerfile b/Dockerfile
index 304f794631..f5f5787bec 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -37,7 +37,7 @@ RUN apt-get update \
&& apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
mesa-va-drivers \
- jellyfin-ffmpeg \
+ jellyfin-ffmpeg5 \
openssl \
locales \
# Intel VAAPI Tone mapping dependencies:
diff --git a/Emby.Dlna/Emby.Dlna.csproj b/Emby.Dlna/Emby.Dlna.csproj
index 60e6dd644d..aca2399644 100644
--- a/Emby.Dlna/Emby.Dlna.csproj
+++ b/Emby.Dlna/Emby.Dlna.csproj
@@ -28,13 +28,13 @@
-
+
all
runtime; build; native; contentfiles; analyzers
-
-
-
+
+
+
@@ -80,7 +80,7 @@
-
+
diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs
index c9a091d8c2..87c52163d9 100644
--- a/Emby.Dlna/Main/DlnaEntryPoint.cs
+++ b/Emby.Dlna/Main/DlnaEntryPoint.cs
@@ -7,6 +7,7 @@ using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Net.Sockets;
+using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Emby.Dlna.PlayTo;
using Emby.Dlna.Ssdp;
@@ -261,7 +262,7 @@ namespace Emby.Dlna.Main
{
_publisher = new SsdpDevicePublisher(
_communicationsServer,
- MediaBrowser.Common.System.OperatingSystem.Name,
+ Environment.OSVersion.Platform.ToString(),
Environment.OSVersion.VersionString,
_config.GetDlnaConfiguration().SendOnlyMatchedHost)
{
diff --git a/Emby.Naming/Emby.Naming.csproj b/Emby.Naming/Emby.Naming.csproj
index 3106e22465..f3973dad95 100644
--- a/Emby.Naming/Emby.Naming.csproj
+++ b/Emby.Naming/Emby.Naming.csproj
@@ -42,18 +42,18 @@
-
+
-
+
all
runtime; build; native; contentfiles; analyzers
-
-
-
+
+
+
diff --git a/Emby.Notifications/CoreNotificationTypes.cs b/Emby.Notifications/CoreNotificationTypes.cs
deleted file mode 100644
index 35aac3a11c..0000000000
--- a/Emby.Notifications/CoreNotificationTypes.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-#pragma warning disable CS1591
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using MediaBrowser.Controller.Notifications;
-using MediaBrowser.Model.Globalization;
-using MediaBrowser.Model.Notifications;
-
-namespace Emby.Notifications
-{
- public class CoreNotificationTypes : INotificationTypeFactory
- {
- private readonly ILocalizationManager _localization;
-
- public CoreNotificationTypes(ILocalizationManager localization)
- {
- _localization = localization;
- }
-
- public IEnumerable GetNotificationTypes()
- {
- var knownTypes = new NotificationTypeInfo[]
- {
- new NotificationTypeInfo
- {
- Type = nameof(NotificationType.ApplicationUpdateInstalled)
- },
- new NotificationTypeInfo
- {
- Type = nameof(NotificationType.InstallationFailed)
- },
- new NotificationTypeInfo
- {
- Type = nameof(NotificationType.PluginInstalled)
- },
- new NotificationTypeInfo
- {
- Type = nameof(NotificationType.PluginError)
- },
- new NotificationTypeInfo
- {
- Type = nameof(NotificationType.PluginUninstalled)
- },
- new NotificationTypeInfo
- {
- Type = nameof(NotificationType.PluginUpdateInstalled)
- },
- new NotificationTypeInfo
- {
- Type = nameof(NotificationType.ServerRestartRequired)
- },
- new NotificationTypeInfo
- {
- Type = nameof(NotificationType.TaskFailed)
- },
- new NotificationTypeInfo
- {
- Type = nameof(NotificationType.NewLibraryContent)
- },
- new NotificationTypeInfo
- {
- Type = nameof(NotificationType.AudioPlayback)
- },
- new NotificationTypeInfo
- {
- Type = nameof(NotificationType.VideoPlayback)
- },
- new NotificationTypeInfo
- {
- Type = nameof(NotificationType.AudioPlaybackStopped)
- },
- new NotificationTypeInfo
- {
- Type = nameof(NotificationType.VideoPlaybackStopped)
- },
- new NotificationTypeInfo
- {
- Type = nameof(NotificationType.UserLockedOut)
- },
- new NotificationTypeInfo
- {
- Type = nameof(NotificationType.ApplicationUpdateAvailable)
- }
- };
-
- foreach (var type in knownTypes)
- {
- Update(type);
- }
-
- var systemName = _localization.GetLocalizedString("System");
-
- return knownTypes.OrderByDescending(i => string.Equals(i.Category, systemName, StringComparison.OrdinalIgnoreCase))
- .ThenBy(i => i.Category)
- .ThenBy(i => i.Name);
- }
-
- private void Update(NotificationTypeInfo note)
- {
- note.Name = _localization.GetLocalizedString("NotificationOption" + note.Type);
-
- note.IsBasedOnUserEvent = note.Type.IndexOf("Playback", StringComparison.OrdinalIgnoreCase) != -1;
-
- if (note.Type.IndexOf("Playback", StringComparison.OrdinalIgnoreCase) != -1)
- {
- note.Category = _localization.GetLocalizedString("User");
- }
- else if (note.Type.IndexOf("Plugin", StringComparison.OrdinalIgnoreCase) != -1)
- {
- note.Category = _localization.GetLocalizedString("Plugin");
- }
- else if (note.Type.IndexOf("UserLockedOut", StringComparison.OrdinalIgnoreCase) != -1)
- {
- note.Category = _localization.GetLocalizedString("User");
- }
- else
- {
- note.Category = _localization.GetLocalizedString("System");
- }
- }
- }
-}
diff --git a/Emby.Notifications/Emby.Notifications.csproj b/Emby.Notifications/Emby.Notifications.csproj
deleted file mode 100644
index eb269183e9..0000000000
--- a/Emby.Notifications/Emby.Notifications.csproj
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
- {2E030C33-6923-4530-9E54-FA29FA6AD1A9}
-
-
-
- net7.0
- false
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers
-
-
-
-
-
-
-
diff --git a/Emby.Notifications/NotificationConfigurationFactory.cs b/Emby.Notifications/NotificationConfigurationFactory.cs
deleted file mode 100644
index 3fb3553d0e..0000000000
--- a/Emby.Notifications/NotificationConfigurationFactory.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-#pragma warning disable CS1591
-
-using System.Collections.Generic;
-using MediaBrowser.Common.Configuration;
-using MediaBrowser.Model.Notifications;
-
-namespace Emby.Notifications
-{
- public class NotificationConfigurationFactory : IConfigurationFactory
- {
- public IEnumerable GetConfigurations()
- {
- return new ConfigurationStore[]
- {
- new ConfigurationStore
- {
- Key = "notifications",
- ConfigurationType = typeof(NotificationOptions)
- }
- };
- }
- }
-}
diff --git a/Emby.Notifications/NotificationEntryPoint.cs b/Emby.Notifications/NotificationEntryPoint.cs
deleted file mode 100644
index 3763b1e922..0000000000
--- a/Emby.Notifications/NotificationEntryPoint.cs
+++ /dev/null
@@ -1,314 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using Jellyfin.Data.Events;
-using Jellyfin.Extensions;
-using MediaBrowser.Common.Configuration;
-using MediaBrowser.Controller;
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.Entities.Audio;
-using MediaBrowser.Controller.Entities.TV;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.Notifications;
-using MediaBrowser.Controller.Plugins;
-using MediaBrowser.Model.Activity;
-using MediaBrowser.Model.Globalization;
-using MediaBrowser.Model.Notifications;
-using Microsoft.Extensions.Logging;
-
-namespace Emby.Notifications
-{
- ///
- /// Creates notifications for various system events.
- ///
- public class NotificationEntryPoint : IServerEntryPoint
- {
- private readonly ILogger _logger;
- private readonly IActivityManager _activityManager;
- private readonly ILocalizationManager _localization;
- private readonly INotificationManager _notificationManager;
- private readonly ILibraryManager _libraryManager;
- private readonly IServerApplicationHost _appHost;
- private readonly IConfigurationManager _config;
-
- private readonly object _libraryChangedSyncLock = new object();
- private readonly List _itemsAdded = new List();
-
- private Timer? _libraryUpdateTimer;
-
- private string[] _coreNotificationTypes;
-
- private bool _disposed = false;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The logger.
- /// The activity manager.
- /// The localization manager.
- /// The notification manager.
- /// The library manager.
- /// The application host.
- /// The configuration manager.
- public NotificationEntryPoint(
- ILogger logger,
- IActivityManager activityManager,
- ILocalizationManager localization,
- INotificationManager notificationManager,
- ILibraryManager libraryManager,
- IServerApplicationHost appHost,
- IConfigurationManager config)
- {
- _logger = logger;
- _activityManager = activityManager;
- _localization = localization;
- _notificationManager = notificationManager;
- _libraryManager = libraryManager;
- _appHost = appHost;
- _config = config;
-
- _coreNotificationTypes = new CoreNotificationTypes(localization).GetNotificationTypes().Select(i => i.Type).ToArray();
- }
-
- ///
- public Task RunAsync()
- {
- _libraryManager.ItemAdded += OnLibraryManagerItemAdded;
- _appHost.HasPendingRestartChanged += OnAppHostHasPendingRestartChanged;
- _activityManager.EntryCreated += OnActivityManagerEntryCreated;
-
- return Task.CompletedTask;
- }
-
- private async void OnAppHostHasPendingRestartChanged(object? sender, EventArgs e)
- {
- var type = NotificationType.ServerRestartRequired.ToString();
-
- var notification = new NotificationRequest
- {
- NotificationType = type,
- Name = string.Format(
- CultureInfo.InvariantCulture,
- _localization.GetLocalizedString("ServerNameNeedsToBeRestarted"),
- _appHost.Name)
- };
-
- await SendNotification(notification, null).ConfigureAwait(false);
- }
-
- private async void OnActivityManagerEntryCreated(object? sender, GenericEventArgs e)
- {
- var entry = e.Argument;
-
- var type = entry.Type;
-
- if (string.IsNullOrEmpty(type) || !_coreNotificationTypes.Contains(type, StringComparison.OrdinalIgnoreCase))
- {
- return;
- }
-
- var userId = e.Argument.UserId;
-
- if (!userId.Equals(default) && !GetOptions().IsEnabledToMonitorUser(type, userId))
- {
- return;
- }
-
- var notification = new NotificationRequest
- {
- NotificationType = type,
- Name = entry.Name,
- Description = entry.Overview
- };
-
- await SendNotification(notification, null).ConfigureAwait(false);
- }
-
- private NotificationOptions GetOptions()
- {
- return _config.GetConfiguration("notifications");
- }
-
- private void OnLibraryManagerItemAdded(object? sender, ItemChangeEventArgs e)
- {
- if (!FilterItem(e.Item))
- {
- return;
- }
-
- lock (_libraryChangedSyncLock)
- {
- if (_libraryUpdateTimer is null)
- {
- _libraryUpdateTimer = new Timer(
- LibraryUpdateTimerCallback,
- null,
- 5000,
- Timeout.Infinite);
- }
- else
- {
- _libraryUpdateTimer.Change(5000, Timeout.Infinite);
- }
-
- _itemsAdded.Add(e.Item);
- }
- }
-
- private bool FilterItem(BaseItem item)
- {
- if (item.IsFolder)
- {
- return false;
- }
-
- if (!item.HasPathProtocol)
- {
- return false;
- }
-
- if (item is IItemByName)
- {
- return false;
- }
-
- return item.SourceType == SourceType.Library;
- }
-
- private async void LibraryUpdateTimerCallback(object? state)
- {
- List items;
-
- lock (_libraryChangedSyncLock)
- {
- items = _itemsAdded.ToList();
- _itemsAdded.Clear();
- _libraryUpdateTimer!.Dispose(); // Shouldn't be null as it just set off this callback
- _libraryUpdateTimer = null;
- }
-
- if (items.Count > 10)
- {
- items = items.GetRange(0, 10);
- }
-
- foreach (var item in items)
- {
- var notification = new NotificationRequest
- {
- NotificationType = NotificationType.NewLibraryContent.ToString(),
- Name = string.Format(
- CultureInfo.InvariantCulture,
- _localization.GetLocalizedString("ValueHasBeenAddedToLibrary"),
- GetItemName(item)),
- Description = item.Overview
- };
-
- await SendNotification(notification, item).ConfigureAwait(false);
- }
- }
-
- ///
- /// Creates a human readable name for the item.
- ///
- /// The item.
- /// A human readable name for the item.
- public static string GetItemName(BaseItem item)
- {
- var name = item.Name;
- if (item is Episode episode)
- {
- if (episode.IndexNumber.HasValue)
- {
- name = string.Format(
- CultureInfo.InvariantCulture,
- "Ep{0} - {1}",
- episode.IndexNumber.Value,
- name);
- }
-
- if (episode.ParentIndexNumber.HasValue)
- {
- name = string.Format(
- CultureInfo.InvariantCulture,
- "S{0}, {1}",
- episode.ParentIndexNumber.Value,
- name);
- }
- }
-
- if (item is IHasSeries hasSeries)
- {
- name = hasSeries.SeriesName + " - " + name;
- }
-
- if (item is IHasAlbumArtist hasAlbumArtist)
- {
- var artists = hasAlbumArtist.AlbumArtists;
-
- if (artists.Count > 0)
- {
- name = artists[0] + " - " + name;
- }
- }
- else if (item is IHasArtist hasArtist)
- {
- var artists = hasArtist.Artists;
-
- if (artists.Count > 0)
- {
- name = artists[0] + " - " + name;
- }
- }
-
- return name;
- }
-
- private async Task SendNotification(NotificationRequest notification, BaseItem? relatedItem)
- {
- try
- {
- await _notificationManager.SendNotification(notification, relatedItem, CancellationToken.None).ConfigureAwait(false);
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error sending notification");
- }
- }
-
- ///
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- ///
- /// Releases unmanaged and optionally managed resources.
- ///
- /// true to release both managed and unmanaged resources; false to release only unmanaged resources.
- protected virtual void Dispose(bool disposing)
- {
- if (_disposed)
- {
- return;
- }
-
- if (disposing)
- {
- _libraryUpdateTimer?.Dispose();
- }
-
- _libraryUpdateTimer = null;
-
- _libraryManager.ItemAdded -= OnLibraryManagerItemAdded;
- _appHost.HasPendingRestartChanged -= OnAppHostHasPendingRestartChanged;
- _activityManager.EntryCreated -= OnActivityManagerEntryCreated;
-
- _disposed = true;
- }
- }
-}
diff --git a/Emby.Notifications/NotificationManager.cs b/Emby.Notifications/NotificationManager.cs
deleted file mode 100644
index a5a76b2af7..0000000000
--- a/Emby.Notifications/NotificationManager.cs
+++ /dev/null
@@ -1,224 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using Jellyfin.Data.Entities;
-using Jellyfin.Data.Enums;
-using MediaBrowser.Common.Configuration;
-using MediaBrowser.Common.Extensions;
-using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Controller.Notifications;
-using MediaBrowser.Model.Dto;
-using MediaBrowser.Model.Notifications;
-using Microsoft.Extensions.Logging;
-
-namespace Emby.Notifications
-{
- ///
- /// NotificationManager class.
- ///
- public class NotificationManager : INotificationManager
- {
- private readonly ILogger _logger;
- private readonly IUserManager _userManager;
- private readonly IServerConfigurationManager _config;
-
- private INotificationService[] _services = Array.Empty();
- private INotificationTypeFactory[] _typeFactories = Array.Empty();
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The logger.
- /// The user manager.
- /// The server configuration manager.
- public NotificationManager(
- ILogger logger,
- IUserManager userManager,
- IServerConfigurationManager config)
- {
- _logger = logger;
- _userManager = userManager;
- _config = config;
- }
-
- private NotificationOptions GetConfiguration()
- {
- return _config.GetConfiguration("notifications");
- }
-
- ///
- public Task SendNotification(NotificationRequest request, CancellationToken cancellationToken)
- {
- return SendNotification(request, null, cancellationToken);
- }
-
- ///
- public Task SendNotification(NotificationRequest request, BaseItem? relatedItem, CancellationToken cancellationToken)
- {
- var notificationType = request.NotificationType;
-
- var options = string.IsNullOrEmpty(notificationType) ?
- null :
- GetConfiguration().GetOptions(notificationType);
-
- var users = GetUserIds(request, options)
- .Select(i => _userManager.GetUserById(i))
- .Where(i => relatedItem is null || relatedItem.IsVisibleStandalone(i))
- .ToArray();
-
- var title = request.Name;
- var description = request.Description;
-
- var tasks = _services.Where(i => IsEnabled(i, notificationType))
- .Select(i => SendNotification(request, i, users, title, description, cancellationToken));
-
- return Task.WhenAll(tasks);
- }
-
- private Task SendNotification(
- NotificationRequest request,
- INotificationService service,
- IEnumerable users,
- string title,
- string description,
- CancellationToken cancellationToken)
- {
- users = users.Where(i => IsEnabledForUser(service, i));
-
- var tasks = users.Select(i => SendNotification(request, service, title, description, i, cancellationToken));
-
- return Task.WhenAll(tasks);
- }
-
- private IEnumerable GetUserIds(NotificationRequest request, NotificationOption? options)
- {
- if (request.SendToUserMode.HasValue)
- {
- switch (request.SendToUserMode.Value)
- {
- case SendToUserType.Admins:
- return _userManager.Users.Where(i => i.HasPermission(PermissionKind.IsAdministrator))
- .Select(i => i.Id);
- case SendToUserType.All:
- return _userManager.UsersIds;
- case SendToUserType.Custom:
- return request.UserIds;
- default:
- throw new ArgumentException("Unrecognized SendToUserMode: " + request.SendToUserMode.Value);
- }
- }
-
- if (options is not null && !string.IsNullOrEmpty(request.NotificationType))
- {
- var config = GetConfiguration();
-
- return _userManager.Users
- .Where(i => config.IsEnabledToSendToUser(request.NotificationType, i.Id.ToString("N", CultureInfo.InvariantCulture), i))
- .Select(i => i.Id);
- }
-
- return request.UserIds;
- }
-
- private async Task SendNotification(
- NotificationRequest request,
- INotificationService service,
- string title,
- string description,
- User user,
- CancellationToken cancellationToken)
- {
- var notification = new UserNotification
- {
- Date = request.Date,
- Description = description,
- Level = request.Level,
- Name = title,
- Url = request.Url,
- User = user
- };
-
- _logger.LogDebug("Sending notification via {0} to user {1}", service.Name, user.Username);
-
- try
- {
- await service.SendNotification(notification, cancellationToken).ConfigureAwait(false);
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error sending notification to {0}", service.Name);
- }
- }
-
- private bool IsEnabledForUser(INotificationService service, User user)
- {
- try
- {
- return service.IsEnabledForUser(user);
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error in IsEnabledForUser");
- return false;
- }
- }
-
- private bool IsEnabled(INotificationService service, string notificationType)
- {
- if (string.IsNullOrEmpty(notificationType))
- {
- return true;
- }
-
- return GetConfiguration().IsServiceEnabled(service.Name, notificationType);
- }
-
- ///
- public void AddParts(IEnumerable services, IEnumerable notificationTypeFactories)
- {
- _services = services.ToArray();
- _typeFactories = notificationTypeFactories.ToArray();
- }
-
- ///
- public List GetNotificationTypes()
- {
- var list = _typeFactories.Select(i =>
- {
- try
- {
- return i.GetNotificationTypes().ToList();
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error in GetNotificationTypes");
- return new List();
- }
- }).SelectMany(i => i).ToList();
-
- var config = GetConfiguration();
-
- foreach (var i in list)
- {
- i.Enabled = config.IsEnabled(i.Type);
- }
-
- return list;
- }
-
- ///
- public IEnumerable GetNotificationServices()
- {
- return _services.Select(i => new NameIdPair
- {
- Name = i.Name,
- Id = i.Name.GetMD5().ToString("N", CultureInfo.InvariantCulture)
- }).OrderBy(i => i.Name);
- }
- }
-}
diff --git a/Emby.Notifications/Properties/AssemblyInfo.cs b/Emby.Notifications/Properties/AssemblyInfo.cs
deleted file mode 100644
index 5c82c90c47..0000000000
--- a/Emby.Notifications/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Emby.Notifications")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Jellyfin Project")]
-[assembly: AssemblyProduct("Jellyfin Server")]
-[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-[assembly: NeutralResourcesLanguage("en")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
diff --git a/Emby.Photos/Emby.Photos.csproj b/Emby.Photos/Emby.Photos.csproj
index ae6bc2db1f..0f97a06867 100644
--- a/Emby.Photos/Emby.Photos.csproj
+++ b/Emby.Photos/Emby.Photos.csproj
@@ -15,7 +15,7 @@
-
+
@@ -26,13 +26,13 @@
-
+
all
runtime; build; native; contentfiles; analyzers
-
-
-
+
+
+
diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
index 985a127d50..a4deeddb78 100644
--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -33,15 +31,10 @@ namespace Emby.Server.Implementations.AppBase
private ConfigurationStore[] _configurationStores = Array.Empty();
private IConfigurationFactory[] _configurationFactories = Array.Empty();
- ///
- /// The _configuration loaded.
- ///
- private bool _configurationLoaded;
-
///
/// The _configuration.
///
- private BaseApplicationConfiguration _configuration;
+ private BaseApplicationConfiguration? _configuration;
///
/// Initializes a new instance of the class.
@@ -63,17 +56,17 @@ namespace Emby.Server.Implementations.AppBase
///
/// Occurs when [configuration updated].
///
- public event EventHandler ConfigurationUpdated;
+ public event EventHandler? ConfigurationUpdated;
///
/// Occurs when [configuration updating].
///
- public event EventHandler NamedConfigurationUpdating;
+ public event EventHandler? NamedConfigurationUpdating;
///
/// Occurs when [named configuration updated].
///
- public event EventHandler NamedConfigurationUpdated;
+ public event EventHandler? NamedConfigurationUpdated;
///
/// Gets the type of the configuration.
@@ -107,31 +100,25 @@ namespace Emby.Server.Implementations.AppBase
{
get
{
- if (_configurationLoaded)
+ if (_configuration is not null)
{
return _configuration;
}
lock (_configurationSyncLock)
{
- if (_configurationLoaded)
+ if (_configuration is not null)
{
return _configuration;
}
- _configuration = (BaseApplicationConfiguration)ConfigurationHelper.GetXmlConfiguration(ConfigurationType, CommonApplicationPaths.SystemConfigurationFilePath, XmlSerializer);
-
- _configurationLoaded = true;
-
- return _configuration;
+ return _configuration = (BaseApplicationConfiguration)ConfigurationHelper.GetXmlConfiguration(ConfigurationType, CommonApplicationPaths.SystemConfigurationFilePath, XmlSerializer);
}
}
protected set
{
_configuration = value;
-
- _configurationLoaded = value is not null;
}
}
@@ -183,7 +170,7 @@ namespace Emby.Server.Implementations.AppBase
Logger.LogInformation("Saving system configuration");
var path = CommonApplicationPaths.SystemConfigurationFilePath;
- Directory.CreateDirectory(Path.GetDirectoryName(path));
+ Directory.CreateDirectory(Path.GetDirectoryName(path) ?? throw new InvalidOperationException("Path can't be a root directory."));
lock (_configurationSyncLock)
{
@@ -323,25 +310,20 @@ namespace Emby.Server.Implementations.AppBase
private object LoadConfiguration(string path, Type configurationType)
{
- if (!File.Exists(path))
- {
- return Activator.CreateInstance(configurationType);
- }
-
try
{
- return XmlSerializer.DeserializeFromFile(configurationType, path);
- }
- catch (IOException)
- {
- return Activator.CreateInstance(configurationType);
+ if (File.Exists(path))
+ {
+ return XmlSerializer.DeserializeFromFile(configurationType, path);
+ }
}
- catch (Exception ex)
+ catch (Exception ex) when (ex is not IOException)
{
Logger.LogError(ex, "Error loading configuration file: {Path}", path);
-
- return Activator.CreateInstance(configurationType);
}
+
+ return Activator.CreateInstance(configurationType)
+ ?? throw new InvalidOperationException("Configuration type can't be Nullable.");
}
///
@@ -367,7 +349,7 @@ namespace Emby.Server.Implementations.AppBase
_configurations.AddOrUpdate(key, configuration, (_, _) => configuration);
var path = GetConfigurationFile(key);
- Directory.CreateDirectory(Path.GetDirectoryName(path));
+ Directory.CreateDirectory(Path.GetDirectoryName(path) ?? throw new InvalidOperationException("Path can't be a root directory."));
lock (_configurationSyncLock)
{
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index fc7d0242d7..50befaa537 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -11,7 +11,6 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
-using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
@@ -19,7 +18,6 @@ using Emby.Dlna;
using Emby.Dlna.Main;
using Emby.Dlna.Ssdp;
using Emby.Naming.Common;
-using Emby.Notifications;
using Emby.Photos;
using Emby.Server.Implementations.Channels;
using Emby.Server.Implementations.Collections;
@@ -70,7 +68,6 @@ using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Lyrics;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Net;
-using MediaBrowser.Controller.Notifications;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Playlists;
using MediaBrowser.Controller.Plugins;
@@ -115,15 +112,11 @@ namespace Emby.Server.Implementations
///
public abstract class ApplicationHost : IServerApplicationHost, IAsyncDisposable, IDisposable
{
- ///
- /// The environment variable prefixes to log at server startup.
- ///
- private static readonly string[] _relevantEnvVarPrefixes = { "JELLYFIN_", "DOTNET_", "ASPNETCORE_" };
-
///
/// The disposable parts.
///
private readonly ConcurrentDictionary _disposableParts = new();
+ private readonly DeviceId _deviceId;
private readonly IFileSystem _fileSystemManager;
private readonly IConfiguration _startupConfig;
@@ -132,7 +125,6 @@ namespace Emby.Server.Implementations
private readonly IPluginManager _pluginManager;
private List _creatingInstances;
- private IMediaEncoder _mediaEncoder;
private ISessionManager _sessionManager;
///
@@ -141,8 +133,6 @@ namespace Emby.Server.Implementations
/// All concrete types.
private Type[] _allConcreteTypes;
- private DeviceId _deviceId;
-
private bool _disposed = false;
///
@@ -166,6 +156,7 @@ namespace Emby.Server.Implementations
Logger = LoggerFactory.CreateLogger();
_fileSystemManager.AddShortcutHandler(new MbLinkShortcutHandler(_fileSystemManager));
+ _deviceId = new DeviceId(ApplicationPaths, LoggerFactory);
ApplicationVersion = typeof(ApplicationHost).Assembly.GetName().Version;
ApplicationVersionString = ApplicationVersion.ToString(3);
@@ -193,23 +184,9 @@ namespace Emby.Server.Implementations
public bool CoreStartupHasCompleted { get; private set; }
- public virtual bool CanLaunchWebBrowser
- {
- get
- {
- if (!Environment.UserInteractive)
- {
- return false;
- }
-
- if (_startupOptions.IsService)
- {
- return false;
- }
-
- return OperatingSystem.IsWindows() || OperatingSystem.IsMacOS();
- }
- }
+ public virtual bool CanLaunchWebBrowser => Environment.UserInteractive
+ && !_startupOptions.IsService
+ && (OperatingSystem.IsWindows() || OperatingSystem.IsMacOS());
///
/// Gets the singleton instance.
@@ -286,15 +263,7 @@ namespace Emby.Server.Implementations
/// The application name.
public string ApplicationProductName { get; } = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).ProductName;
- public string SystemId
- {
- get
- {
- _deviceId ??= new DeviceId(ApplicationPaths, LoggerFactory);
-
- return _deviceId.Value;
- }
- }
+ public string SystemId => _deviceId.Value;
///
public string Name => ApplicationProductName;
@@ -447,7 +416,7 @@ namespace Emby.Server.Implementations
ConfigurationManager.ConfigurationUpdated += OnConfigurationUpdated;
ConfigurationManager.NamedConfigurationUpdated += OnConfigurationUpdated;
- _mediaEncoder.SetFFmpegPath();
+ Resolve().SetFFmpegPath();
Logger.LogInformation("ServerId: {ServerId}", SystemId);
@@ -615,8 +584,6 @@ namespace Emby.Server.Implementations
serviceCollection.AddSingleton();
- serviceCollection.AddSingleton();
-
serviceCollection.AddSingleton();
serviceCollection.AddSingleton();
@@ -659,7 +626,6 @@ namespace Emby.Server.Implementations
var localizationManager = (LocalizationManager)Resolve();
await localizationManager.LoadAll().ConfigureAwait(false);
- _mediaEncoder = Resolve();
_sessionManager = Resolve();
SetStaticProperties();
@@ -670,36 +636,6 @@ namespace Emby.Server.Implementations
FindParts();
}
- public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths)
- {
- // Distinct these to prevent users from reporting problems that aren't actually problems
- var commandLineArgs = Environment
- .GetCommandLineArgs()
- .Distinct();
-
- // Get all relevant environment variables
- var allEnvVars = Environment.GetEnvironmentVariables();
- var relevantEnvVars = new Dictionary