mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Renamed watched to played (since we support audio)
This commit is contained in:
parent
874469d476
commit
f392de9b69
@ -38,6 +38,7 @@ namespace MediaBrowser.Api
|
|||||||
dto.HasPrimaryImage = !string.IsNullOrEmpty(item.LogoImagePath);
|
dto.HasPrimaryImage = !string.IsNullOrEmpty(item.LogoImagePath);
|
||||||
dto.HasThumb = !string.IsNullOrEmpty(item.ThumbnailImagePath);
|
dto.HasThumb = !string.IsNullOrEmpty(item.ThumbnailImagePath);
|
||||||
dto.Id = item.Id;
|
dto.Id = item.Id;
|
||||||
|
dto.IsRecentlyAdded = item.IsRecentlyAdded(user);
|
||||||
dto.IndexNumber = item.IndexNumber;
|
dto.IndexNumber = item.IndexNumber;
|
||||||
dto.IsFolder = item is Folder;
|
dto.IsFolder = item is Folder;
|
||||||
dto.LocalTrailerCount = item.LocalTrailers == null ? 0 : item.LocalTrailers.Count();
|
dto.LocalTrailerCount = item.LocalTrailers == null ? 0 : item.LocalTrailers.Count();
|
||||||
|
@ -96,5 +96,7 @@ namespace MediaBrowser.Model.DTO
|
|||||||
{
|
{
|
||||||
return Type.Equals(type, StringComparison.OrdinalIgnoreCase);
|
return Type.Equals(type, StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsRecentlyAdded { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,5 +130,13 @@ namespace MediaBrowser.Model.Entities
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if the item is considered new based on user settings
|
||||||
|
/// </summary>
|
||||||
|
public bool IsRecentlyAdded(User user)
|
||||||
|
{
|
||||||
|
return (DateTime.Now - DateCreated).TotalDays < user.RecentItemDays;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ namespace MediaBrowser.Model.Entities
|
|||||||
counts.RecentlyAddedItemCount = GetRecentlyAddedItems(recursiveChildren, user).Count();
|
counts.RecentlyAddedItemCount = GetRecentlyAddedItems(recursiveChildren, user).Count();
|
||||||
counts.RecentlyAddedUnPlayedItemCount = GetRecentlyAddedUnplayedItems(recursiveChildren, user).Count();
|
counts.RecentlyAddedUnPlayedItemCount = GetRecentlyAddedUnplayedItems(recursiveChildren, user).Count();
|
||||||
counts.InProgressItemCount = GetInProgressItems(recursiveChildren, user).Count();
|
counts.InProgressItemCount = GetInProgressItems(recursiveChildren, user).Count();
|
||||||
counts.WatchedPercentage = GetWatchedPercentage(recursiveChildren, user);
|
counts.PlayedPercentage = GetPlayedPercentage(recursiveChildren, user);
|
||||||
|
|
||||||
return counts;
|
return counts;
|
||||||
}
|
}
|
||||||
@ -139,9 +139,7 @@ namespace MediaBrowser.Model.Entities
|
|||||||
|
|
||||||
private static IEnumerable<BaseItem> GetRecentlyAddedItems(IEnumerable<BaseItem> itemSet, User user)
|
private static IEnumerable<BaseItem> GetRecentlyAddedItems(IEnumerable<BaseItem> itemSet, User user)
|
||||||
{
|
{
|
||||||
DateTime now = DateTime.Now;
|
return itemSet.Where(i => !(i is Folder) && i.IsRecentlyAdded(user));
|
||||||
|
|
||||||
return itemSet.Where(i => !(i is Folder) && (now - i.DateCreated).TotalDays < user.RecentItemDays);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<BaseItem> GetRecentlyAddedUnplayedItems(IEnumerable<BaseItem> itemSet, User user)
|
private static IEnumerable<BaseItem> GetRecentlyAddedUnplayedItems(IEnumerable<BaseItem> itemSet, User user)
|
||||||
@ -169,7 +167,7 @@ namespace MediaBrowser.Model.Entities
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static decimal GetWatchedPercentage(IEnumerable<BaseItem> itemSet, User user)
|
private static decimal GetPlayedPercentage(IEnumerable<BaseItem> itemSet, User user)
|
||||||
{
|
{
|
||||||
itemSet = itemSet.Where(i => !(i is Folder));
|
itemSet = itemSet.Where(i => !(i is Folder));
|
||||||
|
|
||||||
@ -203,7 +201,7 @@ namespace MediaBrowser.Model.Entities
|
|||||||
|
|
||||||
return totalPercent / itemSet.Count();
|
return totalPercent / itemSet.Count();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Finds an item by ID, recursively
|
/// Finds an item by ID, recursively
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -9,6 +9,6 @@ namespace MediaBrowser.Model.Entities
|
|||||||
public int RecentlyAddedItemCount { get; set; }
|
public int RecentlyAddedItemCount { get; set; }
|
||||||
public int RecentlyAddedUnPlayedItemCount { get; set; }
|
public int RecentlyAddedUnPlayedItemCount { get; set; }
|
||||||
public int InProgressItemCount { get; set; }
|
public int InProgressItemCount { get; set; }
|
||||||
public decimal WatchedPercentage { get; set; }
|
public decimal PlayedPercentage { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user