[SCRIPT] RetroPie Limit Last Played Games
-
Hi @Clyde and thank you for your help.
If I understand correctly, the script remove or set to 0 the
playcount
and don't touchlastplayed
, maybe this is the reason is not working, or at least don't seems to work for me.
In any case, I did wath you asked me, this is the resultspi@retropie:~/RetroPie/roms/megadrive $ grep lastplayed gamelist.xml <lastplayed>20180626T204249</lastplayed> <lastplayed>20180704T005027</lastplayed> <lastplayed>20180725T124034</lastplayed> <lastplayed>20180725T143844</lastplayed> pi@retropie:~/RetroPie/roms/megadrive $ ../retropie-limit-last-played-games.sh -s --nth 1 Number of 'last played' games to limit is set to '1'. megadrive --------- 'gamelist.xml' for 'megadrive' found! > Creating 'gamelist-backup.xml' for 'megadrive' ... There is already a 'gamelist-backup.xml' for 'megadrive'. > Removing 'last played' games for 'megadrive' ... 20180725T124034 20180704T005027 20180626T204249 > Done! Done! pi@retropie:~/RetroPie/roms/megadrive $ grep lastplayed gamelist.xml <lastplayed>20180626T204249</lastplayed> <lastplayed>20180704T005027</lastplayed> <lastplayed>20180725T124034</lastplayed> <lastplayed>20180725T143844</lastplayed>
After this, i opened thegamelist.xml for the megadrive and the file is not modified
-rw-r--r-- 1 pi pi 1145107 Sep 6 18:03 gamelist-backup.xml -rw-r--r-- 1 pi pi 15697 Jun 20 11:58 gamelist.Missing.Serial.txt -rw-r--r-- 1 pi pi 1145107 Jul 25 15:41 gamelist.xml
So it seems it create a backup and then don't change anything.
Thank you for your help, I really appreciate it.
-
@madhorse I found the bug! I'll release a new version with additional functionalities. Maybe tomorrow ;)
-
@hiulit
According to @MadHorse's test, the script removed three "last played" occurances, while grep listed four of them in the file. Is that part of the bug, or what else caused the discrepancy? Just mentioning to help you debug. :)Ah, just ignore me. The script limited the "last played" to one, thus removed three of four. It's too early here in Germany to write in forums, obviously. 😇
-
@clyde Almost got it! Been working hard, refactoring stuff :P I guess I'll be releasing a new version soonish.
-
-
-
@hiulit said in [SCRIPT] RetroPie Limit Last Played Games:
@madhorse whoops, sorry, hehe! You were the one with the issue, actually, and I was replying to @Clyde :P
hehe no problem :)
-
-
-
Here it is!
RetroPie Limit Last Played Games v2.0.0
Read the new docs, as there have been a few changes.
Added
- Option to install/Uninstall the script from EmulationStation's RetroPie menu.
- GUI mode.
- Debug mode - To test the script. No harm will done to the gamelists ;)
- Log files - Found in
/home/pi/Retropie-Limit-Last-Played-Games/logs
).
Fixed
- Uncommented code preventing to actually remove 'last played' games.
- Fixed #1 - Only show systems that have a gamelist.xml.
Changed
- Refactored the code to create backups. Now the folder is called
gamelist-backups
(inside the$SYSTEM_ROMS
folder) and contains all the game lists backups, named[DATE]-gamelist-backup.xml
. - Added more
error/success
output messages. - Better control of what games have to be processed.
Examples
./retropie-limit-last-played-games.sh --nth 25 --systems
This will set the number of 'last played' games to limit at 25 and then it will show a dialog from where it can be selected as many systems as needed.
./retropie-limit-last-played-games.sh --nth 25 --systems --debug
This will set the debug mode on. It's perfect for testing the script before actually 'harming' the gamelists.
./retropie-limit-last-played-games.sh --gui
This will start the GUI. It will ask you to enter a number to limit the number of 'last played' the games shown. Then it will ask you to choose the desired systems to apply that limit.
Options
--help
: Print the help message and exit.--install
: Install the script in EmulationStation's RetroPie menu.--uninstall
: Uninstall the script from EmulationStation's RetroPie menu.--nth
: Set number of 'last played' games to limit per system (10 by default).--systems
: Show dialog to select systems to limit.--gui
: Start the GUI.--debug
: Set debug mode to test the script.--version
: Show script version.
-
@hiulit Great work! (without having tested it)
-
@hiulit, first, thank you so much for your work, your work is really appreciated.
Second, yout script is awesome, it's working perfectly.
Installed the script on the Retropie menu, launched the script, choosed to keep 1 last played game, at the end of the execution you need to restart Emulationstation to see the results.Now my last played list contain only 40 games, one per system :)
Thank you again, you did a great job.
-
@hiulit I don't want to do a PR but you can add these lines to perform a restart. You can write a small yes/no dialog to perform a restart to ES.
# Restart ES! touch /tmp/es-restart chown pi:pi /tmp/es-restart kill $(pidof emulationstation)
Best wishes ;)
-
@madhorse Hey! You're welcome! I'm glad you find it useful :D
And you made a good point about EmulationStation having to be restarted to see the changes. I'll add a message to the script .
-
@cyperghost hey, I was just thinking about adding a message but I like your idea better. Thanks for the code ;)
-
@cyperghost btw, can this code be run under 'sudo'? Because my script has an option be installed in the RetroPie menu and I think the scripts executed from there are run under 'sudo'.
-
@hiulit Yes but then the file has to be chowend to pi:pi
Added to the codebox -
@cyperghost the file being 'tmp/es-restart' or my script?
-
@hiulit The restart file
Because ES entitiy deletes the file on restart and if it was created by root it won't work -
@cyperghost got it. Thanks! I'll try it ;)
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.