|
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. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
Question about replacing a SageTV recording
I am writeing a plugin that will need to replace an original recording in a SageTV recording directory with one that has been edited with VideoReDo. I have code in place to change the modifed date and time:
Code:
DateTime=java_io_File_lastModified(FilePath) java_io_File_setLastModified(OutputFile, DateTime) I have tried several ways to copy the new file back to the SageTV server and get the new file to show up the way I want. I've tried leaving the SageTV Service mode running and also with the Service and GUI completely shut down. Here's the problem. I copy it to the Server then rename the existing file to .old and rename the new file by removing the .new (file names are AmazingEarth-9024239-0.mpg.new and AmazingEarth-9024239-0.mpg) so the names match what Sage is expecting when done. I've also tried kicking off an EPG update and an imported files refresh but that hasn't worked either. I even tried adding a vrd to the file name ahead of the Sage id (mazingEarth-vrd-9024239-0.mpg). Sage appears to recognize the diference in the files just fine as the size is listed in detailed setup correctly (2.17Gb instead of 3.41Gb). The problem is I expected to see red in the OSD to show that some of the show was missing or the time line on the OSD display to be less then an hour and I don't. In addition the edited file starts playback 2 minutes into the file because of the start padding I put on the recording on the original file. Which is what the problem really is. Anybody using this would miss however much of the file due to the padding. Is this how something like this is suppose to work or do I need to modify another file attribute like create time or maybe change the extension to get Sage to recogize that part of the recording is missing? What I hoped was that with the same ending time I would just see red in the OSD for the begining of the file for the amount of time cut from the file. Would this have worked if instead of doing it manually I had let my code copy the file to the appropriate directory? This is the first time I've tried this so your help would be appreciated. This is with 6.0.15 so this could just be new with the beta I suppose. Also I posted this here because ultimately whatever I need to do would need to be done in studio and/or java even though I did all my testing manually. Thanks. BobP. |
#2
|
||||
|
||||
GetSize(MediaFile) just reads the file size from the disk, so it is no surprise that it gets updated.
I went through this a lot when creating the webserver's edit file info... Sage only rescans a media file for duration when the file is seen as a new file, so you need to convince Sage that the old file is gone, and to find the new file. AddMediaFile() tells sage about new media files without the need for any library rescan Sage will only reassociate a file with an Airing when that Airing does not have any old files (so you need to delete the old file from the DB) File Start time is calculated as file timestamp - file duration, so you need to set the modified time to: AIRING START TIME + NEW FILE DURATION (don't worry about create time) So what you need to do is:
That should be it... The file should now start at offset=0, and there should be a bunch of red at the end of the timebar corresponding to the missing edited commercials. If at step 3, you do not know in advance what the new file duration will be, then rename the new to temp_dnjlafdaj.mpg (or similar), add the file to Sage with tempfile=AddMediaFile(), get the tempfile duration, rename the file back to it's old name, then Delete(tempfile) Things to check: in older versions of sage, when a file was much shorter than the Airing duration, it was considered to be a partial recording. I think in the newer (5.0 or later) versions any file added with AddMediaFile() is automatically considered to be complete. Check this with a very edited file Error check after every step: A couple of obvious failures are: If the media file is in use (playing by a client), you will not be able to rename or delete it. If the edited file is not be readable by Sage, AddMediaFile will fails, (and so you will need to rename the _old back and re-add it to the DB to prevent the Airing from being cleaned up) Good luck!!!
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki |
#3
|
|||
|
|||
Thanks. I was afraid it was going to have to be something this complicated. Thanks for the detailed instructions too!!!
BobP. |
#4
|
|||
|
|||
Quote:
Code:
Thu 12/14 20:12:24.370 Added:Wasted[id=9563084 Airing=A[9024239,9024222,"Amazing Earth",16616@1020.13:00,60]] Thu 12/14 20:12:24.397 Carny got a Wasted job of A[9024239,9024222,"Amazing Earth",16616@1020.13:00,60] Thu 12/14 20:12:24.401 Deleted media segment file \\SageTVSrv\VideoSrv$\Video\AmazingEarth-9024239-0.mpg dtime=30 len=0 Thu 12/14 20:12:24.404 Added:Agent[Trend=TitleReRunsTrend, Title=Amazing Earth id=9563085 watchProb=0.0 createTime=Thu 12/14 20:12:24.400] Thu 12/14 20:12:24.517 Added:MediaFile[id=9563086 A[9563090,9563087,"VideoAmazingEarth-9024239-0",0@1231.17:59,19435812] host=sagetvsrv encodedBy= format=null \\SageTVSrv\VideoSrv$\Video\AmazingEarth-9024239-0.mpg_new, Seg0[Wed 12/31 17:59:59.999-Wed 12/31 18:00:00.000]] . . . Thu 12/14 20:16:56.662 Checking video directories for new files Thu 12/14 20:16:56.738 Swapping MediaFile's file to be \\SageTVSrv\VideoSrv$\Video\AmazingEarth-9024239-0.mpg from MediaFile[id=9563086 A[9024239,9024222,"Amazing Earth",16616@1020.13:00,60] host=sagetvsrv encodedBy= format=null \\SageTVSrv\VideoSrv$\Video\AmazingEarth-9024239-0.mpg_new, Seg0[Wed 12/31 17:59:59.999-Wed 12/31 18:00:00.000]] Thu 12/14 20:16:58.280 File Format Parsed-2 \\SageTVSrv\VideoSrv$\Video\AmazingEarth-9024239-0.mpg=MPEG2-PS 0:41:59 0 kbps [#0 Video[MPEG2-Video 29.97003 fps 720x480 4:3 interlaced]#1 Audio[MP2 48000 Hz 2 channels 384 kbps MAIN idx=1 id=c0]] BobP. Edit: Figured it out. It's amazing what typo'ing a variable name will cause. Last edited by BobPhoenix; 12-15-2006 at 09:22 PM. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|