Skip to content

Commit

Permalink
Added other replacement characters.
Browse files Browse the repository at this point in the history
  • Loading branch information
KirovAir committed Oct 29, 2019
1 parent f383c59 commit 67e5287
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion TwilightBoxart.CLI/Properties/PublishProfiles/Linux.pubxml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<TargetFramework>netcoreapp3.0</TargetFramework>
<PublishDir>bin\Release\linux-x64</PublishDir>
<PublishDir>bin\Release\TwilightBoxart-Linux-CLI</PublishDir>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion TwilightBoxart.CLI/Properties/PublishProfiles/MacOS.pubxml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<TargetFramework>netcoreapp3.0</TargetFramework>
<PublishDir>bin\Release\TwilightBoxart-MacOS.CLI</PublishDir>
<PublishDir>bin\Release\TwilightBoxart-MacOS-CLI</PublishDir>
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
</PropertyGroup>
Expand Down
14 changes: 13 additions & 1 deletion TwilightBoxart/Models/Base/LibRetroRom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 67e5287

Please sign in to comment.