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
  #101  
Old 03-10-2009, 09:47 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
I can't confirm this... but I think it would be something like...
Quote:
/sagex/api?c=Watch&1=mediafile:MEDIA_FILE_ID&context=UI_CONTEXT
where MEDIA_FILE_ID is the Media File Id of the file you want to play, and UI_CONTEXT is the context/client on which you want to play the file.

Hope this helps.
Reply With Quote
  #102  
Old 03-10-2009, 11:15 AM
iolaus iolaus is offline
Sage Advanced User
 
Join Date: Jan 2008
Posts: 83
Thanks Stuckless,

I managed to get it working.

Just for the record...

Code:
http://htpc_livingroom:8080/sagex/api?command=Watch&1=mediafile:600831&context=SAGETV_PROCESS_LOCAL_UI
Results in...

Code:
<error>
<message>Unknown Object Type: sage.e$e</message>
<exception>
java.lang.Exception: Unknown Object Type: sage.e$e
	at sagex.remote.builder.SimpleXmlBuilder.handleError(SimpleXmlBuilder.java:38)
	at sagex.remote.builder.SageAPIBuilder.build(SageAPIBuilder.java:56)
	at sagex.remote.api.XmlReplyEncoder.encodeReply(XmlReplyEncoder.java:26)
	at sagex.remote.api.ApiHandler.hanleRequest(ApiHandler.java:151)
	at sagex.remote.SagexServlet.doPost(SagexServlet.java:71)
	at sagex.remote.SagexServlet.doGet(SagexServlet.java:49)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:324)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: java.lang.Exception: Unknown Object Type: sage.e$e
	... 21 more
</exception>
</error>
But does play the file.

While

Code:
http://htpc_livingroom:8080/sagex/rpcXml/MediaPlayerAPI?command=Watch&1=mediafile:600831&context=SAGETV_PROCESS_LOCAL_UI
Results in...

Code:
<response>
<header>
</header>
<body>
<objectRef ref="29522508"/>
</body>
</response>
And also plays the file.
Reply With Quote
  #103  
Old 03-10-2009, 11:30 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Thanks, I will make a note of it and try to fix it in the next build.
Reply With Quote
  #104  
Old 03-20-2009, 11:50 AM
iolaus iolaus is offline
Sage Advanced User
 
Join Date: Jan 2008
Posts: 83
Stuckless,

I'm also getting an error trying to use MediaFileAPI.GetThumbnail(). Could you please take a look at it? Also, do you know if there is any way to retrieve all media thumbnails in one big shot?

Thanks again!
Reply With Quote
  #105  
Old 03-20-2009, 12:11 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by iolaus View Post
Stuckless,

I'm also getting an error trying to use MediaFileAPI.GetThumbnail(). Could you please take a look at it? Also, do you know if there is any way to retrieve all media thumbnails in one big shot?

Thanks again!
MediaFileAPI.GetThumbnail() returns a native sage object that isn't serializable. I'm not sure how to deal with some of those object remotely. I'll add a bug for it, but I'm not sure how to fix it yet.

I'm not sure how to retrieve all thumbnails, except by retrieving all mediafiles and iterating over them.
Reply With Quote
  #106  
Old 03-20-2009, 12:18 PM
iolaus iolaus is offline
Sage Advanced User
 
Join Date: Jan 2008
Posts: 83
Quote:
Originally Posted by stuckless View Post
MediaFileAPI.GetThumbnail() returns a native sage object that isn't serializable. I'm not sure how to deal with some of those object remotely. I'll add a bug for it, but I'm not sure how to fix it yet.
Would it be possible to actually return the binary image data within a XML tag?
Reply With Quote
  #107  
Old 03-20-2009, 12:45 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by iolaus View Post
Would it be possible to actually return the binary image data within a XML tag?
I recall looking at this a long time ago... and I didn't see any way to get access to the actual image. But it's probably doable.

Just curious, which api are you using, Java, or /sagex/rpcXml or /sagex/api ?
Reply With Quote
  #108  
Old 03-20-2009, 03:32 PM
iolaus iolaus is offline
Sage Advanced User
 
Join Date: Jan 2008
Posts: 83
A couple more things I've run into.

