SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-08-2006, 04:43 AM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Delete existing part of show

Scenario: I have watched a live show for a certain time, and at some point I want to delete the corresponding media file (which contains all contents from where I started watching up to now) so that when I start a manual recording on that show the recording will not include the prior part.

I tried the following code, but it doesn't work:

Code:
+- currfile = GetCurrentMediaFile()
  +- CloseAndWaitUntilClosed()
        +- DeleteFile(currfile)
            +- Watch(Airing)
                +- Record(Airing)
I even inserted a long Wait() after DeleteFile(), but the corresponding mpg does not get deleted.

Any ideas ?


Dirk
Reply With Quote
  #2  
Old 09-08-2006, 09:53 AM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
I'm just guessing... maybe it doesn't like to delete things that are currently airing, not just currently recording. Have you tried DeleteFileWithoutPrejudice()?

- Andy
__________________
SageTV Open Source v9 is available.
- Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1.
- Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus
- HD Extenders: A) FAQs B) URC MX-700 remote setup
Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request.
Reply With Quote
  #3  
Old 09-08-2006, 09:58 AM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Quote:
Originally Posted by Opus4
I'm just guessing... maybe it doesn't like to delete things that are currently airing, not just currently recording. Have you tried DeleteFileWithoutPrejudice()?

- Andy
Thanks Andy, I'll give this a shot tonight


Dirk
Reply With Quote
  #4  
Old 09-08-2006, 11:44 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
Also just guessing: maybe it is still recorded for a few seconds after playback is stopped...
Perhaps a small loop with IsFileCurrentlyRecording(currfile) (and a timeout) before the delete?
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #5  
Old 09-08-2006, 12:00 PM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Quote:
Originally Posted by nielm
Also just guessing: maybe it is still recorded for a few seconds after playback is stopped...
Perhaps a small loop with IsFileCurrentlyRecording(currfile) (and a timeout) before the delete?
I tried it with a fixed 'Wait(5000)', but I'll give your suggestion a try too ...

Thanks,
Dirk
Reply With Quote
  #6  
Old 09-08-2006, 03:52 PM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
Quote:
Originally Posted by flachbar
I tried it with a fixed 'Wait(5000)', but I'll give your suggestion a try too ...

Thanks,
Dirk
I tried with a fixed Wait(5000) myself last night with very similar code. I also tried several different things to delete the file file right away including "DeleteFileWithoutPrejudice" just couldn't find a way to get SageTV to delete the recording while it was still airing. If you get this working I would be interested in the solution.

BobP.
Reply With Quote
  #7  
Old 09-08-2006, 03:58 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Is this being attempted while still on the playback screen w/the video widget still active?

I can delete a partial recording for a live tv show I just watched, but I tried doing it while on another screen.

- Andy
__________________
SageTV Open Source v9 is available.
- Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1.
- Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus
- HD Extenders: A) FAQs B) URC MX-700 remote setup
Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request.
Reply With Quote
  #8  
Old 09-08-2006, 04:05 PM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Quote:
Originally Posted by Opus4
Is this being attempted while still on the playback screen w/the video widget still active?

I can delete a partial recording for a live tv show I just watched, but I tried doing it while on another screen.

- Andy
Yeah, this is called while still on the playback screen with video widget still active... The intended functionality makes this necessary ...

Dirk
Reply With Quote
  #9  
Old 09-08-2006, 04:06 PM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
Quote:
Originally Posted by Opus4
Is this being attempted while still on the playback screen w/the video widget still active?

I can delete a partial recording for a live tv show I just watched, but I tried doing it while on another screen.

- Andy
In my case it was anyway. I did a CloseAndWaitUntilClosed and got a black screen in the MediaPlayer OSD. I waited there for 5 seconds then did a DeleteFile and then I tried a DeleteFileWithoutPrejudice but the file was left on the system. Didn't try to display a different screen however.
Reply With Quote
  #10  
Old 09-08-2006, 04:41 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
I should have said this before, then, when I thought of it... if you are using a video widget instead of a video background for the menu widget (or switch to using a video widget), put a conditional on its display. When you close the file, turn off the conditional for the widget, refresh, wait a bit, then restart playback & reshow the video widget. You will definitely be inserting a delay from when the user chooses to do this, in case that is an issue for you.

