You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/src/Lidarr.Api.V1/Artist/ArtistStatisticsResource.cs

47 lines
1.2 KiB

using NzbDrone.Core.ArtistStats;
namespace Lidarr.Api.V1.Artist
{
public class ArtistStatisticsResource
{
public int AlbumCount { get; set; }
public int TrackFileCount { get; set; }
public int TrackCount { get; set; }
public int TotalTrackCount { get; set; }
public long SizeOnDisk { get; set; }
public decimal PercentOfTracks
{
get
{
if (TrackCount == 0)
{
return 0;
}
return TrackFileCount / (decimal)TrackCount * 100;
}
}
}
public static class ArtistStatisticsResourceMapper
{
public static ArtistStatisticsResource ToResource(this ArtistStatistics model)
{
if (model == null)
{
return null;
}
return new ArtistStatisticsResource
{
AlbumCount = model.AlbumCount,
TrackFileCount = model.TrackFileCount,
TrackCount = model.TrackCount,
TotalTrackCount = model.TotalTrackCount,
SizeOnDisk = model.SizeOnDisk
};
}
}
}