aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorrzhxeo <rzhxeo@users.noreply.github.com>2013-08-28 06:23:33 -0700
committerrzhxeo <rzhxeo@users.noreply.github.com>2013-08-28 06:23:33 -0700
commit550bfd4cbd1236fdb02abf99a81fc52a2680a8dc (patch)
tree75d630414b74239c34ef3d6abae61ad0a99e18f1 /youtube_dl/utils.py
parent97b3656c2e37e45d556816b8f1f15c20d14f1acd (diff)
parent48ea9cea77e7ea24ee867027f03ca37dd1b935d8 (diff)
Merge pull request #1 from phihag/youporn-hd-pr
Allow changes to run under Python 3
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 59eeaf4a8..07b40da6c 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -708,3 +708,13 @@ class DateRange(object):
return self.start <= date <= self.end
def __str__(self):
return '%s - %s' % ( self.start.isoformat(), self.end.isoformat())
+
+
+def bytes_to_intlist(bs):
+ if not bs:
+ return []
+ if isinstance(bs[0], int): # Python 3
+ return list(bs)
+ else:
+ return [ord(c) for c in bs]
+