User:Inge Hoonte/captain tweet: Difference between revisions
Inge Hoonte (talk | contribs) No edit summary |
Inge Hoonte (talk | contribs) No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[File: | '''FOLLOW CAPTAIN TWEET ON [http://twitter.com/#!/tweet_captain Twitter]''' | ||
[[File:captain_augsept.png]] [[File:NL010.jpg |250px]] | |||
Aymeric has helped me steadily progress with the code for Captain Tweet. And I'm starting to understand dictionaries and strings better. | Aymeric has helped me steadily progress with the code for Captain Tweet. And I'm starting to understand dictionaries and strings better. | ||
Line 14: | Line 16: | ||
08/04 -- Captain Tweet now has 28 followers, about half of which are ship crew and shipping journals. | 08/04 -- Captain Tweet now has 28 followers, about half of which are ship crew and shipping journals. | ||
09/12 -- Laura Dekker, a 16-year old Dutch girl who's sailing around the world, solo, is now also following Capt Tweet! | 09/12 -- Laura Dekker, a 16-year old Dutch girl who's sailing around the world, solo, is now also following Capt Tweet! And NL010 published a line on the project in their September issue. | ||
Some important things to note: <br/> | Some important things to note: <br/> |
Latest revision as of 12:00, 12 September 2011
FOLLOW CAPTAIN TWEET ON Twitter
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
07/02 -- script stopped after error message from twitter, no duplicate messages allowed within certain time frame. Possible solution: "Whatever code you have that uses Twitter's API needs to handle errors and exceptions --- they happen too often to ignore".............. so I have to build in a line that if there is an error, the script should skip it and keep running.
07/04 -- Evo showed me how to fix the bump. Built in a "try" line. Over the following week, I adjusted the log so messages within 24hrs are no longer exactly the same. Added spaces between words which seems to do the trick.
08/04 -- Captain Tweet now has 28 followers, about half of which are ship crew and shipping journals.
09/12 -- Laura Dekker, a 16-year old Dutch girl who's sailing around the world, solo, is now also following Capt Tweet! And NL010 published a line on the project in their September issue.
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.
- This project is based on movements of migration, exploring the seas, claiming new land, and colonialism, which is only expressed indirectly. I felt I had to focus on advancing my programming skills, while keeping an eye on the concept. I think this can be pushed further but not in this project necessarily.
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 refreshmake twitter url "home" on exhibit computerupdate time in log to standardized 06:00 etc hours that Python can readcreate new twitter account for the captainmake friends for the captainput 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.lewevanaduard.nl/ --> endeavor by Digital Erfgoed
The Beagle Revisited > tv documentary by VPRO. Revisiting Darwin's diaries and travels. Captain Tweet follows the program on twitter.
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://creativetime.org/programs/archive/2011/tweets/ >> Dusan sent me this link. Creative Time commissioned twitter art.
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)