SageTV Community  

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

Notices

SageTV Github Development Discussion related to SageTV Open Source Development. Use this forum for development topics about the Open Source versions of SageTV, hosted on Github.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-27-2015, 12:39 AM
wnjj wnjj is offline
Sage Icon
 
Join Date: Jan 2009
Posts: 1,514
SageTV architecture overview

With all of the discussion about native code, JARs, STV's, core vs plugins, miniclients, etc., I came to realize how well I don't understand the whole system.

Is there somewhere that describes how this all works?

What would be nice is an overall description about what happens on the server versus an extender or PC client, including which pieces are running from native (C++) code and which are java.

Maybe this is asking too much if there are too many options but with at least a basic understanding I'd be able to poke through the code to figure out more of the details. I already spent some time looking at Wizard.java to start to build an understanding of that age-old "mystery" wiz.bin file.

I have some experience with C/C++ in Visual Studio and have 2005 Pro, 2013 Pro and 2015 community editions available and may find myself wanting to play with this stuff. I've never written any java but it looks close enough to C++ to pick up.
Reply With Quote
  #2  
Old 08-27-2015, 01:58 AM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Most of what sage does is Java, and most of that is in a single file, sage.jar. That file is launched differently depending on what task is is supposed to be doing. It can be a headless server (service mode), it can be a UI (client mode), it can do both at the same time (standalone mode), it can be an IDE (studio mode). On windows, there are launchers written in c++ to fire off sage.jar in whatever mode that particular .exe is written for. sage.jar also pulls in other java .jar's to extend it's functionality (mostly plugins, some core libraries). sage.jar also makes calls to native libraries to handle system specific calls (like rendering the UI, receiving ui inputs, recording from local tuners, etc).

Extenders/placeshifters are a different beast. They use a different .jar called miniclient. miniclient connects to the server's sage.jar, and renders the UI that is built in the server's process, plays back media, and recieves control input. It uses various amounts of native calls, depending on the system it is running on.
__________________
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
  #3  
Old 08-27-2015, 06:54 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
I do agree that an achitecture diagram, from a high level would be a good idea. I also think that having a lower level architecture diagram would be good as well.

The SageTV devs seems to have some fun in their Class naming, so we have classes, like Catbert, BigBrother, Carny, Ministry, Wizzard, etc... I'm sure their meanings are relevant to what they do, but I haven't really dug deep enough to figure them out

Either way I think it would be good to get some extra documentation around things. For example we alll know at a high level how some things work, but it would also be nice to see a flow diagram of how a client connection is handled, and how a video request is processed, ie, what classes/methods handle a video request, which parts delegate to native calls, etc. Hopefully over time, all this stuff will become clearer, to everyone... but until then, we just post questions here, and hope that Jeff answers them (which he usually does )

Last edited by stuckless; 08-27-2015 at 12:18 PM.
Reply With Quote
  #4  
Old 08-27-2015, 12:03 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
I wish I had something I could share that outlines the whole architecture better, but I don't currently. It'd take me quite awhile to come up with something....so at this point I'm leaning towards just answering all the questions people ask. Of course feel free to ask me specific or even somewhat general questions and I'll do my best to answer them....such as if Sean wants explanations for the few things he mentioned in his post.

Fuzzy,

One correction...the miniclient on the extenders is not a JAR file. It's a C program. There is also a Sage.jar on the HD200/HD300 which is built from the same codebase as the x86 version and is used for everything but actual UI rendering and media playback (and as you probably know, the miniclient uses the same protocol as the placeshifter, and of course the placeshifter is Java based...and of course the miniclient can placeshift too )
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #5  
Old 08-27-2015, 01:44 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
yeah, I had mentioned that various amounts of the individual miniclients were native code.. didn't actually clarify that in some cases, it's 100% of it.. :-)
__________________
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
  #6  
Old 08-27-2015, 06:47 PM
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
The SageTV devs seems to have some fun in their Class naming, so we have classes, like Catbert, BigBrother, Carny, Ministry, Wizzard, etc... I'm sure their meanings are relevant to what they do, but I haven't really dug deep enough to figure them out
I think we can figure this one out:

Code:
    // Clear out all of the negative energy, this includes marked waste
    Wasted[] stoners = wiz.getWasted();
__________________

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
  #7  
Old 08-28-2015, 12:10 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
Quote:
Originally Posted by tmiranda View Post
I think we can figure this one out:

Code:
    // Clear out all of the negative energy, this includes marked waste
    Wasted[] stoners = wiz.getWasted();
Lol...I guess I missed that one when scrubbing the code.

