diff --git a/queue/views.py b/queue/views.py
index b5c2732..e46203a 100644
--- a/queue/views.py
+++ b/queue/views.py
@@ -3,13 +3,25 @@
import twilio.twiml
from django.views.generic import View
from django.http import HttpResponse
+
+from rdio import Rdio
# Create your views here.
class Queue(View):
def get(self, request):
res = twilio.twiml.Response()
- from_number = request.GET['Body']
- print from_number
- twiml = 'Hello from your Django app!'
- return HttpResponse(twiml+ '/n' + from_number, content_type='text/xml')
+ body = request.GET['Body']
+ results = searchRdio(body)
+
+ twiml = 'message of ' +body+ ' was recieved'
+ res.message("You're song "+results + "has been found")
+ return HttpResponse(twiml+ '/n' + results, content_type='text/xml')
+
+ def searchRdio(query):
+ rdio = Rdio(("WF00svqcVrTXHv3eHSQO1w"), ("FYAjVfujchx4eTCFAOD8ag"))
+ results = rdio.call("search", {"query" : query,
+ "types" : ["Track",],
+ "extras" : "isExplicit",
+ "count" : 1})
+ return results[0]