How to update EyeTV DVB EPG automatically
EyeTV expects you to pay for a subscription to keep the TV guide up to date. The free alternative (using the DVB guide) is perfectly adequate, but suffers from a major flaw: it doesn’t update automatically. This makes EyeTV somewhat useless as an unattended TV server.
Fortunately, there’s a solution. You can use AppleScript to send EyeTV the (complicated) series of keystrokes to update the TV guide each night. The resulting script required a bit of experimentation to get it completely reliable and only works with the latest version (v3.6.9 at the time of writing). For other versions, you might need to tweak the keystrokes slightly.
First of all, you must enable accessibility scripting in macOS, otherwise the scripting engine can’t control the GUI.
Next, open up Script Editor and paste in the following commands:
tell application "EyeTV" to activate try tell application "System Events" tell process "EyeTV" keystroke "p" using control down delay 5 keystroke "g" using command down delay 5 click pop up button 1 of window "EyeTV Programs" delay 10 click menu item "Update DVB Program Guide" delay 300 keystroke "w" using command down delay 5 keystroke "o" using command down delay 5 key code 53 using command down delay 5 end tell end tell end try try tell application "EyeTV" hide programs_window enter full screen pause end tell end try
Test it by pressing the play button in Script Editor. EyeTV should update the EPG guide and the script should complete without errors. Now save the script in ~/Library/Scripts as "Update EyeTV EPG.scpt".
To automate the script, just invoke it with a launchd script. Here’s a sample:
<key>Debug</key> <true/> <key>Disabled</key> <false/> <key>Label</key> <string>com.paul.eyetv</string> <key>LowPriorityIO</key> <true/> <Program> /usr/bin/osascript <key>ProgramArguments</key> <array> osascript <string>/Users/paul/Library/Scripts/Update EyeTV EPG.scpt</string> </array> <key>StartCalendarInterval</key> <dict> <key>Hour</key> <integer>3</integer> <key>Minute</key> <integer>0</integer> </dict> <key>StandardOutPath</key> <string>/Users/paul/Library/Logs/eyetv_epg.log</string> <key>StandardErrorPath</key> <string>/Users/paul/Library/Logs/eyetv_epg.log</string>
You’ll need to change the paths in the script to point to your own home directory. Save the resulting file to ~/Library/LaunchAgents/com.eyetv.plist.
Now load it into launchd with:
sudo launchctl load ~/Library/LaunchAgents/com.eyetv.plist
That will enable the script and it’ll run every night at 3am.