aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-08-28 12:57:10 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2013-08-28 12:57:10 +0200
commitc496ca96e7639e5dd0020074b7ada18c2bd4ae3e (patch)
tree0d97ce8d0b6d4bce77d1478e8708ccf155b38b74 /youtube_dl/utils.py
parentce6a696e4d964aeb27de46a31a899b28d7ca7754 (diff)
Fix platform name in Python 2 with --verbose (Closes #1228)
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index be788cf5a..64ab30910 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1,19 +1,20 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
+import datetime
+import email.utils
import errno
import gzip
import io
import json
import locale
import os
+import platform
import re
+import socket
import sys
import traceback
import zlib
-import email.utils
-import socket
-import datetime
try:
import urllib.request as compat_urllib_request
@@ -732,3 +733,13 @@ class DateRange(object):
return self.start <= date <= self.end
def __str__(self):
return '%s - %s' % ( self.start.isoformat(), self.end.isoformat())
+
+
+def platform_name():
+ """ Returns the platform name as a compat_str """
+ res = platform.platform()
+ if isinstance(res, bytes):
+ res = res.decode(preferredencoding())
+
+ assert isinstance(res, compat_str)
+ return res