http://server/sagex/api?c=GetNowPlayingList always returns:
Code:
<Result/>
even when there are items in the Now Playing List

also...

http://htpc_livingroom:8080/sagex/api?c=GetPlaylists returns:
Code:
<error>
<message>Unknown Object Type: sage.cm</message>
<exception>
java.lang.Exception: Unknown Object Type: sage.cm
	at sagex.remote.builder.SimpleXmlBuilder.handleError(SimpleXmlBuilder.java:38)
	at sagex.remote.builder.SageAPIBuilder.build(SageAPIBuilder.java:56)
	at sagex.remote.builder.SageAPIBuilder.buildArray(SageAPIBuilder.java:158)
	at sagex.remote.builder.SageAPIBuilder.build(SageAPIBuilder.java:42)
	at sagex.remote.api.XmlReplyEncoder.encodeReply(XmlReplyEncoder.java:26)
	at sagex.remote.api.ApiHandler.hanleRequest(ApiHandler.java:151)
	at sagex.remote.SagexServlet.doPost(SagexServlet.java:71)
	at sagex.remote.SagexServlet.doGet(SagexServlet.java:49)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:324)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: java.lang.Exception: Unknown Object Type: sage.cm
	... 23 more
</exception>
</error>
Reply With Quote
  #109  
Old 03-20-2009, 06:49 PM
babgvant babgvant is offline
Sage Icon
 
Join Date: Jul 2008
Location: London
Posts: 1,834
Quote:
Originally Posted by stuckless View Post
I recall looking at this a long time ago... and I didn't see any way to get access to the actual image. But it's probably doable.

Just curious, which api are you using, Java, or /sagex/rpcXml or /sagex/api ?
I'd vote for a base64 encoded byte array if you have time to fix it.
__________________
babgvant.com | @babgvant | Missing Remote
Reply With Quote
  #110  
Old 03-20-2009, 07:04 PM
iolaus iolaus is offline
Sage Advanced User
 
Join Date: Jan 2008
Posts: 83
Quote:
Originally Posted by stuckless View Post
Just curious, which api are you using, Java, or /sagex/rpcXml or /sagex/api ?
Sorry, I missed that bit before. I'm using sagex/api.

I have another big request. It would be fantastic if you could add some sort of &filter= parameter to the query string to limit the XML elements that are returned. I seem to be able to get Media Files from the server across my LAN at about 40/second. I think if I could limit the returned XML to only elements I'm using that figure would skyrocket.

Thanks again for all your work,
Ryan
Reply With Quote
  #111  
Old 03-20-2009, 07:24 PM
babgvant babgvant is offline
Sage Icon
 
Join Date: Jul 2008
Location: London
Posts: 1,834
Quote:
Originally Posted by iolaus View Post

I have another big request. It would be fantastic if you could add some sort of &filter= parameter to the query string to limit the XML elements that are returned. I seem to be able to get Media Files from the server across my LAN at about 40/second. I think if I could limit the returned XML to only elements I'm using that figure would skyrocket.

Thanks again for all your work,
Ryan
You're probably bound by the sage api perf not bandwidth, so unless there's a huge gain in not serializing the object, you might not see any diff.
__________________
babgvant.com | @babgvant | Missing Remote
Reply With Quote
  #112  
Old 03-21-2009, 07:22 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by iolaus View Post
A couple more things I've run into.

http://server/sagex/api?c=GetNowPlayingList always returns:
Code:
<Result/>
even when there are items in the Now Playing List

also...

http://htpc_livingroom:8080/sagex/api?c=GetPlaylists returns:
Code:
<error>
<message>Unknown Object Type: sage.cm</message>
<exception>
java.lang.Exception: Unknown Object Type: sage.cm
	at sagex.remote.builder.SimpleXmlBuilder.handleError(SimpleXmlBuilder.java:38)
	at sagex.remote.builder.SageAPIBuilder.build(SageAPIBuilder.java:56)
	at sagex.remote.builder.SageAPIBuilder.buildArray(SageAPIBuilder.java:158)
	at sagex.remote.builder.SageAPIBuilder.build(SageAPIBuilder.java:42)
	at sagex.remote.api.XmlReplyEncoder.encodeReply(XmlReplyEncoder.java:26)
	at sagex.remote.api.ApiHandler.hanleRequest(ApiHandler.java:151)
	at sagex.remote.SagexServlet.doPost(SagexServlet.java:71)
	at sagex.remote.SagexServlet.doGet(SagexServlet.java:49)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:324)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: java.lang.Exception: Unknown Object Type: sage.cm
	... 23 more
