Created
January 2, 2012 02:00
-
-
Save me-vlad/1548975 to your computer and use it in GitHub Desktop.
youtube-dl Python 2.4 compatibility patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- youtube-dl.orig 2012-02-28 00:24:14.664150644 +0200 | |
+++ youtube-dl 2012-02-28 00:27:40.810150644 +0200 | |
@@ -55,6 +55,7 @@ | |
import email.utils | |
except ImportError: # Python 2.4 | |
import email.Utils | |
+ email.utils = email.Utils | |
try: | |
import cStringIO as StringIO | |
except ImportError: | |
@@ -74,7 +75,7 @@ | |
try: | |
import xml.etree.ElementTree | |
except ImportError: # Python<2.5: Not officially supported, but let it slip | |
- warnings.warn('xml.etree.ElementTree support is missing. Consider upgrading to Python >= 2.5 if you get related errors.') | |
+ from elementtree import ElementTree | |
std_headers = { | |
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:5.0.1) Gecko/20100101 Firefox/5.0.1', | |
@@ -1406,7 +1407,10 @@ | |
url_map = dict((ud['itag'][0], ud['url'][0]) for ud in url_data) | |
format_limit = self._downloader.params.get('format_limit', None) | |
- available_formats = self._available_formats_prefer_free if self._downloader.params.get('prefer_free_formats', False) else self._available_formats | |
+ if self._downloader.params.get('prefer_free_formats', False): | |
+ available_formats = self._available_formats_prefer_free | |
+ else: | |
+ available_formats = self._available_formats | |
if format_limit is not None and format_limit in available_formats: | |
format_list = available_formats[available_formats.index(format_limit):] | |
else: | |
@@ -4052,6 +4056,12 @@ | |
""" | |
return information # by default, do nothing | |
+ | |
+try: | |
+ BaseException | |
+except NameError: | |
+ # Python 2.4 compatibility | |
+ BaseException = Exception | |
class AudioConversionError(BaseException): | |
def __init__(self, message): | |
self.message = message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment