Permalink
Browse files

fixed string encoding errors

  • Loading branch information...
1 parent f75043e commit 4415c058a9abaa25124d4339bc7d4ae7d9dfa2cd carl committed Oct 30, 2011
Showing with 13 additions and 12 deletions.
  1. +7 −7 testPage.py
  2. +6 −5 tools/page.py
View
@@ -18,12 +18,12 @@
pageHandler = pages.getClass(link)
media = pageHandler.extract(link)
-for part in pageHandler.parts:
- for stream in part['streams']:
- pinfo = stream['pinfo']
- if not pinfo.title or not pinfo.stream_url:
- # this must be called before flv_url, else it won't work (a fix for this would cost more performance and more code)
- continue
- log.info('added "%s" to downloadqueue with "%s"' % (part['name'], stream['url']))
+#for part in pageHandler.parts:
+# for stream in part['streams']:
+# pinfo = stream['pinfo']
+# if not pinfo.title or not pinfo.stream_url:
+# # this must be called before flv_url, else it won't work (a fix for this would cost more performance and more code)
+# continue
+# log.info('added "%s" to downloadqueue with "%s"' % (part['name'], stream['url']))
print media
View
@@ -68,7 +68,7 @@ def __str__(self):
ret.append(indent*" "+self.name)
for part in self.parts:
part._indent = indent + 2
- ret.append(str(part))
+ ret.append(unicode(part))
return "\n".join(ret)
def createSub(self):
sub = Part(self)
@@ -92,7 +92,7 @@ def __str__(self):
ret.append(indent*" "+self.name)
for alt in self.alternatives:
alt._indent = indent+2
- ret.append(str(alt))
+ ret.append(unicode(alt))
return "\n".join(ret)
def createSub(self):
sub = Alternative(self)
@@ -106,19 +106,20 @@ def __init__(self, part):
self.part = part
self.alternativeParts = []
self._indent = 0 # used for printing
+ self.audio = ''
def __str__(self):
ret = []
indent = self._indent
ret.append(self._indent*" "+"Alt:")
if self.audio:
- ret.append(self._indent*" "+self.audio)
+ ret.append(self._indent*" "+str(self.audio))
if self.hoster:
ret.append(self._indent*" "+self.hoster)
if self.name:
ret.append(indent*" "+self.name)
for altP in self.alternativeParts:
altP._indent = indent+2
- ret.append(str(altP))
+ ret.append(unicode(altP))
return "\n".join(ret)
def createSub(self):
sub = AlternativePart(self)
@@ -142,5 +143,5 @@ def __str__(self):
if self.url:
ret.append(indent*" "+self.url)
if self.pinfo:
- ret.append(indent*" "+str(self.pinfo))
+ ret.append(indent*" "+unicode(self.pinfo))
return "\n".join(ret)

0 comments on commit 4415c05

Please sign in to comment.