Easy way to add video and marquees tags in your gamelist for video support.



  • @ebtalk Please can you post here the code on your videofix.ps1?



  • $doc = [xml] (Get-Content -raw gamelist.xml)
    
    foreach ($gameEl in $doc.DocumentElement.game) { 
      # Use -replace to extract the filename without extension from the 
      # path contained in the <path> element.
      $gameName = $gameEl.path -replace '^.*/([^.]+)\..*$', '$1'
      # Append elements 'video' and 'marquee', but only if they don't already
      # exist.
       if ($null -eq $gameEl.video) {
        $gameEl.AppendChild($doc.CreateElement('video')).InnerText = "~/.emulationstation/roms/gbc/snap/${gameName}.mp4"
      }
      if ($null -eq $gameEl.marquee) {
        $gameEl.AppendChild($doc.CreateElement('marquee')).InnerText = "~/.emulationstation/roms/gbc/marquee/${gameName}.png"
      }
    }
    
    
    $writer = [System.IO.StreamWriter] "$PWD/newFile.xml"
    $doc.Save($writer)
    $writer.Close()
    


  • @ebtalk Seems the code it's ok, i think the problem it's because the double back slash in the path you are trying to save, try to do it in another folder that not contains double back slash "//" in their path.



  • @Nismo Where is the double backslash. I don't see it in the code.

    All my roms are in folders within:

    \RETROPIE\roms\ when i'm viewing from my PC

    so there's \RETROPIE\roms\mastersystem which worked
    then \RETROPIE\roms\gbc - didn't work
    \RETROPIE\roms\atari7800 - didn't work



  • @Nismo in the following code: $writer = [System.IO.StreamWriter] "$PWD/newFile.xml"

    I took out $PWD and it worked.



  • @ebtalk I told you, it's because your folder path where you are trying to save the newFile.xml conflicts.

    The double back slash is not in the code, it's on your path. See the image with the error you send to me before.

    Anyway your solution it's working.

    I have edit the first post with new code so you don't need to edit path if you have videos and marquees folders inside your roms folder.

    I also removed $PWD to avoid path errors.



  • @ebtalk I edited the code, now the "missing characters after dot" bug it's fixed.



  • @Nismo Would love to add these to my repertoire and tend to do this (mostly) manually, so I appreciate this tool.

    Do y'all have a theme that you recommend? I've never downloaded a theme from github as I'm not sure how. I've only ever done it from the RetroPie Menu.



  • Where and what do I add if I want to rename the gamelist.xml to oldgamelist.xml at the end of the script and then save the newfile.xml to gamelist.xml?

    Also, I run into a problem with all my videos and marquees being in the arcade folder instead, but all the fba games are in their respective folder (/home/pi/RetroPie/roms/fba/". I suppose I could add the full path to that script before I run it... is the correct syntax "~/home/pi/RetroPie/roms/arcade/snap/${gameName}.mp4"? Is there a better way of doing it?

    I'm kind of new to file paths in linux and powershell scripts. Thanks!



  • @alaindesjardins Fixed the code in first post to fix the changes you requested about renaming previous gamelist to oldgamelist and newfile it's now gamelist.xml.

    About the path, yes, that's the way to change the path.

    Regards.


Log in to reply
 

Looks like your connection to RetroPie Forum was lost, please wait while we try to reconnect.