I can't remember whether the v5.0 default STV does this kind of thing on the OSD playback screen, but you could see if it does for an example.

Of course, it is still possible that this won't help you at all & nielm's guess works better. You may want to try jumping to another menu first to see if the delete will work then, before adding a conditional to the video widget display.

- Andy
__________________
SageTV Open Source v9 is available.
- Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1.
- Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus
- HD Extenders: A) FAQs B) URC MX-700 remote setup
Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request.
Reply With Quote
  #11  
Old 09-08-2006, 05:01 PM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
Quote:
Originally Posted by Opus4
You may want to try jumping to another menu first to see if the delete will work then, before adding a conditional to the video widget display.

- Andy
I just tried the following and it appears to work:
Code:
Drop Prior Video - item widget in popup menu when Record is pressed - DefaultSTV
+CloseOptionsMenu()
 +CloseAndWaitUntilClosed() 
  +MF=GetMediaFileForAiring(Airing)
   +AddStaticContext("MF", MF)
    +AddStaticContext("Airing", Airing)
     +MediaPlayerDummy - link to another menu

MediaPlayerDummy
+BeforeMenuLoad
 +DeleteFileWithoutPrejudice(MF)
  +Wait(5000)
   +Watch(Airing)
    +MediaPlayer OSD - link to menu
But I think I like your other idea better or just waiting until IsFileCurrentlyRecording is false. Will have to try them next.

BobP.
Reply With Quote
  #12  
Old 09-08-2006, 05:14 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by Opus4
You will definitely be inserting a delay from when the user chooses to do this, in case that is an issue for you.
Seems to me this is pretty much a show-stopper (so to speak) for this sort of implementation. The people asking for this feature probably aren't going to be happy if the screen goes blank for several seconds while it deletes one recording file and starts another.

It it were me, I'd probably code it so that the Start Clip and Stop Clip commands (however you invoke them) would simply make a note of the time marks in the currently recording media file. The user could specify as many clips as they like in a given program without interrupting playback. This would work on pre-recorded programs as well as Live TV. The code could also be clever about backing up the start-clip time mark a few seconds to allow for slow reflexes.

Then, after the program is over and the file is closed, run a VideoRedo script or something like that to pull out the clips into separate files. That way you can have your cake and eat it, by keeping a full, intact recording of the entire program (if that's what you want) in addition to the specified clips. Seems like a better implementation design than taking the "start record" and "stop record" commands too literally.

Just my $0.02.
__________________
-- Greg
Reply With Quote
  #13  
Old 09-08-2006, 05:21 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Quote:
Originally Posted by GKusnick
It it were me, I'd probably code it so that the Start Clip and Stop Clip commands (however you invoke them) would simply make a note of the time marks in the currently recording media file.
Funny... I had just decided to walk back into my office to suggest pretty much the same thing -- perhaps you should just focus on marking the start & stop times for now & worry about chopping out what you want later on. It probably wouldn't be as transparent a feature as what some people want, but the resulting clip would be cleaner.

- Andy
__________________
SageTV Open Source v9 is available.
- Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1.
- Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus
- HD Extenders: A) FAQs B) URC MX-700 remote setup
Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request.
Reply With Quote
  #14  
Old 09-08-2006, 05:26 PM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
Quote:
Originally Posted by GKusnick
Seems to me this is pretty much a show-stopper (so to speak) for this sort of implementation. The people asking for this feature probably aren't going to be happy if the screen goes blank for several seconds while it deletes one recording file and starts another.
Correct. At this point this is just a "I want to see if I can do it" type of thing for me. Your idea is much more practical and was another thought I had about improving the comskip import. Adjust the ComSkip file from inside SageTV to refine the commercial breaks while you watch the video.

BobP.
Reply With Quote
  #15  
Old 09-08-2006, 06:47 PM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Quote:
Originally Posted by BobPhoenix
Correct. At this point this is just a "I want to see if I can do it" type of thing for me. Your idea is much more practical and was another thought I had about improving the comskip import. Adjust the ComSkip file from inside SageTV to refine the commercial breaks while you watch the video.

