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
  #821  
Old 06-04-2011, 12:31 PM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
 
Join Date: Oct 2009
Location: NC
Posts: 1,389
Try to learn this groovy but coming from 0 prior experience so a lot of trial/error adn guess work from other examples. Coming hard.

Wanting to have a test script to check if MF is currently being watched.
Found where MediaHelpers isBeingWatched would get me the value but no matter the umpteen different variations of trying to get that value, still getting errors.

Below is just 1 of my attempts. Will continue trial/error or someone helps show me the way out of this wilderness

Code:
/*
   Pretest if MediaFile is currently being Watched 
*/

String fileName = SJQ4_METADATA.get("SJQ4_LAST_SEGMENT");
boolean Watching = MediaFileHelpers.isBeingViewed(fileName);

if(Watching) {
	println("Is Being Viewed; return task to queue!")
	return 2 
} else {
        println("Is not being Viewed: executing the task now")
}

return 2
Reply With Quote
  #822  
Old 06-04-2011, 01:18 PM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
 
Join Date: Oct 2009
Location: NC
Posts: 1,389
ok...got past the errors but not getting correct results
import of the MediaHelpers resolved the errors

Code:
/*
   Pretest if MediaFile is currently being Watched 
*/
import com.google.code.sagetvaddons.groovy.api.MediaFileHelpers

String fileName = SJQ4_METADATA.get("SJQ4_LAST_SEGMENT");

if( MediaFileHelpers.isBeingViewed(fileName) ) {
	println(" is being viewed; Return task to queue!")
	return 1 
} else {
        println(" is not being viewed: executing the task now")
}

return 2
ok. on an HD200, I Watch Now a recording.
on an HD300, I assign the task to that same show. The test gives me " is not being viewed: executing the task now" instead of the expected " is being viewed; Return task to queue!" <sigh>

Reply With Quote
  #823  
Old 06-04-2011, 02:28 PM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
 
Join Date: Oct 2009
Location: NC
Posts: 1,389


Got it to work. Boy this is going to be a bit more of a learning curve than V3 was. But eventually will get it I guess.

Code:
/*
   Pretest if MediaFile is currently being Watched 
*/
import com.google.code.sagetvaddons.groovy.api.MediaFileHelpers

String id   = SJQ4_METADATA.get("SJQ4_ID");
String fileName = SJQ4_METADATA.get("SJQ4_LAST_SEGMENT");
Object mediaFile = MediaFileAPI.GetMediaFileForID(id.toInteger());

println( MediaFileHelpers.isBeingViewed(mediaFile) );
println( fileName ) ;

return 2
Reply With Quote
  #824  
Old 06-04-2011, 04:30 PM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
 
Join Date: Oct 2009
Location: NC
Posts: 1,389
ok...next question and I haven't found the docs on the Class yet.

Code:
    ServerClient sc = new ServerClient();
    sc.scheduleMediaScan();
Is there a way to wait until the scheduleMediaScan completes?
Or is there a way to have a Task kick off when a scheduleMediaScan completes?

Also, where is the javadocs for Tools class?
Code:
Tools.setTaskResources
Tools.setExeArgs

Last edited by graywolf; 06-04-2011 at 04:41 PM.
Reply With Quote
  #825  
Old 06-05-2011, 07:44 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by graywolf View Post
ok...next question and I haven't found the docs on the Class yet.

Code:
    ServerClient sc = new ServerClient();
    sc.scheduleMediaScan();
Is there a way to wait until the scheduleMediaScan completes?
No, this call is asynchronous. This method is there to prevent multiple media scans from being triggered at once. Let's say you were writing a script that moved a recording and then you needed to scan to have the core find the new location. Well if you were moving 15 recordings at once you wouldn't want to trigger 15 separate media scan threads on your system. This method schedules a scan for 20 mins from the first time it's called. Any other calls to this method within that 20 mins are ignored and so in the end you get just one media scan. It's a resource saver on your system.

Quote:
Or is there a way to have a Task kick off when a scheduleMediaScan completes?
Not with the above method, but you can use the Sage API call directly:

Code:
Global.RunLibraryImportScan(true)
That call, with true as the argument, will run a media scan immediately and wait until it's done.