Wasted is the equivalent of 'Don't Like' in the system...while it's a funny name, conceptually it actually refers to it being a 'Wasted' recording because the user didn't watch it. SageTV will create a Wasted object when you mark something Don't Like...AND it will create one if it records something and then deletes it before it gets watched (so this is negative feedback in the intelligent recording system). Wasted has a flag for 'manual' waste (which means the user marked it don't like) so we can treat those more strongly than when the system automatically infers Wasted.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #8  
Old 08-29-2015, 05:32 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by Narflex View Post
Lol...I guess I missed that one when scrubbing the code.

Wasted is the equivalent of 'Don't Like' in the system...while it's a funny name, conceptually it actually refers to it being a 'Wasted' recording because the user didn't watch it. SageTV will create a Wasted object when you mark something Don't Like...AND it will create one if it records something and then deletes it before it gets watched (so this is negative feedback in the intelligent recording system). Wasted has a flag for 'manual' waste (which means the user marked it don't like) so we can treat those more strongly than when the system automatically infers Wasted.
Thanks. I was digging through the code in that area because I'm interested in adding a "never record" option. A wrote a plugin for that but still think it may be something that can go in the core.
__________________

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.

Last edited by tmiranda; 08-29-2015 at 06:57 PM.
Reply With Quote
  #9  
Old 08-29-2015, 02:36 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
On a somewhat related note it would be nice if there was a way of not recording an airing that is a Favorite that is about to record or is actually in the process of recording. Or maybe I am missing something and you can do this today.
__________________
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
  #10  
Old 08-29-2015, 06:56 PM
KryptoNyte's Avatar
KryptoNyte KryptoNyte is offline
SageTVaholic
 
Join Date: Dec 2006
Posts: 2,754
You can, wayner, but you currently have to mark the show as watched. Someone will likely come up with a better way to do this.
Reply With Quote
  #11  
Old 08-29-2015, 08:36 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
Quote:
Originally Posted by KryptoNyte View Post
You can, wayner, but you currently have to mark the show as watched. Someone will likely come up with a better way to do this.
I think I have done that in the past and it doesn't always seem to work.
__________________
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 08-29-2015, 10:12 PM
david1234 david1234 is offline
Sage Aficionado
 
Join Date: Nov 2007
Location: Beaverton, OR
Posts: 313
Quote:
Originally Posted by stuckless View Post
The SageTV devs seems to have some fun in their Class naming, so we have classes, like Catbert, BigBrother, Carny, Ministry, Wizzard, etc... I'm sure their meanings are relevant to what they do, but I haven't really dug deep enough to figure them out
This is funny... reminds me of my last job where they named all the classes in a distributed search algorithm metaphorically as a fishing tournament. On my first day at work, I'm a gazillion layers deep in the debugger, and then all of a sudden I fall through the front end code into a BassBoat with a couple of GameWardens.

It was maddening, and I couldn't make any sense of what was going on. Good times
Reply With Quote
  #13  
Old 08-30-2015, 08:10 AM
KryptoNyte's Avatar
KryptoNyte KryptoNyte is offline
SageTVaholic
 
Join Date: Dec 2006
Posts: 2,754
Quote:
Originally Posted by wayner View Post
I think I have done that in the past and it doesn't always seem to work.
I use it a few times a week, never had a problem. It does take Sage a short bit (20 seconds I suppose) to realize that it will not record the show and reflect that status.

That said, it's a good suggestion to try and get in a better method if possible.

I have to believe that the scheduling system is probably some of the most complex parts of the code. Seems like it would be easy to break something in there.

Last edited by KryptoNyte; 08-30-2015 at 08:12 AM.
Reply With Quote
  #14  
Old 08-30-2015, 10:37 AM
Tiki's Avatar
Tiki Tiki is offline
Sage Icon
 
Join Date: Feb 2005
Location: Southwest Florida, USA
Posts: 2,009
Quote:
Originally Posted by KryptoNyte View Post
I use it a few times a week, never had a problem. It does take Sage a short bit (20 seconds I suppose) to realize that it will not record the show and reflect that status.

That said, it's a good suggestion to try and get in a better method if possible.

I have to believe that the scheduling system is probably some of the most complex parts of the code. Seems like it would be easy to break something in there.
I often do this as well. Another trick is to schedule a manual recording for some time in the future to force a favorite to record at a more convenient time. However, it often takes quite a while (10-20 minutes) before the "unwanted" favorite will get removed from the schedule.
__________________
Server: Ryzen 2400G with integrated graphics, ASRock X470 Taichi Motherboard, HDMI output to Vizio 1080p LCD, Win10-64Bit (Professional), 16GB RAM
Capture Devices (7 tuners): Colossus (x1), HDHR Prime (x2)
,USBUIRT (multi-zone)
Source:
Comcast/Xfinity X1 Cable
Primary Client: Server Other Clients: (1) HD200, (1) HD300
Retired Equipment: MediaMVP, PVR150 (x2), PVR150MCE,
HDHR, HVR-2250, HD-PVR
Reply With Quote
  #15  
Old 08-30-2015, 11:05 AM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
Quote:
Originally Posted by KryptoNyte View Post
I use it a few times a week, never had a problem. It does take Sage a short bit (20 seconds I suppose) to realize that it will not record the show and reflect that status.
Maybe it is the delay that gets me. And I really don't used the Watched status at all since most of our recordings are Kids' Shows that get watched repeatedly. Or movies that we want to keep and watch more than once.
__________________
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
  #16  
Old 08-30-2015, 11:51 AM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Yeah, the issue is that once it gets flagged as watched, or you mark a future recording as manual, for instance, it still takes a whole run through the scheduler to reprocess before the originally scheduled airing is cleared from the schedule. This can take quite a while, depending on your scheduling lookahead, number of favorites, number of channels, and server processor speed.
Even if you gave the airing a super-mega-wasted tag, it still wouldn't be reflected immediately in the schedule, until a new schedule is rehashed.
__________________
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
  #17  
Old 08-31-2015, 07:39 AM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
It depends on your number of favorites or so I believe. It often takes 10 minutes to stop for me and I do that often as well. The fastest way I've found to stop it is to make it a manual recording then make it watched and then cancel the manual recording. I can usually get it under 5 minutes that way depending on the server. On my oldest server it can take more than 10 minutes to stop something once the recording as started upto 20 minutes (which if the show is 30 minutes and you don't notice it right away means you still get the whole thing anyway). On my newest server that only records OTA it usually stops in a minute or less. Another way I've done it is to still mark it watched but also start a recording of something else so that the only other available tuner (HD-PVR I have two on one server) is being used then start a show live to get the original favorite to change to the new show that is being watched live. Then once it switches I cancel both manual recordings and they usually stop in the 20 second window talked about here.

So I would like a way to kill a favorite that is recording myself. So much so I was going to write my own favorites processor and it would make the recordings manual recordings in SageTV so that I can cancel them easier. I also was going to add the ability to record the same episode or show multiple times up to a set number to allow me to get a good recording off of bad reception or around weather warnings. And a few other things like that. Problem is I never seem to have the time.
__________________
"Keep your goals away from the trolls"

Last edited by BobPhoenix; 08-31-2015 at 07:43 AM.
Reply With Quote
  #18  
Old 08-31-2015, 08:27 AM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
Quote:
Originally Posted by david1234 View Post
This is funny... reminds me of my last job where they named all the classes in a distributed search algorithm metaphorically as a fishing tournament. On my first day at work, I'm a gazillion layers deep in the debugger, and then all of a sudden I fall through the front end code into a BassBoat with a couple of GameWardens.

It was maddening, and I couldn't make any sense of what was going on. Good times
Wow, someone there must have wanted to ensure their job security.
__________________
Server: i5 8400, ASUS Prime H370M-Plus/CSM, 16GB RAM, 15TB drive array + 500GB cache, 2 HDHR's, SageTV 9, unRAID 6.6.3
Client 1: HD300 (latest FW), HDMI to an Insignia 65" 1080p LCD and optical SPDIF to a Sony Receiver
Client 2: HD200 (latest FW), HDMI to an Insignia NS-LCD42HD-09 1080p LCD
Reply With Quote
  #19  
Old 08-31-2015, 12:54 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
Quote:
Originally Posted by KryptoNyte View Post
I have to believe that the scheduling system is probably some of the most complex parts of the code. Seems like it would be easy to break something in there.
Yes, you would be correct...it's the support for multiple different lineups that made the problem very difficult to solve. It's straightforward if the lineups are all the same..but when they are not...the problem becomes NP hard.

And a lot of the variance in delay is because the Scheduler probably just needs to get kicked. When you mark something watched; that'll kick Carny (which does all the Favorite/intelligent recording analysis, and when that's done it'll kick the Scheduler). There is code in the Scheduler to exclude Watched items from the schedule, so Carny doesn't need to complete for that to get enforced...but the Scheduler does need to get kicked by some means.

Carny can take many hours to complete (mine takes almost a day because I have 13 years of history in my DB)...the Scheduler should complete it's calculations in seconds generally though.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #20  
Old 08-31-2015, 07:14 PM
KryptoNyte's Avatar
KryptoNyte KryptoNyte is offline
SageTVaholic
 
Join Date: Dec 2006
Posts: 2,754
Jeff, is your SageTV server installation currently running on a solid state drive or a conventional hard drive? ... or anyone else for that matter ...
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
General Overview of SMM, MM, Sage & Collection management For PluckyHD wjones Sage My Movies 2 08-26-2010 01:22 PM
SageTV overview ? Old_Skool General Discussion 1 06-22-2009 05:29 PM
Channel Selection/EPG Relationship - Technical Overview Available? wacole SageTV EPG Service 2 06-17-2009 07:26 AM
Overview of installing an STV? steingra SageTV Software 6 10-25-2005 03:27 PM
SageTV Client<-> Master Architecture question IVB SageTV Software 4 11-12-2003 08:00 PM


All times are GMT -6. The time now is 05:50 PM.


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