Right, i now have half the solution.
An automator script downloads a rss feed and extracts the text from it to give a file containing:
Friday: sunny, Max Temp: 21°C (70°F), Min Temp: 9°C (48°F) -
2009-05-26 20:35:09 +0100
Max Temp: 21°C (70°F), Min Temp: 9°C (48°F), Wind Direction: SE, Wind Speed: 9mph, Visibility: poor, Pressure: 1031mB, Humidity: 62%, Sunrise: 04:58BST, Sunset: 21:18BST
Thursday: sunny intervals, Max Temp: 19°C (66°F), Min Temp: 10°C (50°F) -
2009-05-26 20:35:09 +0100
Max Temp: 19°C (66°F), Min Temp: 10°C (50°F), Wind Direction: W, Wind Speed: 8mph, Visibility: good, Pressure: 1030mB, Humidity: 73%, Sunrise: 04:59BST, Sunset: 21:17BST
Wednesday: heavy rain, Max Temp: 15°C (59°F), Min Temp: 9°C (48°F) -
2009-05-26 20:35:09 +0100
Max Temp: 15°C (59°F), Min Temp: 9°C (48°F), Wind Direction: WSW, Wind Speed: 16mph, Visibility: poor, Pressure: 1017mB, Humidity: 86%, Sunrise: 05:00BST, Sunset: 21:15BST
Next a python program takes it and parses the file and outputs: the weather, max temp and min temp.
The python is:
#!/usr/bin/python
# Filename : weather1.py
import datetime
from datetime import date
enableser = bool(input("Enable serial, (True or False) : "))
if enableser:
import serial
ser = serial.Serial('/dev/tty.usbserial-A8004Iyv', 9600)
import time
def getday():
dayshift = int(raw_input("Enter dayshift, (eg 0 for today,1 for tomorrow.) : "))
now = datetime.datetime.now()
year = now.year
month = now.month
day = now.day + dayshift
dayofweek = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saterday', 'Sunday']
daytoday = dayofweek[date.weekday(date(year,month,day))]
return daytoday
def findcolon(no):
for x in range(1, len(strweather)):
if strweather[x] == ':' :
no =no -1
if no == 0:
return x
def parseline(str):
strsky = str[ findcolon(1)+2 : str.index(',') ]
print strsky
strmax = str[ findcolon(2)+2 : str.index("C") -1]
print strmax
strmin = str[ findcolon(3)+2 : str.rindex("C") -1]
print strmin
today= getday()
fileoverride = bool(input("Override default file, (True or False) : "))
if fileoverride:
newfile = raw_input("Enter the path for the file : ")
file = open(newfile, "r")
else:
file = open("HerefordWeather3Days.txt", "r")
for line in file:
if today in line:
strweather = line
occurs = True
break
else:
occurs = False
print "The day is", today
if occurs:
print strweather
if enableser:
ser.write("Y")
parseline(strweather)
else:
print today, "is not in the file"
if enableser:
ser.write("N")
#time.sleep(5)
It contains a lot of useless serial stuff which makes a green or red led on my arduino signify if the script worked or failed.
Sorry for the lack of comment, but i haven't had time yet. Just learnt python in a few days and my heads still spinning a bit =P. Just ask away if you want.
Thanks for your help pointing me in the right direction.