SageTV Community  

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


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.

Thread Tools Search this Thread Display Modes
Old 01-25-2022, 09:40 PM
hvymetal hvymetal is offline
Sage Advanced User
Join Date: Nov 2007
Posts: 162
Forcing EPG update on only one lineup

I'm really close to bringing PultoTV native to SageTV by using OpenDCT and Streamlink(No commercial lockups ). The guide data is provided by the XMLTV plugin which I updated. Guide data is created from Docker that was created for ChannelDVR ( I have one issue I need to resolve. I need to force the EPG to update every 2 hours as PlutoTV only provides 8 hours ahead. I do not want to force all lineups to be updated just the PlutoTV. Forcing all lineups....especially SD would result in DOS. Does any one know an automated way to force a single lineup? Below is what I found so far.

1. Manually remove/add in channel setup all in one step and then exit it will trigger an EPG update.
2. Installing the Web Server Plugin by Nielm. This force an update on all the lineups. This is achieve by adding and removing a channel on all lineups
if ( SageApi.Size(AllInputs)> 0){
Map<?, ?> LineupMap = (Map<?, ?>)SageApi.Api("GroupByMethod",
		new Object[]{AllInputs, "GetLineupForCaptureDeviceInput"});
Set<?> Lineups=LineupMap.keySet();
Iterator<?> it=Lineups.iterator();
	out.println("<p>Forcing update on lineup: "+Lineup.toString()+"</p>");
	Object AllChannels = SageApi.Api("GetChannelsOnLineup",Lineup);
	Object Channel=SageApi.GetElement(AllChannels,0);
	Object ChannelNumbers = SageApi.Api("GetChannelNumbersForLineup",new Object[]{Channel, Lineup});
	Object Number=SageApi.GetElement(ChannelNumbers,0);
	boolean viewable=SageApi.booleanApi("IsChannelViewableOnNumberOnLineup",new Object[]{Channel, Number, Lineup});
	// out.println("<p>Toggling viewable for channel number: "+Number.toString()+"</p>");
	SageApi.Api("SetChannelViewabilityForChannelNumberOnLineup",new Object[]{Channel, Number, Lineup, new Boolean(!viewable)});
	SageApi.Api("SetChannelViewabilityForChannelNumberOnLineup",new Object[]{Channel, Number, Lineup, new Boolean(viewable)});
// the following probably commits the changes and triggers an EPG update
3. Modify epg_data_sources/#####/expanded_until entry in the This requires SageTV server stopped before modification and restarted. Not sure if Sage Server reads these values all the time. It might be possible to use the SageAPI to rewrite the value once EPG update is done from the XMLTV plugin. If they are read all the time the XMLTV plugin could detect that it finished an update then change the values so it forces SageTV server to update on the next time.


Last edited by hvymetal; 01-25-2022 at 09:46 PM.
Reply With Quote
Old 01-26-2022, 10:10 AM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
Join Date: Oct 2009
Location: NC
Posts: 1,389
Could you just "copy/modify" option 2 so it just does the 1 lineup you want, then have that scheduled to execute every 2 hrs?

<not a java programmer>
Reply With Quote
Old 01-26-2022, 01:06 PM
hvymetal hvymetal is offline
Sage Advanced User
Join Date: Nov 2007
Posts: 162
Force EPG update on a single lineup using Sagex Plugin

First have to say thanks to stuckless for great plugin sagex....could not have done the following without.

//1.  Install SageTV Sagex Remote API Service Plugin
//2.  Copy contents to file called epg.js and save to sagex/services directory on the server
//3.  To force update on lineup http://sage:frey@

function ForceUpdate(Lineup_Name) {
	var GlobalAPI = Packages.sagex.api.Global;
	var DatabaseAPI = Packages.sagex.api.Database;
	var UtilityAPI = Packages.sagex.api.Utility;
	var ChannelAPI = Packages.sagex.api.ChannelAPI;
	var AllChannels = DatabaseAPI.GetChannelsOnLineup(Lineup_Name);
		return "Lineup Name Not Found";
		var Channel=UtilityAPI.GetElement(AllChannels,0);
		var ChannelNumbers = ChannelAPI.GetChannelNumbersForLineup(Channel, Lineup_Name);
		var ChannelNumber=UtilityAPI.GetElement(ChannelNumbers,0);
		var ChannelViewable=ChannelAPI.IsChannelViewableOnNumberOnLineup(Channel, ChannelNumber, Lineup_Name);
		ChannelAPI.SetChannelViewabilityForChannelNumberOnLineup(Channel, ChannelNumber, Lineup_Name, !ChannelViewable);
		ChannelAPI.SetChannelViewabilityForChannelNumberOnLineup(Channel, ChannelNumber, Lineup_Name, ChannelViewable);
		return "Lineup EPG Update Forced";
Reply With Quote

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
Forcing Sage to redownload a channel lineup mistergq SageTV EPG Service 1 04-15-2009 10:10 PM
Forcing Sage to use Quicktime sandor SageTV Mac Edition 4 01-05-2009 02:10 PM
How do we tell EPG data provider to update their lineup for new Comcast HD channels? mkanet SageTV EPG Service 2 05-28-2007 07:19 AM
Forcing a channel update tvmaster2 SageTV EPG Service 1 09-18-2006 05:34 AM
Please wait while the channel lineup is downloaded for XMLTV Lineup gafrol SageTV EPG Service 1 01-06-2006 08:08 AM

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

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