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 07-16-2009, 06:20 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Clarification on api/apiUI

From the sagetv javadoc, it says,
Quote:
By default, all method calls made using the api call that need a user interface context will use the local user interface context.
From that, I can assume that if api() is used, then at any time it needs a UI context, it will default to SAGETV_PROCESS_LOCAL_UI.

But, if apiUI is called, with null, will it also default to SAGETV_PROCESS_LOCAL_UI? ie, will the following 3 statements yield the same results.

Code:
apiUI("SAGETV_PROCESS_LOCAL_UI", Cmd, Args)
apiUI(null, Cmd, Args)
api(Cmd, Args)
Also, does SageTV ignore the context for API calls that do not require a Context. ie, if I have a valid SageTV context, is it always safe to pass the UI context.
Reply With Quote
  #2  
Old 07-16-2009, 08:45 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
My experience is that calling apiUI() with a null context means no UI context, not the local UI context. So this way of calling it is useful only for methods that deal with global database and configuration data, and not for any UI-related API methods (i.e. those that change client settings, control media playback, etc).

Passing a context in to a method that doesn't require it does no harm; the method still operates on the shared global data regardless of which context you pass in.

The thing to remember is that when running in service mode, the service process has no local UI context. So in that case you must always pass in a valid context to do anything UI-related.

The rule I use in my API wrappers is to always call apiUI() instead of api(), and always pass in an explicit context if available, instead of relying on any defaulting behavior.
__________________
-- Greg
Reply With Quote
  #3  
Old 07-16-2009, 08:53 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by GKusnick View Post
My experience is that calling apiUI() with a null context means no UI context, not the local UI context. So this way of calling it is useful only for methods that deal with global database and configuration data, and not for any UI-related API methods (i.e. those that change client settings, control media playback, etc).

Passing a context in to a method that doesn't require it does no harm; the method still operates on the shared global data regardless of which context you pass in.

The thing to remember is that when running in service mode, the service process has no local UI context. So in that case you must always pass in a valid context to do anything UI-related.

The rule I use in my API wrappers is to always call apiUI() instead of api(), and always pass in an explicit context if available, instead of relying on any defaulting behavior.
Thanks Greg. I suspected the same, but I just wanted make sure. I started thinking about this because I was looking at some code in the nielm webserver and I noticed that nielm was forcefully setting the UI context to the local context when no context was being passed.
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
Intelligent Recordings - Need clarification Skirge01 SageTV Software 3 05-14-2009 08:49 AM
Clarification on my setup eventerke SageTV Software 1 10-28-2006 09:04 PM
Clarification on 4.1 dfrancis SageTV Software 5 12-21-2005 11:12 AM
Clarification of what does what..... icel0rd SageTV Software 15 03-15-2003 01:16 PM


All times are GMT -6. The time now is 02:27 AM.


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