-
Notifications
You must be signed in to change notification settings - Fork 0
/
tabgetter.py
28 lines (23 loc) · 1.07 KB
/
tabgetter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import tabs
class GuitarTabGetter(object):
@classmethod
def get_class_for_url(cls, url):
for class_ in (tabs.GuitarTabFromUltimateGuitar,
tabs.GuitarTabFromGuitarTabDotCom,
tabs.GuitarTabFromTabs4Acoustic,
tabs.GuitarTabFromGuitarTabsDotCc,
tabs.GuitarTabFromEChords,
tabs.GuitarTabFromSongsterr,
tabs.GuitarTabFromAzChords,
tabs.GuitarTabFromBoiteAChansons,
tabs.GuitarTabFromGuitarTabsExplorer):
for prefix in class_.prefixes:
if url.startswith(prefix):
return class_
raise Exception("Unsupported URL %s" % url)
@classmethod
def from_url(cls, url, log_prefix, use_fake_data):
return cls.get_class_for_url(url).from_url(url, log_prefix, use_fake_data)
@classmethod
def from_list_url(cls, url, log_prefix, use_fake_data):
return cls.get_class_for_url(url).from_list_url(url, log_prefix, use_fake_data)