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
  #1401  
Old 10-30-2013, 09:49 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Right... wow it's been so long since I've touched any of my SJQ scripts that I've forgotten how I even implemented this stuff. I think it's more to do with how I wish I had done it and how I would have done it for SJQv5 had that ever seen the light of day.

Anyway, yeah, the API variables are actually injected into the scripts automatically so you don't need to import anything.

But you don't prefix with "Global". See here. I actually had to go skim over this to remind myself.

So to iterate through the system messages and delete specific ones, I might do something like this (all completely untested):

Code:
// Find and delete every system message that contains the word 'Halt' in its message text
SystemMessageAPI.GetSystemMessages().findAll { SystemMessageAPI.GetSystemMessageString(it).contains('Halt') }.each {
   SystemMessageAPI.DeleteSystemMessage(it)
}
__________________
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
  #1402  
Old 10-30-2013, 10:22 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Actually, i seemed to have sorted it out as you were typing that it seems. Here's what I ended up with:

Code:
if(SJQ4_METADATA.get("SJQ4_MSG_TYPE")=="Halt Detected in Recording") {
	if(SJQ4_METADATA.get("SJQ4_TEXT").contains("VIP-211-1")) {
		if (Integer.parseInt(SJQ4_METADATA.get("SJQ4_COUNT")) == 2) {
			for ( obj in SystemMessageAPI.GetSystemMessages() ) { 
				if(SystemMessageAPI.GetSystemMessageString(obj)==SJQ4_METADATA.get("SJQ4_TEXT")) {
					SystemMessageAPI.DeleteSystemMessage(obj); 
				}
			}
			SystemMessageAPI.PostSystemMessage(1204,2,"R5000HD Software was reset due to : " + SJQ4_METADATA.get("SJQ4_TEXT"), null);
			return 0;
		} else {
			return 2;
		}			
	} else {
		return 2;
	}
} else {
	return 2;
}
only current issue is that, while yes, this does delete any previous messages that led up to the reset, and it does generate a warning level message to say that it reset it, the reset itself generates a new halt message afterward, that doesn't get removed. I'll have to add on yet another section to this pretest script i think to handle that - if I feel the need.
__________________
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
  #1403  
Old 11-04-2013, 08:32 PM
bikesquid's Avatar
bikesquid bikesquid is offline
Sage Aficionado
 
Join Date: Jan 2010
Location: California's North Coast
Posts: 392
I must have screwed up something unknowingly. I've got a few tasks that simply are stuck. Not active, the associated .exe's aren't running, so I know their are dead, but sjq won't let me delete them and won't go on to do other work. I've tried a restart of sage as well with no luck. Any suggestions on this greatly appreciated, I'm lost.
Reply With Quote
  #1404  
Old 11-05-2013, 10:15 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
You might have to remove the entries from the db manually:

https://code.google.com/p/sagetv-add...ModifyDatabase
__________________
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
  #1405  
Old 11-05-2013, 10:43 AM
bikesquid's Avatar
bikesquid bikesquid is offline
Sage Aficionado
 
Join Date: Jan 2010
Location: California's North Coast
Posts: 392
I did try that, just did again hoping for a different outcome. What I get is if I do a query in the console of "SELECT * FROM QUEUE " I get get the full queue list, as expected, so far so good. If I run the various commands from your post #775, such as "DELETE * FROM queue WHERE state = 'WAITING'" I get "DELETE * FROM queue WHERE state = 'WAITING';
Syntax error in SQL statement "DELETE *[*] FROM QUEUE WHERE STATE = 'WAITING' "; expected "identifier"; SQL statement:
DELETE * FROM queue WHERE state = 'WAITING' [42001-145]
42001/42001 (Help)" as the output.

When I do "DELETE * FROM queue" I get the same sort of output.

What I'd really like to do is just clear the queue and remove all tasks and clear the clients assigned tasks. Then I can add back what I want.
Reply With Quote
  #1406  
Old 11-05-2013, 10:52 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Ok, I updated 775, the SQL syntax is wrong.

Drop the * in the queries, then they should work.

So DELETE FROM queue WHERE state = 'WAITING'
__________________
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
  #1407  
Old 11-05-2013, 11:00 AM
bikesquid's Avatar
bikesquid bikesquid is offline
Sage Aficionado
 
Join Date: Jan 2010
Location: California's North Coast
Posts: 392
Quote:
Originally Posted by Slugger View Post
Ok, I updated 775, the SQL syntax is wrong.

Drop the * in the queries, then they should work.

So DELETE FROM queue WHERE state = 'WAITING'
It's different... but not working yet:
DELETE FROM queue WHERE state = 'WAITING';
Row not found when trying to delete from index "PUBLIC.FK_CLIENT__QUEUE_INDEX_1: ( /* key:33352 */ 33352, 'CUT', TIMESTAMP '2013-11-04 16:30:27.717', NULL, NULL, 'WAITING', NULL, NULL, FALSE)"; SQL statement:
DELETE FROM queue WHERE state = 'WAITING' [90112-145]
90112/90112 (Help)
Reply With Quote
  #1408  
Old 11-05-2013, 11:04 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Your database file is corrupted. If you have a backup, restore it. If not, I'm afraid you're going to have to delete the entire database and start fresh.
__________________
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
  #1409  
Old 11-05-2013, 11:10 AM
bikesquid's Avatar
bikesquid bikesquid is offline
Sage Aficionado
 
Join Date: Jan 2010
Location: California's North Coast
Posts: 392
Quote:
Originally Posted by Slugger View Post
Your database file is corrupted. If you have a backup, restore it. If not, I'm afraid you're going to have to delete the entire database and start fresh.
No problem, just the sjq4.h2.db file?
Reply With Quote
  #1410  
Old 11-05-2013, 11:18 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
You must stop SageTV first then go to the following dir and remove the following files and subdir (the .lock.db file probably won't be there, that's ok).

Code:
 Directory of C:\Program Files (x86)\SageTV\SageTV\plugins\sjq

11/05/2013  11:05 AM         2,889,728 sjq4.h2.db
11/05/2013  04:12 AM    <DIR>          sjq4.lobs.db
11/05/2013  03:31 AM               103 sjq4.lock.db
__________________
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
  #1411  
Old 11-05-2013, 11:47 AM
bikesquid's Avatar
bikesquid bikesquid is offline
Sage Aficionado
 
Join Date: Jan 2010
Location: California's North Coast
Posts: 392
Thanks again Slugger, that did it! Wonder what happened...glad my backups are working at least!
Reply With Quote
  #1412  
Old 11-29-2013, 11:31 PM
TechBill's Avatar
TechBill TechBill is offline
Sage Fanatic
 
Join Date: Aug 2007
Posts: 827
I had to reiinstall SAgeTV and I cannot remember how did I set up to use Groovy script to restart SageTV when there no recording going on.

I remember using stand alone Groovy exe and I download it but it giving me a license not found error when I tried to set it up.

Is there a new way of restarting SageTV nightly using this script or still need to use stand alone exe?

Still struggling trying to make this work again

Can anyone here help me out ?

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
  #1413  
Old 11-30-2013, 08:55 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Follow this tutorial, except use the script below instead of the mentioned exe script (you can use the mentioned test script as is).

Code:
Utility.ServerRestart()
sleep 300000
return 0
Just make sure the sleep time is long enough for Sage to completely restart. That value is currently set at 5 minutes (300 seconds/300000 ms). It still must be run on an external task client. You don't need SageGroovy other than to test scripts, etc. If you want to use SageGroovy copy the salicense.jar file from SageTV\JARs\ into the lib dir on SageGroovy, that will fix the licensing errors from it. The standalone SJQ task client does not use licensing.
__________________
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
  #1414  
Old 11-30-2013, 11:32 AM
TechBill's Avatar
TechBill TechBill is offline
Sage Fanatic
 
Join Date: Aug 2007
Posts: 827
Quote:
Originally Posted by Slugger View Post
Follow this tutorial, except use the script below instead of the mentioned exe script (you can use the mentioned test script as is).

