mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
62 lines
1.7 KiB
C#
62 lines
1.7 KiB
C#
using MediaBrowser.Controller.Providers;
|
|
using MediaBrowser.Model.Configuration;
|
|
using MediaBrowser.Model.Users;
|
|
using System;
|
|
using System.Linq;
|
|
using System.Runtime.Serialization;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MediaBrowser.Controller.Entities
|
|
{
|
|
public class PhotoAlbum : Folder, IMetadataContainer
|
|
{
|
|
public override bool SupportsLocalMetadata
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
[IgnoreDataMember]
|
|
public override bool AlwaysScanInternalMetadataPath
|
|
{
|
|
get
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
protected override bool GetBlockUnratedValue(UserPolicy config)
|
|
{
|
|
return config.BlockUnratedItems.Contains(UnratedItem.Other);
|
|
}
|
|
|
|
public async Task RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress<double> progress, CancellationToken cancellationToken)
|
|
{
|
|
var items = GetRecursiveChildren().ToList();
|
|
|
|
var totalItems = items.Count;
|
|
var numComplete = 0;
|
|
|
|
// Refresh songs
|
|
foreach (var item in items)
|
|
{
|
|
cancellationToken.ThrowIfCancellationRequested();
|
|
|
|
await item.RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);
|
|
|
|
numComplete++;
|
|
double percent = numComplete;
|
|
percent /= totalItems;
|
|
progress.Report(percent * 100);
|
|
}
|
|
|
|
// Refresh current item
|
|
await RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);
|
|
|
|
progress.Report(100);
|
|
}
|
|
}
|
|
}
|