Total noob here, so be gentle.
I’m trying to make use of kiwilegal’s script for automatically exporting recordings from EyeTV to .mp4 files found at http://bbs.applescript.net/viewtopic.php?pid=70501#p70501.
I need the files to be named in a very specific way though based on the time and date when they were recorded so I started work on my own code to pull the info from eyeTV to make the filename. To ease this, I’m making use of a routine I found written by jj at http://applescriptsourcebook.com/viewtopic.php?pid=46991 to emulates the split() function found elsewhere. It works great on it’s own but for some reason when I plug it in the middle of his/her repeat, I get
EyeTV got an error: Can’t continue split
Any ideas? Great heaps of appreciation for any assistance. Again, I’m wildly new to all of this, so please let me know if I’m doing something dumb.
Here’s the full script.
set destFolder to "scomhd:crs:encoded:"
--split subroutine provided by jj at applecriptsourcebook.com
to split(someText, delimiter)
set AppleScript's text item delimiters to delimiter
set someText to someText's text items
set AppleScript's text item delimiters to {""} --> restore delimiters to default value
return someText
end split
--Apple provided subroutine for replace_chars
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
--Get MAC Address from Text File
set file_ref to open for access "scomhd:crs:macaddress.txt"
set macaddress to read file_ref
close file_ref
--Check if busy or recording. If not export using most recent settings from EyeTV Export.
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 time_stamp to start time of item myCounter of recordings
--split into array
set dateformat_array to split(time_stamp, space)
set split_dayname to item 1 of dateformat_array
set split_month to item 2 of dateformat_array
set split_day to item 3 of dateformat_array
set split_year to item 4 of dateformat_array
set split_time to item 5 of dateformat_array
set split_AMPM to item 6 of dateformat_array
--reformat individual elements
--drop comma on day
set split_day to replace_chars(split_day, ",", "")
--convert month to number
set the split_month to replace_chars(split_month, "January", "01")
set the split_month to replace_chars(split_month, "February", "02")
set the split_month to replace_chars(split_month, "March", "03")
set the split_month to replace_chars(split_month, "April", "04")
set the split_month to replace_chars(split_month, "May ", "05")
set the split_month to replace_chars(split_month, "June", "06")
set the split_month to replace_chars(split_month, "July", "07")
set the split_month to replace_chars(split_month, "August", "08")
set the split_month to replace_chars(split_month, "September", "09")
set the split_month to replace_chars(split_month, "October", "10")
set the split_month to replace_chars(split_month, "November", "11")
set the split_month to replace_chars(split_month, "December", "12")
--add leading zero to day
set split_day to text -2 thru -1 of ("00" & split_day)
--remove colons from time
set the split_time to replace_chars(split_time, ":", "-")
--put it all together
set reformated_timestamp to split_year & split_month & split_day & "_" & split_time & "_" & split_AMPM
--Export Files
export from item myCounter of recordings to file (destFolder & macaddress & reformated_timestamp & "_800k.mp4") as MPEG4 replacing yes
export from item myCounter of recordings to file (destFolder & macaddress & reformated_timestamp & "_300k.mp4") as iPodMP4 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