SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-25-2009, 04:44 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
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.
Reply With Quote
  #2  
Old 10-25-2009, 08:32 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by tmiranda View Post
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
I never was able to save a list,array or the like to properties I don't think it is possible (could be wrong)

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.
Reply With Quote
  #3  
Old 10-25-2009, 09:59 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
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.
Reply With Quote
  #4  
Old 10-25-2009, 10:30 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by tmiranda View Post
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?
I need to look at the java code I haven't looked at this part in a while (sense I coded)but I think I am incorrect you don't need the haspropertyelement. I only used that for display purposes and because of the way I coded my stv.

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.
Reply With Quote
  #5  
Old 10-25-2009, 12:52 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
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.
Reply With Quote
  #6  
Old 10-25-2009, 01:42 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by tmiranda View Post
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?
of course not
Reply With Quote
  #7  
Old 10-25-2009, 06:22 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
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.
Reply With Quote
  #8  
Old 10-26-2009, 06:04 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by tmiranda View Post
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
No problem glad it worked for you

interested to tsee what you are doing
Reply With Quote
  #9  
Old 10-26-2009, 11:35 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by PLUCKYHD View Post
interested to tsee what you are doing
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.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -6. The time now is 06:06 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.