aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-08-28 14:28:55 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2013-08-28 14:34:49 +0200
commit48ea9cea77e7ea24ee867027f03ca37dd1b935d8 (patch)
tree75d630414b74239c34ef3d6abae61ad0a99e18f1 /youtube_dl/utils.py
parent97b3656c2e37e45d556816b8f1f15c20d14f1acd (diff)
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]
+