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
  #41  
Old 08-16-2010, 01: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 Slugger View Post
Once the user upgraded the Ortus MQ plugin then all the SageAlert issues were immediately resolved. Thanks for the quick turn around.

I opened a bug with Sage to have them take a look at this. I believe they should be reconstructing the map for each listener anyway. Or if not, they should at least make the "do not mod the map" requirement explicit.
hmmm... I was wrestling with an issue this past weekend where the MediaFile was looking like it was being converted to an int.... (which looks like what your particular problem was as well)... I never thought that another plugin could modify the contents of the Map... there's goes a perfectly good weekend
Reply With Quote
  #42  
Old 08-16-2010, 03:06 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
As a matter of general programming style, it's usually considered bad form for a function to modify the parameters passed in to it, even if they're not shared references. You generally want to preserve a record of how the function was invoked for debugging purposes.

That said, we do have a fair number of amateurs here who aren't familiar with all the niceties of gentlemanly programming. So it's probably appropriate for the core to be a bit more defensive in guarding against plugin misbehavior.
__________________
-- Greg
Reply With Quote
  #43  
Old 08-16-2010, 04:46 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Yeah, those new to Java may not realize that an object as an arg is just a reference (pointer for our C++ friends) to the object so modifying the object in the method indeed modifies the caller's reference as well, whereas with primitives as args, you're dealing with a copy of the actual value so modifying that locally doesn't affect the caller's value. (Remember, a copy of a reference to an obj is still referencing the same obj, which is why you end up modifying the caller's object). And as GKusnick says, it's best to simply not modify the args of a method unless you're well aware of what the side effects are. (And the core still needs to protect the arg map/reconstruct it for each listener invocation anyway because even the most seasoned Java coders can muck up the map and not realize it leaving the rest of us to try and figure out what's going on.)

Something else I've been thinking about since this was discovered is, should a listener be able to modify an actual object (i.e. the MediaFile instance itself) before all listeners are invoked? The Sage API makes no mention of what state the object will be in when the listener is invoked so, technically, I suppose there's no right or wrong answer here, but there's a race condition created by the event queue thread in that if Plugin A is going to take the MediaFile arg and do something with it (maybe even delete it for whatever reason) then Plugin B is going to end up with a reference to a non-existent MediaFile object when it gets invoked. Even worse is that it's not consistent because if Plugin B happens to register for the event before Plugin A next time (maybe Plugin A registers/unregisters itself dynamically at run time) then now Plugin B will get a valid MediaFile obj to handle before Plugin A gets a hold of it and deletes. Talk about a debug nightmare!! I don't think there's a good solution here other than to warn plugin authors that you cannot know/trust the state of the args when you receive them to process, but the core can (and should) guarantee the state and contents of the arg map it's passing to the invoked event listeners.
__________________
Twitter: @ddb_db
Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive
Capture: 2 x Colossus
STB Controller: 1 x USB-UIRT
Software:Java 1.7.0_71; SageTV 7.1.9
Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter
Plugins: Too many to list now...
Reply With Quote
  #44  
Old 08-17-2010, 05:15 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Us (We?) noobs are learning all the time thanks to you pros

To be fair to Sage, I looked at the comments for the sageEvent() method and it clearly says that the args should not be modified.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #45  
Old 08-23-2010, 11:58 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Missing PluginAPI.IsPluginStartupComplete()

I'm running Tools Lib 1.2.31, which says is current for core 7.0.12, but it's missing the PluginAPI.IsPluginStartupComplete() call, which, according to the release notes, was introduced in core 7.0.12. Just wondering if this call made its way into your 1.3 wrappers? I'm just calling the underlying SageTV.api() call for this method because I don't want 7.0.12 users to have to move to 7.0.15 just so I can get this one wrapped call. But just thought I'd mention it in case the call still doesn't appear in 1.3 of your wrappers.
__________________
Twitter: @ddb_db
Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive
Capture: 2 x Colossus
STB Controller: 1 x USB-UIRT
Software:Java 1.7.0_71; SageTV 7.1.9
Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter
Plugins: Too many to list now...
Reply With Quote
  #46  
Old 08-23-2010, 01:57 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
According to my zip archives and SVN logs, IsPluginStartupComplete() is in 1.2.31, unless the JAR somehow got out of sync with the source.

In any case, it's definitely in 1.3.
__________________
-- Greg
Reply With Quote
  #47  
Old 10-23-2010, 05:54 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Greg, I'm not sure if I mentioned this before... But in Linux, I can't install your tools because it requires "DesktopOnly". I realize that in most cases, it is a DesktopOnly plugin, but in linux, the server is the desktop... and the only way to access the server in linux is via the placeshifter (or a windows desktop). Is there any chance that you'd change the restriction on the plugin to allow it to be installed on Linux?

If there are other Linux devs... How are you installing Greg's tools?
Reply With Quote
  #48  
Old 10-23-2010, 06:50 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by stuckless View Post

If there are other Linux devs... How are you installing Greg's tools?
The better question is what the heck is stuckless doing in studio.
Reply With Quote
  #49  
Old 10-23-2010, 08:12 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by PLUCKYHD View Post
The better question is what the heck is stuckless doing in studio.
Not very much... that much is certain To be honest, I just want to make some small changes, ie, use phoenix_media_GetFormattedTitle, and a simple smart sorter... But I need to "find" the locations that need updating... from what I recall, I think Greg's tools have better "Find" abiities than the core studio... especially since "Find" in core studio never returns any results for me (I have tried to simply do this using vim, but the Xml is a little hard to read outside of studio, although it's hard enough for me to read it in studio as well )
Reply With Quote
  #50  
