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
  #921  
Old 09-16-2011, 09:40 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by Rob View Post
I'm still getting the task run on recording start and recording stop. When I go to the screen to assign tasks to events, it always opens with recording start selected. If I change to recoding stop and close the screen, when I return it shows recoding start again. Is there a way to change this in a properties file instead of relying on the screen?
Events are encoded into the properties of the Sage objects, so you can modify them through the Sage properties, but there's no easy way to access them. When the screen comes up and starts on recording start, scroll down the right side of checkboxes and make sure nothing's checked for recording started then go to recording stop and make sure only the one checkbox is checked. Then go back. That should fix it.

Quote:
New question. For multi segment recordings, after looping through the segments and running video redo on each, is there a way to attach all the segments (files) to a single sage mediafile. In the API, I see the method for adding a new mediafile with a single java.io.file, but no method for adding it with an array of files or a method for adding segments to an existing media file. What am I missing here?
Though I've never tested it, I did bring this up with Jeff once upon a time and he said it was fixed in one of the 7.0 or 7.1 betas. The way it works, if my memory is correct, is that you simply add the first segment of the recording with the API call and the core will find the rest of them and attach them to the MediaFile object.
__________________
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
  #922  
Old 09-16-2011, 09:46 AM
Rob Rob is offline
Sage Expert
 
Join Date: Sep 2003
Posts: 568
Thanks Slugger.

I'll test out the multiple segments for a mediafile solution and post back with results.
Reply With Quote
  #923  
Old 09-16-2011, 10:46 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 Rob View Post
New question. For multi segment recordings, after looping through the segments and running video redo on each, is there a way to attach all the segments (files) to a single sage mediafile. In the API, I see the method for adding a new mediafile with a single java.io.file, but no method for adding it with an array of files or a method for adding segments to an existing media file. What am I missing here?
Why not just setup a videoRedo subtask to the cut script to join the segments to one file if it's multi-segment, and reassign the metadata to that file using the same logic?

Always meant to do that but haven't gotten around to it... but then I'm not having ANY multi-segment files these days, if you get it sorted would love to include it myself!
Reply With Quote
  #924  
Old 09-17-2011, 11:35 AM
Jason's Avatar
Jason Jason is offline
Sage Expert
 
Join Date: Nov 2003
Location: Texas
Posts: 598
I'm still struggling to understand the hows and whys of the scripting in regards to moving files.

If I were to take the base mv_media_file.groovy file and I wanted to move the specified file to a distinct sub-directory based on the Series Title, can I add this to the script, which would a) Grab the Series Title from the "Airing" metadata map, and b) tack on that Series Title as a sub-directory to the default 'dest' directory?

Code:
Object title = AiringAPI.GetAiringForID(SJQ4_METADATA.get("SJQ4_TITLE").toString())
File dest   = new File(SJQ4_ARGS[0]) + "\" + title;
Now as I understand things, the supplied argument in the UI must be a directory and it must also be an (SageTV) import directory for SageTV to keep track of the file, since there is no re-linking involved of the file in question... Is that correct?

In addition, is there a way to parse the Season from the filename and then make a specific subfolder for the Series>Season heirarchy?

I truly tried to get the gist of it all, but the scripting is killing me...

-Jason
__________________
True standalone tuner functionality with the --> HAVA Channel Changer<--
Reply With Quote
  #925  
Old 09-17-2011, 01:30 PM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
 
Join Date: Oct 2009
Location: NC
Posts: 1,389
Jason - here is some code you might want to look thru for ideas
you pass this the parent path that you desire as an argument

ie. \\path\to\parent\directory

Code:
import com.google.code.sagetvaddons.groovy.api.MediaFileHelpers ;
import org.apache.commons.io.FileUtils ;

String ParentPath = SJQ4_ARGS[0] 
String id   = SJQ4_METADATA.get("SJQ4_ID");
Object mf = MediaFileAPI.GetMediaFileForID(id.toInteger());

