SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV v7 Customizations
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV v7 Customizations This forums is for discussing and sharing user-created modifications for the SageTV version 7 application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss plugins for SageTV version 7 and newer.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-27-2012, 02:25 PM
Dargason Dargason is offline
Sage Expert
 
Join Date: Oct 2003
Posts: 516
Overload SageAPI classes

I've been trying to learn Java and I'm at the point where I need a project to play with to get things to solidify in my mind.

One idea I had would be to write some Java code to replace the built-in transcode features of SageTV with some that would run custom scripts (like ccextractor + handbrake). One idea would be to override some of the methods in the TranscodeAPI object.

I love how the transcode stuff is integrated with SageTV and in the webserver, but I'd really like to be able to transcode stuff without losing the closed captions...

Is this feasible thing to try?
Reply With Quote
  #2  
Old 12-27-2012, 03:14 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Short answer: no.

Long answer: The SageAPI is only accessible via reflection, there is no direct access to the actual API calls. Even if there were, I'd lay 50:1 that the underlying obfuscated classes are all defined final, which means you couldn't subclass them anyway. But even if they weren't final and you could subclass them, you'd have to convince the Sage core to instantiate your subclass(es) instead of the core's parent classes at runtime, which also isn't possible. Either way, you're out of luck.

You could write your own routines, but I assume you also want other things, like the web ui, etc. to also use your routines instead of the default ones without having to touch anything? That won't happen. Trying to change the base functionality of any Sage API calls is simply not worth anyone's time or effort because it's not going to happen.

I highly recommend finding a new project to feed your SageTV curiosity.
__________________
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
  #3  
Old 12-29-2012, 07:35 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
What about writing SJQ routines that can do pretty much all of the stuff that you suggest? This coding is done in Groovy which is closely related to Java. I have written some SJQ scripts that use Handbrake to transcode my files and perform other tasks, but I don't care about CC so I don't know what happens to them.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #4  
Old 12-29-2012, 11:28 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by wayner View Post
What about writing SJQ routines that can do pretty much all of the stuff that you suggest? This coding is done in Groovy which is closely related to Java. I have written some SJQ scripts that use Handbrake to transcode my files and perform other tasks, but I don't care about CC so I don't know what happens to them.
Sure, you can definitely write alternate routines for all of the Sage functionality. Be it thru SJQ/Groovy or any other of a half dozen ways I can think of.

But what I believe the OP wants to do is to override the default Sage API calls, like the transcoder calls such that they use his tools/methods to transcode videos and also by doing so other UIs, like the Sage STV and the web UI "magically" tie into these new routines without having to modify the STV or the web UI. This part is what's not possible.

You can definitely write alternate routines to do anything Sage does, but if you want other pieces of the puzzle (i.e. the web UI) to also use these alternate routines then you need to rewrite those pieces (web ui/stv/etc.) to make them use your alternate routines. You can't get the Sage core to use alternate API calls, won't happen. You could get the STV to use alternate API calls, but you're basically rewriting the STV and creating a custom version of it.

In the end, it's not really worth it, imho. Or it's at least not worth it as an "I want to learn Java/the Sage API" kind of project.
__________________
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
  #5  
Old 01-07-2013, 08:43 AM
Dargason Dargason is offline
Sage Expert
 
Join Date: Oct 2003
Posts: 516
Thanks for the replies -- I didn't really think it could possibly be that easy, but I figured it couldn't hurt to ask.

One way to accomplish a similar effect might be to create a plugin that monitors the convert queue for items to be converted using a special type of profile, and then call the external conversion of those files. So, for example, I could create profile called "High Quality with Captions" and whenever the plugin sees it, it would run external stuff.

Maybe this is basically what SJQ would do -- I haven't used that stuff.
Reply With Quote
  #6  
Old 01-07-2013, 09:55 AM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
There is possibly another route you could take. You could analyse the modified ffmpeg source that is available, which is the SageTVTranscoder.exe application, and write a wrapper for it to launch a different encoding process on conversion jobs, and redirect to a renamed original SageTVTranscoder for placeshifter/thumbnail generation.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #7  
Old 01-07-2013, 10:08 AM
routerunner's Avatar
routerunner routerunner is offline
Sage Icon
 
