jellyfin/MediaBrowser.Controller/Dto/DtoOptions.cs

54 lines
1.6 KiB
C#
Raw Normal View History

2014-11-30 12:01:33 -07:00
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
2014-12-26 22:08:39 -07:00
using System;
2014-11-30 12:01:33 -07:00
using System.Collections.Generic;
2014-12-26 22:08:39 -07:00
using System.Linq;
2014-11-30 12:01:33 -07:00
2015-01-03 12:38:22 -07:00
namespace MediaBrowser.Controller.Dto
2014-11-30 12:01:33 -07:00
{
public class DtoOptions
{
2014-12-26 22:08:39 -07:00
private static readonly List<ItemFields> DefaultExcludedFields = new List<ItemFields>
{
ItemFields.SeasonUserData
};
2014-11-30 12:01:33 -07:00
public List<ItemFields> Fields { get; set; }
public List<ImageType> ImageTypes { get; set; }
public int ImageTypeLimit { get; set; }
public bool EnableImages { get; set; }
2016-03-21 23:49:36 -07:00
public bool AddProgramRecordingInfo { get; set; }
2015-01-24 12:03:55 -07:00
public string DeviceId { get; set; }
2016-08-17 12:28:43 -07:00
public bool EnableUserData { get; set; }
public bool AddCurrentProgram { get; set; }
2014-11-30 12:01:33 -07:00
public DtoOptions()
{
Fields = new List<ItemFields>();
ImageTypeLimit = int.MaxValue;
EnableImages = true;
2016-08-17 12:28:43 -07:00
EnableUserData = true;
AddCurrentProgram = true;
2014-12-26 22:08:39 -07:00
Fields = Enum.GetNames(typeof (ItemFields))
.Select(i => (ItemFields) Enum.Parse(typeof (ItemFields), i, true))
.Except(DefaultExcludedFields)
.ToList();
ImageTypes = Enum.GetNames(typeof(ImageType))
.Select(i => (ImageType)Enum.Parse(typeof(ImageType), i, true))
.ToList();
2014-11-30 12:01:33 -07:00
}
public int GetImageLimit(ImageType type)
{
if (EnableImages && ImageTypes.Contains(type))
{
return ImageTypeLimit;
}
return 0;
}
}
}