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

Clearing the lastplayed and playcount from gamelist.xml's

Scheduled Pinned Locked Moved Ideas and Development
clearinglastplayedplaycountgamelist.xml
34 Posts 13 Posters 14.2k 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.
  • T
    tanstaafl @pjft
    last edited by 21 Aug 2017, 13:08

    @pjft not sure what you mean by what is the use case, but if you mean what is the purpose, it is simply to clear the lastplayed and playcounter values, hence clearing the lastplayed. I use both the lastplayed and favorites collections. Adding to favorites as I go and in testing/checking different roms the lastplayed gets HUGE.. so I wanted to be able to clear it, nothing more, nothing less.

    Cheers!

    P 1 Reply Last reply 21 Aug 2017, 14:05 Reply Quote 1
    • P
      pjft @tanstaafl
      last edited by 21 Aug 2017, 14:05

      @tanstaafl Thanks. I didn't mean it as in "there's no purpose" - I try to understand the use cases from people to see if this is something that can affect a wider audience vs being niche, whether it'll be recurrent vs rarely used, etc. That can inform future developments.

      I suspect there are a few options there.

      One, which I have ran into in the past, is that probably the play counter should only be incremented if you stay in the game for at least <insert period of time - I was thinking 1 min>. Quite often I launch a game for testing or by mistake, and it adds up quickly. The first game in my Arcade list has only been played perhaps 5% of the times it reports, because of that. Still, this is likely the wrong solution for the problem.

      The other is to allow users to clear the last played/play counter metadata from an individual game. That would probably be the most helpful.

      The last one could be to keep the "Last Played" list shorter, to maybe 100 games or so, tops. There likely isn't much interest in a "Last Played" list that spans a lot of games - even 50 would probably be good as well.

      So that's what I was trying to understand the use case for:

      • Trying out games
      • Leads to long list
      • Wants to remove irrelevant items from list /wants list not to be long (unclear what is the actual goal here, I'm assuming #1 and part of #2).

      Still, this will not be implemented in the short term, unfortunately, as I'll have no access to a development environment for the coming weeks. I'll keep it on my to do list.

      Thanks.

      T 1 Reply Last reply 26 Aug 2017, 16:05 Reply Quote 2
      • T
        tanstaafl @pjft
        last edited by 26 Aug 2017, 16:05

        @pjft changing the code to a specific rom directory would take care of the 'individual game' item. Limiting the number of 'lastplayed' would be moot if you are using this I would think.

        And yes, for trying out games, removing long lists in their entirety (unless you opt to change the code as above) would be the goal.

        I like to keep a tidy ship and that lastplayed list is handy to look back on, but there reaches a point where it is an annoyance so I clear it. If it is a game I want to remember I simply add to my favorites.

        1 Reply Last reply Reply Quote 0
        • P
          papinist
          last edited by 23 Dec 2017, 21:33

          @tanstaafl
          I was searching for this feature for a while, thank you!
          Since I don't know much about linux systems, what do you mean with "make it executable"?
          What's the correct procedure to use your script?
          I should probably create a new text file called clearlastplayed.sh, copy\paste the code you wrote, transfer the file somewhere on the retropie's sd card and.. ?

          thanks!

          M 1 Reply Last reply 23 Dec 2017, 21:41 Reply Quote 0
          • M
            mitu Global Moderator @papinist
            last edited by 23 Dec 2017, 21:41

            @papinist said in Clearing the lastplayed and playcount from gamelist.xml's:

            make it executable

            Run chmod +x clearlastplayed.sh to make it executable, then run it by executing with ./clearlastplayed.sh

            P 1 Reply Last reply 23 Dec 2017, 22:58 Reply Quote 1
            • P
              papinist @mitu
              last edited by 23 Dec 2017, 22:58

              @mitu
              thank you very much, I'll try it tomorrow!

              1 Reply Last reply Reply Quote 0
              • P
                papinist
                last edited by 24 Dec 2017, 11:08

                got this error:

                -bash: ./clearlastplayed.sh: /bin/sh^M: bad interpreter: No such file or directory

                I placed the clearlastplayed.sh file in roms directory, if this is relevant.

                M 1 Reply Last reply 24 Dec 2017, 11:17 Reply Quote 0
                • M
                  mitu Global Moderator @papinist
                  last edited by 24 Dec 2017, 11:17

                  @papinist That's because of the DOS newline in the file. Run the following command on over the command line, from the same folder where you have the script

                  sed -i 's/\r//' clearlastplayed.sh 
                  

                  then try running the command again.

                  1 Reply Last reply Reply Quote 0
                  • P
                    papinist
                    last edited by papinist 24 Dec 2017, 11:46

                    It worked like a charm! Thank you @mitu for the help :)

                    M 1 Reply Last reply 24 Dec 2017, 13:18 Reply Quote 0
                    • M
                      mitu Global Moderator @papinist
                      last edited by 24 Dec 2017, 13:18

                      @papinist @tanstaafl is the real help here. I'm just browsing.

                      1 Reply Last reply Reply Quote 0
                      • G
                        ganondork
                        last edited by ganondork 14 Mar 2018, 07:39

                        Hey thanks for the script, really appreciate it. I added some stuff, that I‘d also liked to flush for a clean start, Wifi-credentials for example. And I also added a chmod 777 for the gamelist folder afterwards, because the rebuild xmls lacked writing permission.

                        Still i couldn‘t accomplish to also remove my favorites by adding „-e favorites“ to the grep line. All xmls that had favorites get screwed up, I can‘t see any metadata for the systems games afterwards.

                        I‘m on my way to work now, so I can‘t provide you with any more information. But perhaps someone has already dealt with this issue?

                        I‘d also like to remove all registered bluetooth devices with this script. To have just my roms and gamelists left to carry over to another setup. But I couldn‘t find a config file to edit or remove. Ideas?

                        1 Reply Last reply Reply Quote 0
                        • R
                          Riverstorm
                          last edited by 22 Mar 2018, 18:29

                          Thanks for the script. I would add a +1 as a feature. After setup and testing I have the first game in each emulator in my list which would be nice to flush before imaging.

                          1 Reply Last reply Reply Quote 0
                          • K
                            kactius
                            last edited by 27 May 2018, 15:01

                            Very thanks.
                            I contribute with a grain of sand, in Spanish, but it is easy to edit, it is a menu with dialog to clean lastplayed and playcount, 3 options:
                            1 "home/pi/RetroPie/roms"
                            2 "opt/retropie/configs"
                            3 "both 1 and 2"
                            4 "Exit" 2>"${INPUT}"
                            The code, copy paste and give execution permission:
                            https://pastebin.com/tGPMehXr

                            1 Reply Last reply Reply Quote 1
                            • D
                              davidgrohl Banned
                              last edited by davidgrohl 13 Aug 2018, 16:24

                              Hi all,
                              I've tried this usefull script but it doesn't work for me.
                              I put it in /home/pi/Retropie/roms folder. Make it executable. Than launch it typing ./name_of_The_script.sh and it says:

                              file: /home/pi/RetroPie/roms//gamelist.xml'
                              ./clear_played.sh: 7: ./clear_played.sh: cannot create /home/pi/RetroPie/roms/
                              /gamelist.xml.tmp : Directory nonexistent
                              mv: cannont stat '/home/pi/RetroPie/roms/**/gamelist.xml.tmp' : No such file or directory

                              What's the mistake?

                              M 1 Reply Last reply 13 Aug 2018, 16:42 Reply Quote 0
                              • M
                                mitu Global Moderator @davidgrohl
                                last edited by 13 Aug 2018, 16:42

                                @davidgrohl The script fragment expects the gamelist.xml located in the ROMs folders, but by default they're in /home/pi/.emulationstation/gamelists/<system_name>. Try the script posted by @kactius, it allows you to select one of the 2 locations for the gamelist.xml files.

                                D I 2 Replies Last reply 13 Aug 2018, 17:02 Reply Quote 1
                                • D
                                  davidgrohl Banned @mitu
                                  last edited by 13 Aug 2018, 17:02

                                  @mitu said in Clearing the lastplayed and playcount from gamelist.xml's:

                                  @davidgrohl The script fragment expects the gamelist.xml located in the ROMs folders, but by default they're in /home/pi/.emulationstation/gamelists/<system_name>. Try the script posted by @kactius, it allows you to select one of the 2 locations for the gamelist.xml files.

                                  Thanks @mitu for reply. That scripts works with option 2.
                                  Great! Thanks a lot.

                                  1 Reply Last reply Reply Quote 1
                                  • I
                                    Invisible89 @mitu
                                    last edited by Invisible89 6 May 2019, 15:20 5 Jun 2019, 12:31

                                    @mitu said in Clearing the lastplayed and playcount from gamelist.xml's:

                                    @davidgrohl The script fragment expects the gamelist.xml located in the ROMs folders, but by default they're in /home/pi/.emulationstation/gamelists/<system_name>. Try the script posted by @kactius, it allows you to select one of the 2 locations for the gamelist.xml files.

                                    Hi guys.

                                    I'm trying to clear my last played games list, but it doesn't work :(

                                    I've created cleanlastplayed.sh file with this code:

                                    #!/bin/sh
                                    #clear_played.sh

                                    for f in /home/pi/RetroPie/roms/**/gamelist.xml
                                    do
                                    echo "file: $f"
                                    grep -e lastplayed -e playcount -v $f > "$f.tmp"
                                    mv -f "$f.tmp" $f
                                    done

                                    It's ok? Or I've to modify it with the name of the system name (**)?

                                    And where should I put this file? What directory?

                                    Thanks

                                    1 Reply Last reply Reply Quote 0
                                    • M
                                      mitu Global Moderator
                                      last edited by 5 Jun 2019, 13:02

                                      You should use a single wildcard (*) instead of the system name, but the script will only find the gamelist.xml files from the ROM folders, you might have some gamelist files in ~/.emulationstation/gamelists/<system> folders.

                                      I 1 Reply Last reply 5 Jun 2019, 14:21 Reply Quote 0
                                      • I
                                        Invisible89 @mitu
                                        last edited by 5 Jun 2019, 14:21

                                        @mitu said in Clearing the lastplayed and playcount from gamelist.xml's:

                                        You should use a single wildcard (*) instead of the system name, but the script will only find the gamelist.xml files from the ROM folders, you might have some gamelist files in ~/.emulationstation/gamelists/<system> folders.

                                        Ok, i will try with only one windcard.

                                        But where i've to put my cleanlastplayed.sh file?

                                        M 1 Reply Last reply 5 Jun 2019, 14:50 Reply Quote 0
                                        • M
                                          mitu Global Moderator @Invisible89
                                          last edited by 5 Jun 2019, 14:50

                                          @Invisible89 said in Clearing the lastplayed and playcount from gamelist.xml's:

                                          But where i've to put my cleanlastplayed.sh file?

                                          It doesn't matter, as long as you execute it correctly. Let's say you save it in /home/pi/RetroPie/scripts.

                                          #make the folder
                                          mkdir -p $HOME/RetroPie/scripts
                                          
                                          # create the file in $HOME/RetroPie/scripts/lastplayed.sh
                                          
                                          # run the script
                                          bash $HOME/$HOME/RetroPie/scripts/lastplayed.sh
                                          
                                          I 2 Replies Last reply 5 Jun 2019, 15:01 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.

                                            This community forum collects and processes your personal information.
                                            consent.not_received