Tuesday, September 21, 2021

#1 2006-11-19 03:24:25 am

kiwilegal
Member
From:: France
Registered: 2006-01-20
Posts: 350

EyeTV Script for automatic export and delete recordings

Hi there

Hoping someone can help me with a query.  I have just done a very short script which exports all EyeTV recordings in MPEG4 format then deletes the original recordings freeing up space.  I want to run the script at a set time each day and so it needs to work without user input.  The script is as follows:

Applescript:


tell application "EyeTV"
   set myCounter to 0
   set bbTest to false
   set cntr to number of items in recordings
   repeat until myCounter is equal to cntr
       set myCounter to myCounter + 1
       export from item myCounter of recordings to alias "PowerBook HD:Users:andrewtetley:Movies:EyeTV Encoded:" as MPEG4 replacing yes
   end repeat
   set finExport to false
   repeat until finExport is true
       set myCounter to 0
       delay 10
       set tempExport to false
       repeat until myCounter is equal to cntr
           set myCounter to myCounter + 1
           if busy of item myCounter of recordings is true then set tempExport to true
       end repeat
       if tempExport is false then set finExport to true
   end repeat
   delete recordings
end tell

All works except that it prompts me to hit the save button for each recording, whereas I want it to save automatically.  It is the export line of code that must be to blame for this but I have not been able to work around this,

Hopefully someon who has scripted EyeTV before can enlighten me.

Cheers

Model: PowerMac
AppleScript: Latest
Browser: Safari
Operating System: Mac OS X (10.4)


Filed under: eyetv

Offline

 

#2 2006-11-19 08:50:39 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11749
Website

Re: EyeTV Script for automatic export and delete recordings

Hi,

the problem is, your code exports the files into a folder not into a specific file of this folder.
If you add the filename (title of the recording) and the extension to the folder’s name, you never see this "Save as" dialog

And your "busy-handler" can be simplified a bit ;-)

Applescript:

set destFolder to "PowerBook HD:Users:andrewtetley:Movies:EyeTV Encoded:"
tell application "EyeTV"
   set bbTest to false
   repeat with myCounter from 1 to count recordings
       set thisTitle to title of item myCounter of recordings
       export from item myCounter of recordings to file (destFolder & thisTitle & ".mp4") as MPEG4 replacing yes
   end repeat
   repeat
       delay 10
       set busyList to recordings whose busy is true
       if busyList is {} then exit repeat
   end repeat
   delete recordings
end tell


regards

Stefan


Filed under: eyetv

Offline

 

#3 2006-11-20 02:22:13 am

kiwilegal
Member
From:: France
Registered: 2006-01-20
Posts: 350

Re: EyeTV Script for automatic export and delete recordings

Stefan

Great post.  Thanks a bunch.  I am a beginner/dabbler in Applecript but EyeTV looked like it was nicely designed for applescript.  Your script shows it must be!  Just need to get a script working with Pando.  Next query!!!

Cheers

Offline

 

#4 2006-11-20 02:55:00 am

kiwilegal
Member
From:: France
Registered: 2006-01-20
Posts: 350

Re: EyeTV Script for automatic export and delete recordings

Oh and I made some small changes to check that there are recordings to encode before launching into things and also to check that no recordings are going on before getting into it as well:

Applescript:


set destFolder to "PowerBook HD:Users:andrewtetley:Movies:EyeTV Encoded:"
tell application "EyeTV"
   set recordCount to count recordings
   if recordCount is greater than 0 then
       repeat
           delay 100
           set busyList to recordings whose busy is true
           if busyList is {} then exit repeat
       end repeat
       repeat with myCounter from 1 to count recordings
           set thisTitle1 to title of item myCounter of recordings
           set thisTitle2 to unique ID of item myCounter of recordings
           set thisTitle to thisTitle1 & thisTitle2
           export from item myCounter of recordings to file (destFolder & thisTitle & ".mp4") as MPEG4 replacing yes
       end repeat
       repeat
           delay 100
           set busyList to recordings whose busy is true
           if busyList is {} then exit repeat
       end repeat
       delete recordings
   end if
end tell

Cheers


Filed under: eyetv

Offline

 

#5 2006-12-01 09:30:19 am

grovberg
Member
Registered: 2006-12-01
Posts: 13

Re: EyeTV Script for automatic export and delete recordings

It looks like you've written exactly the script I need for a project at work and in a much more robust way that I had intended, so for that I'm eternally grateful.