Join Date: May 2008
Location: Wiltshire, UK
Posts: 1,384
Quote:
Originally Posted by Fuzzy View Post
There is possibly another route you could take. You could analyse the modified ffmpeg source that is available, which is the SageTVTranscoder.exe application, and write a wrapper for it to launch a different encoding process on conversion jobs, and redirect to a renamed original SageTVTranscoder for placeshifter/thumbnail generation.
I thought the OP said he wanted to learn Java
__________________

Automatic Power Off | Squeezeslave | DVB-S Importer | DVB Decrypter & Card Client | Tuner Preroll


Every man is a damn fool for at least five minutes every day; wisdom consists in not exceeding the limit. ~ Elbert Hubbard
Reply With Quote
  #8  
Old 01-07-2013, 12:38 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
What, no reason the wrapper can't be written in Java - it most likely just has to interpret the command line, and pass through standard input/output.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #9  
Old 01-07-2013, 01:31 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by Dargason View Post
I've been trying to learn Java and I'm at the point where I need a project to play with to get things to solidify in my mind.

One idea I had would be to write some Java code to replace the built-in transcode features of SageTV with some that would run custom scripts (like ccextractor + handbrake). One idea would be to override some of the methods in the TranscodeAPI object.

I love how the transcode stuff is integrated with SageTV and in the webserver, but I'd really like to be able to transcode stuff without losing the closed captions...

Is this feasible thing to try?
Why not write an STV Mod plugin that replaces the calls to the Sage transcode APIs and uses your custom written API? There is no need to overload the existing Sage APIs when Studio allows you to eliminate them altogether and use your own (which would be written in Java.) By doing this you'll learn Studio as well as Java.

The Studio work for this would be minimal so it's a good first project.
__________________

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
  #10  
Old 01-07-2013, 01:33 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
I think the key aspect of keeping the original API call's is the Auto-convert feature built into the favorites - this, of course, can all be duplicated, and already has been with SJQ.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #11  
Old 01-07-2013, 01:53 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
To go back to the beginning - I don't really know why you would want to override the calls to the Sage transcoder. IMHO there was one huge drawback of that transcoder, at least when called from the Sage API, and that was that you didn't know when a job was done. The API would through a process into the Transcoder queue and you wouldn't know when it was done - that's a real issue if you want to do something else when the transcoding is finished, like move the file or copy the file to a mobile device.

I would far rather write my own process in something like SJQ in Groovy/Java and be able to have full control over the process. And you can view SJQ jobs through the web UI as well.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #12  
Old 01-07-2013, 05:34 PM
Dargason Dargason is offline
Sage Expert
 
Join Date: Oct 2003
Posts: 516
Quote:
There is possibly another route you could take. You could analyse the modified ffmpeg source that is available, which is the SageTVTranscoder.exe application, and write a wrapper for it to launch a different encoding process on conversion jobs, and redirect to a renamed original SageTVTranscoder for placeshifter/thumbnail generation.
Interesting idea. So basically, replace the SageTVTranscoder.exe with my own thing. You say the source code is available somewhere?

Edit: Maybe I'm not the first person to want to work on this: http://forums.sagetv.com/forums/showthread.php?t=59756

Last edited by Dargason; 01-07-2013 at 06:16 PM.
Reply With Quote
  #13  
Old 01-07-2013, 06:43 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
I think that other person was looking to just roll the required modifications into a more current revision of ffmpeg, for better performance - not change the functionality as a whole. Really, the only reason you'd need to even look at the ffmpeg source code would be to figure out what sort of communications are built into it with he sagetv server. there is something, as the server gets transocding status from it - but whether that is via the standard output, error output, or some other connection, I'm not sure.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #14  
Old 01-07-2013, 06:53 PM
Dargason Dargason is offline
Sage Expert
 
Join Date: Oct 2003
Posts: 516
Running "SageTVTranscoder.exe -version" gives me the ffmpeg version that was used along with the build configuration. I'll have to dig through the source code a bit to see if I can figure out how it's communicating with the SageTV service.
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
SageAPI question - find active CaptureDevice? wayner SageTV v7 Customizations 4 01-04-2012 01:26 PM
Think I have reached information overload medwynd SageMC Custom Interface 6 04-18-2010 06:33 PM
access SageAPI from standalone application matrix35 SageTV Studio 16 02-21-2007 03:09 PM
Help! Forum overload! What plug ins can do this? Homebuilder SageTV Customizations 1 12-06-2005 02:34 AM
Intelligent Recording Overload Grey_Goose SageTV Software 6 08-28-2004 11:17 PM


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


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