Overcoming List property size

HouseBot Plugin Development Discussions.
Post Reply
Circe640
Advanced Member
Posts: 206
Joined: Tue Oct 07, 2003 10:01 am
Location: Columbus, OH
Contact:

Overcoming List property size

Post by Circe640 »

I ahve been working on a new Media plugin for HouseBot and would like some suggestions on how to handle a particular problem. The plugin has a separate backend application that handles maintaining the database that the plugin sits on top of. The database can handle referencing thousands of song files --- during recent testing DL used the music crawler component to load a directory structure containing about 1000 CD's and laround 10,000 song's ID3 data to the database. Part of the plugin contains search filters to retrieve song data from the database. This presents the problem.

Although I can easily retrieve this data into an array in the plugin, I need to transfer it through the plugin into a list property. However, a list property can only hold about 2K or 4k of text. Give the length of song titles this might allow about 50 - 100 songs at a time. The array however, depending on the search filters might easily hold several hundred (thousand). Obviously, I need to page the data to the property and be able to move up and down through the array. This is a little more problematic than it sounds because of the way HB holds old/new values until you return from the function call HB places to the plugin when a value is changed. I worked around this with my original JukeBot plugin by using tasks and timers to control the paging for thuimbnails but I would like to be able to use forward and back properties directly without having the additional complexity and timing issues of the tasks and timers.

Any ideas????
Circe640
Advanced Member
Posts: 206
Joined: Tue Oct 07, 2003 10:01 am
Location: Columbus, OH
Contact:

clarification

Post by Circe640 »

Let me clarify the logic problem --- it is not with the list property itself but rather with the movement.
I have a boolean property call 'Forward' When I use the UI in HB to set the value to 1 HB then calls a function that is handled by the plugin. passes the "New" value of 1 but retains the "0' as the Old value. The plugin recognizes the value of "1" for the property and goes off and does the array to list propery assignment etc. When completed one would like to set the Forward property back to "0" to be ready for the next button press. However, this can't be done because you are still in the original function call from HB based on the Forward property change. The Forward property is not actually set to "1" until you give a valid return at the end of the function. The new value is not moved to the old(current) value until the return from the function call. Since the function call is common for all property changes you just can't default to an invalid return to cause HB to leave the property at the old value of '0'.
I had a work around with my old JukeBot plugin where the Forward button called a task that set the property value , waited 500 ms and then set the property back to '0' but this is clunky and with a much bigger database may not always work
ScottBot
Site Admin
Posts: 2786
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Re: clarification

Post by ScottBot »

Circe640 wrote:...However, this can't be done because you are still in the original function call from HB based on the Forward property change. The Forward property is not actually set to "1" until you give a valid return at the end of the function.
This is a limitation of the VB SDK only. If you are using the C SDK, you can commit/fail/abandon the Property Value change and then change it to anything you like during the same call.

I can't come up with any non-kludgey ways to do this with the VB SDK (but I'm not that familiar with it). You could have a 'Forwarded' Property that you set to "1" instead of the "Forward" Property. then have the PV change logic for the "Forwarded" property change the "Forward" property to "1" (or you could do it in a Task).
Scott
Circe640
Advanced Member
Posts: 206
Joined: Tue Oct 07, 2003 10:01 am
Location: Columbus, OH
Contact:

Post by Circe640 »

So the commit/rollback logic is only implemented in the VB SDK. What I mean is that from the HB function for a property change, one can execute a extensive set of logic that can change multiple property values but these changes only commit if the return from the function call is true. If it is returned false or there is any code failure then all the property changes are rolled back to the state before the function call.
dlmorgan999
HouseBot Special Member
Posts: 409
Joined: Tue Jul 13, 2004 9:13 am
Location: Tigard, OR

Re: clarification

Post by dlmorgan999 »

ScottBot wrote:[This is a limitation of the VB SDK only. If you are using the C SDK, you can commit/fail/abandon the Property Value change and then change it to anything you like during the same call.]
Scott: can you give me an example of how you would abandon a property change using the C SDK? And maybe also an example of how you would change the property to something different than what was requested?

-- Dave
ScottBot
Site Admin
Posts: 2786
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Re: Overcoming List property size

Post by ScottBot »

To abandon a change request, you can call Property::ChangeRequestAbandoned() on the Property object. If you are using the C API, you call the pHB_ChangeRequestAbandoned callback with a handle to the property value.

I've never changed a property to something other than what was requested (that doesn't seem very nice ;)). I suppose you could first call ChangeRequestAbandoned() on the PV that is in the queue. Then just just do the usual to create a new change like:

Code: Select all

pValueFromQueue->ChangeRequestAbandoned();
delete pValueFromQueue;

CPropertyValue* pNewValue = pProperty->CreatePropertyValue( "Value you want to change to" );
pNewValue->ChangeRequestCompleted();
delete pNewValue;
But I've never tried that.
Scott
dlmorgan999
HouseBot Special Member
Posts: 409
Joined: Tue Jul 13, 2004 9:13 am
Location: Tigard, OR

Re: Overcoming List property size

Post by dlmorgan999 »

Great - that should get me what I need. Thanks!
Post Reply