Ton

Gracenote --> XMLTV

Recommended Posts

Having become extremely frustrated at Gracenote's deterioration of service and ridiculous increase in price, I developed the following system to download the UK EPG from xmltv.co.uk. The xml service is not as slick as Gracenote's but it's free!  This has been working for over a week now.

 

Applescript to retrieve http://www.xmltv.co.uk/feed/6721 UK tv 24 hour listings and load it into EyeTV.app. Can be adapted for other xmltv.co.uk downloads such as the 7 day download.

 

You must decide what directories to put the Applescript and where working directories will be. See Instruction number 2.

 

Be aware that xmltv.co.uk periodicly changes the URL to disable old users who have not stopped their automated downloaders that are no longer required

 

1. Following is the Applescript to run. Copy and paste the lines into the Script Editor application and save it to the directories that you select or created per instruction 2. You can run it manually but there are instructions to have it run daily below.

 

 

# Start of Applescript

# Retrieve head of file to test for change of URL.

do shell script "curl http://www.xmltv.co.uk/feed/6721 --head --silent --output /Users/Your_Username/some_subdirectory/xmlTV/UKtv_24hr.xml"

 

# Set variable with the retrieved file's path.

 

set xmlUKtv_24_file to "/Users/Your_Username/some_subdirectory/xmlTV/UKtv_24hr.xml"

 

# Read first line of file and test for missing file

set firstLine to paragraphs of (read xmlUKtv_24_file before linefeed)

# Send email if file doesn't exist

if ((firstLine as string) is equal to "HTTP/1.1 404 Not Found") then

tell application "Mail"

set my_message to make new outgoing message

set subject of my_message to "xmlTV 24 Hour Download Failed"

set content of my_message to "Not sure why it happened... Check xmlTV.co.uk/feeds for list number change."

set sender of my_message to "Your_Username@some_email.com"

--

tell my_message

make new to recipient at end of to recipients with properties {name:"Your_Username@some_email.com"}

end tell

--

send my_message

end tell

else

-- Get the complete file and load into EyeTV

log " Success!!"

# Download the xml file

do shell script "curl http://www.xmltv.co.uk/feed/6721 --silent --output /Users/Your_Username/some_subdirectory/xmlTV/UKtv_24hr.xml"

# Load it into EyeTV

do shell script "/usr/bin/open -a /Applications/EyeTV.app /Users/Your_Username/some_subdirectory/xmlTV/UKtv_24hr.xml"

log (current date)

end if

# End of Applescript

 

 

2. The following is the contents of local.xmlTV_UK_24hr_Dwnld.plist. Copy and paste into a text editor and save to /Users/Your_Username/Library/LaunchAgents/local.xmlTV_UK_24hr_Dwnld.plist. Be sure to save as a plain text file into the directory shown. All other files can be any directory you want. You can change the filename if you like but the file extension MUST BE “.plist

 

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>Label</key>

<!-- Comment Delimiters -->

<!-- Following contains a unique string that identifies your daemon to launchd. -->

<string>local.xmlTV_UK_24hr_Dwnld</string>

<!-- Run when it first loads. This will also run at boot time. -->

<key>RunAtLoad</key>

<true/>

<key>ProgramArguments</key>

<array>

<string>osascript</string>

<!-- Location of Applescript to run. -->

<string>/Users/Your_Username/some_subdirectory/xmlTV_Listings_Dwnld_24hr.scpt</string>

</array>

<!-- Set the time to run every day. -->

<key>StartCalendarInterval</key>

<dict>

<key>Hour</key>

<integer>3</integer>

<key>Minute</key>

<integer>30</integer>

</dict>

<!-- Working directories for logs and errors. -->

<key>WorkingDirectory</key>

<string>Users/Your_Username/some_subdirectory/xmlTV</string>.

<key>StandardOutPath</key>

<string>/Users/Your_Username/some_subdirectory/logs/xmlTV_dwnld.log</string>

<key>StandardErrorPath</key>

<string>/Users/Your_Username/some_subdirectory/logs/xmlTV_dwnld.err</string>

</dict>

</plist>

 

 

3. The following is the terminal command to launch the above file which will then run every 24 hours at 03:30 which is shortly after the xmltv.co.uk database is updated. Open the Terminal application and copy and paste the following line into it and press “Return”.

 

launchctl load /Users/Your_Username/Library/LaunchAgents/local.xmlTV_UK_24hr_Dwnld.plist

 

To stop the service:

 

launchctl unload local.xmlTV_UK_24hr_Dwnld

 

 

Tags: EyeTV.app, Elgato, Geniatech, Gracenote, xmltv.co.uk, EPG

 

 

Share this post


Link to post
Share on other sites

Be aware!  Gracenote's Program Titles can be different from xmltv.co.uk's.  If you have Smart Guides created with Gracenote, re-create them manually.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.