New Plugin: xml2xlobby

Xlobby plugin development

New Plugin: xml2xlobby

Postby antipasto on Sat Sep 18, 2004 9:22 pm

Hello all!

I just created a plugin for xlobby that will let you perform XSL transformations of any XML file into Xlobby's database format, and trigger that through normal Xlobby events.

Plugin and Skin download @ SourceForget.net
Version 1.0 - September 18th, 2004

This can provide all kinds of possibilities:

Integrating all kinds of software with Xlobby, RSS-available media, integration with the XML-heavy bittorrent client Azureus, network bookmarks, and all sorts of things.

More details in the release notes, like how to install and how to use the plugin, but there's also an example skin!!! Here's screenshots:

Main Menu:
Image

Streaming Radio Stations (via RSS feed of my list of streamingmedia at http://del.icio.us/antipasto/streamingmedia ... when I update that page, this list updates too!):
Image

#TV-Torrents RSS Feed... calls WGET batch file when selected on the remote:
Image

Flickr.com is an online photo album with RSS feeds of keywords of people's personal photos:
Image

Here's the general new photo's:
Image

Again, this all works from live internet RSS feeds, and allows you to come up with all sorts of silly combinations and possibilities. Learn XSL transformations! They're easy (I swear!) and can help you out in general as the world moves to using XML more and more.

Best of luck, let me know what you all are accomplishing with this plugin, and also let me know if I can be of any assistance.

Thomas Winningham
mailto:winninth@users.sourceforge.net
http://writtorrent.sf.net/
antipasto
 
Posts: 44
Joined: Fri May 07, 2004 10:35 pm

Postby bradsjm on Sun Sep 19, 2004 1:22 pm

Very cool :D

I really think it we need a way to have plugins interact with categories directly instead of writing out XML database files and having Xlobby re-load them.

Steve - Any chance you could create an interface for a category and allow plugins to implement it?
bradsjm
 
Posts: 18
Joined: Sun Sep 05, 2004 6:12 pm
Location: New York City

Postby antipasto on Sun Sep 19, 2004 3:33 pm

I agree... when I looked at this, I was sort of wishing for that. It would, perhaps in the future, expose traditional database problems such as concurrent access.... If plugins could manipulate the data through an x-lobby mediated way, that would be ideal, but sounds like quite a bit more overhead too.
antipasto
 
Posts: 44
Joined: Fri May 07, 2004 10:35 pm

Postby rubbah on Tue Aug 23, 2005 7:16 am

Is it possible to have you're app convert the xoapdump.xml from xoapweather into a xlobby database?

do you have an example on inputfile, .xls file and output xlobby db?
rubbah
 
Posts: 135
Joined: Sun Sep 05, 2004 11:47 am
Location: Norway

Postby dandiodati on Sun Oct 09, 2005 7:35 am

I want to convert data from media center into xlobby, but I'm trying to find the format for xlobby's db files. Is there any dtd or schema or any docs describing the xml?
dandiodati
 
Posts: 17
Joined: Tue Mar 15, 2005 7:03 am

sample xsl

Postby jpoveda on Sat Oct 22, 2005 6:07 am

Hi,

I don't understand very well what I have to write in xsl file to import a xml dabatase into xlobby.

Does anybody have any sample?
jpoveda
 
Posts: 111
Joined: Mon May 17, 2004 6:45 am
Location: Spain

refreshing xml database

Postby jpoveda on Sat Oct 22, 2005 10:40 am

Hi,

I'm using the sample demo skin and I changed stream source from internet to a xml file that I downloaded containing the same information succesfully. Good, it works!!!!. But I'm not able to refresh it. If I edit xml file and change some data, how do I do to refresh it within xlobby?. I've tried with:

a.-Refreshing database and xlobby frezzes.
b.-Executing getdb command and nothing happens.
c.-Deleting database, executing getdb command and restarting xlobby and it works, but I had to close xlobby. mmmhhhhh , not good.

Any idea what could be happening?
jpoveda
 
Posts: 111
Joined: Mon May 17, 2004 6:45 am
Location: Spain

Postby jpoveda on Fri Oct 28, 2005 7:38 pm

As this plugins seems to be stopped I decided to develop my solution. The objective was modify a database and as it is a xml file (i.e. a text file) I made a vbs file that rewrite it (You can do it with a bat or another languaje you know as well, just take a look into an existing database to see the format), then the problem was refresh the database. I didn't find a way to send a sendcommand from vbs to xlobby (If there is anybody that know how to do it, please, let me know, I'll be eternally grettyful) but as I use girder and it has a dll to send sendcommands to himself I decided to send a sendmessage to it and then girder sends another sendmessage to xlobby to do the database refresh (I know, it's so complicated but I don't know other ways) and then ........IT WORKS!!!!!!.

