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
  #241  
Old 12-02-2010, 12:21 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by bradvido View Post
I've got a question on how to use the api. I'm trying to get XML over http.

Say, for example, I want to call GetFileDuration, which takes 1 parameter:
Code:
1; MediaFile:sage.MediaFile
What should i use for this MediaFile parameter? Do i just pass in the mediafileID? I tried that like so, where my MediaFileID is 86533:
Code:
http://localhost:8080/sagex/api?c=GetFileDuration&1=86533
but it returned
Code:
<Result>0</Result>
Is the media file ID not the right thing to pass in? How can i pass a MedaiFile object in?
I'm not sure if you've seen or read the documentation that ships with the api, but if you enter, http://localhost:8080/sagex/api in your browser, then it gives some help on using the api over http.

The very first sentence...
Quote:
NOTE: If the command arg expects a sage object, such mediafile, ariing, playlist, channel, show, etc, then you can still pass a reference to sage object, using mediafile:MEDIAFILE_ID, airing:AIRING_ID, playlist:PLAYLIST_NAME, etc.
so, in your case, it should be
Code:
http://localhost:8080/sagex/api?c=GetFileDuration&1=mediafile:86533
Reply With Quote
  #242  
Old 12-02-2010, 12:39 PM
bradvido's Avatar
bradvido bradvido is offline
Sage User
 
Join Date: Nov 2010
Location: MN
Posts: 68
Thanks you. I had looked at the documentation, but I was so eager to start using the methods that I missed that info at the top.
This is now working.

Thanks, again.
Reply With Quote
  #243  
Old 12-02-2010, 01:15 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by bradvido View Post
Thanks you. I had looked at the documentation, but I was so eager to start using the methods that I missed that info at the top.
This is now working.

Thanks, again.
Glad it's working, and good luck.
Reply With Quote
  #244  
Old 12-05-2010, 10:56 AM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Quote:
Originally Posted by stuckless View Post
I guess I need a specialized media handler for music.... since you have the sagex-code, and you see how I added the /logo handler... you could add in the music handler, if you wanted
Has there been any progress in that regard?

I suppose the pictures would also need a dedicated method, as the /sagex/media/thumbnail/ didn't seem to work them.
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #245  
Old 12-05-2010, 11:15 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by Fonceur View Post
Has there been any progress in that regard?

I suppose the pictures would also need a dedicated method, as the /sagex/media/thumbnail/ didn't seem to work them.
You can try
/sagex/media/albumart/####
where #### is the mediafile id of the mediafile that belongs to the album.

I don't don't have any music on my test server, so i can't really test this myself.
Reply With Quote
  #246  
Old 12-05-2010, 11:27 AM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Quote:
Originally Posted by stuckless View Post
You can try /sagex/media/albumart/####
Thanks, that does work great!

So what about photos, any way to get at them?
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #247  
Old 12-05-2010, 12:57 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by Fonceur View Post
Thanks, that does work great!

So what about photos, any way to get at them?
I'm not sure, but you can fetch any media file via
/sagex/media/mediafile/####
I'm assuming this would work for music, photos and video files, but I haven't tested it

btw, you may be able to do it by file a well, if you used
/sagex/media/mediafile?mediafile=full_path_to_mediafile

provided the full_path_to_mediafile resolves to a mediafile when passed to GetMediaFileForPath()
Reply With Quote
  #248  
Old 12-05-2010, 01:52 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Quote:
Originally Posted by stuckless View Post
I'm assuming this would work for music, photos and video files, but I haven't tested it
I did test it, and it wasn't working. I got:

Code:
Problem accessing /sagex/media/mediafile/161. Reason:

    F:\Photos\JP-Lisette\Picture 209.jpg
Quote:
btw, you may be able to do it by file a well, if you used
/sagex/media/mediafile?mediafile=full_path_to_mediafile
I just tried that and got:

Code:
sagex.api (7.0.23.3): Media Handler Error
3

java.lang.ArrayIndexOutOfBoundsException: 3
	at sagex.remote.media.MediaHandler.handleRequest(MediaHandler.java:65)
	at sagex.remote.SagexServlet.doPost(SagexServlet.java:63)
	at sagex.remote.SagexServlet.doGet(SagexServlet.java:41)
	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:502)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.handler.rewrite.RewriteHandler.handle(RewriteHandler.java:230)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:322)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #249  
Old 12-05-2010, 03:32 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
I just tried
Code:
http://localhost:8080/sagex/media/mediafile?mediafile=/home/sean/BETA/Images/IMG_20100722_131852.jpg
and I got an image.

I also tried doing it by by id as well, and it worked.
Code:
http://localhost:8080/sagex/media/mediafile/513870
BTW, that exception is a result of not passing the mediafile parameter. I'm guessing your url had a typo or you specified the args as /sagex/media/medifile&mediafile=## instead of using ?mediafile=
Reply With Quote
  #250  
Old 12-05-2010, 03:54 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Doh! I moved my photos' folder and the wiz.bin was still pointing to the older location, which is why that wasn't working... So the thumbnail works for the pictures, though the other methods are trying to play an mpg.
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #251  
Old 12-05-2010, 06:16 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Since those images are bigger than what I need, I've been trying to rescale them with Phoenix API and &transform=[{name:scale, height:100},{name:reflection}], but I'm not having much luck... Is that supposed to only work for the posters or for the rest too?

