Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions GameBrowser/Configuration/configPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ <h3 style="display: inline-block; vertical-align: middle; margin-left: 5px;">

html += '<div class="selectContainer">';
html += '<select class="selectGameSystem" is="emby-select" label="Game system:">';

// TODO Find a way to get acces to GameSystemDefinition.All to fill this list.
// for (var i = 0; i < config.GameSystemDefinitions.length; i++) {
// var definition = config.GameSystemDefinition[i];
// html += '<option value="' + definition.Name + '">' + definition.ConsoleType + '</option>';
// }
html += '<option value="3DO">3DO</option>\
<option value="Amiga">Amiga</option>\
<option value="Arcade">Arcade</option>\
Expand All @@ -151,6 +157,8 @@ <h3 style="display: inline-block; vertical-align: middle; margin-left: 5px;">
<option value="Atari 7800">Atari 7800</option>\
<option value="Atari Jaguar">Atari Jaguar</option>\
<option value="Atari Jaguar CD">Atari Jaguar CD</option>\
<option value="Atari Lynx">Atari Lynx</option>\
<option value="Atari ST">Atari ST</option>\
<option value="Atari XE">Atari XE</option>\
<option value="Colecovision">Colecovision</option>\
<option value="Commodore 64">Commodore 64</option>\
Expand All @@ -161,6 +169,8 @@ <h3 style="display: inline-block; vertical-align: middle; margin-left: 5px;">
<option value="Xbox 360">Microsoft XBox 360</option>\
<option value="Xbox One">Microsoft XBox One</option>\
<option value="Neo Geo">Neo-Geo</option>\
<option value="Neo Geo Pocket">Neo-Geo Pocket</option>\
<option value="Neo Geo Pocket Color">Neo-Geo Pocket Color</option>\
<option value="Nintendo 64">Nintendo 64</option>\
<option value="Nintendo DS">Nintendo DS</option>\
<option value="Game Boy">Nintendo Game Boy</option>\
Expand Down
4 changes: 4 additions & 0 deletions GameBrowser/GameBrowser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@
<PackageReference Include="mediabrowser.server.core" Version="3.3.20" />
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /y &quot;$(targetdir)&quot; &quot;%APPDATA%\Emby-Server\plugins&quot;&#xD;&#xA;" />
</Target>

</Project>
8 changes: 8 additions & 0 deletions GameBrowser/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"profiles": {
"GameBrowser": {
"commandName": "Executable",
"executablePath": "%APPDATA%\\Emby-Server\\system\\EmbyServer.exe"
}
}
}
3 changes: 2 additions & 1 deletion GameBrowser/Providers/CustomGameProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public Task<ItemUpdateType> FetchAsync(Game item, MetadataRefreshOptions options

if (!string.IsNullOrEmpty(platform))
{
item.GameSystem = ResolverHelper.GetGameSystemFromPlatform(platform);
item.GameSystem = ResolverHelper.GetExtendedInfoFromPlatform(platform)?.Name;

result = _cachedResultWithUpdate;
}
}
Expand Down
243 changes: 22 additions & 221 deletions GameBrowser/Providers/EmuMovies/EmuMoviesImageProvider.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
using MediaBrowser.Common.Net;
using GameBrowser.Resolvers;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Providers;
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using System.Net;

