Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

Emulationstation: Save metadata on change



  • I have the problem that often my metadata is not saved in Emulationstation. This is cause I am running Retropie on an Intel NUC and often enough when playing with friends it won't get shut down properly but just turned off. In those cases the metadata changes are lost.

    I googled a bit and I didn't find a way to have ES automatically save metadata while running. Like every time when metadata changes save it immediately. I only found the usual "Save metadata on exit" function.

    So the question: Is there a way to have ES save metadata instantly when it changes? Would it be an appreciated feature?

    I could offer to look into implementing it into ES.



  • @vbs did you try sync command?



  • @vbs It is not possible. That's the way it is designed in EmulationStation source code.
    Gamelists are saved on exit only. It would need source code changes.
    Gamelists are XML files and using this format, to store 1 changed character you need to save the whole file. I'm not sure doin' it in realtime is a good idea as sometimes gamelists are very big files and take a long time to write (expecially on a SD card). You'd get enormous lags - waiting time...



  • @f-caruso said in Emulationstation: Save metadata on change:

    @vbs It is not possible. That's the way it is designed in EmulationStation source code.
    Gamelists are saved on exit only. It would need source code changes.

    Yes, it would need a change in source code.

    Gamelists are XML files and using this format, to store 1 changed character you need to save the whole file. I'm not sure doin' it in realtime is a good idea as sometimes gamelists are very big files and take a long time to write (expecially on a SD card). You'd get enormous lags - waiting time...

    That behavior should be optional (defaults to off). I, for example, run Retropie on an i5 NUC with an SSD so I assume saving even a large XML with like 50 MB would only take a fraction of a second. But even if it would take 2 seconds I would possibly be willing to accept it instead of of losing the data.

    Anyway, there are even other options to avoid lags at all like saving the XML to disk in a background thread. This would be a bit more tricky as it would mean introducing multithreading into ES which is generally a thing to avoid :)

    @cyperghost
    Not sure which sync you mean? The Linux sync command? No, I didn't try and I am unsure how it could help?



  • @vbs I think it could help to flush memory and force write to disc. Never tried this. Yes I ment the Linux sync



  • @cyperghost
    According to the code ES just does not write the data before exiting so I think flushing caches does not help here.


  • Global Moderator

    @vbs said in Emulationstation: Save metadata on change:

    According to the code ES just does not write the data before exiting so I think flushing caches does not help here.

    Actually metadata is written to the disk on exiting/restarting Emulationstation - if you run it with the --debug flag, these writes are logged in the es_log.txt file.



  • @mitu
    That's what I tried to say I guess.



  • @vbs as I said - never tried. But you can use a script to do restarts or proper shutdowns to ES. But this will not help if you pull the cord



  • @BuZz
    Do you have an opinion on this matter?

    I am thinking about

    • an option to enable instant save on every change in the event loop which might introduce lags depending on the system
    • having a background thread that saves changes which would not introduce lags but introduce more complexity into ES


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.