]> git.bitcoin.ninja Git - youtube-dl/commitdiff
Add some parentheses around print for #180
authorPhilipp Hagemeister <phihag@phihag.de>
Mon, 26 Nov 2012 03:05:54 +0000 (04:05 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Mon, 26 Nov 2012 03:05:54 +0000 (04:05 +0100)
youtube_dl/FileDownloader.py
youtube_dl/InfoExtractors.py
youtube_dl/__init__.py
youtube_dl/utils.py

index 08bd83354930921c14a52ee38820852386e47c0e..9feff9bb0d0fc674c80f82ede0e6236bbca7a373 100644 (file)
@@ -364,17 +364,17 @@ class FileDownloader(object):
 
                # Forced printings
                if self.params.get('forcetitle', False):
-                       print info_dict['title'].encode(preferredencoding(), 'xmlcharrefreplace')
+                       print(info_dict['title'].encode(preferredencoding(), 'xmlcharrefreplace'))
                if self.params.get('forceurl', False):
-                       print info_dict['url'].encode(preferredencoding(), 'xmlcharrefreplace')
+                       print(info_dict['url'].encode(preferredencoding(), 'xmlcharrefreplace'))
                if self.params.get('forcethumbnail', False) and 'thumbnail' in info_dict:
-                       print info_dict['thumbnail'].encode(preferredencoding(), 'xmlcharrefreplace')
+                       print(info_dict['thumbnail'].encode(preferredencoding(), 'xmlcharrefreplace'))
                if self.params.get('forcedescription', False) and 'description' in info_dict:
-                       print info_dict['description'].encode(preferredencoding(), 'xmlcharrefreplace')
+                       print(info_dict['description'].encode(preferredencoding(), 'xmlcharrefreplace'))
                if self.params.get('forcefilename', False) and filename is not None:
-                       print filename.encode(preferredencoding(), 'xmlcharrefreplace')
+                       print(filename.encode(preferredencoding(), 'xmlcharrefreplace'))
                if self.params.get('forceformat', False):
-                       print info_dict['format'].encode(preferredencoding(), 'xmlcharrefreplace')
+                       print(info_dict['format'].encode(preferredencoding(), 'xmlcharrefreplace'))
 
                # Do nothing else if in simulate mode
                if self.params.get('simulate', False):
index d2d8d7b778107e0321bd7b684bc89ec19a88de0b..13cf034ef4b77e133192ea3e843f1a8f3794f4a2 100644 (file)
@@ -213,9 +213,9 @@ class YoutubeIE(InfoExtractor):
                return srt
 
        def _print_formats(self, formats):
-               print 'Available formats:'
+               print('Available formats:')
                for x in formats:
-                       print '%s\t:\t%s\t[%s]' %(x, self._video_extensions.get(x, 'flv'), self._video_dimensions.get(x, '???'))
+                       print('%s\t:\t%s\t[%s]' %(x, self._video_extensions.get(x, 'flv'), self._video_dimensions.get(x, '???')))
 
        def _real_initialize(self):
                if self._downloader is None:
@@ -2796,15 +2796,15 @@ class MixcloudIE(InfoExtractor):
                return None
 
        def _print_formats(self, formats):
-               print 'Available formats:'
+               print('Available formats:')
                for fmt in formats.keys():
                        for b in formats[fmt]:
                                try:
                                        ext = formats[fmt][b][0]
-                                       print '%s\t%s\t[%s]' % (fmt, b, ext.split('.')[-1])
+                                       print('%s\t%s\t[%s]' % (fmt, b, ext.split('.')[-1]))
                                except TypeError: # we have no bitrate info
                                        ext = formats[fmt][0]
-                                       print '%s\t%s\t[%s]' % (fmt, '??', ext.split('.')[-1])
+                                       print('%s\t%s\t[%s]' % (fmt, '??', ext.split('.')[-1]))
                                        break
 
        def _real_extract(self, url):
index ee6de6237aa7f58012218fd2651ced4450c51c7d..bf4b55f4817514c1bceca9d17fe90e04f8587681 100644 (file)
@@ -48,7 +48,7 @@ from PostProcessor import *
 def updateSelf(downloader, filename):
        ''' Update the program file with the latest version from the repository '''
        # Note: downloader only used for options
-       
+
        if not os.access(filename, os.W_OK):
                sys.exit('ERROR: no write permissions on %s' % filename)
 
@@ -66,7 +66,7 @@ def updateSelf(downloader, filename):
                directory = os.path.dirname(exe)
                if not os.access(directory, os.W_OK):
                        sys.exit('ERROR: no write permissions on %s' % directory)
-                       
+
                try:
                        urlh = urllib2.urlopen(UPDATE_URL_EXE)
                        newcontent = urlh.read()
@@ -75,20 +75,18 @@ def updateSelf(downloader, filename):
                                outf.write(newcontent)
                except (IOError, OSError), err:
                        sys.exit('ERROR: unable to download latest version')
-                       
+
                try:
                        bat = os.path.join(directory, 'youtube-dl-updater.bat')
                        b = open(bat, 'w')
-                       
-                       print >> b, """
+                       b.write("""
 echo Updating youtube-dl...
 ping 127.0.0.1 -n 5 -w 1000 > NUL
 move /Y "%s.new" "%s"
 del "%s"
-                       """ %(exe, exe, bat)
-                       
+                       \n""" %(exe, exe, bat))
                        b.close()
-                       
+
                        os.startfile(bat)
                except (IOError, OSError), err:
                        sys.exit('ERROR: unable to overwrite current version')
index 56d0461456fe7e96a259100d7e60bdf2f1dc87a2..6f53337d49496561cada56ed149866fa4f949c0e 100644 (file)
@@ -83,7 +83,6 @@ class IDParser(HTMLParser.HTMLParser):
                HTMLParser.HTMLParser.__init__(self)
 
        def error(self, message):
-               #print >> sys.stderr, self.getpos()
                if self.error_count > 10 or self.started:
                        raise HTMLParser.HTMLParseError(message, self.getpos())
                self.rawdata = '\n'.join(self.html.split('\n')[self.getpos()[0]:]) # skip one line