--- a/server/ammicosrv/ammico/utils.py Wed Dec 02 18:34:43 2015 +0100
+++ b/server/ammicosrv/ammico/utils.py Wed Dec 02 19:33:41 2015 +0100
@@ -1,4 +1,4 @@
-from html.parser import HTMLParser
+# from html.parser import HTMLParser
import json
from django.core.cache import cache
@@ -15,7 +15,7 @@
content = r.content
else:
# Write some proper error handling code here
- print ("Error - status code: " + r.status_code)
+ print ("Error - status code: " + r.status_code)
else:
# Return the cached content
content = cached
@@ -26,43 +26,43 @@
#Hopefully they'll update it because so far it's too slow
#to parse the xml and then the html..
#Better use extractFromJameSpot for now.
-class MyHTMLParser(HTMLParser):
-
- def __init__(self):
- self.starttag=''
- self.endtag=''
- self.audio=''
- self.video=''
- self.images=[]
- self.captions=[]
- self.description=''
- self.captionList=''
- HTMLParser.__init__(self)
-
- def handle_starttag(self, tag, attrs):
- if (self.starttag == 'audio' and tag == 'source'):
- for attr in attrs:
- if 'src' in attr:
- self.audio = attr[1]
- elif (tag == 'img'):
- for attr in attrs:
- if 'src' in attr:
- self.images.append(attr[1])
- elif (tag == 'video'):
- for attr in attrs:
- if 'poster' in attr:
- self.images.append(attr[1])
- if (self.starttag == 'video' and tag == 'source'):
- for attr in attrs:
- if 'src' in attr:
- self.video = attr[1]
- self.starttag = tag
- def handle_endtag(self, tag):
- self.tag = tag
- def handle_data(self, data):
- if ('Caption_image' in data):
- self.captionList = True
- elif (self.captionList == True):
- self.captions.append(data)
- else:
- self.description = data
\ No newline at end of file
+# class MyHTMLParser(HTMLParser):
+#
+# def __init__(self):
+# self.starttag=''
+# self.endtag=''
+# self.audio=''
+# self.video=''
+# self.images=[]
+# self.captions=[]
+# self.description=''
+# self.captionList=''
+# HTMLParser.__init__(self)
+#
+# def handle_starttag(self, tag, attrs):
+# if (self.starttag == 'audio' and tag == 'source'):
+# for attr in attrs:
+# if 'src' in attr:
+# self.audio = attr[1]
+# elif (tag == 'img'):
+# for attr in attrs:
+# if 'src' in attr:
+# self.images.append(attr[1])
+# elif (tag == 'video'):
+# for attr in attrs:
+# if 'poster' in attr:
+# self.images.append(attr[1])
+# if (self.starttag == 'video' and tag == 'source'):
+# for attr in attrs:
+# if 'src' in attr:
+# self.video = attr[1]
+# self.starttag = tag
+# def handle_endtag(self, tag):
+# self.tag = tag
+# def handle_data(self, data):
+# if ('Caption_image' in data):
+# self.captionList = True
+# elif (self.captionList == True):
+# self.captions.append(data)
+# else:
+# self.description = data