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
  #1561  
Old 01-05-2015, 06:43 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by KarylFStein View Post
I think you want your crontab entry to have a minute e.g. 0 4 * * *.
Indeed you definitely want a minute value other than * otherwise it will queue up 60 restart jobs every night and your server will be restarted 60 times each night. Pick a specific minute of the 4 o'clock hour you want the restart to happen.
__________________
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
  #1562  
Old 01-15-2015, 07:46 AM
TechBill's Avatar
TechBill TechBill is offline
Sage Fanatic
 
Join Date: Aug 2007
Posts: 827
Quote:
Originally Posted by Slugger View Post
Indeed you definitely want a minute value other than * otherwise it will queue up 60 restart jobs every night and your server will be restarted 60 times each night. Pick a specific minute of the 4 o'clock hour you want the restart to happen.

I fixed the cron job setting.

It's executing the script every morning at 4am but in the SageTV web showing that the Task Queue is failing every night even it restarting SageTV service without a problem.

I am getting a fail message every morning but when I look at SageTV system message uptime, it shows me that service have been restarted each day without a problem.

Since it working, I will leave it alone unless there a way to fix it so it would show "Complete" instead of "Failed"?

Thank you

Bill
__________________
HTPC System
GIGABYTE GA-MA69GM-S2H AM2 AMD 690G HDMI // AMD Athlon 64 X2 6000+ Windsor 3.0GHz // G.SKILL 6GB (2 x 2GB) 240-Pin DDR2 SDRAM DDR // Hauppauge Colossus HD-PVR // Hauppauge Colossus HD-PVR // Seagate ST3750640AS 750GB SATA-300 16MB // DVD R/W - SAMSUNG Black
Media Extenders
HD300
HTPC Software
Windows 7 Professional 64bits // SageTV 7.1.x // Java 1.7.x
Reply With Quote
  #1563  
Old 01-15-2015, 08:04 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Other than being annoying, the failed status really doesn't hurt anything. But to fix it, just increase the sleep time as needed for your system. For example, the script I use to do the restart looks like this:

Code:
Utility.ServerRestart()
sleep 300000
return 0
That sleep means the client waits 5 minutes before trying to tell the server it completed successfully. If that's not enough time for your Sage server to restart so it can accept the response from the client then increase it as needed.

Also, this only works if you're using the command line or Windows service version of the task client. If you're using the Sage plugin version of the task client then it will always report a failure because the task client is restarted along with the Sage server in that case and therefore will never be able to report the completion of the task. (Well, I could offer you some alternative code to actually make the plugin client report success, but it would just blindly report success, which is about as useful/meaningful as it always reporting failed.)
__________________
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
  #1564  
Old 01-20-2015, 02:10 PM
TechBill's Avatar
TechBill TechBill is offline
Sage Fanatic
 
Join Date: Aug 2007
Posts: 827
Quote:
Originally Posted by Slugger View Post
Other than being annoying, the failed status really doesn't hurt anything. But to fix it, just increase the sleep time as needed for your system. For example, the script I use to do the restart looks like this:

Code:
Utility.ServerRestart()
sleep 300000
return 0
That sleep means the client waits 5 minutes before trying to tell the server it completed successfully. If that's not enough time for your Sage server to restart so it can accept the response from the client then increase it as needed.

Also, this only works if you're using the command line or Windows service version of the task client. If you're using the Sage plugin version of the task client then it will always report a failure because the task client is restarted along with the Sage server in that case and therefore will never be able to report the completion of the task. (Well, I could offer you some alternative code to actually make the plugin client report success, but it would just blindly report success, which is about as useful/meaningful as it always reporting failed.)

It what I thought, since it working and I will just ignore it.

Thank you for clearing it up.

Bill
__________________
HTPC System
GIGABYTE GA-MA69GM-S2H AM2 AMD 690G HDMI // AMD Athlon 64 X2 6000+ Windsor 3.0GHz // G.SKILL 6GB (2 x 2GB) 240-Pin DDR2 SDRAM DDR // Hauppauge Colossus HD-PVR // Hauppauge Colossus HD-PVR // Seagate ST3750640AS 750GB SATA-300 16MB // DVD R/W - SAMSUNG Black
Media Extenders
HD300
HTPC Software
Windows 7 Professional 64bits // SageTV 7.1.x // Java 1.7.x
Reply With Quote
  #1565  
Old 03-25-2015, 07:59 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
As of tonight, I have unsubscribed from this thread. What does this mean? It means I am no longer actively developing or supporting this plugin. All my plugins have actually been EOL'd since about 2012-2013, but tonight I unsubscribe from these threads which means I no longer get instant email notifications when people post. I'm not leaving, I'm still a user, I'm still around these forums, but I no longer support these out of date plugins and since I don't sub to these threads any longer, I may or may not notice your questions and therefore may or may not answer them -- assume that I won't, certainly not in a timely manner.

This also means I will never release another version of this plugin to the repository. I remain the owner of the plugin in the repository, but will approve a transfer if requested. No one has taken me up on that offer since my original announcement many weeks back. Unless someone does, there will be no more releases of this plugin.
__________________
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
  #1566  
Old 10-31-2015, 02:28 PM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
I've decided to try out this plugin again, but I've gotten stuck setting it up once again.

I've installed SJQ, the SJQ UI, and the SJQ Task client on my SageTV server.

I've setup a Comskip task. I've assigned this task to the RecordingStarted event.

I start a recording, and it shows up in the Queued Tasks screen. Comskip never launches. Whenever I go to the Queued Tasks screen, the Started/Completed times are updated to the exact time I enter the screen. The log files show no information.

How can I see what's going wrong? Also, how can I edit the Comskip task I setup to make sure I set it up correctly? I can't find anywhere to edit/view the task I created.

Thanks.
Reply With Quote
  #1567  
Old 10-31-2015, 03:28 PM
KarylFStein KarylFStein is offline
Sage Fanatic
 
Join Date: Apr 2006
Location: Westland, Michigan, USA
Posts: 999
Quote:
Originally Posted by peternm22 View Post
How can I see what's going wrong? Also, how can I edit the Comskip task I setup to make sure I set it up correctly? I can't find anywhere to edit/view the task I created.

Thanks.
Go to manage clients and select the task from the drop down next to a client. My comskip task is a Groovy script. If yours is make sure you have "script:" in front of the executable name. Are you looking at the log files in the web GUI? If so maybe the log files on the server have more information in them (in SageTV/plugins/sjq and sjq-agent on the clients).
__________________
Home Network: https://karylstein.com/technology.html
Reply With Quote
  #1568  
Old 10-31-2015, 03:52 PM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
Thank you! I found the problem, a misspelled path.

My Comskip task is just pointed to the comskip.exe file, and I'm using the Groovy comskip_test.groovy script as my test script (this is one of the sample scripts available from the setup guide).

In the past I've used Showanalyzer, but I'm giving Comskip a go to see how it works. In the Showanalyzer setup you could specify channels not to process, I don't think Comskip offers the same functionality so I'll have to use SJQ for this.

Is Groovy the best (only) way to exclude certain channels from processing in SJQ?

Sorry for asking all of these obvious questions, but this thread is 79 pages long, and a Google search isn't show me much relevant information.
Reply With Quote
  #1569  
Old 10-31-2015, 05:49 PM
Denali Denali is offline
Sage Advanced User
 
Join Date: Aug 2008
Location: South Florida
Posts: 169
Quote:
Originally Posted by peternm22 View Post
In the Showanalyzer setup you could specify channels not to process, I don't think Comskip offers the same functionality so I'll have to use SJQ for this.
Have a look at Setup/Detailed Setup/Customize/ComSkip Playback Options/CommercialDetector/Do Not Run comskip on These Channels/
__________________
HTPC: Gigabyte GA-Z170XP-SLI, I7-6700, 16GB, Windows 10 Pro x64, Hauppauge HVR-1600, WinTV-dualHD, Colossus 2, Samsung 850 EVO 120GB, Seagate 3TB, WD 3TB, 3TB, 5TB, Java v1.8.0_231, SageTVx64 v9.2.1.826, Samsung UN60EH6003F, Dish ViP222K, ViewHD 1x2 HDMI Splitter.
Reply With Quote
  #1570  
Old 11-02-2015, 01:09 PM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
I'm trying to do a more advanced Comskip task so that I can load different .ini files depending on the channel. Instead of using the executable and test script, I want to put everything inside of a single script. I then call this script as the executable like so: script:C:\Sage\Tools\comskip.groovy

My initial testing has been working so far, however I can't seem to find a way to mark a task as skipped.

Code:
if(ignoreLiveTv && AiringAPI.IsNotManualOrFavorite(mf)) {
   println "Recording is live TV or IR recording, skipping comskip!"
   return 2
}
The above code works in a test script (and marks the task as skipped). If I run the script as the primary executable though, the task is marked as failed.

It seems that SJQ only understands "return 2" in the context of a test script, and not an executable. Any way around this?

As a workaround, I could make two scripts. One as the test script (which first verifies whether or not the task should be skipped or not), and then an executable script which decides what .ini file to use, and the launches Comskip with that .ini file. Is this the best way to do this?

Is it possible to have a test script return a string value, and then have that string value passed as an argument to the exe? This way I would only need one groovy script.

Last edited by peternm22; 11-02-2015 at 01:12 PM.
Reply With Quote
  #1571  
Old 11-02-2015, 02:57 PM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
I'm going ahead with the two script method (test and executable), since I can't find a way to do everything in one script.

I have the basic logic working now. You can define different ini files by channel number (might change it to channel name later on), by simply adding this line: ruleList.push('first.ini>400|300|291') This should be self explanatory.

If the channel number isn't found in any of the ruleList's, then it just uses the default ini file. See code below:

Code:
ComskipPath = "C:/Program Files (x86)/Comskip/comskip.exe"
iniDirectory = "C:/Program Files (x86)/Comskip/"
DefaultIniFile = "comskip.ini"

def ruleList = []
ruleList.push('first.ini>400|300|291') //each line defines which channels to use a particular .ini with
ruleList.push('second.ini>255|652')

/****************************************************************************************/
/****************************************************************************************/
/****************************************************************************************/

Object mf = MediaFileAPI.GetMediaFileForID(SJQ4_METADATA.get("SJQ4_ID").toInteger()) 
def channel = AiringAPI.GetAiringChannelNumber(mf)

file = SJQ4_METADATA.get("SJQ4_PATH") + "\\" + SJQ4_METADATA.get("SJQ4_LAST_SEGMENT")
fileType = SJQ4_METADATA.get("SJQ4_LAST_SEGMENT_TYPE") 

def path = new File(SJQ4_METADATA.get("SJQ4_PATH"))
def fileName = SJQ4_METADATA.get("SJQ4_LAST_SEGMENT")



def channelFound = false

ruleList.each { contents ->
	if(!channelFound) {
		def (inifile, channels) = contents.tokenize('>')
		channels = "/${channels}/"
		if(channel =~ channels) {
			channelFound = true
			println "Use '${inifile}' for channel ${channel}"
			runComskip(inifile)
			return 0
		}
	}
}

if(!channelFound) {
	println "Use '${DefaultIniFile}' for default processing on channel ${channel}"
	runComskip(DefaultIniFile)
}


def runComskip(String iniConfig) {
	arg = "--ini=${iniDirectory}${iniConfig}"

	def command = [ComskipPath, arg, file].execute()
    def p = command.waitFor() 
    p.consumeProcessOutput(System.out, System.err)
    def rc = p.waitFor()
    if(rc == 0 || rc == 1)
       return 0
    else
       return 1 

}
Everything works until it gets to the point where it executes the process. Comskip is launched and starts writing the .edl file, but Comskip just stops before it has finished processing. In Windows task manager, comskip.exe is just sitting there with zero CPU usage. I had to end the process.

This is what popped up in the log file afterwards:

Code:
javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.consumeProcessOutput() is applicable for argument types: (java.io.PrintStream, java.io.PrintStream) values: [java.io.PrintStream@f41f34, java.io.PrintStream@12cb871]
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:138)
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:124)
	at com.google.code.sagetvaddons.sjq.agent.ScriptRunner.exec(ScriptRunner.java:114)
	at com.google.code.sagetvaddons.sjq.agent.ScriptRunner.main(ScriptRunner.java:175)
Caused by: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.consumeProcessOutput() is applicable for argument types: (java.io.PrintStream, java.io.PrintStream) values: [java.io.PrintStream@f41f34, java.io.PrintStream@12cb871]
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:335)
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:132)
	... 3 more
Caused by: groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.consumeProcessOutput() is applicable for argument types: (java.io.PrintStream, java.io.PrintStream) values: [java.io.PrintStream@f41f34, java.io.PrintStream@12cb871]
	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
	at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
	at Script1.runComskip(Script1.groovy:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1076)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
	at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:149)
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl$2.invokeMethod(GroovyScriptEngineImpl.java:316)
	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
	at Script1.run(Script1.groovy:36)
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:332)
	... 4 more
Any idea what is going wrong? It seems like it is having trouble with consumeProcessOutput().

I saw in some other examples that certain things (libraries?) need to be imported. Do I need those imports with this script? If so, which ones would i need?

Thanks.
Reply With Quote
  #1572  
Old 11-02-2015, 03:58 PM
KarylFStein KarylFStein is offline
Sage Fanatic
 
Join Date: Apr 2006
Location: Westland, Michigan, USA
Posts: 999
I use a two script method, but don't think it's necessary. I used the scripts here as templates:

https://sagetv-addons.googlecode.com...nk/SJQScripts/

Not knowing much about Java or Groovy, I think you don't want that extra def p and just use the methods from command. Here's my comskip task, (again just ripped from the samples):

Code:
def cmd = "C:\\comskip\\comskip.exe"
def failed = false

for(int i = 0; i <= SJQ4_METADATA["SJQ4_MAX_SEGMENT_INDEX"].toInteger(); ++i) {
   def segment = SJQ4_METADATA["SJQ4_PATH"] + "/" + SJQ4_METADATA["SJQ4_SEGMENT_${i}"]
   def exe = [cmd, segment]
   def edlFile = "${segment}.edl"
   if (Utility.IsFilePath(edlFile))
      continue;

   def p = exe.execute()
   p.consumeProcessOutput(System.out, System.err)
   p.waitFor()
   def rc = p.exitValue()
   if(rc < 0 || rc > 1) // Task failed, but run against the rest of the segments anyways...
      failed = true
}
return failed ? 1 : 0
__________________
Home Network: https://karylstein.com/technology.html
Reply With Quote
  #1573  
Old 11-02-2015, 04:15 PM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
Quote:
Originally Posted by KarylFStein View Post
Here's my comskip task, (again just ripped from the samples):
What same did you use for this code? I looked at all of them, and the only comskip related samples were for just the test script. I couldn't see any for actually running comskip.exe themselves.

Thanks.
Reply With Quote
  #1574  
Old 11-02-2015, 04:20 PM
KarylFStein KarylFStein is offline
Sage Fanatic
 
Join Date: Apr 2006
Location: Westland, Michigan, USA
Posts: 999
Huh, beats me . Maybe it was posted in this thread somewhere. I know I didn't write it from scratch.
__________________
Home Network: https://karylstein.com/technology.html
Reply With Quote
  #1575  
Old 11-02-2015, 04:27 PM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
Hot dang, it worked!

Thanks for the code. Time to clean things up a little and I'll post the finished code when I'm done.
Reply With Quote
  #1576  
Old 11-02-2015, 05:14 PM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
A new problem just showed up.

One of my encoders is a network encoder (an R5000), and on certain channels it can take 30 seconds before it starts writing data to the recording file. I'm also trying to do commercial detection while the show is being recorded (as I have always done with Showanalyzer)

Comskip doesn't like this and produces a few "Can not open file" in the log before giving up.

Is there anyway for SJQ to wait until the recording actually has data before calling Comskip.exe?
Reply With Quote
  #1577  
Old 11-02-2015, 05:32 PM
KarylFStein KarylFStein is offline
Sage Fanatic
 
Join Date: Apr 2006
Location: Westland, Michigan, USA
Posts: 999
Quote:
Originally Posted by peternm22 View Post
A new problem just showed up.

One of my encoders is a network encoder (an R5000), and on certain channels it can take 30 seconds before it starts writing data to the recording file. I'm also trying to do commercial detection while the show is being recorded (as I have always done with Showanalyzer)

Comskip doesn't like this and produces a few "Can not open file" in the log before giving up.

Is there anyway for SJQ to wait until the recording actually has data before calling Comskip.exe?
What I do is set my comskip trigger task to run from crontab at 5 and 35 minutes after the hour. It also skips things that are not "manual or favorite" recordings. Maybe you could just add a file size check in the Groovy script and sleep 30 seconds a couple times before giving up trying to run comskip (?).
__________________
Home Network: https://karylstein.com/technology.html
Reply With Quote
  #1578  
Old 11-02-2015, 06:01 PM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
Both good ideas. I have my Comskip task currently attached to the RecordingStarted event.

I'm using a slightly modified version of the comskip_test.groovy as my test. I have it set to only run Comskip on Manual and Favorite recordings.

I also added an ignore channel setting, where I enter in all the channels I don't want scanned (premium channels that have no commercials). These trigger a "return 2", which tells SJQ to make these tasks as skipped.

I'm just working on tweaking my main executable script. I still need to add logic to deal with recordings that have multiple segments (I see your code does that already). I'm also going to look into adding a filesize check like you suggested, and not fire comskip.exe until the file actually has data.

Thanks again.
Reply With Quote
  #1579  
Old 11-02-2015, 11:12 PM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
I think I've got all of the bugs worked out now. See below for the groovy script.

A few notes:
  • At the top of the script you need to define some variables. The path to comskip.exe, the directory in which you store your .ini files (usually the same place as comskip.exe, but I wanted to give the script some flexibility). Also set the default .ini file use if the channel isn't matched in any of our ruleList's.
  • You can add as many .ini ruleList's as you like. The format is: ruleList.push('amc.ini>AMCCHD|CIIIDT') where amc.ini is you ini file, and then a list of channels that should use this ini file. Make sure to keep the ">" character in there, it's what separates the ini file from the channel list. Each channel is separated with a "|" character.
  • ruleList's are parsed in the same order as they are listed. So if you define the same channel name in two or more ruleList's, only the first one would be use.
  • This script is designed to be placed in the executable when setting up a task in SJQ. For example: script:C:\Sage\Tools\sjqscript\multicomskip.groovy
  • You still need to define a test file for the task. The test file can check if an edl file already exists, set comskip to not run on livetv, etc. I use a test file based on this one: http://sagetv-addons.googlecode.com/...ip_test.groovy
  • I have some logic in the script to make sure that comskip.exe isn't launched until the recording actually has data in it. I did this because one of my network encoders can be a bit slow starting to write the file. The script checks to make sure the file isn't empty, if it is, it waits 30 seconds and tries again. It retries 3 times, so in total it will wait 90 seconds before giving up

I hope this script can help out people out. I know a little bit of programming so that helped, but groovy was completely new to me.

Code:
ComskipPath = "C:/Program Files (x86)/Comskip/comskip.exe"
iniDirectory = "C:/Program Files (x86)/Comskip/"
DefaultIniFile = "comskip.ini"

def ruleList = []

//each line defines which channels to use a particular .ini with
//just add another line with the same format to define additional files
ruleList.push('amc.ini>AMCCHD|CIIIDT') 
ruleList.push('second.ini>WDIVDT|ECAN')
ruleList.push('third.ini>FXCHD|WUHFDT|MCHD')

/****************************************************************************************/
/* No changes needed below this line                                                   **/
/****************************************************************************************/

Object mf = MediaFileAPI.GetMediaFileForID(SJQ4_METADATA.get("SJQ4_ID").toInteger()) 
def channel = AiringAPI.GetAiringChannelName(mf)

def IniFileToUse = DefaultIniFile

for (String item : ruleList) {
	def (inifile, channels) = item.tokenize('>')
	channels = /${channels}/
	if(channel =~ channels) {
		println "Use '${inifile}' for channel ${channel}"
		IniFileToUse = inifile
		break
	}
}

if (IniFileToUse == DefaultIniFile) {
		println "Channel didn't match any rules. Use  default '${DefaultIniFile}' for channel ${channel}"
}

def failed = false

for(int i = 0; i <= SJQ4_METADATA["SJQ4_MAX_SEGMENT_INDEX"].toInteger(); ++i) {
   def arg = "--ini=${iniDirectory}${IniFileToUse}"
   def segment = SJQ4_METADATA["SJQ4_PATH"] + "/" + SJQ4_METADATA["SJQ4_SEGMENT_${i}"]
   
   File fileseg = new File(segment)

	for (i = 0; i < 3; i++) {
		if (fileseg.length() == 0) {
			println "File is empty. Sleeping 30 seconds."
			sleep(30000)
			if (i == 2) {
				println "File was empty, could not process."
				return 1
			}
		} else {
			break
		}
	}
   
   def exe = [ComskipPath, arg, segment]
   def edlFile = "${segment}.edl"
   if (Utility.IsFilePath(edlFile))
      continue;

   def p = exe.execute()
   p.consumeProcessOutput(System.out, System.err)
   p.waitFor()
   def rc = p.exitValue()
   if(rc < 0 || rc > 1) // Task failed, but run against the rest of the segments anyways...
      failed = true
}
return failed ? 1 : 0
Reply With Quote
  #1580  
Old 01-16-2016, 04:25 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
Does anyone have SJQ v4 working under Sage V9? I have installed V9 and installed three plugins: SJQ, SJQ UI and SJQ Agent (Task Client). But I don't get a SJQ entry in my Setup menu as I do under my V7 server.

In addition the SQJ Web UI says "Not compatible" I wonder if that is really the case or if it just doesn't like V9 as the version number?
__________________
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
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
Plugin: MizookLCD (Alternate SageTV LCDSmartie Plugin) cslatt SageTV Customizations 48 06-11-2012 10:44 AM
SJQv4: Technology Preview Slugger SageTV v7 Customizations 39 12-17-2010 01:17 PM
SageTV Plugin Developers: Any way to see stats for your plugin? mkanet SageTV Software 4 12-12-2010 10:33 PM
MediaPlayer Plugin/STV Import: Winamp Media Player Plugin deria SageTV Customizations 447 12-11-2010 07:38 PM
SJQv4: Design Discussion Slugger SageTV v7 Customizations 26 10-18-2010 08:22 AM


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


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