SlideShare a Scribd company logo
1 of 23
ORDER PIZZA
ROB – GONZEE.TV
I’M ROB! (yet again)
USEFULNESS OF SOFTWARE
PIZZA POWER
/pizza
>
WEB STANDARDS FTW!
>
I H8 ATT
>
:(
ORDER PIZZA
(totally demoing theapp)
ORDER PIZZA
Resources
Onclick events
Intro to TwiML
CODE
easy buddy
GET MACGUYVER ON IT
 Onclick events -
http://developer.boxee.tv/Python_API#Examples
 Twilio PHP library -
http://www.twilio.com/docs/libraries/
 Yelp Python module -
http://code.google.com/p/yelp-python-
client/
HOW IT WORKS
SUPER SMASH!
YELP CODE
results = yelp.ReviewSearchApi(client_key="e482aAygGs2SeCGxlwQg3w",
output="json").by_location(zipcode, term="pizza", radius="1")
rows = results["businesses"]
container = mc.ListItems()
for row in rows:
newitem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN)
newitem.SetLabel( str(row["name"]) )
newitem.SetThumbnail( str(row["rating_img_url"]) )
newitem.SetProperty("address1", str(row["address1"]) )
newitem.SetProperty("city", str(row["city"]) )
newitem.SetProperty("state", str(row["state"]) )
newitem.SetProperty("avg_rating", str(row["avg_rating"]))
business_phone = "(" + str(row["phone"][0:3]) + ")" + str(row["phone"][3:6]) + "-" +
str(row["phone"][6:10])
newitem.SetProperty("phone", business_phone)
newitem.SetProperty("int_phone", str(row["phone"]))
newitem.SetPath(str(row["name"]))
if row["is_closed"] == True:
newitem.SetProperty("closed", "No")
else:
newitem.SetProperty("closed", "Yes")
container.append(newitem)
EVENT
n = mc.GetWindow(14000).GetList(111).GetFocusedItem()
listitem = mc.GetWindow(14000).GetList(111).GetItem(n)
pizza_number = listitem.GetProperty("int_phone")
url = "http://apps.gonzee.tv/orderpizza/makecall.php"
values = {'called' : telephone,
'outgoing' : pizza_number}
data = urllib.urlencode(values)
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
mc.ShowDialogOk("Calling...", "We are calling this pizza place on your behalf.
Expect a call shortly.")
SERVER-SIDE – TWILIO
LIBRARY
require "twilio.php";
/* Twilio REST API version */
$ApiVersion = "2008-08-01";
/* Set our AccountSid and AuthToken */
$AccountSid = “INSERTACCOUNTSID";
$AuthToken = “INSERTAUTHTOKEN";
/* Outgoing Caller ID you have previously validated with Twilio */
$number = ‘INSERTPHONENUMBER';
/* Outgoing Number you wish to call */
if (!isset($_REQUEST['outgoing'])) {
$err = urlencode("Must specify outgoing phone number.");
header("Location: index.php?msg=$err");
die;
}
/* Instantiate a new Twilio Rest Client */
$client = new TwilioRestClient($AccountSid, $AuthToken);
MAKING THE CALL
/* make Twilio REST request to initiate outgoing call
*/
$response = $client-
>request("/$ApiVersion/Accounts/$AccountSid/Cal
ls",
"POST", array(
"Caller" => $number,
"Called" => $_REQUEST['called'],
"Url" => $url . 'callback.php?number=' .
$_REQUEST['outgoing']
));
CONNECTING TO PIZZA
<?php
header("content-type: text/xml");
echo "<?xml version="1.0" encoding="UTF-
8"?>n";
?>
<Response>
<Say>Connecting you to pizza - please
hold.</Say>
<Dial><?php echo
$_REQUEST['number']?></Dial>
</Response>
QUESTIONS?
10001110111
 Download
http://dir.gonzee.tv/download/tv.gonzee.orderpizza.zip
 Checkout
svn checkout http://twilio-boxee-
hackathon.googlecode.com/svn/trunk/orderpiz
za/ twilio-boxee-hackathon-read-only
KTHX

More Related Content

Similar to Order pizza from Boxee

How to measure everything - a million metrics per second with minimal develop...
How to measure everything - a million metrics per second with minimal develop...How to measure everything - a million metrics per second with minimal develop...
How to measure everything - a million metrics per second with minimal develop...
Jos Boumans
 
From Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShiftFrom Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShift
Eric D. Schabell
 
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
Frédéric Harper
 
Firefox OS: HTML5 sur les stéroïdes - HTML5mtl - 2014-04-22
Firefox OS: HTML5 sur les stéroïdes - HTML5mtl - 2014-04-22Firefox OS: HTML5 sur les stéroïdes - HTML5mtl - 2014-04-22
Firefox OS: HTML5 sur les stéroïdes - HTML5mtl - 2014-04-22
Frédéric Harper
 
Plack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversPlack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and servers
Tatsuhiko Miyagawa
 

Similar to Order pizza from Boxee (20)

Debugging Effectively in the Cloud - Felipe Fidelix - Presentation at eZ Con...
Debugging Effectively in the Cloud - Felipe Fidelix - Presentation at  eZ Con...Debugging Effectively in the Cloud - Felipe Fidelix - Presentation at  eZ Con...
Debugging Effectively in the Cloud - Felipe Fidelix - Presentation at eZ Con...
 
PyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web ApplicationsPyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web Applications
 
How to measure everything - a million metrics per second with minimal develop...
How to measure everything - a million metrics per second with minimal develop...How to measure everything - a million metrics per second with minimal develop...
How to measure everything - a million metrics per second with minimal develop...
 
Python Flask app deployed to OPenShift using Wercker CI
Python Flask app deployed to OPenShift using Wercker CIPython Flask app deployed to OPenShift using Wercker CI
Python Flask app deployed to OPenShift using Wercker CI
 
Budapest Spark Meetup - Apache Spark @enbrite.ly
Budapest Spark Meetup - Apache Spark @enbrite.lyBudapest Spark Meetup - Apache Spark @enbrite.ly
Budapest Spark Meetup - Apache Spark @enbrite.ly
 
Flask With Server-Sent Event
Flask With Server-Sent EventFlask With Server-Sent Event
Flask With Server-Sent Event
 
Python from zero to hero (Twitter Explorer)
Python from zero to hero (Twitter Explorer)Python from zero to hero (Twitter Explorer)
Python from zero to hero (Twitter Explorer)
 
Asynchronous Programming at Netflix
Asynchronous Programming at NetflixAsynchronous Programming at Netflix
Asynchronous Programming at Netflix
 
From Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShiftFrom Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShift
 
Web Apps on Linux (Paas)
Web Apps on Linux (Paas)Web Apps on Linux (Paas)
Web Apps on Linux (Paas)
 
Øredev2013 - FirefoxOS - the platform HTML5 deserves
Øredev2013 - FirefoxOS - the platform HTML5 deservesØredev2013 - FirefoxOS - the platform HTML5 deserves
Øredev2013 - FirefoxOS - the platform HTML5 deserves
 
InspiringCon14: ElePHPants on speed: Running TYPO3 Flow on HipHop VM
InspiringCon14: ElePHPants on speed: Running TYPO3 Flow on HipHop VMInspiringCon14: ElePHPants on speed: Running TYPO3 Flow on HipHop VM
InspiringCon14: ElePHPants on speed: Running TYPO3 Flow on HipHop VM
 
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
 
Creando microservicios con Java, Microprofile y TomEE - Baranquilla JUG
Creando microservicios con Java, Microprofile y TomEE - Baranquilla JUGCreando microservicios con Java, Microprofile y TomEE - Baranquilla JUG
Creando microservicios con Java, Microprofile y TomEE - Baranquilla JUG
 
Enhance system transparency and truthfulness with request tracing
Enhance system transparency and truthfulness with request tracingEnhance system transparency and truthfulness with request tracing
Enhance system transparency and truthfulness with request tracing
 
Firefox OS: HTML5 sur les stéroïdes - HTML5mtl - 2014-04-22
Firefox OS: HTML5 sur les stéroïdes - HTML5mtl - 2014-04-22Firefox OS: HTML5 sur les stéroïdes - HTML5mtl - 2014-04-22
Firefox OS: HTML5 sur les stéroïdes - HTML5mtl - 2014-04-22
 
Supporting Enterprise System Rollouts with Splunk
Supporting Enterprise System Rollouts with SplunkSupporting Enterprise System Rollouts with Splunk
Supporting Enterprise System Rollouts with Splunk
 
How to switch stack without downtime
How to switch stack without downtimeHow to switch stack without downtime
How to switch stack without downtime
 
Plack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversPlack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and servers
 
(Micro?)services architecture in practice
(Micro?)services architecture in practice(Micro?)services architecture in practice
(Micro?)services architecture in practice
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Recently uploaded (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Order pizza from Boxee

  • 2.
  • 9. :(
  • 12. GET MACGUYVER ON IT  Onclick events - http://developer.boxee.tv/Python_API#Examples  Twilio PHP library - http://www.twilio.com/docs/libraries/  Yelp Python module - http://code.google.com/p/yelp-python- client/
  • 15. YELP CODE results = yelp.ReviewSearchApi(client_key="e482aAygGs2SeCGxlwQg3w", output="json").by_location(zipcode, term="pizza", radius="1") rows = results["businesses"] container = mc.ListItems() for row in rows: newitem = mc.ListItem(mc.ListItem.MEDIA_UNKNOWN) newitem.SetLabel( str(row["name"]) ) newitem.SetThumbnail( str(row["rating_img_url"]) ) newitem.SetProperty("address1", str(row["address1"]) ) newitem.SetProperty("city", str(row["city"]) ) newitem.SetProperty("state", str(row["state"]) ) newitem.SetProperty("avg_rating", str(row["avg_rating"])) business_phone = "(" + str(row["phone"][0:3]) + ")" + str(row["phone"][3:6]) + "-" + str(row["phone"][6:10]) newitem.SetProperty("phone", business_phone) newitem.SetProperty("int_phone", str(row["phone"])) newitem.SetPath(str(row["name"])) if row["is_closed"] == True: newitem.SetProperty("closed", "No") else: newitem.SetProperty("closed", "Yes") container.append(newitem)
  • 16. EVENT n = mc.GetWindow(14000).GetList(111).GetFocusedItem() listitem = mc.GetWindow(14000).GetList(111).GetItem(n) pizza_number = listitem.GetProperty("int_phone") url = "http://apps.gonzee.tv/orderpizza/makecall.php" values = {'called' : telephone, 'outgoing' : pizza_number} data = urllib.urlencode(values) req = urllib2.Request(url, data) response = urllib2.urlopen(req) mc.ShowDialogOk("Calling...", "We are calling this pizza place on your behalf. Expect a call shortly.")
  • 17. SERVER-SIDE – TWILIO LIBRARY require "twilio.php"; /* Twilio REST API version */ $ApiVersion = "2008-08-01"; /* Set our AccountSid and AuthToken */ $AccountSid = “INSERTACCOUNTSID"; $AuthToken = “INSERTAUTHTOKEN"; /* Outgoing Caller ID you have previously validated with Twilio */ $number = ‘INSERTPHONENUMBER'; /* Outgoing Number you wish to call */ if (!isset($_REQUEST['outgoing'])) { $err = urlencode("Must specify outgoing phone number."); header("Location: index.php?msg=$err"); die; } /* Instantiate a new Twilio Rest Client */ $client = new TwilioRestClient($AccountSid, $AuthToken);
  • 18. MAKING THE CALL /* make Twilio REST request to initiate outgoing call */ $response = $client- >request("/$ApiVersion/Accounts/$AccountSid/Cal ls", "POST", array( "Caller" => $number, "Called" => $_REQUEST['called'], "Url" => $url . 'callback.php?number=' . $_REQUEST['outgoing'] ));
  • 19. CONNECTING TO PIZZA <?php header("content-type: text/xml"); echo "<?xml version="1.0" encoding="UTF- 8"?>n"; ?> <Response> <Say>Connecting you to pizza - please hold.</Say> <Dial><?php echo $_REQUEST['number']?></Dial> </Response>
  • 20.
  • 22. 10001110111  Download http://dir.gonzee.tv/download/tv.gonzee.orderpizza.zip  Checkout svn checkout http://twilio-boxee- hackathon.googlecode.com/svn/trunk/orderpiz za/ twilio-boxee-hackathon-read-only
  • 23. KTHX