Jump to content

Play State backup for Libraries whose Content Type is "Home videos & photos"


MrTechnic

Recommended Posts

MrTechnic

I recently rebuilt the PC I have that runs my Emby Server. I used the Server Configuration Backup plugin to backup and restore my configuration and I also have enabled writing of the Play States into the NFO files for each Library. When I reinstalled Emby Server and selected a restore from backup all the server setting and some of the Library information was restored. What was missing was the Play States for Libraries whose Content Type is "Home videos & photos". The Play States for Libraries that are "TV Shows" and "Movies" restored perfectly. 

After that decided I wanted to change each Libraries sourced folder from being a locally mapped folder to being a network share reference. Once again Libraries whose Content Type is "TV Shows" and "Movies" retained their Play State and Libraries whose Content Type is "Home videos & photos" lost their Play States. This despite the Play State being accurately stored in the NFO files - the first Scan Media Library event just goes and rewrites the NFO files.

So my question is: How can I backup Play States for Libraries whose Content Type is "Home videos & photos"? Ideally this should be part of the Server Configuration Backup plugin but it clearly either isn't or doesn't work.

Link to comment
Share on other sites

Hi.  Emby never reads play state from the NFO file because we have a multi-user system.  The only reason we have an option to write that data is for 3rd party apps (like Kodi) to use it.

We save play state in our database by an ID.  With anything that can be globally identified (like movies and TV) we use that global identifier for just the reason you found - even if the location changes we can preserve the play state.

With things that don't have global IDs (like home videos) we have to use the internal ID for the system. In the past, we derived this ID from the location of the file and, if that location stayed the same, then we could also preserve that state.  However, recently (for many reasons - performance being a major one) we moved to random numeric IDs so play states on these types of items would only be preserved if the restore was back into the same database as opposed to moving or re-installing the server.

Does that make sense?

Link to comment
Share on other sites

MrTechnic

Thanks for the explanation EBR. It is a shame these Play States cannot be backed up as I have lost them on at least 4 occasions over the last few years and each time I have cursed for days and considered giving up Emby altogether.

You said "play states on these types of items would only be preserved if the restore was back into the same database". I am not quite sure what you mean by this. Do you simply mean running the restore feature in Emby Server without any other changes?

I have read on line instructions about using SQLite to copy the entries that are Home Videos from the old Library file to new Library file. I have not tried this yet but I could see that talking a backup of the Library file itself and rebuilding as required could be useful if it works. Do you know anything about this? Have you considered and "transfer" tool to automatically do this for the case of rebuilds?

 

Link to comment
Share on other sites

Happy2Play
1 hour ago, MrTechnic said:

Thanks for the explanation EBR. It is a shame these Play States cannot be backed up as I have lost them on at least 4 occasions over the last few years and each time I have cursed for days and considered giving up Emby altogether.

You said "play states on these types of items would only be preserved if the restore was back into the same database". I am not quite sure what you mean by this. Do you simply mean running the restore feature in Emby Server without any other changes?

I have read on line instructions about using SQLite to copy the entries that are Home Videos from the old Library file to new Library file. I have not tried this yet but I could see that talking a backup of the Library file itself and rebuilding as required could be useful if it works. Do you know anything about this? Have you considered and "transfer" tool to automatically do this for the case of rebuilds?

 

You would have to have a backup copy of your library.db (ideally your entire emby programdata folder).  This would have nothing to do with the Server Configuration Backup plugin as it only applies to configs and user/userdata.  So any standard system backup should cover the ability to restore you previously running Emby server.

 

Link to comment
Share on other sites

MrTechnic
15 hours ago, Luke said:

@MrTechnic has this helped?

Yes thanks - this has helped. I will automate regular snap shots of the Library.db file only as the entire programdata folder is much too large to do this and keep a few copies.

I assume to "restore" all I would have to do is rename the existing file to .old or similar, copy in the backup file and restart the server?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...