/*
* Jellyfin.Plugin.Webdav
* Copyright (C) 2025 Jellyfin contributors
* Licensed under GPLv3
*/
namespace Jellyfin.Plugin.Webdav
{
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Configuration;
using Microsoft.Extensions.Hosting;
///
/// Hosted service that registers the WebDAV cache as a virtual folder on startup.
///
public class WebDavHostedService : IHostedService
{
private readonly ILibraryManager _libraryManager;
///
/// Initializes a new instance of the class.
///
/// The library manager.
public WebDavHostedService(ILibraryManager libraryManager)
{
_libraryManager = libraryManager;
}
///
public async Task StartAsync(CancellationToken cancellationToken)
{
var options = new LibraryOptions();
await _libraryManager.AddVirtualFolder("WebDAV", null, options, true).ConfigureAwait(false);
}
///
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
}
}