I do have a question though. What settings are being used to export these files? The script just says "as MPEG4", but what is the bitrate, frames size, etc... Is there any way to customize that? I looked at the eyetv applescript documentation, but it just says export to X as well.

Thanks very much.

-Grover

Offline

 

#6 2006-12-01 10:02:53 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11749
Website

Re: EyeTV Script for automatic export and delete recordings

grovberg wrote:

I do have a question though. What settings are being used to export these files? The script just says "as MPEG4", but what is the bitrate, frames size, etc... Is there any way to customize that? I looked at the eyetv applescript documentation, but it just says export to X as well.


Hi Grover,

you can export recordings with these settings

QuickTime
VCD
SVCD
DVD
DivXDisc
Toast
eMail
Web
iMovie
iMovieHD
iDVD
DVDStudioPro
Toast
MPEGPS
MPEGES
DV
DV169
Movie
AVI
MPEG4
ThreeG
DivX
HDV720p
HDV1080i
iTunes
AAC
AppleLossless
PSP
PSPH264
iPod
iPodMP4

the options, you have in EyeTV’s export window, are not accessible by AppleScript AFAIK,
but probably the manual settings are taken


regards

Stefan

Offline

 

#7 2006-12-05 06:19:51 pm

grovberg
Member
Registered: 2006-12-01
Posts: 13

Re: EyeTV Script for automatic export and delete recordings

I'm having some trouble customizing the file name. I posted about it here.

http://bbs.applescript.net/viewtopic.php?pid=70787

I just thought I'd mention it here since it's based off the code mentioned here.

Thanks again guys for getting me off to a great start.

Last edited by grovberg (2006-12-05 06:20:33 pm)

Offline

 

#8 2006-12-15 02:43:54 am

polysics
Member
Registered: 2006-12-15
Posts: 3

Re: EyeTV Script for automatic export and delete recordings

Hello everyone, i just got an EyeTV Hybrid, with the EyeTV 2 software. And i found this board while looking for an applescript to automate exporting. The problem with the eyetv hybrid is that it captures in raw. so the files get HUGE. I found this page and wanted to use the scripts on here to export to ipod compatible h.264 format. then delete the original RAW files. 30 minutes can be 4 gigs! The EyeTV Hybrid has no other capture options besides raw. so i'm forced to encode afterwards. I tried using the scripts on this thread, but I've NEVER used applescript before, and i cant find any programs that would help me do the following:

1. Scan my EyeTV recordings
2. Convert the raw captures to h.264 mpeg4 (ipod compatible size & bitrate)
3. Export the converted files to a specified destination
4. DELETE the raw files.

I don't need to have it auto add to itunes, because i dont use itunes for that. My biggest problem is the raw files. I want to record many shows in a day, the ones i miss while im asleep. but since the file sizes are huge, and my hard drive space is limited, i can only record a couple of shows at most before i'd have to go and delete the raw's to free up space. I obviously cannot monitor this recording activity while i'm asleep/away. Can someone please help me? i would greatly appreciate it! If the scripts on this page do infact, do what i want. Can someone guide me as to how to properly set them up? Thanks!

Model: MacBook Pro 15'
Browser: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.7) Gecko/20060911 Camino/1.0.3 (MultiLang)
Operating System: Mac OS X (10.4)

Offline

 

#9 2006-12-15 08:25:45 am

grovberg
Member
Registered: 2006-12-01
Posts: 13

Re: EyeTV Script for automatic export and delete recordings

The last script posted by kiwilegal should do exactly what you are asking for. Just replace PowerBook HD:Users:andrewtetley:Movies:EyeTV Encoded: with the path to the folder where you want to save your files. To use it you'll need to copy and paste the code into the ScriptEditor found in the Applescript folder. Save it as an application. You can then use something like ScriptTimer (Google can help you find it) to make that application run every twenty minutes or so while you are asleep.

Hope that helps.

Offline

 

#10 2006-12-15 07:01:31 pm

polysics
Member
Registered: 2006-12-15
Posts: 3

Re: EyeTV Script for automatic export and delete recordings

grovberg wrote:

The last script posted by kiwilegal should do exactly what you are asking for. Just replace PowerBook HD:Users:andrewtetley:Movies:EyeTV Encoded: with the path to the folder where you want to save your files. To use it you'll need to copy and paste the code into the ScriptEditor found in the Applescript folder. Save it as an application. You can then use something like ScriptTimer (Google can help you find it) to make that application run every twenty minutes or so while you are asleep.

Hope that helps.


Thank you, it helped. The script worked when i changed the destination path like you said. However, I would like it to convert to h.264 format MP4, not just the plain MP4 format. since the quality is alot higher for a smaller file size. What should I change to do that? I know i'll have to replace the "MPEG4" but with what? i tried "H.264" and it did not work.

Also, script timer is a good idea, but i'd like a free alternative if possible. Is there an automator script, or even another applescript that i can make that will loop it? Thank you very much for your help! smile

Offline

 

#11 2006-12-16 04:10:54 pm

grovberg
Member
Registered: 2006-12-01
Posts: 13

Re: EyeTV Script for automatic export and delete recordings

As an alternative to Script Timer, you can use one of the many LaunchD editors. Lingon is a good choice, but I've found working with LaunchD to be wildly troublesome and think ST is well worth the $12.

If you look up further in the thread you'll see that I had the same questions you did about using the different formats. StefanK was kind enough to post a list of all possible options to replace MPEG4 with in your script. EyeTV will use the settings for this format as it was the last time you manually exported something, so if you set the MPEG4 option to use H.264 as your codec, you're all set. Another way to use H.264 is to set the iPod format in the preferences to H.264 640x480 and use iPodMP4 as your format.

Offline

 

#12 2006-12-17 05:59:13 am

polysics
Member
Registered: 2006-12-15
Posts: 3

Re: EyeTV Script for automatic export and delete recordings

grovberg wrote:

As an alternative to Script Timer, you can use one of the many LaunchD editors. Lingon is a good choice, but I've found working with LaunchD to be wildly troublesome and think ST is well worth the $12.

If you look up further in the thread you'll see that I had the same questions you did about using the different formats. StefanK was kind enough to post a list of all possible options to replace MPEG4 with in your script. EyeTV will use the settings for this format as it was the last time you manually exported something, so if you set the MPEG4 option to use H.264 as your codec, you're all set. Another way to use H.264 is to set the iPod format in the preferences to H.264 640x480 and use iPodMP4 as your format.


Thank you very much, and thanks for putting up with a "noob" smile

Offline

 

#13 2007-03-21 03:32:38 am

kiwilegal
Member
From:: France
Registered: 2006-01-20
Posts: 350

Re: EyeTV Script for automatic export and delete recordings

Hi there

I am following up on this thread as I have encountered a perplexing problem recently.  It may be linked to an OS update.

Applescript:

set destFolder to "Mum's HD (Mac Mini):Users:clairetetley:Movies:EyeTV Encoded:"
tell application "EyeTV"
   launch
   set recordCount to count recordings
   if recordCount is greater than 0 then
       repeat
           --delay 100
           set busyList to recordings whose busy is true
           if busyList is {} then exit repeat
       end repeat
       repeat with myCounter from 1 to count recordings
           set thisTitle1 to title of item myCounter of recordings
           set thisTitle2 to unique ID of item myCounter of recordings
           set thisTitle to thisTitle1 & thisTitle2
           export from item myCounter of recordings to file (destFolder & thisTitle & ".avi") as DivX replacing yes
       end repeat
       repeat
           delay 100
           set busyList to recordings whose busy is true
           if busyList is {} then exit repeat
       end repeat
       delete recordings
   end if
end tell

The line "export from item myCounter of recordings to file (destFolder & thisTitle & ".avi") as DivX replacing yes" produces an applescript runtime error "EyeTV got an error: parameter error" -50. I have no idea why it is doing this as nothing has changed since it was working over the last few months.

Can anyone suggest what may be wrong here?

Thanks


Filed under: eyetv

Offline

 

#14 2007-03-28 04:06:53 am

kiwilegal
Member
From:: France
Registered: 2006-01-20
Posts: 350

Re: EyeTV Script for automatic export and delete recordings

Following up on my last post. The problem was that occasionally the EYETV program title contains characters (such as a colon) which throws out the script as a program title with a colon is treated as a path (which does not exist). So I have added a subroutine to remove troublesome characters. New script is as follows:

Applescript:

set destFolder to "Mum's HD (Mac Mini):Users:clairetetley:Movies:EyeTV Encoded:"
tell application "EyeTV"
   launch
   set recordCount to count recordings
   if recordCount is greater than 0 then
       repeat
           delay 100
           set busyList to recordings whose busy is true
           if busyList is {} then exit repeat
       end repeat
       repeat with myCounter from 1 to count recordings
           set thisTitle1 to title of item myCounter of recordings
           set thisTitle1 to my parseout(thisTitle1)
           set thisTitle2 to unique ID of item myCounter of recordings
           set thisTitle to thisTitle1 & thisTitle2
           export from item myCounter of recordings to file (destFolder & thisTitle & ".avi") as DivX replacing yes
       end repeat
       repeat
           delay 100
           set busyList to recordings whose busy is true
           if busyList is {} then exit repeat
       end repeat
       delete recordings
   end if
end tell

--Subroutine to remove troublesome characters
to parseout(stringtoparse)
   set illegals to (ASCII character of 60) & (ASCII character of 62) & (ASCII character of 58) & (ASCII character of 34) & (ASCII character of 47) & (ASCII character of 92) & (ASCII character of 124)
   repeat with i from 1 to count (illegals)
       set testletter to (text i thru i of illegals)
       set the_offset to 1
       repeat
           set the_offset to offset of testletter in stringtoparse
           if the_offset > 0 then
               set stringtoparse to (text 1 thru (the_offset - 1) of stringtoparse) & "" & (text (the_offset + 1) thru -1 of stringtoparse)
           else
               exit repeat
           end if
       end repeat
   end repeat
   return stringtoparse
end parseout


Filed under: eyetv

Offline

 

#15 2009-06-04 07:38:25 pm

shabani
Member
Registered: 2009-06-05
Posts: 1

Re: EyeTV Script for automatic export and delete recordings

Hi everyone, I realize it's been some time since the last post, but I've been following this thread and have a question that I'm hoping someone can help me with.

I'm writing a very simple script that exports a recording using the RecordingDone.scpt trigger script that comes with the EyeTV 3 software. The catch is I want to export my recordings to an external harddrive as an .eyetv package rather than one of the many export formats available. This is the code I have thus far:

Applescript:

on RecordingDone(recordingID)
   tell application "EyeTV"
       set rec to recordingID as integer
       set theRec to recording id rec
       set recording_date to start time of recording id rec
       set {yr, mo, dy, hr, mn, sc} to {year, month, day, hours, minutes, seconds} of recording_date
       set formated_date to (yr * 10000 + (mo as number) * 100 + (text -2 thru -1 of ("0" & dy) as number)) as string
       set title of theRec to "rec_" & formated_date
       set a to title of theRec
       display dialog "RecordingDone: " & a
       export from recording id rec to file ("Macintosh HD:Users:shabani:Desktop:" & a & ".eyetv") replacing yes
   end tell
end RecordingDone

Basically, I try skipping the "as (format)" argument and saving the file with an .eyetv extension. This ends up saving a video file that can be opened with EyeTV, but is not a package containing the five or six files inside an EyeTV recording package.

Also, I would not be opposed to simply moving the recorded package from my EyeTV Archives folder to a folder on my external harddrive. Is there a way to do this?

Any help is very much appreciated!! Thank you!!


Filed under: eyetv

Offline

 

#16 2009-09-21 12:56:58 pm

dubjbl
Member
From:: berkeley, ca
Registered: 2009-09-21
Posts: 2

Re: EyeTV Script for automatic export and delete recordings

I'm sorry, I'm not sure how to export as an eyetv package, but I am working on trying to implement the script presented further up this thread, and hoping somebody can give me a pointer or two as this is my first attempt at AppleScript. I tried to combine kiwilegal's script with the RecordingDone triggered script and I want to export the files to a server share. Nothing seems to work, I am losing hair! I am seeking input on whether the format is correct for the path to my server:
set destFolder to "volumes:bartholomew:Recorded TV:"

Should I be using "shares" or "Shared" rather than "volumes?"
Any other issues with this script that you notice, I would appreciate your insight!
Should the script be saved as an app or a scpt file?

Here is the script. Thank you.

on RecordingDone(recordingID)
set destFolder to "volumes:bartholomew:Recorded TV:"
tell application "EyeTV"
launch
set recordCount to count recordings
if recordCount is greater than 0 then
repeat
delay 100
set busyList to recordings whose busy is true
if busyList is {} then exit repeat
end repeat
repeat with myCounter from 1 to count recordings
set thisTitle1 to title of item myCounter of recordings
set thisTitle1 to my parseout(thisTitle1)
set thisTitle2 to unique ID of item myCounter of recordings
set thisTitle to thisTitle1 & thisTitle2
export from item myCounter of recordings to file (destFolder & thisTitle & ".m4v") as MPEG4 replacing yes
end repeat
repeat
delay 100
set busyList to recordings whose busy is true
if busyList is {} then exit repeat
end repeat
delete recordings
end if
end tell
end RecordingDone


Filed under: eyetv

Offline

 

#17 2009-11-10 11:04:26 am

crmarvin42
Member
Registered: 2009-11-10
Posts: 1

Re: EyeTV Script for automatic export and delete recordings

My set up is slightly different because I'm running older hardware with the EyeTV dongle and Turbo.264 dongle both attached via a 3rd party USB 2.0 card.  If I use the built in export automation I inevitably end up with the EyeTV software trying to record a current program and export a previous program simultaneously.  This seems to require more bandwidth than my 3rd part card can reliably provide and ends up screwing up the video quality of the export and the new recording.  Hence the desire to set exports to occur at a specific time, well after my shows are done recording, and with sufficient time to finish any exports before new recordings are scheduled.  I handle scheduling with iCal, which simply runs this script at 1am every day.

I've taken the latest version of this script posted here and tried to add a couple of extra steps to the execution. 

After exporting the files as AppleTV *.M4V files, I have the script add the entire export folder to the eyeTV playlist in iTunes.  The export destination is within the "Media" folder that iTunes 9 stores content in, so instead of copying the files on import it just moves them. 

Finally the script tells iTunes to sync with my Apple TV so that by the time my wife and I get around to watching TV, everything we've recorded the night before is available without having to manually sync. 

The script appears to be working fine.  Everything I want it to do is getting done.  However, every morning when I've dialed in using VNC (the machine is running headless) I see an error message indicating that the script failed to finish running.  I'm a neophyte when it comes to Applescript so I may be missing something, but I don't see anything in this script that should be setting off the error message.  Does anyone have any suggestions?

Applescript:

set destFolder to "Internal 931s:Media:• Ripped Movies:"
tell application "EyeTV"
   launch
   set recordCount to count recordings
   if recordCount is greater than 0 then
       repeat
           delay 100
           set busyList to recordings whose busy is true
           if busyList is {} then exit repeat
       end repeat
       repeat with myCounter from 1 to count recordings
           set thisTitle1 to title of item myCounter of recordings
           set thisTitle1 to my parseout(thisTitle1)
           set thisTitle2 to unique ID of item myCounter of recordings
           set thisTitle to thisTitle1 & thisTitle2
           export from item myCounter of recordings to file (destFolder & thisTitle & ".m4v") as AppleTV replacing yes
       end repeat
       repeat
           delay 100
           set busyList to recordings whose busy is true
           if busyList is {} then exit repeat
       end repeat
       delete recordings
       tell application "iTunes"
           delay 100
           add destFolder to playlist "EyeTV"
       end tell
       tell application "System Events"
           delay 100
           click menu item "Sync \"Jendza TV\"" of menu "File" of menu bar item "File" of menu bar 1 of application process "iTunes"
       end tell
   end if
end tell

--Subroutine to remove troublesome characters
to parseout(stringtoparse)
   set illegals to (ASCII character of 60) & (ASCII character of 62) & (ASCII character of 58) & (ASCII character of 34) & (ASCII character of 47) & (ASCII character of 92) & (ASCII character of 124)
   repeat with i from 1 to count (illegals)
       set testletter to (text i thru i of illegals)
       set the_offset to 1
       repeat
           set the_offset to offset of testletter in stringtoparse
           if the_offset > 0 then
               set stringtoparse to (text 1 thru (the_offset - 1) of stringtoparse) & "" & (text (the_offset + 1) thru -1 of stringtoparse)
           else
               exit repeat
           end if
       end repeat
   end repeat
   return stringtoparse
end parseout

Model: dual 1.25GHz MDD G4
AppleScript: 2.0.1
Browser: Safari 531.9
Operating System: Mac OS X (10.5)


Filed under: iTunes, System, eyetv

Offline

 

#18 2015-10-21 08:45:20 am

wichwetyl
Member
Registered: 2015-10-20
Posts: 1

Re: EyeTV Script for automatic export and delete recordings

Hello everyone, I'm absolutely new to Apple Script: did anyone of you find a script to export automatically as the recording is done?

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)