Jump to content
LaunchBox Community Forums

Launchbox media export to Batocera


Recommended Posts

 I roughed up a proof of concept for exporting launchbox style media to a batocera installation.  It's just something to play around with I guess.

 This POC copied video files, renamed them appropriately and generated a new game list xml.

 There are going to be limitations, but it certainly beats downloading gigs of data again through very slow scrapers.

$imgsourcedir = "D:\Launchbox\Images\Sammy Atomiswave"
$vidsourcedir = "D:\Launchbox\Videos\Sammy Atomiswave"

$destdir = "Z:\roms\atomiswave"


[xml]$xml = Get-Content $destdir\gamelist.xml

$xml.gameList.game | ForEach-Object {

$name = $_.name
write-host "Game: " $name

$videos = dir $vidsourcedir -Recurse

$firstvid = $null
$firstvid = $videos | Where-Object {$_.name -match $name} | select -first 1

if ($firstvid -ne $null) {
write-host "Video Found: " $firstvid.name

$startchar = "/"
$endchar = "."
$pattern = @"
(?<=\$StartChar).+?(?=\$EndChar)
"@

$newvidname = [regex]::Matches($_.path, $pattern).Value + "-video" + $firstvid.Extension
$firstvid | Copy-Item -Destination ($destdir + "\videos\$newvidname")

$newvideoelement = $_.AppendChild($xml.CreateElement("video"))
$newvideoelement.AppendChild($xml.CreateTextNode('./videos/' + $newvidname)) | Out-Null

}
}


$xml.save("$destdir\gamelist.xml")

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...