By this way tou can't create, update or modify ANY xlobby database. I made a EPG (xmltv gets a xml file that I rewrite with an vbs to xlobby format), an scheduler (I read schedule from a vbs file), an alarm, a dinamic recording menu,... whatever you want.

This is one vbs sample code:

Interactive = &H1
DeleteWhenDone = &H2
Disabled = &H4
StartOnlyIfIdle = &H10
KillOnIdleEnd = &H20
DontStartIfOnBatteries = &H40
KillIfGoingOnBatteries = &H80
RunOnlyIfDocked = &H100
Hidden = &H200
RunIfConnectedToInternet = &H400
RestartOnIdleResume = &H800
SystemRequired = &H1000
RunOnlyIfLoggedOn = &H2000

AtLogon = TASK_EVENT_TRIGGER_AT_LOGON
AtSystemStart = TASK_EVENT_TRIGGER_AT_SYSTEMSTART
OnIdle = TASK_EVENT_TRIGGER_ON_IDLE
DailyTrigger = 1
MonthlyDate = TASK_TIME_TRIGGER_MONTHLYDATE
MonthlyWeekDay = 3
Once = 0
WeeklyTrigger = 2

January = 1
February = 2
March = 4
April = 8
May = 16
June = 32
July = 64
August = 128
September = 256
October = 512
November = 1024
December = 2048

Sunday = 1
Monday = 2
Tuesday = 4
Wednesday = 8
Thursday = 16
Friday = 32
Saturday = 64

Set shell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists("E:\xlobby2\skins\HTPC\databases\schedule.xml") Then
fso.DeleteFile("E:\xlobby2\skins\HTPC\databases\schedule.xml")
End If
Set file = fso.CreateTextFile("E:\xlobby2\skins\HTPC\databases\schedule.xml", True)
file.WriteLine("<?xml version='1.0' encoding='UTF-8'?>")
file.WriteLine("<database>")
file.WriteLine("<sortorder>display</sortorder>")
file.WriteLine("<sortable>")
file.WriteLine("</sortable>")
file.WriteLine("<paths>")
file.WriteLine("</paths>")
Set objSchedule = CreateObject("TaskScheduler2.Schedule")
objSchedule.Refresh
task = 1

file.WriteLine(" <item>")
file.WriteLine(" <parameter>D:\My Programs\Schedule\Graba ahora.vbs</parameter>")
file.WriteLine(" <display> Graba ahora</display>")
'file.WriteLine(" <event>"&event&"</event>")
file.WriteLine(" <information>")
file.WriteLine(" <channel>The task will not run at the scheduled times because it has been disabled</channel>")
file.WriteLine(" <state>Not paused</state>")
file.WriteLine(" <startdate>8/14/2004</startdate>")
file.WriteLine(" <starttime>11:05:00 AM</starttime>")
file.WriteLine(" <ttype>2</ttype>")
file.WriteLine(" <interval1>1</interval1>")
file.WriteLine(" <interval2>65</interval2>")
file.WriteLine(" <tttype>At 11:05 AM every Sat, Sun of every week</tttype>")
file.WriteLine(" </information>")
file.WriteLine(" </item>")
task = task +1

For Each objTask In objSchedule
With objTask
file.WriteLine(" <item>")
file.WriteLine(" <parameter>"&.ApplicationName&"</parameter>")
file.WriteLine(" <display>"&.Name&"</display>")
' file.WriteLine(" <event>"&event&"</event>")
file.WriteLine(" <information>")
file.WriteLine(" <channel>"&Replace(.StatusText, "."&vbCrLf, "")&"</channel>")
For Each trigger In .Triggers
filename = trigger.text
startdate = trigger.BeginDay
starttime = trigger.StartTime
ttype = trigger.TriggerType
If ttype = 1 Then
interval1 = trigger.Daily_Interval
interval2 = ""
tttype = left(trigger.Text,Instr(trigger.Text,", starting") - 1)
End If
If ttype = 2 Then
interval1 = trigger.Weekly_Interval
interval2 = trigger.Weekly_DaysOfTheWeek
tttype = left(trigger.Text,Instr(trigger.Text,", starting") - 1)
End If
If ttype = 3 Then
interval1 = trigger.MonthlyDate_Day
interval2 = trigger.MonthlyDate_Months
tttype = left(trigger.Text,Instr(trigger.Text,", starting") - 1)
End If
Next
If .flags And 4 Then
file.WriteLine(" <state>Paused</state>")
Else
file.WriteLine(" <state>Not paused</state>")
End If
file.WriteLine(" <startdate>"&startdate&"</startdate>")
file.WriteLine(" <starttime>"&starttime&"</starttime>")
file.WriteLine(" <ttype>"&ttype&"</ttype>")
file.WriteLine(" <interval1>"&interval1&"</interval1>")
file.WriteLine(" <interval2>"&interval2&"</interval2>")
file.WriteLine(" <tttype>"&tttype&"</tttype>")
file.WriteLine(" </information>")
file.WriteLine(" </item>")
End With
task = task + 1
Next
file.WriteLine("</database>")
file.Close
Set GirderEvent = WScript.CreateObject("Girder.GirderEvent")
GirderEvent.Device = 18
GirderEvent.EventString = "Refresh Schedule"
GirderEvent.Payload(1) = "Schedule"
GirderEvent.Payload(2) = ""
GirderEvent.Payload(3) = ""
GirderEvent.Send()
'MsgBox("End")
jpoveda
 
Posts: 111
Joined: Mon May 17, 2004 6:45 am
Location: Spain

Postby dgemily on Sat Oct 29, 2005 1:32 am

jpoveda wrote: then the problem was refresh the database. I didn't find a way to send a sendcommand from vbs to xlobby (If there is anybody that know how to do it, please, let me know, I'll be eternally grettyful)


you can do it using xevent plugin:

HERE is the last version.

you have to write in the file XAlarmeNow.txt a parameter like that:
Code: Select all
xxx|eventgroup:event
ex: xxx|music:refresh .
the event "refresh" of the eventgroup "music" will be executed imediatly when the parameter will be writed. (maximum 5sec after writing).


so add in your vbs:
- on the top of the script
' ------------------------------------------------------------------------------------
Dim fsoXAlarm, wshXAlarm, XalarmPath, XEventCmd
Set fsoXAlarm = CreateObject("Scripting.FileSystemObject")
Set wshXAlarm = WScript.CreateObject("WScript.Shell")
XalarmPath = "c:\Program Files\XLobby\plugins\XEvent\XAlarmeNow.txt"
' ------------------------------------------------------------------------------------



- place these lines where you want in the script, you can also duplicate them
' ------------------------------------------------------------------------------------
' write in XAlarmeNow.txt : (place it where you want in the script
' you can also duplicate it)
XEventCmd = "music:refresh"
WriteEvent(XEventCmd)
' ------------------------------------------------------------------------------------



- At the end of the script.
' -----------------------------------------------------------------------------------
Function WriteEvent(str)
Dim tf
Set tf = fsoXAlarm.OpenTextFile(XalarmPath, 8, True)
tf.WriteLine( "xxx|" & str )
tf.Close
End Function
' ------------------------------------------------------------------------------------



later,

ps: now, parameters are stocked in a database "Xevent.xml", only immediat events are stocked in XAlarmeNow.txt http://www.xlobby.com/forum/viewtopic.php?t=3217 ;)
dgemily
 
Posts: 793
Joined: Thu May 13, 2004 6:24 am
Location: Paris, France

Postby jpoveda on Sat Oct 29, 2005 6:05 am

Hi dgemily,

How long without talking to you. Thanks for your answer. I'd prefer a solution to to send the command directly to xlobby, not to a plugin, to do so I have girder, it's easier. Other people can choose this way it they don't use girder.

I thought xalarm didn't use xml file (I saw my request and there was not an answer), does it?.

Thanks a lot for your support again.
jpoveda
 
Posts: 111
Joined: Mon May 17, 2004 6:45 am
Location: Spain

Postby dgemily on Sat Oct 29, 2005 11:46 am

jpoveda wrote:Hi dgemily,

How long without talking to you..

yep so far lol, however I was in spain on august :wink:


jpoveda wrote:I'd prefer a solution to to send the command directly to xlobby, not to a plugin, to do so I have girder, it's easier. Other people can choose this way it they don't use girder.

you can use girder of course... me I prefer use xevent, I use it in a lot of vbs and it's working very well and it's not hard to integrate it.

jpoveda wrote:I thought xalarm didn't use xml file (I saw my request and there was not an answer), does it?.
sorryI didn't answer to your post but Ptrinchi add it since a long time ago, but I didn't release it , we where working on some addon on it...
I released a new xalarm fonction using the last XEvent, you can keep an eye on it:
HeavyMetalXFR

HERE are somme screenshots.

later,
dgemily
 
Posts: 793
Joined: Thu May 13, 2004 6:24 am
Location: Paris, France

Postby rembetis on Wed Dec 07, 2005 8:16 pm

Anyone have any idea how I might go about writing an .xsl translation file for this .xml output from Motherboard Monitor? I'm really only interested in displaying the most current data, not the last nine readings...
rembetis
 
Posts: 493
Joined: Thu Jul 28, 2005 10:27 pm