jellyfin/MediaBrowser.Providers/UserRootFolderNameProvider.cs

43 lines
1.3 KiB
C#
Raw Normal View History

2013-11-28 18:27:29 +00:00
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Logging;
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Providers
{
public class UserRootFolderNameProvider : BaseMetadataProvider
{
public UserRootFolderNameProvider(ILogManager logManager, IServerConfigurationManager configurationManager)
: base(logManager, configurationManager)
{
}
public override bool Supports(BaseItem item)
{
return item is UserRootFolder;
}
2013-12-06 20:07:34 +00:00
public override Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
2013-11-28 18:27:29 +00:00
{
var parentName = Path.GetFileNameWithoutExtension(item.Path);
if (string.Equals(parentName, "default", StringComparison.OrdinalIgnoreCase))
{
item.Name = "Media Library";
}
2013-12-06 20:07:34 +00:00
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
2013-11-28 18:27:29 +00:00
return TrueTaskResult;
}
public override MetadataProviderPriority Priority
{
get { return MetadataProviderPriority.First; }
}
}
}