RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

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

    Scheduled Pinned Locked Moved Ideas and Development
    videogamelistmarquees
    40 Posts 12 Posters 27.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      ebtalk @Nismo
      last edited by

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

      I took out $PWD and it worked.

      N 2 Replies Last reply Reply Quote 0
      • N
        Nismo @ebtalk
        last edited by Nismo

        @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.

        1 Reply Last reply Reply Quote 0
        • N
          Nismo @ebtalk
          last edited by Nismo

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

          hooperreH 1 Reply Last reply Reply Quote 1
          • hooperreH
            hooperre @Nismo
            last edited by

            @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.

            4B ~ RPi PSU 5.1V / 3.0A ~ 32GB SanDisk microSD ~ 128GB USB

            1 Reply Last reply Reply Quote 0
            • A
              alaindesjardins
              last edited by

              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!

              N 1 Reply Last reply Reply Quote 0
              • N
                Nismo @alaindesjardins
                last edited by

                @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.

                1 Reply Last reply Reply Quote 0
                • A
                  alaindesjardins
                  last edited by

                  I don't know if you can look at the comparison differences but It's changing the output format of the scrapers and as you can see it doesn't seem to keep things proper. I would expect it to only add the video and marquee line but it's doing much more than that.

                  I suppose I can load it up and see if it makes a difference in how it displays everything in emulation station but, is there another way of doing it so it doesn't screw up the whole formatting?

                  1 Reply Last reply Reply Quote 0
                  • A
                    alaindesjardins
                    last edited by

                    I would expect it to look like this if that makes sense. The lines added have a blue dot on the line number.

                    N 1 Reply Last reply Reply Quote 0
                    • N
                      Nismo @alaindesjardins
                      last edited by Nismo

                      @alaindesjardins I don't see the differences, what's the problem if the xml works ok?

                      I see the new gamelist.xml more clean...

                      1 Reply Last reply Reply Quote 0
                      • A
                        alaindesjardins
                        last edited by

                        Yeah, I won't worry about it. My OCD targets the fact that the description is all different because the formatting it all screwed up after I run the powershell script.

                        I'll try not to look at it, I just wish there was an easier way to append the <video> and <marquee> lines without changing the rest. Maybe I'll see if the sselph scraper can add that data in or request it be worked in. I just figured out how to scrape using sselph scraper and my own images/artwork so I was able to generate a gamelist.xml with metadata. Adding the videos and wheel art was the only thing left which your script does.

                        Thanks!

                        N 1 Reply Last reply Reply Quote 0
                        • N
                          Nismo @alaindesjardins
                          last edited by

                          @alaindesjardins I don't know a easiest way to do it. Sorry maybe it's a stupid question but what is OCD?

                          1 Reply Last reply Reply Quote 0
                          • A
                            alaindesjardins
                            last edited by

                            Obsessive Compulsive Disorder, for me its like having a stack of money and making sure all the bills are facing the same instead of just folding them all and putting them in my wallet. I'm sure there are better examples but that's all I can come up with right now.

                            N 1 Reply Last reply Reply Quote 0
                            • N
                              Nismo @alaindesjardins
                              last edited by

                              @alaindesjardins I know what is Obsessive Compulsive Disorder, but my native language it's not english so when I have read OCD I didn't think it was that.

                              So now I understand you much better, and why you want that "issue" fixed.

                              I'm sorry I can not help you.

                              Regards.

                              1 Reply Last reply Reply Quote 0
                              • D
                                duiz
                                last edited by

                                I'm not getting this to work unfortunately. I followed each step in the first post but powershell gives me this in return

                                "C:\Users\duiz.emulationstation\addvideos\addvideomarquees.ps1 : File C:\Users\duiz.emulationstation\addvideos\addvide
                                omarquees.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Exec
                                ution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
                                At line:1 char:1

                                • C:\Users\duiz.emulationstation\addvideos\addvideomarquees.ps1
                                •   + CategoryInfo          : SecurityError: (:) [], PSSecurityException
                                    + FullyQualifiedErrorId : UnauthorizedAccess"
                                  
                                  

                                My ps1 file looks like this
                                $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 = "./videos/${gameName}.mp4"
                                }
                                if ($null -eq $gameEl.marquee) {
                                $gameEl.AppendChild($doc.CreateElement('marquee')).InnerText = "./marquees/${gameName}.png"
                                }
                                }
                                rename-item gamelist.xml -newname oldgamelist.xml
                                $writer = [System.IO.StreamWriter] "gamelist.xml"
                                $doc.Save($writer)
                                $writer.Close()

                                N 1 Reply Last reply Reply Quote 0
                                • N
                                  Nismo @duiz
                                  last edited by Nismo

                                  @duiz Try this:

                                  1- Open a text document and place this inside:

                                  powershell -ExecutionPolicy ByPass -File addvideomarquees.ps1
                                  

                                  Make sure the name of .ps1 file is the same than in the code above and save changes.

                                  2- Rename the .txt extension to .bat

                                  3- Place it in the same folder than addvideomarquees.ps1 and do right click on the .bat file and select " exec as administrator".

                                  Tell me if it works. I hope so.

                                  D 1 Reply Last reply Reply Quote 0
                                  • D
                                    duiz @Nismo
                                    last edited by

                                    @Nismo It worked! Thanks! Now everything adds perfectly

                                    N 1 Reply Last reply Reply Quote 0
                                    • N
                                      Nismo @duiz
                                      last edited by Nismo

                                      @duiz Nice, I'm glad to help. I'll add this to the first post.

                                      1 Reply Last reply Reply Quote 0
                                      • matchamanM
                                        matchaman
                                        last edited by matchaman

                                        On Windows 7 I used your latest edit of the code and I'm getting this:

                                        0_1491298204122_error.jpg

                                        I tried on several different folders and it didn't work, the path is on F:\SNES 852, no "funny" characters.

                                        N 1 Reply Last reply Reply Quote 0
                                        • N
                                          Nismo @matchaman
                                          last edited by

                                          @matchaman
                                          Why you edited the script? Why you don't use the default path of the script? Can you post your script?

                                          1 Reply Last reply Reply Quote 0
                                          • matchamanM
                                            matchaman
                                            last edited by matchaman

                                            I didn't edit the script at all, the only thing different is that I named it generator.ps1

                                            I have my gamelist.xml and my files located in F:\SNES 852 (should I use something else in particular?)

                                            Here is the exact code I use:

                                            $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 = "./videos/${gameName}.mp4"
                                              }
                                              if ($null -eq $gameEl.marquee) {
                                                $gameEl.AppendChild($doc.CreateElement('marquee')).InnerText = "./marquees/${gameName}.png"
                                              }
                                            }
                                            rename-item gamelist.xml -newname oldgamelist.xml
                                            $writer = [System.IO.StreamWriter] "gamelist.xml"
                                            $doc.Save($writer)
                                            $writer.Close()
                                            

                                            As for my gamelist.xml file, it's formatted as:

                                            <gameList>
                                            	<game>
                                            		<path>./2020 Super Baseball (USA).zip</path>
                                            		<name>2020 Super Baseball (USA)</name>
                                            		<image>./images/2020 Super Baseball (USA).png</image>
                                            	</game>
                                            	<game>
                                            		<path>./3 Ninjas Kick Back (USA).zip</path>
                                            		<name>3 Ninjas Kick Back (USA)</name>
                                            		<image>./images/3 Ninjas Kick Back (USA).png</image>
                                            	</game>
                                            	<game>
                                            		<path>./7th Saga, The (USA).zip</path>
                                            		<name>7th Saga, The (USA)</name>
                                            		<image>./images/7th Saga, The (USA).png</image>
                                            	</game>
                                            	<game>
                                            		<path>./90 Minutes - European Prime Goal (Europe).zip</path>
                                            		<name>90 Minutes - European Prime Goal (Europe)</name>
                                            		<image>./images/90 Minutes - European Prime Goal (Europe).png</image>
                                            	</game>
                                            	<game>
                                            		<path>./A.S.P. - Air Strike Patrol (USA).zip</path>
                                            		<name>A.S.P. - Air Strike Patrol (USA)</name>
                                            		<image>./images/A.S.P. - Air Strike Patrol (USA).png</image>
                                            	</game>
                                            	<game>
                                            		<path>./ABC Monday Night Football (USA).zip</path>
                                            		<name>ABC Monday Night Football (USA)</name>
                                            		<image>./images/ABC Monday Night Football (USA).png</image>
                                            	</game>
                                            ...and so on until </gameList>
                                            

                                            When I run the script, I briefly get that error window I managed to capture (after many attempts) and a new gamelist.xml that's 0 bytes and of course the backup one untouched.

                                            N 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.