Quote:
Also, where is the javadocs for Tools class?
Code:
Tools.setTaskResources
Tools.setExeArgs
They are here (the link is also referenced in the SJQv4 user's guide).
__________________
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
  #826  
Old 06-05-2011, 08:30 AM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
 
Join Date: Oct 2009
Location: NC
Posts: 1,389
Excellent. Got a logical flow of how the mods I want for the mv_media, just need to figure out the rest.

Just need to figure out how to get the new ID for the moved show once the Scan completes for post-move processing. I'm assuming the SJQ4 metadata values would no longer be valid after the move/scan.

Well I'm starting to understand a little about the javadocs and how to read them...at least I hope so.
Reply With Quote
  #827  
Old 06-05-2011, 08:38 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by graywolf View Post
Excellent. Got a logical flow of how the mods I want for the mv_media, just need to figure out the rest.

Just need to figure out how to get the new ID for the moved show once the Scan completes for post-move processing. I'm assuming the SJQ4 metadata values would no longer be valid after the move/scan.

Well I'm starting to understand a little about the javadocs and how to read them...at least I hope so.
If you are calling Global.RunLibraryImportScan(true) and waiting for it to return then you can get the new media file object by calling:

MediaFileAPI.GetMediaFileForFilePath()

Just create a new File object representing the new path of the moved file and pass that to the above method. It will return the new media file object. This only works if you wait until the media scan is complete.
__________________
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
  #828  
Old 06-05-2011, 08:43 AM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
 
Join Date: Oct 2009
Location: NC
Posts: 1,389
wonderful wonderful wonderful...you have helped save my blurry eyes.

that is exactly my intention.

Reply With Quote
  #829  
Old 06-06-2011, 03:12 PM
kmp14 kmp14 is offline
Sage Aficionado
 
Join Date: May 2008
Location: Chicago, IL
Posts: 264
New thread to share SJQv4 Ideas and code

I created a new thread, separate from this one, for sharing SJQv4 ideas and code. This thread rocks, but is more nuts and bolts. I am hoping my new thread will be for sharing ideas for SJQv4. Hopefully it takes off!

http://forums.sagetv.com/forums/showthread.php?p=501009
__________________
HP m9040n Quad Core 2.4Ghz, Windows7 Ultimate, Ceton 4 tuner CableCard with SageDCT, 2 HDHomeRun QAM, Netgear 24 Port GiGE Switch, Linksys WRT600N Router, 3 HD200 Extenders, 2 SageTV Clients

Server: SageTV 7
Reply With Quote
  #830  
Old 06-09-2011, 07:31 AM
ptzink ptzink is offline
Sage Aficionado
 
Join Date: Mar 2008
Posts: 300
Can't Access SJQ Through Web Apps

I am having an issue and am looking for some help. Some time ago I installed SJQ and played around a bit before uninstalling. Recently (yesterday), I decided to purchase a license for Slugger's plugins and want to give SJQ another spin. After installing the plugin from the Sage plugin manager, I went to web apps to begin to configure it. I see an app called "sjq" with version # 4.0.0.1426 and when I click on it, it gives me a "HTTP ERROR: 503 Problem accessing /sjq/. Reason: SERVICE_UNAVAILABLE" error. I tried restarting Sage and that did not fix it. I tried uninstalling and reinstalling SJQ and I still get the same results. When I click on "Configure Plugin" from the GUI, it tells me that the plugin is "Licensed". Anyone have any idea on what is going on here or how to fix it? Thanks.
__________________
Server: SageTV Media Center 7.1.19, Windows 7 Home Premium x64, Pentium Core2Duo, 4GB RAM, (1) Hauppauge HVR-2250, (1) Hauppauge HVR-1600, 1.5 TB of recording space
Android MiniClient: Nvidia Shield TV (16GB) HDMI out to Samsung LN46C630 46" LCD
Extender: STP-HD300, beta firmware "20110506-0", HDMI out to LG 37LD450 37" LCD
Reply With Quote
  #831  
Old 06-09-2011, 07:38 AM
razrsharpe razrsharpe is offline
Sage Icon
 
Join Date: Sep 2008
Location: Boston, MA
Posts: 2,111
Quote:
Originally Posted by ptzink View Post
I am having an issue and am looking for some help. Some time ago I installed SJQ and played around a bit before uninstalling. Recently (yesterday), I decided to purchase a license for Slugger's plugins and want to give SJQ another spin. After installing the plugin from the Sage plugin manager, I went to web apps to begin to configure it. I see an app called "sjq" with version # 4.0.0.1426 and when I click on it, it gives me a "HTTP ERROR: 503 Problem accessing /sjq/. Reason: SERVICE_UNAVAILABLE" error. I tried restarting Sage and that did not fix it. I tried uninstalling and reinstalling SJQ and I still get the same results. When I click on "Configure Plugin" from the GUI, it tells me that the plugin is "Licensed". Anyone have any idea on what is going on here or how to fix it? Thanks.
sjq4v does not have a web component. There is an UI Mod plugin that you do the configuration from. See sluggers response to a similar question last week for more info
__________________
Server 2003 r2 32bit, SageTV9 (finally!)
2x Dual HDHR (OTA), 1x HD-PVR (Comcast), 1x HDHR-3CC via SageDCT (Comcast)
2x HD300, 1x SageClient (Win10 Test/Development)
Check out TVExplorer
Reply With Quote
  #832  
Old 06-09-2011, 07:45 AM
ptzink ptzink is offline
Sage Aficionado
 
Join Date: Mar 2008
Posts: 300
Quote:
Originally Posted by razrsharpe View Post
sjq4v does not have a web component. There is an UI Mod plugin that you do the configuration from. See sluggers response to a similar question last week for more info
Thanks for the prompt response. I had a feeling this was addressed somewhere, but this is a rather daunting thread (although I have seen much worse). I will head over to the wiki and start reading. Thanks again.
__________________
Server: SageTV Media Center 7.1.19, Windows 7 Home Premium x64, Pentium Core2Duo, 4GB RAM, (1) Hauppauge HVR-2250, (1) Hauppauge HVR-1600, 1.5 TB of recording space
Android MiniClient: Nvidia Shield TV (16GB) HDMI out to Samsung LN46C630 46" LCD
Extender: STP-HD300, beta firmware "20110506-0", HDMI out to LG 37LD450 37" LCD
Reply With Quote
  #833  
Old 06-11-2011, 10:03 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Updated task client and SageGroovy builds available

Updated task client and SageGroovy builds are now available. This update simply updates the upstream jars used in these apps. Of significance, is the update to the gtools jar. This update adds many new extender device features that you can use from your Groovy scripts. Namely, there are now methods available to power on, power off, reboot and query the status of extender devices. These features were tested on HD100 and HD200 devices. I don't have HD300s nor MediaMVPs to test against. Rumour has it, the HD300s should work fine and the MediaMVPs probably not so much.

If someone needs/wants support for MediaMVP devices, they simply have to provide me telnet access to the device for an hour or two so I can test and tweak the code. Same for HD300 support, if it doesn't work.

A quick example of what you can now do in Groovy with this update:

Code:
import com.google.code.sagetvaddons.groovy.api.GlobalHelpers

println GlobalHelpers.powerOnExtenderHost('192.168.0.30')
Output:
Code:
true
That simple script will power on the extender device at the given IP address. There are various methods to power on, power off, reboot, and query the status of extender devices by IP/hostname or MAC address. There are also methods to help pinpoint the exact type of an extender device (MediaMVP, HD100, HD200, or HD300) with methods like GlobalHelpers.isMacAddrHD200(). There are caveats with all of these methods and those details are in the javadocs and should be read closely by all users prior to use otherwise you may be scratching your head when you don't get expected results.

Happy scripting!

EDIT: In case I haven't mentioned this before, the gtools.jar file can be used in Java code as well, since I compile that library to byte code. To use gtools.jar in Java, you simply include the jar on your classpath along with the groovy-all-1.7.10.jar plus the other dependencies my library code uses (sagex-api, commons-net, commons-lang). This library provides a lot of nice convenience methods, though if writing pure Java, the dependency on Groovy might be a little heavy for some devs (but well worth it if you like the convenience).
__________________
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; 06-11-2011 at 10:15 AM.
Reply With Quote
  #834  
Old 06-11-2011, 10:42 AM
toricred's Avatar
toricred toricred is offline
Sage Icon
 
Join Date: Jan 2006
Location: Northern New Mexico
Posts: 1,729
Have you issued the new licenses yet?
Reply With Quote
  #835  
Old 06-11-2011, 11:16 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by toricred View Post
Have you issued the new licenses yet?
Not yet.
__________________
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
  #836  
Old 06-11-2011, 11:25 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by Slugger View Post
If someone needs/wants support for MediaMVP devices, they simply have to provide me telnet access to the device for an hour or two so I can test and tweak the code. Same for HD300 support, if it doesn't work.
Slugger,

I've got an MVP and an HD300. Let me know if you want to test against them and I'll set it up for you. (Can't be today, I'm about the leave the house.)

Tom
__________________

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
  #837  
Old 06-11-2011, 11:29 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by tmiranda View Post
Slugger,

I've got an MVP and an HD300. Let me know if you want to test against them and I'll set it up for you. (Can't be today, I'm about the leave the house.)

Tom
Yeah, I'll email you some evening this week. I'm pretty sure the HD300 will work with zero code changes. The MVPs will need some tweaking, I'm sure.
__________________
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
  #838  
Old 06-12-2011, 09:16 AM
kmp14 kmp14 is offline
Sage Aficionado
 
Join Date: May 2008
Location: Chicago, IL
Posts: 264
Help! Can't delete or modify a client

I am not able to delete or modify a client. I have changed the IP address of the client in question (made it static), but I can't update it in SageTV. If I try to delete it, the GUI (on the server) hangs when I click yes to the delete it prompt.

If I try to modify it and enter the new ip address, after making the change in the pop up, and then trying to commit the changes, I get this error "Internal Error Creating new AgentClientClient"

On a possibly related side note, I am not able to SRE overrides in the GUI either, and get an error when I do that too. Something is awry in my Slugger world of awesome plugs.

I checked the logs, and dont see any errors in the logs.
__________________
HP m9040n Quad Core 2.4Ghz, Windows7 Ultimate, Ceton 4 tuner CableCard with SageDCT, 2 HDHomeRun QAM, Netgear 24 Port GiGE Switch, Linksys WRT600N Router, 3 HD200 Extenders, 2 SageTV Clients

Server: SageTV 7
Reply With Quote
  #839  
Old 06-12-2011, 10:52 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by kmp14 View Post
I am not able to delete or modify a client. I have changed the IP address of the client in question (made it static), but I can't update it in SageTV. If I try to delete it, the GUI (on the server) hangs when I click yes to the delete it prompt.

If I try to modify it and enter the new ip address, after making the change in the pop up, and then trying to commit the changes, I get this error "Internal Error Creating new AgentClientClient"
Check your sagetv_0.txt log file for errors. This sounds like errors with the STVi. Get the log file and open a ticket for Tom to look at (he handles all things STVi).

An alternative would be to directly edit the database to make these changes. If you're unsure what you're editing in there, then stop and ask otherwise you'll foobar the SJQv4 db, but it's pretty straightforward. You'll want to edit the client table when you get in there.

Quote:
On a possibly related side note, I am not able to SRE overrides in the GUI either, and get an error when I do that too. Something is awry in my Slugger world of awesome plugs.

I checked the logs, and dont see any errors in the logs.
Same thing here. Get the log file and check for errors, open ticket for Tom's review. In the meantime, you should be able to create/edit overrides via the web UI for SRE. If the web UI isn't working, then that's my department.
__________________
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
  #840  
Old 06-13-2011, 07:48 AM
kmp14 kmp14 is offline
Sage Aficionado
 
Join Date: May 2008
Location: Chicago, IL
Posts: 264
Quote:
Originally Posted by Slugger View Post
If the web UI isn't working, then that's my department.
The Web UI for SRE works fine, so I will follow up with Tom for the SRE and SJQ issues.

I was finally able to delete and re-add my client (not sure why, but a reboot did the trick!), which I did before I saw your post, but thanks for the "Edit DB" trick.
__________________
HP m9040n Quad Core 2.4Ghz, Windows7 Ultimate, Ceton 4 tuner CableCard with SageDCT, 2 HDHomeRun QAM, Netgear 24 Port GiGE Switch, Linksys WRT600N Router, 3 HD200 Extenders, 2 SageTV Clients

Server: SageTV 7
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:11 PM.


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