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
  #1  
Old 05-31-2006, 07:04 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Having trouble handling what an api call returns...

I've written a little java program, and what I'm trying to get it to do (as a test), is return the list of active encoding devices, via the "GetActiveCaptureDevices" api call. All I want to do is output the result to the system I/O (the Sage console window).

The file compiles, and runs fine up to this point:
System.out.println(FileList[0]);

The FileList is a result of:
String[] FileList = (String[])sage.SageTV.api("GetActiveCaptureDevices", null);


The error I get is very generic, and I'm not sure why my catch doesn't catch it. It just says "Exception in thread..."

Basically, it doesn't like me treating it like an array of strings.

Things I think I might be doing wrong: It could be returning a NULL if it doesn't think there are any active capture devices, though I've verified there are.

I've compiled the .java file into a .class file, and it is run by Sage on startup. I get other system I/O message out fine. Any suggestions?
Reply With Quote
  #2  
Old 05-31-2006, 07:30 PM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Quote:
Originally Posted by beelzerob
It could be returning a NULL if it doesn't think there are any active capture devices, though I've verified there are.
It should not return NULL (assuming the API is well behaving), but it could return an empty array, so that your call

Code:
System.out.println(FileList[0]);
will access a non-existing element, and throw an exception. Try to check the length of the array before you try to print:

Code:
if (FileList.length > 0) {
   System.out.println(FileList[0]);
} else {
   System.out.println("No active encoders found");
}
Dirk
Reply With Quote
  #3  
Old 05-31-2006, 07:45 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Doh!

It did show up as no encoders found, even though I could find one listed in the Setup screen. However, what I actually had is the Faker capture card (for development), and what I had failed to do was launch the java null encoder program first. So I did it this time, and NOW it's listed as Faker on etc. etc.



Thanks!
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


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


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