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 03-06-2006, 12:12 PM
jominor's Avatar
jominor jominor is offline
Sage Expert
 
Join Date: Dec 2003
Posts: 573
Renaming Sage recordings through API

Does the Sage API offer a means to access the wizard.bin or does it have anything that can allow you to rename a physical file. For example, if I can compress a file to .avi, them have Sage point to the new file, but maintain the old information, that'll work.
Reply With Quote
  #2  
Old 03-06-2006, 02:14 PM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
What you need to do is:
  1. Set new file's timestamp to the start time + file duration (This is how sage calculates the file start time)
  2. Rename .mpg file to .old
  3. Find the MediaFile object for the Sage Recording
  4. Get the Airing Object for the MediaFile: air=GetMediaFileAiring(mf)
  5. Tell Sage that the file has been deleted: RemoveMediaFile(mf)
  6. Add the new .avi as a new media file: mf2=AddMediaFile("c:\\path\\to\\file","")
  7. Associate the old airing to the new media file: SetMediaFileAiring(mf2,air)
  8. The new file is now flagged as an archived file... you can unset this by calling: MoveTVFileOutOfLibrary(mf2)

If you have auto-edited the media file, you may want to create a new Airing that is the same duration as the edited media file, otherwise it may show up as a partial recording (but there were fixes relating to this in 4.1.7/8)

see the edit show info part of the webserver java code for other hints, but this is more complex because it creates a new Show and new Airing as well as renaming the media file.
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki

Last edited by nielm; 03-07-2006 at 05:38 AM.
Reply With Quote
  #3  
Old 03-06-2006, 02:36 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
It has been a long time since I played with something like this, but doesn't SageTV automatically recognize the files now, as long as you keep the ID number as part of the filename? If done while SageTV isn't running, it will change the file assignment when it restarts. If done while SageTV is running, 'delete' the recording entry for the mpg file (which isn't there any more because you already moved it elsewhere or deleted it) & SageTV will find the avi version. (But, it can be tricky doing that while it is still running; maybe nielm's steps would make that safer.)

See this post for someone else's comments.

- 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
  #4  
Old 03-06-2006, 02:42 PM
jominor's Avatar
jominor jominor is offline
Sage Expert
 
Join Date: Dec 2003
Posts: 573
Quote:
Originally Posted by nielm
What you need to do is:
Whew! Thanks and that is quite a mouthful. Jeff, would you add an API call to the Sage API that would allow third-parties to rename files. It seems that being able to do this would have benefits for both archival and standard sage recordings and would be a good first step towards some kind of implace compression.
Reply With Quote
  #5  
Old 03-07-2006, 05:46 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
The process Opus4 describes will trigger the same behaviour as mine behind-the-scenes...
When Sage scans the video dirs:
  1. it finds that a mediafile is missing
  2. it removes the mediafile object from the DB (same as step 3 above)
  3. It finds a new file with a filename in the standard format (showname-airingID-0.avi)
  4. It gets the airingID from the file name and finds it in the DB
  5. It adds the new media file to the DB scanning it for the duration, and working out the start time from the file timestamp-duration. (same as steps 6)
  6. It assigns the found airing info to it (same as steps 7-8)
So, the same thing really. The difference is that if done via the API, the changes are immediate, and you can be sure that the Airing info is correctly mapped, while using Sage's automatic system, there are occasions where the AiringID on the file does not match the AiringID in the DB, so the show info will not be found by sage and will be lost. (see the linked thread for why).
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
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 01:41 AM.


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