|
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. |
|
Thread Tools | Search this Thread | Display Modes |
#41
|
||||
|
||||
Quote:
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#42
|
||||
|
||||
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 |
#43
|
|||
|
|||
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... |
#44
|
||||
|
||||
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. |
#45
|
|||
|
|||
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... |
#46
|
||||
|
||||
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 |
#47
|
||||
|
||||
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?
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#48
|
|||
|
|||
The better question is what the heck is stuckless doing in studio.
|
#49
|
||||
|
||||
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 )
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#50
|
||||
|
||||
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. |
#51
|
||||
|
||||
Quote:
As a workaround, here's a modified manifest with Desktop set to false. Paste this into SageTVPluginsDev.xml and it should work for you.
__________________
-- Greg Last edited by GKusnick; 10-23-2010 at 02:01 PM. Reason: Updated attachment |
#52
|
||||
|
||||
Quote:
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#53
|
||||
|
||||
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.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#54
|
|||
|
|||
Quote:
Thanks Greg for this addin !! |
#55
|
||||
|
||||
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 |
#56
|
||||
|
||||
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 |
#57
|
||||
|
||||
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 |
#58
|
||||
|
||||
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 |
#59
|
||||
|
||||
Just uploaded version 1.4.6 of the Tools Library with a refresh of the API wrappers for SageTV V7.1.5.
__________________
-- Greg |
#60
|
||||
|
||||
V1.4.7 uploaded to correct some misnamed method wrappers.
__________________
-- Greg |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
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 |