Pull media for Playnite from LANCommander server if it exists
parent
82886221fc
commit
739453c8bc
|
@ -235,6 +235,11 @@ namespace LANCommander.PlaynitePlugin
|
|||
return response.Data;
|
||||
}
|
||||
|
||||
public string GetMediaUrl(Media media)
|
||||
{
|
||||
return (new Uri(Client.BaseUrl, $"/api/Media/{media.Id}/Download?fileId={media.FileId}").ToString());
|
||||
}
|
||||
|
||||
public string GetKey(Guid id)
|
||||
{
|
||||
Logger.Trace("Requesting key allocation...");
|
||||
|
|
|
@ -183,6 +183,15 @@ namespace LANCommander.PlaynitePlugin
|
|||
if (manifest.OnlineMultiplayer != null)
|
||||
metadata.Features.Add(new MetadataNameProperty($"Online Multiplayer {manifest.OnlineMultiplayer.GetPlayerCount()}".Trim()));
|
||||
|
||||
if (game.Media.Any(m => m.Type == SDK.Enums.MediaType.Icon))
|
||||
metadata.Icon = new MetadataFile(LANCommander.GetMediaUrl(game.Media.First(m => m.Type == SDK.Enums.MediaType.Icon)));
|
||||
|
||||
if (game.Media.Any(m => m.Type == SDK.Enums.MediaType.Cover))
|
||||
metadata.CoverImage = new MetadataFile(LANCommander.GetMediaUrl(game.Media.First(m => m.Type == SDK.Enums.MediaType.Cover)));
|
||||
|
||||
if (game.Media.Any(m => m.Type == SDK.Enums.MediaType.Background))
|
||||
metadata.BackgroundImage = new MetadataFile(LANCommander.GetMediaUrl(game.Media.First(m => m.Type == SDK.Enums.MediaType.Background)));
|
||||
|
||||
gameMetadata.Add(metadata);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace LANCommander.SDK.Enums
|
||||
{
|
||||
public enum MediaType
|
||||
{
|
||||
Icon,
|
||||
Cover,
|
||||
Background
|
||||
}
|
||||
}
|
|
@ -16,6 +16,7 @@ namespace LANCommander.SDK.Models
|
|||
public virtual Company Developer { get; set; }
|
||||
public virtual IEnumerable<Archive> Archives { get; set; }
|
||||
public virtual IEnumerable<Script> Scripts { get; set; }
|
||||
public virtual IEnumerable<Media> Media { get; set; }
|
||||
public virtual IEnumerable<Redistributable> Redistributables { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
using LANCommander.SDK.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace LANCommander.SDK.Models
|
||||
{
|
||||
public class Media : BaseModel
|
||||
{
|
||||
public Guid FileId { get; set; }
|
||||
public MediaType Type { get; set; }
|
||||
public string SourceUrl { get; set; }
|
||||
public string MimeType { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue