Storing User Data in Dict

I'm updating my Reddit Videos channel and a lot of users have requested the ability to store their own topics.

 

I've been able to achieve this at least momentarily with the Dict command, but I was wondering how permanent this serialization is.

 

I'm just appending their query to a list (custom_faves) and the code is the following:

 
custom_faves.append(query)
Dict['favorites'] = custom_faves
Dict.Save()
 
I've reloaded plex home theater and the plex media server and the changes are still there, so can I be happy and think I figured it out on my own, or does some bug lurk in my future?

The plugin Dict[] is persistent storage. It should persist through PMS restarts/updates, system reboots, and unless specifically cleared/deleted will even remain intact if your plugin bundle is removed and reinstalled. IMO, it’s the best place we have available to store that sort of user data.

Thank you so much!

One thing I found was that you do have to exit the channel properly to make the Dict save data.

I use Roku and often hit the home button that takes me directly to the Roku home screen rather than hit the back button to get out of a Plex channel. And if I make changes to a channel that uses Dict while using my Roku and then hit the Home button instead of using the back button to get back to the Plex main screen, it will not save my changes. 

Just something to keep in mind if Roku users run into issues.

Edited 12/9/2013:

This is no longer an issue. The Dict saves properly even if the a Roku user exits using the Home button. 

There is an explicit Dict.Save() command as well as Dict.Reset() in case you need to force the save routine or clear the Dict, respectively.

So if I explicitly call dict.save() I should be safe on the roku?

Sent from my Nexus 4 using Tapatalk

There shouldn't be any difference between Roku and any other Plex client when using Dict (or any framework function for that matter) as all the code is run on the Plex Media Server.

Actually Sander is right and I am completely wrong. So disregard my comments about Roku and saving the Dict. The Roku Home button is no longer a problem with saving the Dict. So you do not have to worry about this any more. Sorry for giving you outdated information.

When A Roku user hits the Home button, it pull them from wherever they are and takes them immediately back to the main Roku menu (so it exits them out of Plex completely). I saw that when I hit the Roku Home button using my Webisodes channel, changes that should have been saved to the Dict were not there when I reentered that channel. 

But I just tested it again and now the changes are saved, even when I use the Roku Home button. Maybe something in either PMS or the Roku Plex channel has changed since my last test. It has been awhile so more than one version of PMS and Roku Plex channel have been released since I first tested the theory and saw there was an issue.

Sorry again for the bad info. I will edit my post above as well, so noone will run across this in the future and think it is still an issue.

No problem at all. I didn’t have a roku to check but glad it’s not an issue.

Sent from my Nexus 4 using Tapatalk

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.