# Path: guitar_tabs/tab_grabber.py
# class TabGrabber(object):
# 
#     def __init__(self):
#         self.url = 'http://app.ultimate-guitar.com/search.php?search_type=title&page=1&iphone=1&value=%s'
# 
#     def search(self, keyword):
#         response = None
#         try:
#             tab_list = requests.get(self.url % keyword)
#             if tab_list.status_code == 200:
#                 tabs_list_obj = objectify.fromstring(tab_list.text.encode('utf-8'))
#                 response = tabs_list_obj.result[1].get('url')
#                 tab_req = requests.get(response)
#                 tab_content = tab_req.text
#                 if '[ch]' in tab_content:
#                     tab_content = tab_content.replace('[ch]', '')
#                     response = tab_content.replace('[/ch]', '')
#         except:
#             return response
#         return response


from django.views.generic import TemplateView
from django.shortcuts import render
from guitar_tabs.tab_grabber import TabGrabber
# -*- coding: utf-8 -*-



class GuitarTabsView(TemplateView):
    template_name = "guitar_tabs/tab.html"

    def get(self, request):

# Path: guitar_tabs/tab_grabber.py
# class TabGrabber(object):
# 
#     def __init__(self):
#         self.url = 'http://app.ultimate-guitar.com/search.php?search_type=title&page=1&iphone=1&value=%s'
# 
#     def search(self, keyword):
#         response = None
#         try:
#             tab_list = requests.get(self.url % keyword)
#             if tab_list.status_code == 200:
#                 tabs_list_obj = objectify.fromstring(tab_list.text.encode('utf-8'))
#                 response = tabs_list_obj.result[1].get('url')
#                 tab_req = requests.get(response)
#                 tab_content = tab_req.text
#                 if '[ch]' in tab_content:
#                     tab_content = tab_content.replace('[ch]', '')
#                     response = tab_content.replace('[/ch]', '')
#         except:
#             return response
#         return response


# Path: guitar_tabs/views.py
from django.views.generic import TemplateView
from django.shortcuts import render
from guitar_tabs.tab_grabber import TabGrabber

# -*- coding: utf-8 -*-



class GuitarTabsView(TemplateView):
    template_name = "guitar_tabs/tab.html"

    def get(self, request):

        tab_grabber = TabGrabber()