Jump to content
  • Announcement

    The HyperSpin 2 early access beta is here!

    We’re starting the first public testing phase with Platinum Members to keep the scope manageable while we test the current feature set and begin to add more. In the future, we’ll provide a version for basic members as well.  On behalf of the entire HyperSpin team, we look forward to another exciting adventure with our community.

Game info found on google?


ninja2bceen

Recommended Posts

  • 4 weeks later...
Posted

Not sure if this requires powershell v4 or 2 but here it is, just point it too a folder of roms that are correctly named (folder must be correctly named too... i.e. Nintendo Game Boy Advance):

[void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

$form = new-object Windows.Forms.Form

$objShell = new-object -com shell.application

$objFolder = $objShell.BrowseForFolder(0,"Title",0,"c:\users\$Env:USERNAME");

Set-Location $objFolder.self.path

$plat = (Get-Item .\).Name

$list = (Get-ChildItem).BaseName

$output = @"

<?xml version="1.0"?>

<menu>

<header>

<listname>$plat</listname>

<lastlistupdate>$(get-date -format "yyyy.MM.dd")</lastlistupdate>

<listversion>1.0</listversion>

<exporterversion>Powershell thegamesdb.net scraper</exporterversion>

</header>

"@

$list.ForEach({

$current = $_ | select-string -Pattern "^.*(?=\()" | %{$_.matches} | %{$_.value}

$pull = Invoke-RestMethod -Method GET -Uri "http://thegamesdb.net/api/GetGame.php?name=$current&platform=$plat"

$info = $pull.Data.Game | select -first 1

$game = @"

<game name="$($_)" index="" image="">

<description>($($info.overview))</description>

<cloneof></cloneof>

<crc></crc>

<manufacturer>$($info.Publisher)</manufacturer>

<year>$(([datetime]$info.ReleaseDate).Year)</year>

<genre>$($info.Genres.genre)</genre>

<rating>$($info.ESRB)</rating>

<enabled>Yes</enabled>

</game>

"@

$output += $game

})

$output += "</menu>"

$output

Posted

As in how do you run it? Or how do you use the information? I'm not sure about what use it would be unless you needed to update your hyperpause info files or you needed to create an a game database xml with just the games you have in folder. To run it you need to put it into a text file and change the extension to .ps1, then open powershell on your computer (windows 7 or up) and run the file, it will ask for the directory your roms are in and then generate the xml output.

Posted

I've updated the script to generate something more like the hyperlaunch game info files.

[void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

$form = new-object Windows.Forms.Form

$objShell = new-object -com shell.application

$objFolder = $objShell.BrowseForFolder(0,"Title",0,"c:\users\$Env:USERNAME");


Set-Location $objFolder.self.path
$plat = (Get-Item .\).Name
$list = (Get-ChildItem).BaseName
$list.ForEach({
$current = $_ | select-string -Pattern "^.*(?=\()" | %{$_.matches} | %{$_.value}
$pull = Invoke-RestMethod -Method GET -Uri "http://thegamesdb.net/api/GetGame.php?name=$current&platform=$plat"
$info = $pull.Data.Game | select -first 1
$game = @"
[$($info.GameTitle)]
Publisher=$($info.Publisher)
Developer=$($info.Developer)
Released=$([datetime]$info.ReleaseDate)
Systems=$($info.Platform)
Genre=$($info.Genres.genre)
Players=$($info.Players)
Rating=$($info.ESRB)
Description=$($info.Overview)
`r`n
"@
$output += $game
})
$output

  • 2 weeks later...
Posted
Can u take a screenshot of what it did? I see the text u are nabbing but trying to figure out what it does, how it displays and where u put the code

Ninja put the script in a text file called script.ps1 open powershell go to the directory it is in and then use the command .\script.ps1 it will prompt for a folder location.

Posted

Hey Derekablackburn....when I try running your script (both of em that you posted)I receive the following error:

Method invocation failed because [system.String] doesn't contain a method named 'ForEach'.

+ $list.ForEach({

+ ~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidOperation: (:) [], RuntimeException

+ FullyQualifiedErrorId : MethodNotFound

Something I can check on my end? (I have a folder that has a couple of text files with names of the games...to simulate a rom folder). I tried usin ps4 and 3....on win x64 system.

Posted
Hey Derekablackburn....when I try running your script (both of em that you posted)I receive the following error:

Method invocation failed because [system.String] doesn't contain a method named 'ForEach'.

+ $list.ForEach({

+ ~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidOperation: (:) [], RuntimeException

+ FullyQualifiedErrorId : MethodNotFound

Something I can check on my end? (I have a folder that has a couple of text files with names of the games...to simulate a rom folder). I tried usin ps4 and 3....on win x64 system.

Run $psversiontable in your powershell prompt, more than likely you are running version 2 you need to run version 4 for this script foreach loops are handled differently between the two versions.

Posted
Run $psversiontable in your powershell prompt, more than likely you are running version 2 you need to run version 4 for this script foreach loops are handled differently between the two versions.

Yeah I tried with version 4 with no luck....same error. I'll Prolly have a look in more detail tonight. Are you importing any other classes beside the Windows forms?

Anyone else having the same issues I'm running into?

Posted
Yeah I tried with version 4 with no luck....same error. I'll Prolly have a look in more detail tonight. Are you importing any other classes beside the Windows forms?

Anyone else having the same issues I'm running into?

The only other reason you would get that error is if you tried to run the script against a folder that didn't have any items in it. In that case there would be no foreach method because you have to have multiple items for the method to be available.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...