String FileName = SJQ4_METADATA.get("SJQ4_LAST_SEGMENT");
String FilePath = SJQ4_METADATA.get("SJQ4_PATH");
String ShowTitle=ShowAPI.GetShowTitle(mf);
String ShowSeasonDir ;
String OutputPath ;
int ShowSeasonNum=ShowAPI.GetShowSeasonNumber(mf);

println ( "Test Started");

if ( AiringAPI.IsNotManualOrFavorite(mf) ) {
    println("${FileName} is not a Favorite or Manual Recording - skipped")
    return 2
}
    
if( MediaFileHelpers.isBeingViewed(FileName) ) {
    println("${FileName} is being viewed; Return task to queue!")
    return 1
} 

if( MediaFileAPI.IsFileCurrentlyRecording(mf)) {
   println "${FileName} recording in progress, waiting..."
   return 1
}

if ( ShowSeasonNum == 0 ) {
     ShowSeasonDir = "" ;
} else {
     ShowSeasonDir = "\\Season " + ShowSeasonNum ;
}

if ( ShowAPI.GetShowCategory(mf).equals ("Movie") ) {
        println("This is a Movie ");
        OutputPath = ParentPath + "\\Movies" ;
} else {
        println("This is a TV show") ;
        OutputPath = ParentPath + "\\" + ShowTitle + ShowSeasonDir ; 
}

