mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
34 lines
789 B
C#
34 lines
789 B
C#
using MediaBrowser.Model.Dto;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace MediaBrowser.Controller.Entities
|
|
{
|
|
/// <summary>
|
|
/// Marker interface
|
|
/// </summary>
|
|
public interface IItemByName
|
|
{
|
|
Dictionary<Guid, ItemByNameCounts> UserItemCounts { get; set; }
|
|
}
|
|
|
|
public static class IItemByNameExtensions
|
|
{
|
|
public static ItemByNameCounts GetItemByNameCounts(this IItemByName item, User user)
|
|
{
|
|
if (user == null)
|
|
{
|
|
throw new ArgumentNullException("user");
|
|
}
|
|
|
|
ItemByNameCounts counts;
|
|
|
|
if (item.UserItemCounts.TryGetValue(user.Id, out counts))
|
|
{
|
|
return counts;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
}
|