AddThis Social Bookmark Button

Listen Print Discuss

Digitizing VHS Tapes with EyeTV
Pages: 1, 2, 3

Notes on the Script

The majority of what the script does is to convert one way of talking about folders to another. EyeTV refers to the folders where the recordings are stored as a "unique ID" of a "program." This is a floating point number (like 1.28438934), which has to be translated into the hexadecimal equivalent to find the directory name that corresponds to it in the EyeTV archive (I did this the simple way by passing it to Perl and having it do the conversion in a simple one-line program):



tell application "EyeTV"
  set thePrograms to programs
  set theRepository to repository url as string
  repeat with theProgram in thePrograms
     set theUniqueID to unique ID of theProgram
    set theDirName to (do shell script "perl -e 'printf \"%016x\"," & theUniqueID & "'")
    set thePath to theRepository & theDirName
    set thePOSIXPath to (POSIX path of thePath)
    ...

At this point, I've got the POSIX path (like /Users/mcmahon/Library/EyeTV/000000007839af8) which will let me do the symbolic link later. I save this along with the program name, episode, etc., and then scan the EyeTV archive directory directly with the Finder, looking for the items that are folders (if we ran this program before, it's created symlinks which we want to skip). Now we scan the contents of each one of these directories, adding up the sizes of the files to see if we're still under the magic 4.34GB that will fit on a DVD created via the Finder.

Once we've got a DVD-full, we use chose from list to display the list of programs we're going to back up, and then use code like this to copy the files to the DVD:

tell application "Finder"
    activate
    open disk theDisk
end tell
    
repeat with i from 1 to length of theFolders
    set theFolder to item i of theFolders
    set sourceFolder to alias (theFolder & ":")
    set targetFolder to alias (theDisk & ":")
    
    tell application "Finder"
        with timeout of (10 * minutes) seconds
            duplicate folder sourceFolder to targetFolder replacing yes
        end timeout
    end tell
end repeat

Notice here that we have to talk about the folders as aliases. For safety, we then move the folders we just backed up to the Documents folder (talking about them as aliases again), and then do the work of actually setting up the symbolic links to the folders on the DVD:

-- the directory in the EyeTV Archive we're linking to the DVD 
set targetPOSIXPath to escapeSpaces(thePOSIXPath)
-- use the disk name and directory name to create the name of the file on the backup
set sourcePOSIXPath to "/Volumes/" & escapeSpaces(theDVD) & "/" & (theDirName)
-- Symlink the DVD directory into the archive
do shell script "ln -s " & sourcePOSIXPath & " " & targetPOSIXPath

Now we need to talk about them as files to the (Unix) shell, which means that the folder names can't contain any spaces; these confuse the shell into thinking that the filename ends at the space, which we don't want. The escapeSpaces subroutine makes sure that any spaces in the filename are escaped with a backslash (\) in front of them to keep the shell from getting confused.

I've simplified these excerpts for tutorial purposes; the actual program builds a big list of lists that contains all of the information from the EyeTV Archive and then spends most of the rest of the time filtering it and extracting data out of it.

Final Thoughts

This file archiving is a time-consuming process, and it will take some time to back up a large amount of video. But in the end, you've got backups of your recordings, with captioning intact, and disk space to record more.

Author's note: Elgato just released EyeTV 2.0. I haven't purchased this version yet, so the information in this article is verifiable for the previous version, EyeTV 1.8.4. But I don't see any reason why Elgato would change the archive structure for this update. If you have version 2 and can test these techniques, please post a comment with your outcome.

Joe McMahon is a test automation architect for Yahoo! Search. He has been working with Macs since the 512K got an 800K disk drive.


Return to the Mac DevCenter


  • Are DVDs the right media to archive with?
    2006-02-20 11:01:20  DaveLentz [Reply | View]

    I believe that you've provided the tools to use the best archival media we have at present -- an assemblage of hard drives (duplexed to redundant copies or RAID-5 or something that offers some protection against disk failure) -- but your iniital premise of moving from VCR to DVD is a path to disappointment.

    Sooner or later, the chemical dye based DVDs will break down, and the DVDs will become unreadable. While there is a lot of variance as to exactly how long you can count on a personally-burned DVD lasting (manufactured, or "stamped" DVDs should last a very long time, this pertains only to those DVDs that we can burn on our own PCs), I believe that no one would disagree that burned DVDs will fail a lot sooner than the VHS tapes would have.

    High density media (Blu-ray or HD-DVD) burned on a desktop system will likely be no better, as the burnable forms will also be dye-based, exactly like existing burnable DVDs, just with smaller dye-filled pits.

    Sadly (because a disc array is not as portable as one would like -- but small external discs or even large USB flash drives provide portability), this is not something that is likely to change in the forseeable future, as it is in the content distributors' interests as well as the device manufacturers' to keep burned media as a (slowly) volatile media.

    But DVDs will still be useful as small portable media -- just dont't count on them for indefinite storage.

    BTW -- I love my eyeTV 500! It was an excellent way to enter the realm of HDTV. And the disc drive industry should salute them as well. Stored mpeg-2 will carry that industry well into the 21st century.
    • Are DVDs the right media to archive with?
      2006-02-20 11:06:30  DaveLentz [Reply | View]

      Whoops -- I somehow misread the title as implying that the article was about moving VHS tapes to DVD.

      Nevermind my previous comments, as your fine article clearly covers the topic perfectly.
  • EyeTV 2, iEye Captain
    2006-02-17 08:06:47  GrahamAJones [Reply | View]

    Hi, thanks for your article. I too have found a number of "hacks" and ways of helping the EyeTV be more powerful than the existing software allows. I have bundled about 30 new features into my 'iEye Captain" shareware, which among other things allow you to have as many as 7 hard drives available for full active access by EyeTV 1 or 2 (many other things -- see http://www.vidcan.com/Software/iEyeCaptain.html ).

    Regarding EyeTV 2, the file structure does indeed change, and unfortunately breaks your applescript solution. You may want to check out my software (currently available for $20) rather than put the time into modifying your own script. It's possible, but a little bit of a headache, as EyeTV 2 is inconsistent in which parts of the archive it changes to the new format and which it leaves in the old format.


    Please feel free to contact me directly at info@vidcan.com for any EyeTV or iEye Captain-related questions.


    Thanks, Graham Jones.