SageTV Community  

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

Notices

SageTV v7 Customizations This forums is for discussing and sharing user-created modifications for the SageTV version 7 application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss plugins for SageTV version 7 and newer.

Reply
 
Thread Tools Search this Thread Display Modes
  #21  
Old 08-30-2012, 07:37 AM
JerryB JerryB is offline
Sage Aficionado
 
Join Date: Aug 2008
Posts: 273
Quote:
Originally Posted by stuckless View Post
FYI.... the sagex-apis provide a REST interface to the sagetv apis. So, if you can invoke any sagetv api call and return the data as json or xml from the server.
...
sagex-api also allows your to publish your own services to the server in a javascript file and then you can call those services remotes. The Plex plugin uses this feature, if I recall. This feature is handy because you may want to do something a little more complex and it's faster to grab a bunch of files on the server, process then, and then send back the results instead of doing it on the client. The services javascript is like "storage procedures".
Thanks. I'm already using the sagex-apis to retrieve data when the app is running. What I haven't figured out is how to create a single URL that I can schedule the system to call on an intermittent basis that returns a file with the necessary data in the correct format for the Live Tile update. Your last paragraph is a little over my head at the moment, I have very little experience with web publishing but, if I understand it correctly, this is possible to do. I just need to learn how.
Reply With Quote
  #22  
Old 08-30-2012, 08:36 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by JerryB View Post
Thanks. I'm already using the sagex-apis to retrieve data when the app is running. What I haven't figured out is how to create a single URL that I can schedule the system to call on an intermittent basis that returns a file with the necessary data in the correct format for the Live Tile update. Your last paragraph is a little over my head at the moment, I have very little experience with web publishing but, if I understand it correctly, this is possible to do. I just need to learn how.
Yeah, the javascript side isn't really web publishing... just that you define a one or more functions in a javascript file and then you put them in the sagex/ directory in the SAGE_HOME directory. (There is a sample file there already)

Good luck on your App.
Reply With Quote
  #23  
Old 08-30-2012, 10:17 AM
JerryB JerryB is offline
Sage Aficionado
 
Join Date: Aug 2008
Posts: 273
Quote:
Originally Posted by stuckless View Post
define a one or more functions in a javascript file and then you put them in the sagex/ directory in the SAGE_HOME directory. (There is a sample file there already).
Thanks, I found the sample file and I think I understand. If I'm correct, I need to create a javascript file in the sagex/ directory that queries the SageTV server for the necessary information and outputs this information in the format needed for a Live Tile update. I then invoke this function through a call to the SageTV server using the sagex.api. I still need to work out the details and implementation but at least I'm more confident that it can be done and have a basic approach on how to accomplish it.
Reply With Quote
  #24  
Old 09-04-2012, 12:57 PM
JerryB JerryB is offline
Sage Aficionado
 
Join Date: Aug 2008
Posts: 273
Programming help needed

I'm trying to create an external javascript file that I can access to retrieve data from the sagex.api for live tile updates as suggested by Stuckless and have run into a problem. Specifically, I have a line of code in the javascript file that reads:

var oReg = new XMLHttpRequest();

This line of code is generating the following error message:

javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "XMLHttpRequest" is not defined. (<Unknown source>#25) in <Unknown source> at line number 25

I've tried researching this online and haven't been able to find any examples where "XMLHttpRequest" is specifically defined. Does anyone know what's causing "XMLHttpRequest" to be undefined in my code or what I need to do in my code to define it? Thanks.
Reply With Quote
  #25  
Old 09-04-2012, 01:36 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by JerryB View Post
I'm trying to create an external javascript file that I can access to retrieve data from the sagex.api for live tile updates as suggested by Stuckless and have run into a problem. Specifically, I have a line of code in the javascript file that reads:

var oReg = new XMLHttpRequest();

This line of code is generating the following error message:

javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "XMLHttpRequest" is not defined. (<Unknown source>#25) in <Unknown source> at line number 25

I've tried researching this online and haven't been able to find any examples where "XMLHttpRequest" is specifically defined. Does anyone know what's causing "XMLHttpRequest" to be undefined in my code or what I need to do in my code to define it? Thanks.
Jerry, is this a "javascript" file that you are putting in the sagex script area? If so, then you are on the wrong track.

If it is a sagex api script, then email me... metadatatools at gmail dot com.
Reply With Quote
  #26  
Old 09-04-2012, 01:55 PM
JerryB JerryB is offline
Sage Aficionado
 
Join Date: Aug 2008
Posts: 273
Quote:
Originally Posted by stuckless View Post
Jerry, is this a "javascript" file that you are putting in the sagex script area? If so, then you are on the wrong track.
I'm definitely on the wrong track. I'll go back to the Sagex api documentation and see if I can figure out where I went wrong.
Reply With Quote
  #27  
Old 09-04-2012, 02:06 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by JerryB View Post
I'm definitely on the wrong track. I'll go back to the Sagex api documentation and see if I can figure out where I went wrong.
Jerry, the sagex scripts reside on the server, and are executed in the server's environment, so there is not "communicating" with the server once you are in the script. Once you are in the script you can now call Sage APIs directly and use Java calls as well, if you want, to build up a reply.

When you build up a reply, typically it will be a java.util.List or java.util.Map. The sagex apis will take care serialzing that as xml or json.

Again, I don't mind working with you on this. When Michael was working on the Plex stuff, I worked with him on understanding how to use the sagex scripts. Just email with with what you are trying to do, and I'll try to quickly get you on your way
Reply With Quote
  #28  
Old 09-04-2012, 02:22 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
To expand on that, here's the file that plex scanner uses. They have a single "function" in their javascript that takes a filename, and it finds the mediafile for that given name.

http://code.google.com/p/sagetv-for-...rvices/plex.js

When you call it from a client (ie plex client), the url would be something like this...

Code:
http://SERVER/sagex/api?c=plex:GetMediaFileForName&1=SomeFileName.mkv
On the server, it would execute the GetMediaFileForName function in the plex.js file and serialize the results back as xml (or json if you pass the json encoder in the url). In this case it's returning a single mediafile, and because it's a single mediafile.

Do that make sense? Again, if you provide something specific as to what you are wanting to do, I can help you, and maybe you don't even need a custom script, since you can do a lot with use the url api... and you only need the javascript if you want to do something more efficiently, or if you want to do something that can't be crafted easily as a url api.
Reply With Quote
  #29  
Old 09-04-2012, 04:13 PM
JerryB JerryB is offline
Sage Aficionado
 
Join Date: Aug 2008
Posts: 273
I'm making progress and am now retrieving titles and start times for scheduled recordings through my custom function.

The issue for tomorrow is how to format the start times that I'm retrieving into something recognizable for the user. Can I include a javascript date/time formatting function in the same file as my custom function and then call this function from my custom function or am I strictly limited to what's in the sagex api?

Thanks for your offer of help. If I get really stuck again, I'll take you up on it.
Reply With Quote
  #30  
Old 09-04-2012, 05:36 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by JerryB View Post
I'm making progress and am now retrieving titles and start times for scheduled recordings through my custom function.

The issue for tomorrow is how to format the start times that I'm retrieving into something recognizable for the user. Can I include a javascript date/time formatting function in the same file as my custom function and then call this function from my custom function or am I strictly limited to what's in the sagex api?

Thanks for your offer of help. If I get really stuck again, I'll take you up on it.
You can use any api in SageTV or Java 6 plus any of the included jars.
Reply With Quote
  #31  
Old 09-06-2012, 02:56 PM
JerryB JerryB is offline
Sage Aficionado
 
Join Date: Aug 2008
Posts: 273
Metro App Development Terminated

I just received the following reply from a Microsoft Employee in response to a programming question concerning the Windows 8 Metro App for SageTV:

Quote:
Just FYI... did you know that we block all localhost traffic so hosting a webserver on the same box as the application will fail and not pass store certification. Also, you cannot ship an app that has outside dependency requirements that do not ship in the app package so if you intend to submit this app to the store, ensure it runs fine without any other dependencies (like this web server) or it will not be allowed in the store.
Since, on at least on some setups, the webserver and the app will reside on the same box and since it is impossible for me to provide all the necessary dependencies (SageTV, jetty web server, sagex, etc) in the app package, this app will never be approved by Microsoft for distribution, an absolute requirement for Metro apps. Therefore, I’ve decided to terminate development efforts.
Reply With Quote
  #32  
Old 09-06-2012, 03:53 PM
darcilicious's Avatar
darcilicious darcilicious is offline
Sage Icon
 
Join Date: Jul 2009
Location: Venus
Posts: 1,306
Wow, those are some really harsh requirements

Thanks for making the effort! It's just too bad that MS came up with some whacky restrictions.

(Wait, Metro Apps can't talk to ANY webservers? That seems like a huge limitation? How are any server/client type apps to be developed then?? How do weather apps get their data, etc?)
__________________
SageTV Server 7.1.x w/Gemstone and Plex Home Theater v1.0.10 w/PlexPass
HD-PVR w/v1.5.6 drivers / Hauppauge IR blaster / FiOS Extreme HD / Motorola QIP6200 / SPDIF+720p Fixed Output
on HP Media Center 8400F (Phenom 9500 QuadCore 2.2GHz, nVidia GeForce 8500 GT)
via Olevia 247TFHD/Onyko TX-SR606/Harmony 550/HP MediaSmart EX490 WHS w/12TB
Plex Media Server v0.9.9.5 on HP Touchsmart Envy 23 d16qd
Sonos Play:3, Connect / SimpleTV v2 / Roku 2 XS+Plex / iPhone 5 / iPad 2
Reply With Quote
  #33  
Old 09-06-2012, 04:35 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by darcilicious View Post
Wow, those are some really harsh requirements

Thanks for making the effort! It's just too bad that MS came up with some whacky restrictions.

(Wait, Metro Apps can't talk to ANY webservers? That seems like a huge limitation? How are any server/client type apps to be developed then?? How do weather apps get their data, etc?)
It would appear you can talk to public webservers, just not local ones. ie, if you depend on the user having to configure a local server address (ie, for sagetv, plex, etc) then the app will not pass, but if you depend on mydomain.com and it's a valid domain and the app can talk to it at the time of approval, you are good. That's the way I read it. It should be interesting to see how Plex and Xbmc handle this, since they will require a setup that either discovers servers, or you have to manually add them in order to test the application.
Reply With Quote
  #34  
Old 09-06-2012, 05:10 PM
darcilicious's Avatar
darcilicious darcilicious is offline
Sage Icon
 
Join Date: Jul 2009
Location: Venus
Posts: 1,306
Quote:
It should be interesting to see how Plex and Xbmc handle this, since they will require a setup that either discovers servers, or you have to manually add them in order to test the application.
I had similar thoughts though there will always be the desktop versions; and Plex recently came out with a web *client* version which I think is a great way around this whole "Metro App" thing.
__________________
SageTV Server 7.1.x w/Gemstone and Plex Home Theater v1.0.10 w/PlexPass
HD-PVR w/v1.5.6 drivers / Hauppauge IR blaster / FiOS Extreme HD / Motorola QIP6200 / SPDIF+720p Fixed Output
on HP Media Center 8400F (Phenom 9500 QuadCore 2.2GHz, nVidia GeForce 8500 GT)
via Olevia 247TFHD/Onyko TX-SR606/Harmony 550/HP MediaSmart EX490 WHS w/12TB
Plex Media Server v0.9.9.5 on HP Touchsmart Envy 23 d16qd
Sonos Play:3, Connect / SimpleTV v2 / Roku 2 XS+Plex / iPhone 5 / iPad 2
Reply With Quote
  #35  
Old 09-06-2012, 05:31 PM
JerryB JerryB is offline
Sage Aficionado
 
Join Date: Aug 2008
Posts: 273
Quote:
Originally Posted by stuckless View Post
It would appear you can talk to public webservers, just not local ones. ie, if you depend on the user having to configure a local server address (ie, for sagetv, plex, etc) then the app will not pass, but if you depend on mydomain.com and it's a valid domain and the app can talk to it at the time of approval, you are good. That's the way I read it.
That's how I read it as well. Metro apps that get their information from public web servers are fine but apps that get their information from private and especially local web servers are not. Unfortunately, with respect to SageTV, the only data that is meaningful to a user is the data from their own server.
Reply With Quote
  #36  
Old 09-06-2012, 06:20 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
Won't this preclude apps like Orb, AirVideo, etc?
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #37  
Old 09-07-2012, 07:01 AM
JerryB JerryB is offline
Sage Aficionado
 
Join Date: Aug 2008
Posts: 273
Just to be sure, I sent a message to Microsoft providing the details and describing exactly what I was trying to do with the SageTV Metro app and received a reply confirming that, given those circumstances, they will not approve the app.
Reply With Quote
  #38  
Old 09-07-2012, 07:36 AM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
That is very annoying and brings another downside to Win8.

Any chance of just improving the existing Gadget? I believe that gadgets still run in Win8 and will also work in Win7 and Vista.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #39  
Old 09-07-2012, 08:52 AM
JerryB JerryB is offline
Sage Aficionado
 
Join Date: Aug 2008
Posts: 273
Quote:
Originally Posted by wayner View Post
That is very annoying and brings another downside to Win8.

Any chance of just improving the existing Gadget? I believe that gadgets still run in Win8 and will also work in Win7 and Vista.
Windows removed all support from Gadgets from Win8 at the RTM stage. That's why I started writing a Win8 app, to try and replace the gadget functionality that I was losing.

FYI, if you really want to run the SageTV gadget in Win8, there are hacks available on the Internet that restore gadget functionality by copying and pasting the files, etc. from a previous version of Windows. Of course, you need to be aware of the security concerns with this approach since Microsoft is never going to fix the documented security problems in these files. For myself, I have decided not hack gadget support into Win8 on my systems.
Reply With Quote
  #40  
Old 09-07-2012, 10:02 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by JerryB View Post
Windows removed all support from Gadgets from Win8 at the RTM stage. That's why I started writing a Win8 app, to try and replace the gadget functionality that I was losing.

FYI, if you really want to run the SageTV gadget in Win8, there are hacks available on the Internet that restore gadget functionality by copying and pasting the files, etc. from a previous version of Windows. Of course, you need to be aware of the security concerns with this approach since Microsoft is never going to fix the documented security problems in these files. For myself, I have decided not hack gadget support into Win8 on my systems.
I would pick this up again 6 months after Windows 8 is released. I'm sure MS will change some of their policies (for better or worse) once the OS is released.
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
Are plugins: "Ortus MQ" & "SageTV H2 Mobile Database" needed? mkanet SageTV Customizations 2 12-06-2010 06:56 AM
"Backdrops" "SageTV" "Covers" folders - what's creating them mp328 Sage My Movies 4 09-20-2010 05:31 PM
Potential to make many people happy... "My Movies" for SageTV? vvulture SageTV Customizations 116 04-27-2009 04:53 PM
Can anyone customize for me a Sagetv import for "movie now" "news now" .. menus thenewguy1979 SageMC Custom Interface 9 09-18-2008 02:41 PM
Potential bug in "Keep at Most" field in Favorites Manager jeremydmiller SageTV Software 9 03-19-2005 05:46 PM


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


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