Adding a game now immediately provides a dialog to lookup a game through metadata providers. Selecting a result will create the game with the populated metadata. An additional option of automatically downloading art (icon, cover, background, logo) is also provided, though may be inaccurate and completely up to the results of the provider.
115 lines
No EOL
4 KiB
C#
115 lines
No EOL
4 KiB
C#
using Humanizer.Bytes;
|
|
using LANCommander.SDK.Enums;
|
|
|
|
namespace LANCommander.Server.Settings.Models;
|
|
|
|
public class MediaSettings
|
|
{
|
|
public string SteamGridDbApiKey { get; set; } = String.Empty;
|
|
public bool AutoDownloadMedia { get; set; } = false;
|
|
|
|
public IEnumerable<MediaTypeSettings> MediaTypes { get; set; } =
|
|
[
|
|
new()
|
|
{
|
|
Type = MediaType.Icon,
|
|
MaxFileSize = 2 * ByteSize.BytesInMegabyte,
|
|
Thumbnails = new MediaTypeThumbnailSettings
|
|
{
|
|
MinSize = new ThumbnailSize(32, 32),
|
|
MaxSize = new ThumbnailSize(128, 128),
|
|
}
|
|
},
|
|
new()
|
|
{
|
|
Type = MediaType.Cover,
|
|
MaxFileSize = 50 * ByteSize.BytesInMegabyte,
|
|
Thumbnails = new MediaTypeThumbnailSettings
|
|
{
|
|
MinSize = new ThumbnailSize(240, 360),
|
|
MaxSize = new ThumbnailSize(600, 900),
|
|
}
|
|
},
|
|
new()
|
|
{
|
|
Type = MediaType.Background,
|
|
MaxFileSize = 8 * ByteSize.BytesInMegabyte,
|
|
Thumbnails = new MediaTypeThumbnailSettings
|
|
{
|
|
MinSize = new ThumbnailSize(690, 310),
|
|
MaxSize = new ThumbnailSize(3840, 1240),
|
|
}
|
|
},
|
|
new()
|
|
{
|
|
Type = MediaType.Avatar,
|
|
MaxFileSize = 2 * ByteSize.BytesInMegabyte,
|
|
Thumbnails = new MediaTypeThumbnailSettings
|
|
{
|
|
MinSize = new ThumbnailSize(64, 64),
|
|
MaxSize = new ThumbnailSize(256, 256),
|
|
}
|
|
},
|
|
new()
|
|
{
|
|
Type = MediaType.Logo,
|
|
MaxFileSize = 4 * ByteSize.BytesInMegabyte,
|
|
Thumbnails = new MediaTypeThumbnailSettings
|
|
{
|
|
MinSize = new ThumbnailSize(400, 400),
|
|
MaxSize = new ThumbnailSize(1000, 1000),
|
|
}
|
|
},
|
|
new()
|
|
{
|
|
Type = MediaType.Manual,
|
|
MaxFileSize = 4 * ByteSize.BytesInMegabyte,
|
|
Thumbnails = new MediaTypeThumbnailSettings
|
|
{
|
|
MinSize = new ThumbnailSize(240, 360),
|
|
MaxSize = new ThumbnailSize(600, 900),
|
|
}
|
|
},
|
|
new()
|
|
{
|
|
Type = MediaType.PageImage,
|
|
MaxFileSize = 4 * ByteSize.BytesInMegabyte,
|
|
Thumbnails = new MediaTypeThumbnailSettings
|
|
{
|
|
MinSize = new ThumbnailSize(480, 480),
|
|
MaxSize = new ThumbnailSize(1920, 1920),
|
|
}
|
|
},
|
|
new()
|
|
{
|
|
Type = MediaType.Grid,
|
|
MaxFileSize = 6 * ByteSize.BytesInMegabyte,
|
|
Thumbnails = new MediaTypeThumbnailSettings
|
|
{
|
|
MinSize = new ThumbnailSize(460, 215),
|
|
MaxSize = new ThumbnailSize(920, 430),
|
|
}
|
|
},
|
|
new()
|
|
{
|
|
Type = MediaType.Screenshot,
|
|
MaxFileSize = 8 * ByteSize.BytesInMegabyte,
|
|
Thumbnails = new MediaTypeThumbnailSettings
|
|
{
|
|
MinSize = new ThumbnailSize(480, 270),
|
|
MaxSize = new ThumbnailSize(1920, 1080),
|
|
}
|
|
},
|
|
new()
|
|
{
|
|
Type = MediaType.Video,
|
|
MaxFileSize = 500 * ByteSize.BytesInMegabyte,
|
|
Thumbnails = new MediaTypeThumbnailSettings
|
|
{
|
|
Enabled = false
|
|
}
|
|
},
|
|
];
|
|
|
|
public MediaTypeSettings? GetMediaTypeConfig(MediaType type) => MediaTypes.FirstOrDefault(x => x.Type == type);
|
|
} |