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
  #881  
Old 07-25-2011, 08:10 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
You'd have to experiment a little. Does the core fire a new RecordingStarted event when you change the recording status from live to manual record? If so, then that's how you would catch it. If not, then there's nothing SJQ can do since the core isn't providing a new event for the new status.
__________________
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
  #882  
Old 07-25-2011, 09:55 AM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
Quote:
Does the core fire a new RecordingStarted event when you change the recording status from live to manual record?
How can I check if it does?
Reply With Quote
  #883  
Old 07-25-2011, 10:56 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Enable Sage debug logging, start watching live tv - you should see a RecordingStarted event triggered in the log. Then hit the record button to change it to a manual recording. Is another RecordingStarted event logged? That's how you find out.
__________________
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
  #884  
Old 07-25-2011, 11:23 AM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
Unfortunately, it looks like it doesn't raise another event.
Reply With Quote
  #885  
Old 07-25-2011, 11:26 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Ok, so you'd have to either manually add the job to the queue or periodically scan your library looking for such recordings and adding them to the queue.
__________________
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
  #886  
Old 08-03-2011, 06:22 PM
TechBill's Avatar
TechBill TechBill is offline
Sage Fanatic
 
Join Date: Aug 2007
Posts: 827
I am reading up on this Plugin but it 45 pages long so it'll take me awhile to read but wonder if someone can point me to the right direction.

What I am trying to do is set up something to restart SageTV service nightly but make sure there no recording in process before restarting. If there was a recording then to wait until recording end before restarting.

Is this someone that this plugin can do?

Is there a step by step instruction stepping up a restart service with this plugin somewhere?

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
  #887  
Old 08-03-2011, 07:42 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by TechBill View Post
I am reading up on this Plugin but it 45 pages long so it'll take me awhile to read but wonder if someone can point me to the right direction.

What I am trying to do is set up something to restart SageTV service nightly but make sure there no recording in process before restarting. If there was a recording then to wait until recording end before restarting.

Is this someone that this plugin can do?

Is there a step by step instruction stepping up a restart service with this plugin somewhere?

Thank you

Bill
Follow this tutorial. The only difference is when it tells you download the scripts, download and use the linked to test script, but use the below script to do the restarts instead of the linked to script that does the app dir backups. Everything else in the tutorial is valid for your situation. You must run the standalone task client, etc. just as described in the tutorial.

Code:
/****** CONFIG BELOW ******/
def testMode  = true // You might want to run this in test mode while you test your task setup in SJQv4
def sleepTime = 300  // How many seconds does SageTV need to restart? BE CONSERVATIVE HERE!!
/****** END CONFIG ******/

print "Restarting SageTV... "
if(!testMode) {
    Utility.ServerRestart()
    println "DONE"
    print "Waiting for SageTV to start up... "
   sleep 1000L * sleepTime
   println "DONE"
} else
    println "SKIPPED (test mode)"
return 0
__________________
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
  #888  
Old 08-04-2011, 01:12 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. The only difference is when it tells you download the scripts, download and use the linked to test script, but use the below script to do the restarts instead of the linked to script that does the app dir backups. Everything else in the tutorial is valid for your situation. You must run the standalone task client, etc. just as described in the tutorial.

Code:
/****** CONFIG BELOW ******/
def testMode  = true // You might want to run this in test mode while you test your task setup in SJQv4
def sleepTime = 300  // How many seconds does SageTV need to restart? BE CONSERVATIVE HERE!!
/****** END CONFIG ******/

print "Restarting SageTV... "
if(!testMode) {
    Utility.ServerRestart()
    println "DONE"
    print "Waiting for SageTV to start up... "
   sleep 1000L * sleepTime
   println "DONE"
} else
    println "SKIPPED (test mode)"
return 0


Thank you so much!

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
  #889  
Old 08-11-2011, 10:13 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
Has anyone ever written a script to upload files to a seedbox via ftp? Any suggestion on how to automate an FTP session via script from SJQ? I essentially want to creat an SJQ job that would upload a show to a server via FTP upon completion - perhaps after compressing the show first to save space.
__________________
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
  #890  
Old 08-11-2011, 10:26 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by wayner View Post
Has anyone ever written a script to upload files to a seedbox via ftp? Any suggestion on how to automate an FTP session via script from SJQ? I essentially want to creat an SJQ job that would upload a show to a server via FTP upon completion - perhaps after compressing the show first to save space.
I haven't done it, but it's possible. If you're using the plugin version of the task client then ensure the commons-net library plugin is installed (install it if it's not) and then you can use the FTPClient class from it within your groovy script to perform FTP actions.

