Posted by crayz
One of Apple's pages, right now:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<<<<<<< .mine
<title></title>
<meta http-equiv=refresh content="1; URL=/ipod/nike/">
=======
<title>Apple</title>
<meta http-equiv=refresh content="1; URL=/ipod/nike/">
>>>>>>> .r7535
<script language="JavaScript" type="text/javascript" charset="utf-8">
<!--
function time() {
setTimeout("window.location.replace('')",1)
}
// -->
</script>
</head>
<body onload="time()">
</body>
</html>
Posted by crayz
No real error checking, but it should be pretty obvious whether it works when you run it.
%w(rubygems rbosa chronic).each{ |dep| require dep }
itunes = OSA.app 'iTunes'
wake_at = Chronic.parse ARGV.first
time_until_alarm = wake_at - Time.now
puts "I'll wake you up at #{wake_at}"
sleep time_until_alarm
itunes.play
Posted by crayz
The following uses ruby-growl and Apple's RubyOSA (think AppleScript for Ruby) to connect to iTunes and push the current track(if there is one) to its end, and pop-up a nice notification that it did. It's a slightly silly use, but I've always wanted a quick way to skip to the end of the current song while still bumping it's playcount(just hitting "next track" in iTunes won't increment your playcount of the current one, even though you just listened to 75% of it)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
GROWL_PASS = "zzzzz"
require 'rubygems'
require 'rbosa'
require 'ruby-growl'
def growl_notify(message)
growl = Growl.new "localhost", "ruby-growl", ["itunes-ruby"], nil, GROWL_PASS
growl.notify "itunes-ruby", "iTunes / ruby", message
end
itunes = OSA.app('iTunes')
if(current_track = itunes.current_track.get rescue false)
track_name = current_track.name
itunes.player_position = current_track.finish
growl_notify "track '#{track_name}' ended"
else
growl_notify "no track currently playing"
end |
(sorry about the fugly syntax hilighting)