Created
June 23, 2011 21:49
Revisions
-
plukevdh revised this gist
Jun 23, 2011 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ require 'httparty' require 'twilio' module Twimlet module HoldMusic include HTTParty -
plukevdh created this gist
Jun 23, 2011 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ module Twimlet module HoldMusic include HTTParty AWS_URL = "s3.amazonaws.com" def generate_playlist(bukkit='com.twilio.music.classical', options={}) @bucket = "http://#{bukkit}.#{AWS_URL}" @options = options get_response end private def get_response Twilio::TwiML.build do |res| parse_bukkit.each do |obj| next unless obj =~ /(\.mp3|\.wav|\.ul)$/ res.play "#{@bucket}/#{obj}" res.say @options[:message] if @options[:message] end res.redirect(@options[:redirect] || "/") end end def parse_bukkit listing = Twimlet::HoldMusic.get @bucket listing.parsed_response['ListBucketResult']['Contents'].map {|c| c['Key']} end end end