http://commons.apache.org/net/api-1....FTPClient.html

The jar should already be included with the standalone version of the task client.

A quick glance at the FTPClient javadocs suggests it's going to be a bit of work to get it going, but if you're willing to try and follow the API, it should be quite doable. The sample code provided in the javadocs above looks pretty straightforward to follow along with.
__________________
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
  #891  
Old 08-15-2011, 07:27 PM
evilpenguin's Avatar
evilpenguin evilpenguin is offline
SageTVaholic
 
Join Date: Aug 2003
Location: Seattle, WA
Posts: 3,696
CronTab Question

Question about CronTab jobs, i'm running my server with power saving enabled so it goes to sleep whenever its not recording. So how does it work if I've got a daily job scheduled to go off at midnight and the server isn't on? Will it execute the task the next time it wakes up or will the task only execute if the server happens to be on at that time?
__________________
Clients: 1xHD200 Connected to 50" TH-50PZ750U Plasma
Server : Shuttle SFF SSH55J2 w/ Win7 Home, SageTV v7, Core i3 540, 2GB RAM, 30GB SSD for OS, 1.5TB+2x1TB WDGP for Recordings, BluRay, 2xHDHR, 1xFirewire
SageTV : PlayOn, SJQ, MediaShrink, Comskip, Jetty, Web Client, BMT


Having a problem? Don't forget to include a log! (Instructions for: PlayOn For SageTV v1.5, MediaShrink)
Reply With Quote
  #892  
Old 08-15-2011, 08:01 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by evilpenguin View Post
Question about CronTab jobs, i'm running my server with power saving enabled so it goes to sleep whenever its not recording. So how does it work if I've got a daily job scheduled to go off at midnight and the server isn't on? Will it execute the task the next time it wakes up or will the task only execute if the server happens to be on at that time?
In order for the crontab to insert a task into the task queue, the server would have to be on at the time the crontab schedule would match (so midnight, in your example). If your server is sleeping at midnight then the crontab would not insert the new task into the queue. I've reviewed the cron4j project documentation and there is no support to run missed jobs.

However, tasks inserted into the SJQ task queue will run (eventually). So you could insert the task at any time of the day into the SJQ task queue (via SJQ crontab or any other means) and then restrict your task client to only run the task between midnight and 8am (or whatever). If the server happens to be off at midnight then no big deal, as long as the server comes back on before 8am then the task will be executed. If it doesn't, then the task will sit in the queue until the follow day. Not ideal, but it's about the best you can do - cron wasn't really designed for "servers" that don't run 24x7.
__________________
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
  #893  
Old 08-15-2011, 10:06 PM
KarylFStein KarylFStein is offline
Sage Fanatic
 
Join Date: Apr 2006
Location: Westland, Michigan, USA
Posts: 999
Quote:
Originally Posted by evilpenguin View Post
Question about CronTab jobs, i'm running my server with power saving enabled so it goes to sleep whenever its not recording. So how does it work if I've got a daily job scheduled to go off at midnight and the server isn't on? Will it execute the task the next time it wakes up or will the task only execute if the server happens to be on at that time?
Another option if your BIOS supports it is to set a "wakeup" time. I do this so my desktops are awake five minutes before their scheduled nightly backups. When I ran WHS, it woke up the computers automatically for backups, but now am back to Acronis TIH and it doesn't have that ability being client-based. I imagine WHS uses a "magic packet" to wake up the computers. I do that myself so I can VPN into my home and send a magic packet to a certain desktop via a web page, (modified PHP code I found somewhere), on my 24/7 server. After a few seconds, I can then fire up Remote Desktop of VNC and connect to the desktop. But that probably doesn't apply here if you don't have a full-time server somewhere...I just think it's neat and works well.
__________________
Home Network: https://karylstein.com/technology.html
Reply With Quote
  #894  
Old 08-16-2011, 10:19 AM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
Quote:
Originally Posted by Slugger View Post
I haven't done it, but it's possible. If you're using the plugin version of the task client then ensure the commons-net library plugin is installed (install it if it's not) and then you can use the FTPClient class from it within your groovy script to perform FTP actions.
I have figured out how to do this in a DOS (is that still the right term?) batch file and I will soon be posting a file to automate the encoding (via handbrake) and FTPing of a file as this may be useful to others. I will use this to access TV recordings while travelling as the main constraint is usually my upload speed from home so having the file available on a server with a fast download speed has an advantage.