OutputPath = (OutputPath =~ /[?!*^&#$%@:;]/).replaceAll(" ") ;
println ("Modified OutputPath = ${OutputPath} ");
OutputFile = OutputPath + FileName;
File dest   = new File(OutputPath);

FileUtils.forceMkdir(dest);

Tools.setExeArgs("\"${OutputPath}\"")

println ("Would Start EXE with argument ${OutputPath}");

println ( "Test Ended");

return 0
Reply With Quote
  #926  
Old 09-17-2011, 05:30 PM
Jason's Avatar
Jason Jason is offline
Sage Expert
 
Join Date: Nov 2003
Location: Texas
Posts: 598
Quote:
Originally Posted by graywolf View Post
Jason - here is some code you might want to look thru for ideas
LOL... Thanks Graywolf... At this point, I am probably making this MUCH harder than it is...

I am coded/scripted/groovied/API'd out...

With all this power comes waaaaaay too much complexity in the scripting... at least in my current state.

I just want to move the recorded TV files to a different directory structure based on their Series and Season to use with XBMC. I still want to keep the files within Sage's control, so I need to relink them.

I cannot understand the variety of methods that folks have suggested and right now, I couldn't figure my way out of a wet paper bag if there were multiple holes in it!

Unless someone can basically give me the code/hand hold me to accomplish the above, until I can get my head around the scripting, I'm done.

-Jason
__________________
True standalone tuner functionality with the --> HAVA Channel Changer<--
Reply With Quote
  #927  
Old 09-17-2011, 08:41 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
A timely Groovy example: Premiere Alerts

Here's a little script I whipped up this morning that sends me an email each morning listing any new premieres for the current day. As the fall season kicks off, these emails will alert me to all new shows. Adjust the email settings as required - the settings shown are valid for Gmail (except I've masked the id/pwd for my account, of course). I've configured this script to run daily at 8am via the SJQv4 crontab so I get an email each morning with that day's premieres.

Currently, it includes movies, which I might filter out. Another nice enhancement might be to filter out shows that are already favourites (since I'm recording it anyways). I'm sure others could come up with a few other ideas to enhance this as well. Anyway, here's the script as it stands right now:

http://sagetv-addons.googlecode.com/..._alerts.groovy
__________________
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
  #928  
Old 09-19-2011, 06:29 AM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
 
Join Date: Oct 2009
Location: NC
Posts: 1,389
Quote:
Originally Posted by Jason View Post
LOL... Thanks Graywolf... At this point, I am probably making this MUCH harder than it is...

I am coded/scripted/groovied/API'd out...

With all this power comes waaaaaay too much complexity in the scripting... at least in my current state.

I just want to move the recorded TV files to a different directory structure based on their Series and Season to use with XBMC. I still want to keep the files within Sage's control, so I need to relink them.

I cannot understand the variety of methods that folks have suggested and right now, I couldn't figure my way out of a wet paper bag if there were multiple holes in it!

Unless someone can basically give me the code/hand hold me to accomplish the above, until I can get my head around the scripting, I'm done.

-Jason
Jason - I'm by no means an expert, but if you wanted, you could give mine a shot to see if they do what you want them to do. should put them in /base/directory/path/series/season #/episode_recording.mpg (or ts)

Got the test script, exe script, and screenshot of the task config
Attached Files
File Type: zip mvmedia.zip (43.2 KB, 135 views)

Last edited by graywolf; 09-19-2011 at 06:32 AM.
Reply With Quote
  #929  
Old 09-19-2011, 06:39 AM
gdippel gdippel is offline
Sage Aficionado
 
Join Date: Oct 2003
Location: Bayside, New York
Posts: 301
Quote:
Originally Posted by Slugger View Post
Here's a little script I whipped up this morning that sends me an email each morning listing any new premieres for the current day. As the fall season kicks off, these emails will alert me to all new shows. Adjust the email settings as required - the settings shown are valid for Gmail (except I've masked the id/pwd for my account, of course). I've configured this script to run daily at 8am via the SJQv4 crontab so I get an email each morning with that day's premieres.
I've tried running this script and apparently it doesn't like my smtp server's address. I've attached the screen shot of the log. Thanks
Attached Images
File Type: jpg Premiere Alert Log.jpg (102.6 KB, 134 views)
Reply With Quote
  #930  
Old 09-19-2011, 07:00 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by gdippel View Post
I've tried running this script and apparently it doesn't like my smtp server's address. I've attached the screen shot of the log. Thanks
Looks like you're missing the closing quote at the end of the smtp address.
__________________
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
  #931  
Old 09-19-2011, 08:36 AM
Jason's Avatar
Jason Jason is offline
Sage Expert
 
Join Date: Nov 2003
Location: Texas
Posts: 598
Quote:
Originally Posted by graywolf View Post
Jason - I'm by no means an expert, but if you wanted, you could give mine a shot to see if they do what you want them to do. should put them in /base/directory/path/series/season #/episode_recording.mpg (or ts)

Got the test script, exe script, and screenshot of the task config
OMG! Success! I cannot tell you how much I appreciate this!

I had to comment out a few portions to match my requisites, but so far, I tested it on an existing recording and... success!

Considering that I have it set for 'recording started', it should now move and re-link the file for all future recordings.

Is there a way to trigger a script on everything, since the cron does not gather any input? I reviewed the posts in the thread, but I did not find that specific answer...

Again... your help was so much appreciated, I cannot begin to thank you enough!

-Jason
__________________
True standalone tuner functionality with the --> HAVA Channel Changer<--
Reply With Quote
  #932  
Old 09-19-2011, 09:29 AM
Rob Rob is offline
Sage Expert
 
Join Date: Sep 2003
Posts: 568
Quote:
Originally Posted by Slugger View Post
Though I've never tested it, I did bring this up with Jeff once upon a time and he said it was fixed in one of the 7.0 or 7.1 betas. The way it works, if my memory is correct, is that you simply add the first segment of the recording with the API call and the core will find the rest of them and attach them to the MediaFile object.
I tried two scenarios, neither of which were successful. First I tried adding the first segment to a new mediafile object after all the segments for the recording had been created. Then I tried adding it after the frist segment was created, but before the subsequent segments were created.

I both scenarios, only the first segment is tied to the recording when it is presented in the sage GUI.

Does anyone have any other thoughts on how to do this. If not I'll try bikesquid's throught of using VideoRedo to combine the segments (although I am having trouble finding how to do this with the command line in video redo).
Reply With Quote
  #933  
Old 09-19-2011, 10:12 AM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
 
Join Date: Oct 2009
Location: NC
Posts: 1,389
Is there a means of getting the Channel Name and/or Number for the Priemeres script?
Reply With Quote
  #934  
Old 09-19-2011, 10:50 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by Rob View Post
I tried two scenarios, neither of which were successful. First I tried adding the first segment to a new mediafile object after all the segments for the recording had been created. Then I tried adding it after the frist segment was created, but before the subsequent segments were created.

I both scenarios, only the first segment is tied to the recording when it is presented in the sage GUI.

Does anyone have any other thoughts on how to do this. If not I'll try bikesquid's throught of using VideoRedo to combine the segments (although I am having trouble finding how to do this with the command line in video redo).
If it doesn't work as described, it'll never work since no new fixes are coming to the Sage 7 core. I assume you're running 7.1.9? Though I know it was "fixed" much earlier that that, it would be best to at least give it a shot with 7.1.9. If you are and it's not working then you're going to have to combine the segments and add a single file to the media object.

Did you do a media scan after adding the first segment? I think a media scan would be required for the core to find the rest of the segments and attach them. You definitely must have all segments present before doing the media scan and the segment file names must exactly match except for the ending -0 -1, -2, etc. before the file extension.
__________________
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
  #935  
Old 09-19-2011, 10:56 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by graywolf View Post
Is there a means of getting the Channel Name and/or Number for the Priemeres script?
Grab the latest from svn... I just committed the enhancement.
__________________
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
  #936  
Old 09-19-2011, 12:22 PM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
 
Join Date: Oct 2009
Location: NC
Posts: 1,389
Quote:
Originally Posted by Slugger View Post
Grab the latest from svn... I just committed the enhancement.
Wonderful. I also figured out how to limit to just PrimeTime. Should up the WAF some.

Code:
start >= midnight + 71900000 && start < midnight + 82800000
(72000000 if you want 8pm exactly)
Reply With Quote
  #937  
Old 09-19-2011, 12:38 PM
Rob Rob is offline
Sage Expert
 
Join Date: Sep 2003
Posts: 568
Quote:
Originally Posted by Slugger View Post
Did you do a media scan after adding the first segment? I think a media scan would be required for the core to find the rest of the segments and attach them. You definitely must have all segments present before doing the media scan and the segment file names must exactly match except for the ending -0 -1, -2, etc. before the file extension.
I am running 7.1.8. I did not specifically do a media scan, but gave it a an hour or so. I'll retest and do a specific media scan just to see.
Reply With Quote
  #938  
Old 09-19-2011, 01:09 PM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
 
Join Date: Oct 2009
Location: NC
Posts: 1,389
Quote:
Originally Posted by Slugger View Post
Grab the latest from svn... I just committed the enhancement.
Curious. Noticed that Castle (ABC) did not show up in the e-mail.
Reply With Quote
  #939  
Old 09-19-2011, 01:42 PM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by graywolf View Post
Curious. Noticed that Castle (ABC) did not show up in the e-mail.
Is it marked as "Season Premiere" or "Series Premiere" in the EPG?
__________________
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
  #940  
Old 09-19-2011, 01:53 PM
KarylFStein KarylFStein is offline
Sage Fanatic
 
Join Date: Apr 2006
Location: Westland, Michigan, USA
Posts: 999
Quote:
Originally Posted by graywolf View Post
Curious. Noticed that Castle (ABC) did not show up in the e-mail.
It does for me. I haven't upgraded to the latest version yet, but here's what I get:

Castle: Rise (EP010855880061)
Detective Beckett struggles to survive; Castle tries to identify the shooter; Ryan
and Esposito try to adjust to the new captain.

Nice idea, BTW! I have Top Chef as a favorite and remember one season they named it "Top Chef New York" or something and the favorite didn't pick that up. I'm betting this would give me warning about things like that. And my son's loving SRE now being a big Tiger's fan. I didn't upgrade it right away recently and he missed the end of one game. All's good now, though .
__________________
Home Network: https://karylstein.com/technology.html
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 4 (0 members and 4 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 03:38 AM.


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