namespace GameBrowser.Providers.EmuMovies
{
Expand Down Expand Up @@ -53,14 +54,26 @@ public Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, ImageType ima

switch (imageType)
{
case ImageType.Box:
case ImageType.Backdrop:
return FetchImages(game, EmuMoviesMediaTypes.Cabinet, imageType, cancellationToken);
case ImageType.Screenshot:
return FetchImages(game, EmuMoviesMediaTypes.Snap, imageType, cancellationToken);
case ImageType.Banner:
return FetchImages(game, EmuMoviesMediaTypes.Banner, imageType, cancellationToken);
case ImageType.Primary:
return FetchImages(game, EmuMoviesMediaTypes.Box, imageType, cancellationToken);
case ImageType.BoxRear:
return FetchImages(game, EmuMoviesMediaTypes.BoxBack, imageType, cancellationToken);
case ImageType.Disc:
return FetchImages(game, EmuMoviesMediaTypes.Cart, imageType, cancellationToken);
case ImageType.Menu:
return FetchImages(game, EmuMoviesMediaTypes.Title, imageType, cancellationToken);
case ImageType.Screenshot:
return FetchImages(game, EmuMoviesMediaTypes.Snap, imageType, cancellationToken);

case ImageType.Art:
case ImageType.Box:
case ImageType.Logo:
case ImageType.Thumb:
case ImageType.Chapter:
default:
throw new ArgumentException("Unrecognized image type");
}
Expand All @@ -82,7 +95,9 @@ private async Task<IEnumerable<RemoteImageInfo>> FetchImages(Game game, EmuMovie

if (sessionId == null) return list;

var url = string.Format(EmuMoviesUrls.Search, WebUtility.UrlEncode(game.Name), GetEmuMoviesPlatformFromGameSystem(game.GameSystem), mediaType, sessionId);
var emuMoviesPlatform = ResolverHelper.GetExtendedInfoFromGameSystem(game.GameSystem)?.EmuMoviesPlatform;
if (string.IsNullOrEmpty(emuMoviesPlatform)) return list;
var url = string.Format(EmuMoviesUrls.Search, WebUtility.UrlEncode(game.Name), emuMoviesPlatform, mediaType, sessionId);

using (var response = await _httpClient.SendAsync(new HttpRequestOptions
{
Expand Down Expand Up @@ -130,223 +145,9 @@ private async Task<IEnumerable<RemoteImageInfo>> FetchImages(Game game, EmuMovie
return list;
}

private string GetEmuMoviesPlatformFromGameSystem(string platform)
{
string emuMoviesPlatform = null;

switch (platform)
{
case "3DO":
emuMoviesPlatform = "Panasonic_3DO";

break;

case "Amiga":
emuMoviesPlatform = "";

break;

case "Arcade":
emuMoviesPlatform = "MAME";

break;

case "Atari 2600":
emuMoviesPlatform = "Atari_2600";

break;

case "Atari 5200":
emuMoviesPlatform = "Atari_5200";

break;

case "Atari 7800":
emuMoviesPlatform = "Atari_7800";

break;

case "Atari XE":
emuMoviesPlatform = "Atari_8_bit";

break;

case "Atari Jaguar":
emuMoviesPlatform = "Atari_Jaguar";

break;

case "Atari Jaguar CD":
emuMoviesPlatform = "Atari_Jaguar";

break;

case "Colecovision":
emuMoviesPlatform = "Coleco_Vision";

break;

case "Commodore 64":
emuMoviesPlatform = "Commodore_64";

break;

case "Commodore Vic-20":
emuMoviesPlatform = "";

break;

case "Intellivision":
emuMoviesPlatform = "Mattel_Intellivision";

break;

case "Xbox":
emuMoviesPlatform = "Microsoft_Xbox";

break;

case "Neo Geo":
emuMoviesPlatform = "SNK_Neo_Geo_AES";

break;

case "Nintendo 64":
emuMoviesPlatform = "Nintendo_N64";

break;

case "Nintendo DS":
emuMoviesPlatform = "Nintendo_DS";

break;

case "Nintendo":
emuMoviesPlatform = "Nintendo_NES";

break;

case "Game Boy":
emuMoviesPlatform = "Nintendo_Game_Boy";

break;

case "Game Boy Advance":
emuMoviesPlatform = "Nintendo_Game_Boy_Advance";

break;

case "Game Boy Color":
emuMoviesPlatform = "Nintendo_Game_Boy_Color";

break;

case "Gamecube":
emuMoviesPlatform = "Nintendo_GameCube";

break;

case "Super Nintendo":
emuMoviesPlatform = "Nintendo_SNES";

break;

case "Virtual Boy":
emuMoviesPlatform = "";

break;

case "Nintendo Wii":
emuMoviesPlatform = "";

break;

case "DOS":
emuMoviesPlatform = "";

break;

case "Windows":
emuMoviesPlatform = "";

break;

case "Sega 32X":
emuMoviesPlatform = "Sega_Genesis";

break;

case "Sega CD":
emuMoviesPlatform = "Sega_Genesis";

break;

case "Dreamcast":
emuMoviesPlatform = "Sega_Dreamcast";

break;

case "Game Gear":
emuMoviesPlatform = "Sega_Game_Gear";

break;

case "Sega Genesis":
emuMoviesPlatform = "Sega_Genesis";

break;

case "Sega Master System":
emuMoviesPlatform = "Sega_Master_System";

break;

case "Sega Mega Drive":
emuMoviesPlatform = "Sega_Genesis";

break;

case "Sega Saturn":
emuMoviesPlatform = "Sega_Saturn";

break;

case "Sony Playstation":
emuMoviesPlatform = "Sony_Playstation";

break;

case "PS2":
emuMoviesPlatform = "Sony_Playstation_2";

break;

case "PSP":
emuMoviesPlatform = "Sony_PSP";

break;

case "TurboGrafx 16":
emuMoviesPlatform = "NEC_TurboGrafx_16";

break;

case "TurboGrafx CD":
emuMoviesPlatform = "NEC_TurboGrafx_16";
break;

case "ZX Spectrum":
emuMoviesPlatform = "";
break;
}

return emuMoviesPlatform;

}

public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
{
return new[] { ImageType.Box, ImageType.Disc, ImageType.Screenshot, ImageType.Menu };
return new[] { ImageType.Primary, ImageType.Backdrop, ImageType.Banner, ImageType.BoxRear, ImageType.Disc, ImageType.Menu, ImageType.Screenshot };
}

public string Name
Expand Down
3 changes: 3 additions & 0 deletions GameBrowser/Providers/EmuMovies/EmuMoviesMediaTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
{
enum EmuMoviesMediaTypes
{
Banner,
Box,
BoxBack,
Cabinet,
Cart,
Snap,
Expand Down
Loading