Code:
Utility.ServerRestart()
sleep 300000
return 0
Just make sure the sleep time is long enough for Sage to completely restart. That value is currently set at 5 minutes (300 seconds/300000 ms). It still must be run on an external task client. You don't need SageGroovy other than to test scripts, etc. If you want to use SageGroovy copy the salicense.jar file from SageTV\JARs\ into the lib dir on SageGroovy, that will fix the licensing errors from it. The standalone SJQ task client does not use licensing.
Alright I will give this method a try

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
  #1415  
Old 12-04-2013, 11:11 AM
bikesquid's Avatar
bikesquid bikesquid is offline
Sage Aficionado
 
Join Date: Jan 2010
Location: California's North Coast
Posts: 392
I started a new thread, but maybe it should be here instead as I'm thinking it's related to sjq pretty directly....http://forums.sagetv.com/forums/showthread.php?t=61004
Reply With Quote
  #1416  
Old 12-04-2013, 11:34 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
The connections from SJQ are normal. They will timeout and clean themselves up based on the TCP settings on your system. This is usually like 5 minutes or so. But that seems like a lot of active connections, but that could be normal based on the number of jobs you have setup in SJQ. If you're running Windows 7 then this may or may not help:

https://www.google.ca/url?sa=t&rct=j...57155469,d.aWM

Note: Just a quick google search, I have no idea if that's an issue or is related, etc. Use at your own risk.
__________________
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
  #1417  
Old 12-04-2013, 11:43 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
"Normal" meaning that Windows should clean things up in a timely manner. It's probably a bug in the SJQ task client or server code where one side is closing the connection and the other side isn't explicitly acknowledging the close, which is probably why the socket remains open until Windows times it out and cleans it up.

At this stage of the game, a fix is very unlikely (the current code has been out there since June 2011 so it hasn't been a widespread problem/my familiarity with the code at this point is low, to say the least), but if you provide the stack trace of the connection refused errors you're seeing I will try to diagnose the issue and if it's a critical bug then I might release a fix.
__________________
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
  #1418  
Old 12-04-2013, 11:43 AM
bikesquid's Avatar
bikesquid bikesquid is offline
Sage Aficionado
 
Join Date: Jan 2010
Location: California's North Coast
Posts: 392
That's helpful, I was starting to go that route, but saw this large number of open ports for sagetv. There are a running (approx) 30 open ports waiting, yes they time out but new ones pop up at the same rate. current task queue shows 2 jobs running, 6 waiting. The completed tasks is closer to 30 though....

I've also noticed that the HD300's keep opening ports related to something else running on the same box, so they also leave lots of open/waiting ports. It's probably a perfect storm of danglers that clears up, but only after the damage is done.
Thx.
Reply With Quote
  #1419  
Old 12-04-2013, 12:29 PM
bikesquid's Avatar
bikesquid bikesquid is offline
Sage Aficionado
 
Join Date: Jan 2010
Location: California's North Coast
Posts: 392
Quote:
Originally Posted by Slugger View Post
At this stage of the game, a fix is very unlikely (the current code has been out there since June 2011 so it hasn't been a widespread problem/my familiarity with the code at this point is low, to say the least), but if you provide the stack trace of the connection refused errors you're seeing I will try to diagnose the issue and if it's a critical bug then I might release a fix.
Has it been that long?? 2011

Understood that it's EOL and probably not going to see a fix. But it's possible I'm doing something in my scripts that's exploiting a problem that I can do differently?

If I knew how to get any more info related to stack trace I'd be happy to provide, the only think I find via a web search is "Thread .currentThread().getStackTrace()." which I suppose I could throw in a suspect script with a Println which would get it in the task log file, but I'm not sure that's what you mean. Maybe you're suggesting a netsh trace?
Reply With Quote
  #1420  
Old 12-04-2013, 01:37 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
You said you were getting connection refused errors. I assume where ever you saw that error would also have a stack trace attached to it. Where are you seeing those errors logged?

And the last SJQ server release was indeed on June 20, 2011; the last task client release was Oct 18, 2011. Boy how time flies.
__________________
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...

Last edited by Slugger; 12-04-2013 at 01:40 PM.
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.