Skip to content

Instantly share code, notes, and snippets.

@jubishop
Created June 30, 2009 07:16
Show Gist options
  • Save jubishop/138047 to your computer and use it in GitHub Desktop.
Save jubishop/138047 to your computer and use it in GitHub Desktop.
tell application "iTunes"
copy (convert current track) to newTrack
set newLocation to (location of track 1 of current playlist)
tell application "Finder"
copy (move newLocation to the desktop with replacing) to newFile
end tell
delete (track 1 of current playlist)
do shell script "uptmp " & quote & (POSIX path of newLocation) & quote
end tell
#!/usr/bin/env ruby
require 'rubygems'
require 'rbosa'
raise "Need file name" if (ARGV.empty?)
fileName = ARGV.first
uploadDir = ARGV[1] || (File.extname(fileName) == ".mp3" ? "music" : "tmp")
IO.popen("scp '#{fileName}' [email protected]:~/WebServer/public/#{uploadDir}") {|io| io.read }
IO.popen("rm '#{fileName}'") { |io| io.read }
safari = OSA.app('Safari')
safari.make OSA::Safari::Document
document = safari.documents.last
documents = safari.documents.to_a
if (File.extname(fileName) == ".swf")
document.url = "http://jubishop.com/Flash.html?swf=#{uploadDir}/" +
File.basename(fileName)
else
document.url = "http://jubishop.com/#{uploadDir}/" +
File.basename(fileName)
end
safari.activate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment