file scanner

This commit is contained in:
2026-01-15 17:33:28 -05:00
parent 8fa5612403
commit 023757270a
6 changed files with 254 additions and 11 deletions

View File

@@ -1,6 +1,30 @@
namespace AZKiServer.Services;
using AZKiServer.Models;
public class MediaService
using MongoDB.Driver;
using System.Collections.Frozen;
namespace AZKiServer.Services;
public class MediaService(IMongoDatabase db)
{
public readonly IMongoCollection<MediaEntry> _entries = db.GetCollection<MediaEntry>("media");
public async Task<FrozenSet<string>> GetExistingFilePathsAsync(CancellationToken cancellationToken = default)
{
var files = await _entries.Find("{}").Project(m => m.Filepath).ToListAsync(cancellationToken);
return files.ToFrozenSet();
}
public async Task AddMediaBulkAsync(List<MediaEntry> entries, CancellationToken cancellationToken = default)
{
await _entries.InsertManyAsync(entries, cancellationToken: cancellationToken);
}
public class IndexCreation : BackgroundService
{
protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
throw new NotImplementedException();
}
}
}