SageTV Community  

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

Notices

SageTV Customizations This forums is for discussing and sharing user-created modifications for the SageTV application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss customizations for SageTV version 6 and earlier, or for the SageTV3 UI.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-02-2005, 04:15 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
How-To: Un-archive a Sage Recording...

Warning: You do this at your own risk! This is hacking sage to do something which it may not be intended to do. Any loss of data is not my fault!


Setting a file 'Move to Library' makes a Sage Recording archived... This means that Sage should never delete it, but the Archived Sage Recordings list in Sage 2.0-2.2 is a simple list.

There is a import module to include archived shows in the normal Sage Recording List, but there is no offical method for un-archiving...

However, similar to the other how-to on associating a recompressed file with it's original DB metatdata, the 'media file recovery' feature of Sage can be used to un-archive a file.

(the Media File recovery feature occurs when the Sage server/service starts up, if it finds any unknown files in the Sage video directory, it tries to match the numeric suffix (-xxxxxxx-0.) to an internal Airing ID in the EPG. If it finds one, then it links the mediafile to the airing and uses the file duration and file timestamp to set the start/end time of the recording.

With this feature, you can rename the first part of the filename, or the extension of any Sage recording file while the sage server/service is shut down, and it will still be linked to the airing info in the EPG when Sage restarts.)



In most cases, simply renaming the file while Sage is shut down will un-archive the file, but the full sequence of steps below is the 'safest' way...
  1. If the file is segmented (multiple sections ending in xxxxxx-0.mpg, xxxxxxx-1.mpg etc), see Note 5 below before going any further...
    .
  2. Verify in the web-interface that the AringID in the MPG file name is the real Airing ID (In webserver 1.2+ the AiringID is at the bottom of the Detailed Info page. In webserver 1.1, it is in the address of the detailed info page found from a search for airings 'in the past': AiringID=xxxx)
    .
  3. make sure that an EPG update is not about to happen, or in progress (Setup/System information), and that nothing is currently being recorded (so you don't miss anything)
    .
  4. Check that the timestamp on the file approximatly equals the end time/date of the program (see notes 2+4 below)
    .
  5. Shut down the Sage server, or stop the service (net stop sagetv)
    .
  6. backup Wiz.bin (see note 3 below)
    .
  7. Rename the MPG file, so that the last part of the filename has the same airing ID in the filename suffix (xxxxxxx-0.avi) as the original MPG (or the corrected airing ID as found above). (make sure that you keep the original filename handy for reverting if things go wrong). The name change could simply be inserting an '_' in the first part of the file name.
    Code:
    D:\Sage> rename Show-episode-1234567-0.mpg Show-episode_unarch-1234567-0.mpg
  8. start Sage or Sage service (net start sagetv)
    .
  9. Check Sage Recordings, and start to playback the file to confirm that it is there and the timebar is correct.
    .
  10. If it is not OK, stop Sage or Sage service; restore backed up Wiz; Rename the MPG file to it's original filename and try to figure out what went wrong!
    .
  11. Any manual recording flags are cleared so if it is not a favorite, Sage sees it as an 'unwanted' recording after replacement. This puts it high on the list of things to delete, so it might be an idea to re-set the recording flag (CTRL-Y or 'record' remote button in the detailed information page, or when viewing the file) in Sage to prevent it from being from being automatically deleted.
Issues I have found:
  1. The Airing IDs may actually be different to the filename suffix. This is because when the IDs reach 999999999, Sage automatically 'compresses' the number range and re-assigns low range numbers to everything. The only way of checking the airing ID is looking at the detailed info for it in my webserver.
    .
  2. If the timestamp of the MPG file is changed, then the timebar will be messed up as Sage will think that this media file segment starts a different time to when the airing starts. The timestamp should be equal to the start time+file duration.
    .
  3. If the airing ID is not matched, and the show was not marked as watched or don't like, the information for this airing will be deleted from the DB, and the renamed file will show up in the library so a Wiz backup is important to restore the airing information.
    .
  4. I have Intelligent Recording on, so sage will never delete non-favorite, non-manual record or IR files unless it needs space. I cannot guarantee the behavior if IR is off, as Sage may decide that it is a partial or unwanted file and delete it.
    .
  5. If the file is segmented (multiple sections ending in xxxxxx-0.mpg, xxxxxxx-1.mpg etc), then use an MPEG2 merge tool to create a single MPG.
    You must now set the last modified timestamp on the generated AVI to the to the 'end time' of the program (normally same timestamp as the original MPG).

    There are several tools that can do this, I use the commandline tool touch from Cygwin or GnuWin32 Fileutils with a command line of touch -d 'MMM dd hh:mm', but there are also freeware Windows tools such as XTST

Good luck!
Niel
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki

Last edited by nielm; 05-02-2005 at 04:34 AM.
Reply With Quote
  #2  
Old 05-02-2005, 09:05 PM
aperry's Avatar
aperry aperry is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 680
Thanks, this is a really handy thing to know... I have not had need for it, but have just started "archiving" some shows, and this could be useful.
Reply With Quote
  #3  
Old 05-04-2005, 11:09 AM
DougTea's Avatar
DougTea DougTea is offline
Sage User
 
Join Date: Oct 2003
Location: Raleigh NC
Posts: 40
I'm really surprised Sage doesn't "tag" the mpg files similar to other programs... e.g. MusicMatch Jukebox where the song data (jpg too) is embedded into the file. Wouldn't this allow users to move files from one location to another while leaving the EPG data intact? Seems like it would be fairly simple to implement.

Just my $.02
Doug
Reply With Quote
  #4  
Old 05-04-2005, 11:34 AM
Jere_Jones's Avatar
Jere_Jones Jere_Jones is offline
Sage Fanatic
 
Join Date: Apr 2004
Location: Jacksonville, FL
Posts: 993
As one who has (by force) become intimately familiar with the inner workings of MPEGs, I can tell you that putting any additional information in them becomes problematical. There is a "user data" section, but this can be used by closed captions and would require rewriting at least part of the mpeg stream and at least partially decoding the stream to extract the information.

It's not a simple problem.

Jere
__________________
Death to commercials!!!
Latest ShowAnalyzer Beta version: 0.9.7
Reply With Quote
  #5  
Old 05-04-2005, 02:34 PM
DougTea's Avatar
DougTea DougTea is offline
Sage User
 
Join Date: Oct 2003
Location: Raleigh NC
Posts: 40
Jere,

Thanks for the information ..unfortunately I'm not familiar with the inner workings of mpegs so this explains a lot. Maybe an editable db using something like mysql would work.
I do feel it would be nice to have the ability to alter the mpegs, move and/or add your personal mpegs which could be read by Sage. I recently lost a gigs worth of recordings because I failed to backup my wiz.bin.

Doug
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 05:17 PM.


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