Old 10-23-2010, 08:33 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by stuckless View Post
If there are other Linux devs... How are you installing Greg's tools?
I do all Studio work on a Windows SageClient, but I'm hoping Greg will make the tools available on Linux as well.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #51  
Old 10-23-2010, 10:02 AM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by stuckless View Post
Greg, I'm not sure if I mentioned this before... But in Linux, I can't install your tools because it requires "DesktopOnly". I realize that in most cases, it is a DesktopOnly plugin, but in linux, the server is the desktop... and the only way to access the server in linux is via the placeshifter (or a windows desktop). Is there any chance that you'd change the restriction on the plugin to allow it to be installed on Linux?
Yes, this has come up before, and as I recall it has to be Desktop in order to install properly on Windows in service mode. I'll do some more testing this afternoon, but I'm not sure I can fix it for you without breaking it for someone else.

As a workaround, here's a modified manifest with Desktop set to false. Paste this into SageTVPluginsDev.xml and it should work for you.
Attached Files
File Type: zip LinuxTools.zip (1.1 KB, 369 views)
__________________
-- Greg

Last edited by GKusnick; 10-23-2010 at 02:01 PM. Reason: Updated attachment
Reply With Quote
  #52  
Old 10-23-2010, 10:16 AM
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
Yes, this has come up before, and as I recall it has to be Desktop in order to install properly on Windows in service mode. I'll do some more testing this afternoon, but I'm not sure I can fix it for you without breaking it for someone else.

As a workaround, here's a modified manifest with Desktop set to false. Paste this into SageTVPluginsDev.xml and it should work for you.
Thanks Greg. That was going to be my work around plan, if you were not able to make the change, so thanks for providing it.
Reply With Quote
  #53  
Old 10-23-2010, 10:53 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Just an FYI... When I added Greg's plugin to dev plugins xml, SageTV still would not let me install it. It's almost as if sagetv "merged" the data of the two, and it did not set the Desktop to false. I ended up renaming greg's plugins in the xml (I just added an 'x' to the plugin id), and then I could install it... and yeah, the search facilities in Greg's plugin is much better than the standard, which I suspected.
Reply With Quote
  #54  
Old 10-23-2010, 11:35 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by stuckless View Post
Just an FYI... When I added Greg's plugin to dev plugins xml, SageTV still would not let me install it. It's almost as if sagetv "merged" the data of the two, and it did not set the Desktop to false. I ended up renaming greg's plugins in the xml (I just added an 'x' to the plugin id), and then I could install it... and yeah, the search facilities in Greg's plugin is much better than the standard, which I suspected.
Agreed it Is 100% better and it's find and replace by widget type is unreplaceable to me.

Thanks Greg for this addin !!
Reply With Quote
  #55  
Old 10-23-2010, 02:02 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by stuckless View Post
Just an FYI... When I added Greg's plugin to dev plugins xml, SageTV still would not let me install it. It's almost as if sagetv "merged" the data of the two, and it did not set the Desktop to false.
Whoops, I guess I forgot to bump the version number in the Dev manifest, so it failed to override the one in the repository. I've updated the attachment in the earlier post with new version numbers.
__________________
-- Greg
Reply With Quote
  #56  
Old 12-04-2010, 09:39 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
For the MediaFile methods that return a MetaImage (like GetFullImage or GetThumbnail), you are returning an Object. Is there an easy way to get to the underlying image? Essentially, I'd like to get the bitmap and convert it to a byte array to send over TCP. Since I want those for photos/videos/recordings/songs/etc., it gets tricky just using the filename from airing.GetMediaFileForAiring().GetSegmentFiles()[0]...
__________________
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
  #57  
Old 12-04-2010, 10:15 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
As a rule, my wrapper methods return Objects wherever the documentation indicates a return type of sage.T (for some value of T). This is because the vast majority of sage.T types are obfuscated and not accessible to Java plugins. As far as I can tell, sage.MetaImage appears to be one of the obfuscated types.

If it turns out not to be obfuscated, you're free to cast the returned Object to sage.MetaImage and call whatever methods it exposes. But I don't know what those methods are, and in any case they're beyond the scope of my wrapper library.

I've looked at changing my wrapper generator to allow unobfuscated types through explicitly instead of casting them all to Object. However that would change the type signature of my library in a way that would require dependent plugins to be recompiled, so I chose not to go ahead with that. So if you can find an unobfuscated definition of sage.MetaImage, use the cast trick above as a workaround.
__________________
-- Greg
Reply With Quote
  #58  
Old 12-05-2010, 10:58 AM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
OK thanks, I was afraid that might be the answer.
__________________
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
  #59  
Old 03-18-2011, 05:31 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Just uploaded version 1.4.6 of the Tools Library with a refresh of the API wrappers for SageTV V7.1.5.
__________________
-- Greg
Reply With Quote
  #60  
Old 03-19-2011, 02:53 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
V1.4.7 uploaded to correct some misnamed method wrappers.
__________________
-- Greg
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
New tools for Studio users GKusnick SageTV Studio 206 11-29-2009 10:08 PM
Looking for Word to PDF & HTML conversion tools (for SageTV manual) Opus4 General Discussion 14 11-09-2005 11:20 AM
any chances of altering the graphics in sage without studio? studio users please read reboot_this SageTV Customizations 1 12-03-2004 04:03 AM


All times are GMT -6. The time now is 11:16 AM.


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