Editing a database item externally...possible?

Help each other out

Editing a database item externally...possible?

Postby buymeapc on Sat Oct 07, 2006 12:34 am

I created an application that will write the upcoming recordings from Beyond TV to a database in XLobby. The database is set to a hidden category which text buttons show the info on the screen. All aspects of the program work fine, however, when the lineup changes, the database cannot be read anymore unless I reload XLobby - then it reads the database fine and all text is displayed.

Is there someway to fix this?

If I'm being vague, I'm sorry, I can try to elaborate better.

Here's a screenshot:
http://img139.imageshack.us/img139/6845/temprv9.png
buymeapc
 
Posts: 59
Joined: Wed Mar 22, 2006 5:53 pm

Postby art on Sat Oct 07, 2006 1:40 am

Did you try category>refresh command instead reloading XL after you update your db?
art
 
Posts: 284
Joined: Sat Mar 20, 2004 8:40 am
Location: Allen, TX

Postby buymeapc on Sat Oct 07, 2006 12:22 pm

Yes, I have...In fact, I made a button to do just that. It's shown in the screenshot I posted. :wink:

I have refreshed it externally (with xsend) and internally.

The funny thing is that when I see that the text is not showing up, I can press F2 and go to databases - it shows in the list of databases, but I cannot edit it...unless of course I reload XLobby, then everything works fine.
buymeapc
 
Posts: 59
Joined: Wed Mar 22, 2006 5:53 pm

Postby art on Sat Oct 07, 2006 3:33 pm

Screenshot can't really tell me what the button does, but anyway one more thing I can think of is, are you creating new db each time and overwriting the old one or are you editing the old one and saving changes? If the second is true you should try the first approach.
art
 
Posts: 284
Joined: Sat Mar 20, 2004 8:40 am
Location: Allen, TX

Postby buymeapc on Sat Oct 07, 2006 8:36 pm

Well, actually the first statement is true. It rewrites the database each time. Should I try the second approach?
buymeapc
 
Posts: 59
Joined: Wed Mar 22, 2006 5:53 pm

Postby S Pittaway on Sun Oct 08, 2006 9:22 am

i never got it to read in changes when i edit the xml file directly.

I was deleting the file and creating a new one....

I wonder if you are right?

should we be "editing" the existing xml file?
S Pittaway
 
Posts: 651
Joined: Wed Jan 25, 2006 11:08 am
Location: Manchester, England

Postby P3rv3rt B3ar on Sun Oct 08, 2006 3:34 pm

Why not do it trough cat? So that u can use commands made for that trough SDK.
P3rv3rt B3ar
 
Posts: 1364
Joined: Fri Apr 07, 2006 9:52 pm
Location: West Coast Funland

Postby buymeapc on Sun Oct 08, 2006 4:08 pm

How can that be accomplished?
buymeapc
 
Posts: 59
Joined: Wed Mar 22, 2006 5:53 pm

Postby P3rv3rt B3ar on Sun Oct 08, 2006 4:38 pm

buymeapc wrote:How can that be accomplished?


Its is rather complicated but it is possible. Im doing it in ZPd it takes some video relevant data from zoomplayer and saves those values in fields of DB.

Long story short: U need a cat which represent the database, it can be dummy though (meaning it exist in hidden location) then u have to locate the relevant item from that cat. If DB is flat (meaning no subitems) it is easy and can be accomplished trough regular catwalking, just like in Pittaways MoveTo plugin. If DB is deep (meaning items on 2 or more levels) situation grows substantially more complicated, u need (dummy)cat to represent each level and u need to daisy chain these cats. Then u need multitier catwalk algorith accomplishing feat of finding item, like my recursive version of DeepMoveTo (i gave pseudocode of that algorith on some thread here) basicly its easy, there is just some hacky trickery u have to use when u change level related to the order in which and to what cat u call xlobby category methods ( i cant remember that now, but it should all be clear from that pseudocode). Allthough that algorith can in theory handle any number of levels, i havent been able to create more than two level chained cats in practise, i hope somebody finds a way or Steven fixes that. After u have relevant item as a current u need simply use category methods which allow u to put variable in cat item field. Then u have to call save to database, and then few more category methods to make current situation reflect the change (also there is some trickery attached to calling order here, which i have explained in some of my postings, but i cant remember methods or order right now).

Like i said rather tricky, but certainly possible! Well it is easy if database is flat, but if database is flat and large it can be slow, cause catwalk in flat database is inherently linear operation, if cat is deep, its harder to implement, but u can make algorithm looking for right item logarithmic, so it can be considerably faster in case of large cats.

Now i dont know what exactly u try to accomplish, mayby u have some reason for directly editing database file. Mayby what u r trying to do cannot be done quickly enough with the way i describe. but if this method of feasible, i can look for that pseudocode and check up correct calling orders for hacky parts from my code for xPerT.
P3rv3rt B3ar
 
Posts: 1364
Joined: Fri Apr 07, 2006 9:52 pm
Location: West Coast Funland

Postby S Pittaway on Sun Oct 08, 2006 5:26 pm

i would gess that he is ADDING new itmes into the database, if so you cant do it from inside a plugin as there is now add item commad...
S Pittaway
 
Posts: 651
Joined: Wed Jan 25, 2006 11:08 am
Location: Manchester, England

Postby P3rv3rt B3ar on Sun Oct 08, 2006 5:30 pm

S Pittaway wrote:i would gess that he is ADDING new itmes into the database, if so you cant do it from inside a plugin as there is now add item commad...


Oh, i guess i didnt read description well enough, in that case method i was mentioning isnt going to help. well sorry to waste your time guys.
P3rv3rt B3ar
 
Posts: 1364
Joined: Fri Apr 07, 2006 9:52 pm
Location: West Coast Funland

Postby buymeapc on Sun Oct 08, 2006 7:46 pm

Basically, my app overwrites the current xml file with a new one. After it does this, XLobby no longer sees the database.
buymeapc
 
Posts: 59
Joined: Wed Mar 22, 2006 5:53 pm

Postby art on Sun Oct 08, 2006 8:33 pm

Well, it looks like you're doing everything right, without actually looking at your app and db the one more thing I can think of is make sure that you give your app enough time to overwrite old db before you send category>refresh command, so the new file is not locked.
art
 
Posts: 284
Joined: Sat Mar 20, 2004 8:40 am
Location: Allen, TX

Postby buymeapc on Sun Oct 08, 2006 10:22 pm

Currently, I give it 3 seconds before refreshing it.

But XLobby won't see the database anymore if I use the app. After I run the app, the database is still listed, I can still highlight it, but if I click on refresh or edit - they don't work. They will work on any other database, though.

The best way I can think of explaining it is:

Example:
Say you load winamp with XLobby. Works great, right? Now, close winamp and re-open it. Winamp is still there, but XLobby won't talk to it anymore unless you reload XLobby.


I know that is completely off the subject of xml datbases, but it (sort of) illustrates my issue in a way that everyone can see.
buymeapc
 
Posts: 59
Joined: Wed Mar 22, 2006 5:53 pm

Postby m_ski on Mon Oct 09, 2006 11:18 am

I am writing a plugin that edits the xlobby xml databases and mine works OK by modifying the xml file, NOT creating a new xml file.
m_ski
 
Posts: 204
Joined: Wed Dec 08, 2004 7:57 am
Location: Kent, United Kingdom

Next