Another reason to buy an Apple ibook Log Out | Lost Password? | Topics | Search
Contact | Register | My Profile | SO home | MOL home

M-SO Message Board » 2005 Attic » Virtual Cafe » Archive through June 4, 2005 » Archive through March 22, 2005 » Another reason to buy an Apple ibook « Previous Next »

  Thread Originator Last Poster Posts Pages Last Post
  ClosedClosed: New threads not accepted on this page          

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Tom Reingold
Supporter
Username: Noglider

Post Number: 5762
Registered: 1-2003


Posted on Wednesday, March 9, 2005 - 11:19 am:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

http://www.ipodhacks.com/article.php?sid=1272
Top of pagePrevious messageNext messageBottom of page Link to this message

D.
Moderator
Username: Dave

Post Number: 5521
Registered: 4-1998


Posted on Wednesday, March 9, 2005 - 12:40 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)

This is wild. Wonder if we can adapt this to post messages on MOL by merely shaking our laptops. Shake once = angry. Shake 2x = LOL. etc.

#!/usr/bin/python 

# Download amstracker from http://www.kernelthread.com/software/ams/
# Put amstracker and bumptunes.py in the same directory. Go to this directory
# in the Terminal and type:
# ./amstracker -u 0.1 -s | python bumptunes.py
# Hit ctrl-c to exit.

THRESHOLD = 3 # lower numbers makes this more sensitive
COMPONENT = 1 # three dimensions: sideways: 0, forward/back: 1, up/down: 2

# two types of behaviour:
# bump: go to the next track whenever the machine is bumped
# nextprev: rock backwards to go to next track, forwards for previous track
BEHAVIOR = "bump"

import sys, os

def run_command(command):
script = os.popen("osascript", "w")
script.write('tell application "iTunes"\r\n')
script.write("%s\r\n" % command)
script.write('end tell\r\n')
script.close()

since = 0
while 1:
try:
line = sys.stdin.readline()
since += 1
x = int(line.split()[COMPONENT])
if abs(x) > THRESHOLD and since > 5: # ignore commands for 0.5 seconds
if "bump" == BEHAVIOR:
run_command("next track")
elif "nextprev" == BEHAVIOR:
if x > 0:
run_command("next track")
else:
# first command goes to beginning of current track,
# next command goes to the actual previous track
run_command("previous track")
run_command("previous track")
since = 0
except KeyboardInterrupt:
sys.exit(0)
except:
pass
Top of pagePrevious messageNext messageBottom of page Link to this message

monster
Supporter
Username: Monster

Post Number: 638
Registered: 7-2002


Posted on Wednesday, March 9, 2005 - 4:35 pm:   Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)



Here's something else that's cool, for the iPod.
Replace all of your remote controls and just use the iPod instead.
http://features.engadget.com/entry/6336778455600767/
http://www.griffintechnology.com/griffinmobile/totalremote/




Topics | Last Day | Last Week | Tree View | Search | User List | Help/Instructions | Credits Administration