|
SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
Saving a List?
What's the best way to save a data structure to the .properties file if the data structure is a list?
The data structure is creating using DataUnion(). If I save the list using SetProperty(list, null) it ends up in the .properties file as list=[a,b,c,d] and I can't use GetProperty() to reload it. I don't want to use separate properties for each list item, I would like them all to be saved in one single property. Thanks, Tom
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#2
|
|||
|
|||
Quote:
The flux jar with SMW has a call where you can save individual items to a property with a ";" seperator and then you can use another call to return it as an array It is not the cleanest but works great look at the SMW homepage menu for how I use it flux_api_HasPropertyElement(String PropertyName,String Default Value,String Element)--boolean flux_api_SetPropertyElement(String PropertyName, String DefaultValue, String Element)--string returns 0 if not set 1 if set flux_api_RemovePropertyElement(String PropertyName, String DefaultValue, String Element)--string returns 0 if not removed 1 if removed flux_api_GetPropertyArray(String PropertyName, String DefaultValue)-returns string[]. make sure and use the HasPropertyElement before setting/deleting to verify if it already exist in the property. hope that helps ps the ";" seperator is automatic you don't need to add that in when adding/removing elements. |
#3
|
||||
|
||||
Thanks. I looked at SMW but I still don't have a clear grasp on this.
You say to use the "Has" method to make sure it exists before using the "Set" or "Remove" methods. If it doesn't exist in the array how do I add it? For example, If I start with a property called Things (that has nothing in it) I would assume I add an element by using the Set method: flux_API_SetPropertyElement("Things", "", "AddThisElement") then if I want to remove an element: flux_API_RemovePropertyElement("Things", "", "RemoveThisElement") and to check if NewElement is already in the property: flux_API_HasPropertyElement("Things", "IsThisSetElement") In the first three examples I left the default fields as "" because I do not want to add any default values. Correct? Why do I need to use the Has method before Set or Remove? Are you saying that if I use the Has method and specify a default it will add it if it's not already in there? So: flux_API_HasPropertyElement("Things", "NewElement", "NewElement") will return false if NewElement is not in the property but will add it in since I specified a default value? I am also assuming that calling the Set method saves the property in the .properties file automatically and there is no need to use the SetProperty() method anywhere. Correct?
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#4
|
|||
|
|||
Quote:
you don't need to use setproperty you are correct that is done within the jave code of the api haspropety is simply a boolean that returns true or false it will not set or remove anything. (good for display purposes and such) you are simply checking the property for the element. the default value can be "" I am pretty sure that is okay. just make sure the first time you use flux_API_SetPropertyElement("Things", "", "AddThisElement") you set an element and that will create the property and set the the first element. I think you understand it I just explained the haspart wrong. |
#5
|
||||
|
||||
OK, I used it just like I outlined in my previous post and it works great! Thanks a bunch Plucky.
Do you mind if I package your flux.jar in the .zip file for my latest STVi?
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#6
|
|||
|
|||
of course not
|
#7
|
||||
|
||||
Great. Thanks.
Those APIs worked perfectly the first time I used them. I had the logic for that specific section of code all outlined and just needed a way to save and retrieve the data. I plugged in your API's and was pretty surprised when everything worked on the first try. I made good progress today. (Silly me, a beautiful day in Central Florida and I spend it in front of a computer.) I've got pretty much all of the code written and now am bug-squashing. Tom
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#8
|
|||
|
|||
Quote:
interested to tsee what you are doing |
#9
|
||||
|
||||
A Malore style Online Browser. I've sent alpha versions to some people to get some feedback on Netflix since I do not have an account.
I'm almost ready for a real beta but I have a few more bugs to squash. It's been slow because of the changes that are happening due to EvilPenguin's UPnP2Podcast effort.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Questions about saving changes | Sanguine | SageMC Custom Interface | 1 | 10-24-2009 05:26 AM |
saving channel line-up | jocoman | SageTV EPG Service | 0 | 02-27-2009 10:23 AM |
Power saving | dinki | The SageTV Community | 1 | 10-02-2008 09:25 AM |
Saving the favorites list | henk99 | SageTV Software | 5 | 10-04-2005 05:35 AM |
Saving Favorites | snoopy | SageTV Software | 2 | 07-13-2005 01:18 AM |