</exception>
</error>

The first issue gives an empty result because you need to specify a UI context. And the second issue is a result that I haven't added a serializer for playlist objects. I've added a bug second one. The irony here is that when you call the first url with a context, then you get the same error as your second example, because the object type isn't yet supported.

So the bug is in the system... I can't say when I'll have a fix.
Reply With Quote
  #113  
Old 03-21-2009, 07:26 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by babgvant View Post
I'd vote for a base64 encoded byte array if you have time to fix it.
I've added a bug for image serialization stuff.... I'll try to do a base64 encoded string... or maybe just a url to the image??
Reply With Quote
  #114  
Old 03-21-2009, 07:32 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by iolaus View Post
I have another big request. It would be fantastic if you could add some sort of &filter= parameter to the query string to limit the XML elements that are returned. I seem to be able to get Media Files from the server across my LAN at about 40/second. I think if I could limit the returned XML to only elements I'm using that figure would skyrocket.
Currently the api supports "chunking" the xml results, so that the results can be paged.

if you invoke the api url without any parameters, it shows you all the availble args that supported for an api call.
Code:
http://mediaserver:8081/sagex/api
start and size are there to control the starting position and # of elements that is returns when the result is an array.

If you are looking at returning all elements and then post processing them, then you might want to consider using the EvaluateExpression to have your processing done on the server, and then have the results sent back...

Something like this...
Code:
/sagex/api?c=EvaluateExpression&1=Sort(GetMediaFiles("T"),false,"Intelligent")
Have I misunderstood the request?
Reply With Quote
  #115  
Old 03-21-2009, 08:27 AM
babgvant babgvant is offline
Sage Icon
 
Join Date: Jul 2008
Location: London
Posts: 1,834
Quote:
Originally Posted by stuckless View Post
I've added a bug for image serialization stuff.... I'll try to do a base64 encoded string... or maybe just a url to the image??
If the url points at your API, that would work. Otherwise the client app might not have direct access to the image (i.e. thumbnails stored in the sage root).
__________________
babgvant.com | @babgvant | Missing Remote
Reply With Quote
  #116  
Old 03-21-2009, 05:09 PM
iolaus iolaus is offline
Sage Advanced User
 
Join Date: Jan 2008
Posts: 83
Quote:
Originally Posted by stuckless View Post
Currently the api supports "chunking" the xml results, so that the results can be paged.

if you invoke the api url without any parameters, it shows you all the availble args that supported for an api call.
Code:
http://mediaserver:8081/sagex/api
start and size are there to control the starting position and # of elements that is returns when the result is an array.

If you are looking at returning all elements and then post processing them, then you might want to consider using the EvaluateExpression to have your processing done on the server, and then have the results sent back...

Something like this...
Code:
/sagex/api?c=EvaluateExpression&1=Sort(GetMediaFiles("T"),false,"Intelligent")
Have I misunderstood the request?
I am using the chunking feature to avoid heap space limitations but my real problem is speed. When I make a GetMediaFiles request it can take quite a while to retrieve the results. I was assuming this was a matter of file transfer but as babgvant pointed out it may be a matter of Sage API serialization speed.

Doing a test it took 3:35 to retrieve the xml for 3700 media files using a chunk size of 50. Responses seem to be taking between 0 and 21 seconds per chunk which seems a little odd. I'm wondering if certain files or media types take significantly longer than others to serialize.

Any suggestions on how I might speed up the results when using GetMediaFiles for a large collection?

Quote:
Originally Posted by stuckless View Post
The first issue gives an empty result because you need to specify a UI context. And the second issue is a result that I haven't added a serializer for playlist objects. I've added a bug second one. The irony here is that when you call the first url with a context, then you get the same error as your second example, because the object type isn't yet supported.

So the bug is in the system... I can't say when I'll have a fix.
Thanks for looking into this, I'm excited to give it a try once it is fixed.

