feat: track watch time from playback events
Daily per-user aggregates, counted on the server clock between progress reports. Includes the cleanup task for rows past 90 days.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Jellyfin.Plugin.Herald.Stats;
|
||||
|
||||
/// <summary>
|
||||
/// Persistence for daily watch-time aggregates.
|
||||
/// </summary>
|
||||
public interface IWatchStatsStore
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds increments to the daily aggregates.
|
||||
/// </summary>
|
||||
/// <param name="increments">The increments.</param>
|
||||
void Add(IReadOnlyCollection<WatchIncrement> increments);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the aggregates from a day onwards.
|
||||
/// </summary>
|
||||
/// <param name="from">The first day to include.</param>
|
||||
/// <returns>The aggregates.</returns>
|
||||
IReadOnlyList<DailyWatchStat> GetSince(DateOnly from);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes aggregates older than a day.
|
||||
/// </summary>
|
||||
/// <param name="cutoff">The first day to keep.</param>
|
||||
/// <returns>The number of deleted rows.</returns>
|
||||
int DeleteBefore(DateOnly cutoff);
|
||||
}
|
||||
Reference in New Issue
Block a user