Used with the /media/thumbnail, that results in a "Not A MediaFile", while with "media/mediafile?mediafile=" the full image is returned, not transformed...
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #252  
Old 12-05-2010, 07:00 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by Fonceur View Post
Since those images are bigger than what I need, I've been trying to rescale them with Phoenix API and &transform=[{name:scale, height:100},{name:reflection}], but I'm not having much luck... Is that supposed to only work for the posters or for the rest too?

Used with the /media/thumbnail, that results in a "Not A MediaFile", while with "media/mediafile?mediafile=" the full image is returned, not transformed...
The transforms are a part of the phoenix extensions to the sagex apis, but they only apply when using poster, background, or banner. ie, they don't work for mediafile (pictures) or thumbnails. Mainly it's because the transforms are a recognized function of the fanart additions. I've considered trying to make them available to the other image apis, but I need to do so in such a way that sagex doesn't depend on phoenix, which is where the transformation apis exist.
Reply With Quote
  #253  
Old 12-05-2010, 07:02 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by Fonceur View Post
Doh! I moved my photos' folder and the wiz.bin was still pointing to the older location, which is why that wasn't working... So the thumbnail works for the pictures, though the other methods are trying to play an mpg.
I wonder if i'm automatically setting the mime type a video mime type... i know the apis are quite dumb in that they don't really check what is being returned.
Reply With Quote
  #254  
Old 12-05-2010, 07:34 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Quote:
Originally Posted by stuckless View Post
The transforms are a part of the phoenix extensions to the sagex apis, but they only apply when using poster, background, or banner. ie, they don't work for mediafile (pictures) or thumbnails.
Makes sense, the wiki was a little ambiguous, so I was hoping you were able to make use of the Phoenix API on the other mediafiles.

Quote:
Originally Posted by stuckless View Post
I wonder if i'm automatically setting the mime type a video mime type...
That might explain it...
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #255  
Old 12-07-2010, 02:49 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
With /media/thumbnail, I am getting the feeling that if the thumbnail does not already exists, the first call will fail and a second call is required. Any chance of catching it server side?
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #256  
Old 12-07-2010, 03:18 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by Fonceur View Post
With /media/thumbnail, I am getting the feeling that if the thumbnail does not already exists, the first call will fail and a second call is required. Any chance of catching it server side?
I'm not sure I understand. Basically I just call the GetThumnail api and convert it. It may be that Sage is asynchronous in that manner, in that the MetaImage returned may not acutallly have created the physical thumbnail. I'm not sure how to catch, this, because I don't think an error is thrown on the server. I may have some time to look at this on the weekend, and see what is happening. I've noticed similar behaviour from the bmt web ui, but i haven't been curious enough yet to actually look at it
Reply With Quote
  #257  
Old 12-07-2010, 03:24 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Quote:
Originally Posted by stuckless View Post
It may be that Sage is asynchronous in that manner, in that the MetaImage returned may not acutallly have created the physical thumbnail.
Yes that's what I'm thinking. While there might not be any error, there must be a completion event, as you can see the STV filling up those thumbnails as they get generated (if they were missing).
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #258  
Old 12-11-2010, 09:23 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Quote:
Originally Posted by stuckless View Post
Basically I just call the GetThumnail api and convert it. It may be that Sage is asynchronous in that manner, in that the MetaImage returned may not acutallly have created the physical thumbnail. I'm not sure how to catch, this, because I don't think an error is thrown on the server.
When the thumbnail is not ready, I am systematically seeing a message of length 75, which does not properly translate to text:

<89504e47 0d0a1a0a 0000000d 49484452 00000010 00000010 08060000 001ff3ff 61000000 12494441 5478da63 601805a3 60148c02 08000004 100001af 45882c00 00000049 454e44ae 426082>

That seems to convert to a blank image of 1 MB size or maybe it's just garbage...
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #259  
Old 12-12-2010, 10:19 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by Fonceur View Post
When the thumbnail is not ready, I am systematically seeing a message of length 75, which does not properly translate to text:

<89504e47 0d0a1a0a 0000000d 49484452 00000010 00000010 08060000 001ff3ff 61000000 12494441 5478da63 601805a3 60148c02 08000004 100001af 45882c00 00000049 454e44ae 426082>

That seems to convert to a blank image of 1 MB size or maybe it's just garbage...
Thanks... I haven't had a chance to look at this yet... too busy fighting fires in bmt
Reply With Quote
  #260  
Old 12-12-2010, 06: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 Fonceur View Post
When the thumbnail is not ready, I am systematically seeing a message of length 75, which does not properly translate to text:

<89504e47 0d0a1a0a 0000000d 49484452 00000010 00000010 08060000 001ff3ff 61000000 12494441 5478da63 601805a3 60148c02 08000004 100001af 45882c00 00000049 454e44ae 426082>

That seems to convert to a blank image of 1 MB size or maybe it's just garbage...
I've updated the sagex-apis, so hopefully this problem will be resolved. If not, then email directly at metadatatools at gmail dot com, and I can send you debug versions without having to publish a full build.

BTW, on another note... I've added a force-mime parameter to the /mediafile/ handler. So, if you request an image, from the image libary, then you can force a mime type as well...

/sagex/mediafile/1232323?force-mime=image/jpeg
or
/sagex/mediafile?mediafile=/path/to/music.mpg&force-mime=audio/mpeg

You may not need to actually force a mime, because I do check and set a mime type based on the media file type. But, if i choose the wrong one, then you have the option to override.
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.