Last edited by iolaus; 03-21-2009 at 05:13 PM.
Reply With Quote
  #117  
Old 03-21-2009, 06:35 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
iolaus,

There has to be a reason why the response is taking so long in your case.

When i execute this command,
Code:
http://mediaserver:8081/sagex/api?command=EvaluateExpression&1=Size(GetMediaFiles())
it returns immediately with
Code:
<Result>30561</Result>
Next if i issue this command,
Code:
http://mediaserver:8081/sagex/api?command=GetMediaFiles
I get back an xml with 50 results in less than a second.

My server isn't a beefy server, it's a single core 2.4ghz with 1024mb memory.

So, i'm wondering if maybe after you issue this command if you could check the sage log file and see if there are exceptions. If the serialization process was encountering errors during the process, then that may account for the slow serialization process, since logging exception stack tracing can be a time consuming operation.
Reply With Quote
  #118  
Old 03-22-2009, 12:18 AM
iolaus iolaus is offline
Sage Advanced User
 
Join Date: Jan 2008
Posts: 83
Quote:
Originally Posted by stuckless View Post
iolaus,

There has to be a reason why the response is taking so long in your case.

When i execute this command,
Code:
http://mediaserver:8081/sagex/api?command=EvaluateExpression&1=Size(GetMediaFiles())
it returns immediately with
Code:
<Result>30561</Result>
Next if i issue this command,
Code:
http://mediaserver:8081/sagex/api?command=GetMediaFiles
I get back an xml with 50 results in less than a second.

My server isn't a beefy server, it's a single core 2.4ghz with 1024mb memory.

So, i'm wondering if maybe after you issue this command if you could check the sage log file and see if there are exceptions. If the serialization process was encountering errors during the process, then that may account for the slow serialization process, since logging exception stack tracing can be a time consuming operation.
I think I found the issue. I have about 150 songs tagged with the album name "Unsorted". For each of these files GetMediaFiles generates a <MediaFile> tag with 150 child <Airing> tags under <Album><AlbumTracks>.

In other words, each Song's <MediaFile> tag has child tags for every other song on the same album (which makes the tag sizes increase exponentially with # of tracks per album).

Would it possible to exclude data about other tracks on the album from a serialized song's <MediaFile> tag? If not, is there any other solution?
Reply With Quote
  #119  
Old 03-22-2009, 05:47 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
I've added bug for this as well...

My apologies, but currently I'm swamped with phoenix and metadata tools work, but I'll try to take a look at these serialization issues once we release the phoenix apis and the latest metadata tools.

The only alternative that I can think of, is to use the encoder=nielm option to return the xml in the sage webserver xml format. Niem's serializer works a little different and I bet it doesn't have the recursive flaw.
Reply With Quote
  #120  
Old 03-22-2009, 09:25 AM
iolaus iolaus is offline
Sage Advanced User
 
Join Date: Jan 2008
Posts: 83
Quote:
Originally Posted by stuckless View Post
I've added bug for this as well...

My apologies, but currently I'm swamped with phoenix and metadata tools work, but I'll try to take a look at these serialization issues once we release the phoenix apis and the latest metadata tools.

The only alternative that I can think of, is to use the encoder=nielm option to return the xml in the sage webserver xml format. Niem's serializer works a little different and I bet it doesn't have the recursive flaw.
Thanks for looking into it. Just for the record I think I was wrong when I said it increased exponentially. In fact, I think it increases at rate of (# of tracks)^2.

I'm not sure if it would be possible within your design but a quick fix might be to just not serialize the MediaFile.Album.AlbumTracks list. Any information in that list should be available in other MediaFiles.
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
Hauppauge Remote Issue yacht_boy Hardware Support 4 05-01-2008 09:25 PM
MCE remote transmitting keypresses twice arnabbiswas Hardware Support 1 02-22-2007 10:55 AM
MCE Remote not work fully with Placeshifter devinteske SageTV Placeshifter 5 02-08-2007 11:45 PM
Harmony Remote IR Reciever Help brundag5 Hardware Support 2 01-13-2007 09:08 PM
How to get SageTV to release focus to NVDVD for remote IncredibleHat SageTV Software 4 07-06-2006 07:47 AM


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


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