For example -- let's say you are in Asia and want to watch a hockey game. The hockey game will likely run from 7:30-10pm but that is in the morning for Asia and you are likely working. You can encode the file to a more efficient format and upload to a server - this should be done by about 1am in Toronto. By the time I get back to my hotel in Asia it will likely be 6 pm and I can start the download before dinner and hopefully have the file downloaded in less than an hour and it is on your laptop and ready to watch at that time or on the flight back home. Having to download the file directly from my PC at home would be much slower as my upload speed is only 2 Mbps (900MB/hour).

One further question for Slugger or others.

How do I write some of the attributes of a TV recording to a text file? I want to generate a text file that will look somewhat like a Sage properties file but with my own customized format. How do I create a text file in Groovy and then write elements like the show name, episode name, description, format, etc to that file?
__________________
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
  #895  
Old 08-16-2011, 11:07 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by wayner View Post
I have figured out how to do this in a DOS (is that still the right term?) batch file and I will soon be posting a file to automate the encoding (via handbrake) and FTPing of a file as this may be useful to others. I will use this to access TV recordings while travelling as the main constraint is usually my upload speed from home so having the file available on a server with a fast download speed has an advantage.

For example -- let's say you are in Asia and want to watch a hockey game. The hockey game will likely run from 7:30-10pm but that is in the morning for Asia and you are likely working. You can encode the file to a more efficient format and upload to a server - this should be done by about 1am in Toronto. By the time I get back to my hotel in Asia it will likely be 6 pm and I can start the download before dinner and hopefully have the file downloaded in less than an hour and it is on your laptop and ready to watch at that time or on the flight back home. Having to download the file directly from my PC at home would be much slower as my upload speed is only 2 Mbps (900MB/hour).
All to watch the Leafs? Really? Doesn't that make a flight from Asia to Canada that much longer?

Quote:
One further question for Slugger or others.

How do I write some of the attributes of a TV recording to a text file? I want to generate a text file that will look somewhat like a Sage properties file but with my own customized format.
What type of attributes? Basically, get the MediaFile object and then perform queries on it.

Code:
def mf = MediaFileAPI.GetMediaFileForID(123456)
def output = new StringBuilder()
output.append("title = ${MediaFileAPI.GetMediaTitle(mf)}\n")
output.append("episode = ${ShowAPI.GetShowEpisode(mf)}\n")
new File("C:/mydata/mydata.txt").write(output.toString())
Now C:/mydata/mydata.txt contains the attributes as written above. The above code does not do any appropriate error checking/handling and is left out to aid in readability.

Quote:
How do I create a text file in Groovy and then write elements like the show name, episode name, description, format, etc to that file?
This is a more generic, "how do I write Groovy code?" and those questions I leave to the Groovy docs: http://groovy.codehaus.org/Documentation

However, this question looks very similar to the one above, so the code example I've provided should be a good starting point.
__________________
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
  #896  
Old 08-16-2011, 07:30 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
Thanks Slugger, I will gve that a try. And I don't think an Oilers fan is in any position to give grief to a Leafs fan.
__________________
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
  #897  
Old 08-16-2011, 07:36 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by wayner View Post
Thanks Slugger, I will gve that a try. And I don't think an Oilers fan is in any position to give grief to a Leafs fan.
Hey now!! At least the Oilers tell you when they're rebuilding, they don't hide behind it. Besides, the Oilers provided me the thrill of being in Raleigh, NC for Game 7 of the 2006 Finals. What have Leafs done lately? This century? Last half of last century?? Should I go on?
__________________
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
  #898  
Old 08-25-2011, 08:45 AM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
How do I add an SJQ Action to a Manual recording? I see how to do it for a Favorite but how do I assign a task to occur when specific manual recording stops?
__________________
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
  #899  
Old 08-25-2011, 08:56 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by wayner View Post
How do I add an SJQ Action to a Manual recording? I see how to do it for a Favorite but how do I assign a task to occur when specific manual recording stops?
After you've scheduled the manual recording, go to your rec sched, select the manual recording then on the details menu there should be an option to "Assign SJQ Tasks". Once you click that, the rest should be familiar.
__________________
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
  #900  
Old 08-25-2011, 09:10 AM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
I don't see an Assign SJQ Tasks. I see SRE Options but I don't see anything for SJQ, either in the Detailed Options screen that comes up first, nor in the Record Options screen.

It looks like you have to set up the event when you create the recording as that gives you the option to record this show and assign to event. I was able to assign to an event by deleting the recording and then re-adding it and assigning to event.
__________________
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.