BobP.
Based on an idea from MeInMaui, I now have it working by doing a channel change first, then closing the MediaPlayer, deleting the file, and changing back to record the show. It takes about 4-5 seconds from option selection to recording, but at least it remains in the OSD menu, and isn't really too bad.

Of course, if someone finds a better way, please share ...

Dirk
Reply With Quote
  #16  
Old 09-08-2006, 07:10 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Quote:
Originally Posted by flachbar
Based on an idea from MeInMaui, I now have it working by doing a channel change first, then closing the MediaPlayer, deleting the file, and changing back to record the show. It takes about 4-5 seconds from option selection to recording, but at least it remains in the OSD menu, and isn't really too bad.

Of course, if someone finds a better way, please share ...
I think it will be faster if you hide the video widget temporarily or even jump to another menu & then use SageCommand("Back") after restarting playback. You could display some sort of "please wait" message instead of the video widget or while in the other menu while no video is showing. You won't create extra bits of recordings & won't get all the questions about why it is changing channels.

To prevent the user frmo using Forward & getting stuck on the temp menu, if you use that, just have it leave that menu automatically if the BeforeMenuLoad hook says it is being reloaded.

- Andy
__________________
SageTV Open Source v9 is available.
- Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1.
- Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus
- HD Extenders: A) FAQs B) URC MX-700 remote setup
Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request.
Reply With Quote
  #17  
Old 09-08-2006, 07:52 PM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Quote:
Originally Posted by Opus4
I think it will be faster if you hide the video widget temporarily or even jump to another menu & then use SageCommand("Back") after restarting playback.

- Andy
Using this method (hiding the video widget) I still cant get under 4 seconds, but you are right it is much cleaner than the channel change ...

Thanks for the input !


Dirk
Reply With Quote
  #18  
Old 09-08-2006, 08:23 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
If anybody cares, here's some sample code for calling VideoRedo from Java:

Code:
public void ExtractClip(Object mf, long start, long stop, java.io.File fileOut)
  throws java.lang.reflect.InvocationTargetException, java.io.IOException
    {
    java.io.File fileIn = (java.io.File)sage.SageTV.api("GetFileForSegment", new Object[]{
        mf,     // MediaFile
        0       // Segment
        });
    
    java.io.File fileScript = java.io.File.createTempFile("VRD", ".vbs");
    java.io.PrintWriter script = new java.io.PrintWriter(new java.io.FileWriter(fileScript));
    script.println("Dim vrd : Set vrd = CreateObject(\"VideoReDo.Application\")");
    script.println("Call vrd.FileOpen(\"" + fileIn.getAbsolutePath() + "\")");
    script.println("Call vrd.SetCutMode(False)");
    script.println("Call vrd.SelectScene(" + Long.toString(start) + ", " + Long.toString(stop) + ")");
    script.println("Call vrd.FileSaveAs(\"" + fileOut.getAbsolutePath() + "\")");
    script.println("Do While (vrd.IsOutputInProgress())");
    script.println("    Call WScript.Sleep(100)");
    script.println("Loop");
    script.println("Call vrd.Close()");
    script.close();
    
    sage.SageTV.api("ExecuteProcess", new Object[]{
      "wscript.exe",                    // CommandString 
      fileScript.getAbsolutePath(),     // Arguments 
      null,                             // WorkingDirectory
      false                             // ConsoleApp
      });
    }
I have tested this and it does work.

A more high-tech approach would be to write a Jacob wrapper to expose the VideoRedo API directly in Java. But for this quick hack I'm using VBScript as a poor man's COM wrapper and calling it by way of Windows' built-in script host. (JScript would also work, for you Java purists, but then you'd have to escape the backslashes in the filename strings.)

Obviously a freeware editing tool would be better for this purpose than VideoRedo, but VideoRedo is what I have, and I haven't done a lot of research into freeware alternatives, so I thought I'd throw this out there as a proof-of-concept.
__________________
-- Greg
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


All times are GMT -6. The time now is 06:35 PM.


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