User:Inge Hoonte/captain tweet: Difference between revisions
Inge Hoonte (talk | contribs) No edit summary |
Inge Hoonte (talk | contribs) No edit summary |
||
Line 155: | Line 155: | ||
http://www.dailymail.co.uk/sciencetech/article-1218474/How-Captain-Cooks-ship-logs-helping-scientists-chart-global-climate-change.html | http://www.dailymail.co.uk/sciencetech/article-1218474/How-Captain-Cooks-ship-logs-helping-scientists-chart-global-climate-change.html | ||
http://code.google.com/p/python-twitter/ | |||
Revision as of 18:48, 22 June 2011
FOLLOW CAPTAIN TWEET ON http://twitter.com/#!/tweet_captain
Aymeric has helped me steadily progress with the code for Captain Tweet. And I'm starting to understand dictionaries and strings better.
06/21 -- Copied code and log to server. Runs in screen.
How-to: 1)ssh into server 2)"screen" 3) "ctrl a" "s" for new window 4) python captain_tweet.py 5)"ctrl a" "d" out of screen 6)"ctrl d" out of server
Tried a few different backgrounds with old ships, all too tacky and not the exact right ship. Keeping it simple for now.
Some important things to note:
- I changed the original dates to fit the dates of the show. Ideally I'd have this start on December 16, which is the first entry of the original log. I've changed it to June through November. So... in case you're wondering, that's why it's snowing in July.
- The log used is Captain Turner's log, transcribed by Sue Mackay, of Cardiff.
- The HMS Weymouth, the ship that's tweeted from, was used to transport over 450 settlers, including children, from Portsmouth, United Kingdom, to Algoa Bay (Port Elizabeth), South Africa.
- A big undertone of this project is of course migration, sailing the seas, colonialism, which isn't further explored. I needed to focus on advancing in my programming skills.
TO DO:
- PRESENTATION IN SHOW! Display twitter feed on twitter url? Make new html design for HMS Weymouth w/twitter feed embedded? What communicates the simple idea of logging from 1819 into 2011 best?
- figure out kiosk mode & browser refresh
- make twitter url "home" on exhibit computer
update time in log to standardized 06:00 etc hours that Python can readcreate new twitter account for the captain- make friends for the captain
put code and log on the server, run it from thereadd to code: #check for date continuously and time, when there's a match, push message from log to captain's tweet feed
Inspiration & Process
ORIGINAL LOG BY CAPTAIN TURNER, 1819/1820
Thurs 16 December 1819 – Portsmouth Harbour
Am: Light breezes and clear
8: Do weather. Employed hoisting in provisions and other necessary duties.
The settlers came on board at noon. Do weather. Employed stowing the hold.
Mustered for Checques, discharged several of the crew. Employed stowing the holds.
Midnight: Strong winds
Fri 17 December
Am: Strong breezes with rain
8: Do weather. Employed cleaning decks and stowing chain cables.
Do weather. Employed as before.
Midnight: Do weather
Sat 18 December
Am: Strong breezes and rain. Employed clearing lighter of provisions.
Pm: More moderate employed cleaning decks.
Midnight: Fine weather
Captain Tweet, 2011
06/16
01:00: Light breezes and clear
08:00: Ditto weather. Employed hoisting in provisions and other necessary duties.
15:00: The settlers came on board at noon. Ditto weather. Employed stowing the hold.
17:00: Mustered for Checques, discharged several of the crew. Employed stowing the holds.
23:59: Strong winds
06/17
01:00: Strong breezes with rain
08:00: Ditto weather. Employed cleaning decks and stowing chain cables.
15:00: Ditto weather. Employed as before.
23:59: Ditto weather
06/18
01:00: Strong breezes and rain. Employed clearing lighter of provisions.
15:00: More moderate employed cleaning decks.
23:59: Fine weather
CODE
#!/usr/bin/python
from datetime import datetime
import time, sys
import twitter
log = {}
journal = open("log.txt","r")
days = journal.read().split("\n\n")
for day in days:
daylog = day.split("\n")
day = daylog.pop(0)
entries = {}
for entry in daylog:
event = entry.split(" ")
daytime = event.pop(0)
if daytime in entries.keys():
entries[daytime] += "\n" + " ".join(event)
else:
entries[daytime] = " ".join(event)
log[day] = entries
#log into twitter
api = twitter.Api(consumer_key='..',consumer_secret='..', access_token_key='..', access_token_secret='..')
previous_time = " "
#continuous match searching for date and time to push message
while True:
current_day = datetime.now().strftime("%m/%d")
current_time = datetime.now().strftime("%H:%M:")
if current_time == previous_time:
time.sleep(5)
continue
previous_time = current_time
print "no message for " + current_day + current_time
if current_day not in log.keys():
continue
if current_time not in log[current_day].keys():
continue
status = api.PostUpdate(log[current_day][current_time])
print log[current_day][current_time]
Anomalies
Born on Board, not mentioned in the Cpt Log, but present in the Master's Roll:
Jan 13 ___ Pedlar
Jan 28 ___ Green
Feb 07 ___ Reed
Feb 20 ___ Biggar
Feb 29 ___ Epsey
Mar 08 ___ Godfrey
Mar 10 ___ Usher
Mar 22 ___ Hobbs DD 13 Apr
Apr 07 ___ Sweetman
Apr 26 ___ Bowker
Apr 29 ___ Sanders DD 7 May
May 18 ___ Cronk
References
http://www.theshipslist.com/ships/passengerlists/weymouth.htm >> this is the source log by Captain Turner
http://www.galapagos.to/TEXTS/BEAGLELOG.HTM
http://www.affinitycruises.co.nz/About-Us/Captains-Log.asp >> cruise ship in New Zealand. This is more a blog.
http://www.wielingen1991.org/en/mission_/log_book.htm >> ship employed in war
http://code.google.com/p/python-twitter/
OLD CODE
#!/usr/bin/python import twitter import time api = twitter.Api(username='...', password='...') print('Starting...') while 1 == 1: api.PostUpdate(getoutput('uptime')) print(getoutput('uptime')) time.sleep(3600)