From 67e5287121046949e49dad6656ec0c078f5a7af3 Mon Sep 17 00:00:00 2001 From: Jesse Date: Tue, 29 Oct 2019 15:07:24 +0100 Subject: [PATCH] Added other replacement characters. --- .../Properties/PublishProfiles/Linux.pubxml | 2 +- .../Properties/PublishProfiles/MacOS.pubxml | 2 +- TwilightBoxart/Models/Base/LibRetroRom.cs | 14 +++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/TwilightBoxart.CLI/Properties/PublishProfiles/Linux.pubxml b/TwilightBoxart.CLI/Properties/PublishProfiles/Linux.pubxml index 3ba2281..3607516 100644 --- a/TwilightBoxart.CLI/Properties/PublishProfiles/Linux.pubxml +++ b/TwilightBoxart.CLI/Properties/PublishProfiles/Linux.pubxml @@ -8,7 +8,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Release Any CPU netcoreapp3.0 - bin\Release\linux-x64 + bin\Release\TwilightBoxart-Linux-CLI linux-x64 true diff --git a/TwilightBoxart.CLI/Properties/PublishProfiles/MacOS.pubxml b/TwilightBoxart.CLI/Properties/PublishProfiles/MacOS.pubxml index 7676a89..4c3fbde 100644 --- a/TwilightBoxart.CLI/Properties/PublishProfiles/MacOS.pubxml +++ b/TwilightBoxart.CLI/Properties/PublishProfiles/MacOS.pubxml @@ -8,7 +8,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Release Any CPU netcoreapp3.0 - bin\Release\TwilightBoxart-MacOS.CLI + bin\Release\TwilightBoxart-MacOS-CLI osx-x64 true diff --git a/TwilightBoxart/Models/Base/LibRetroRom.cs b/TwilightBoxart/Models/Base/LibRetroRom.cs index b66a1d1..9199d18 100644 --- a/TwilightBoxart/Models/Base/LibRetroRom.cs +++ b/TwilightBoxart/Models/Base/LibRetroRom.cs @@ -71,8 +71,20 @@ private void Download(ConsoleType consoleType, string name, string targetFile) // We can generate the LibRetro content url based on the NoIntroDb name. var consoleStr = consoleType.GetDescription().Replace(" ", "_"); var url = $"https://github.com/libretro-thumbnails/{consoleStr}/raw/master/Named_Boxarts/"; - name = name.Replace("&", "_"); // Todo: There are probably more replacements going on, search & add them. + + // Found the characters: https://docs.libretro.com/guides/roms-playlists-thumbnails/ + // &*/:`<>?\| + name = name.Replace("&", "_"); + name = name.Replace("*", "_"); name = name.Replace("/", "_"); + name = name.Replace(":", "_"); + name = name.Replace("`", "_"); + name = name.Replace("<", "_"); + name = name.Replace(">", "_"); + name = name.Replace("?", "_"); + name = name.Replace("\\", "_"); + name = name.Replace("|", "_"); + url = FileHelper.CombineUri(url, $"{name}.png"); ImgDownloader.DownloadAndResize(url, targetFile); }