Browse Source

print some version and environment info on --verbose (+ py3 fixes)

Filippo Valsorda 12 years ago
parent
commit
4e38899e97
4 changed files with 16 additions and 4 deletions
  1. 1 1
      README.md
  2. 1 1
      youtube-dl
  3. 13 2
      youtube_dl/__init__.py
  4. 1 0
      youtube_dl/version.py

+ 1 - 1
README.md

@@ -196,7 +196,7 @@ Bugs and suggestions should be reported at: <https://github.com/rg3/youtube-dl/i
 
 Please include:
 
-* Your exact command line, like `youtube-dl -t "http://www.youtube.com/watch?v=uHlDtZ6Oc3s&feature=channel_video_title"`. A common mistake is not to escape the `&`. Putting URLs in quotes should solve this problem.
+* Your exact command line, like `youtube-dl -t "http://www.youtube.com/watch?v=uHlDtZ6Oc3s&feature=channel_video_title"`. If possible re-run the command with `--verbose`, it is really helpful. A common mistake is not to escape the `&`. Putting URLs in quotes should solve this problem.
 * The output of `youtube-dl --version`
 * The output of `python --version`
 * The name and version of your Operating System ("Ubuntu 11.04 x64" or "Windows 7 x64" is usually enough).

+ 1 - 1
youtube-dl

@@ -64,7 +64,7 @@ if not 'signature' in versions_info:
     sys.exit(u'ERROR: the versions file is not signed or corrupted. Aborting.')
 signature = versions_info['signature']
 del versions_info['signature']
-if not rsa_verify(json.dumps(versions_info, sort_keys=True), signature, UPDATES_RSA_KEY):
+if not rsa_verify(json.dumps(versions_info, sort_keys=True).encode('utf-8'), signature, UPDATES_RSA_KEY):
     sys.exit(u'ERROR: the versions file signature is invalid. Aborting.')
 
 version = versions_info['versions'][versions_info['latest']]

+ 13 - 2
youtube_dl/__init__.py

@@ -34,9 +34,10 @@ import socket
 import subprocess
 import sys
 import warnings
+import platform
 
 from .utils import *
-from .version import __version__
+from .version import __version__, __version_codename__
 from .FileDownloader import *
 from .InfoExtractors import *
 from .PostProcessor import *
@@ -81,7 +82,7 @@ def update_self(to_screen, verbose, filename):
         return
     signature = versions_info['signature']
     del versions_info['signature']
-    if not rsa_verify(json.dumps(versions_info, sort_keys=True), signature, UPDATES_RSA_KEY):
+    if not rsa_verify(json.dumps(versions_info, sort_keys=True).encode('utf-8'), signature, UPDATES_RSA_KEY):
         to_screen(u'ERROR: the versions file signature is invalid. Aborting.')
         return
 
@@ -602,6 +603,16 @@ def _real_main():
         })
 
     if opts.verbose:
+        fd.to_screen(u'[debug] youtube-dl version %s - %s' %(__version__, __version_codename__))
+        try:
+            sp = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+            out, err = sp.communicate()
+            out = out.decode().strip()
+            if re.match('[0-9a-f]+', out):
+                fd.to_screen(u'[debug] Git HEAD: ' + out)
+        except:
+            pass
+        fd.to_screen(u'[debug] Python version %s - %s' %(platform.python_version(), platform.platform()))
         fd.to_screen(u'[debug] Proxy map: ' + str(proxy_handler.proxies))
 
     for extractor in extractors:

+ 1 - 0
youtube_dl/version.py

@@ -1,2 +1,3 @@
 
 __version__ = '2012.12.11'
+__version_codename__ = ''