Add some parentheses around print for #180

This commit is contained in:
Philipp Hagemeister 2012-11-26 04:05:54 +01:00
parent 6b50761222
commit 51937c0869
4 changed files with 17 additions and 20 deletions

View File

@ -364,17 +364,17 @@ def process_info(self, info_dict):
# Forced printings # Forced printings
if self.params.get('forcetitle', False): 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): 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: 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: 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: 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): 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 # Do nothing else if in simulate mode
if self.params.get('simulate', False): if self.params.get('simulate', False):

View File

@ -213,9 +213,9 @@ def _closed_captions_xml_to_srt(self, xml_string):
return srt return srt
def _print_formats(self, formats): def _print_formats(self, formats):
print 'Available formats:' print('Available formats:')
for x in 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): def _real_initialize(self):
if self._downloader is None: if self._downloader is None:
@ -2796,15 +2796,15 @@ def check_urls(self, url_list):
return None return None
def _print_formats(self, formats): def _print_formats(self, formats):
print 'Available formats:' print('Available formats:')
for fmt in formats.keys(): for fmt in formats.keys():
for b in formats[fmt]: for b in formats[fmt]:
try: try:
ext = formats[fmt][b][0] 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 except TypeError: # we have no bitrate info
ext = formats[fmt][0] 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 break
def _real_extract(self, url): def _real_extract(self, url):

View File

@ -79,14 +79,12 @@ def updateSelf(downloader, filename):
try: try:
bat = os.path.join(directory, 'youtube-dl-updater.bat') bat = os.path.join(directory, 'youtube-dl-updater.bat')
b = open(bat, 'w') b = open(bat, 'w')
b.write("""
print >> b, """
echo Updating youtube-dl... echo Updating youtube-dl...
ping 127.0.0.1 -n 5 -w 1000 > NUL ping 127.0.0.1 -n 5 -w 1000 > NUL
move /Y "%s.new" "%s" move /Y "%s.new" "%s"
del "%s" del "%s"
""" %(exe, exe, bat) \n""" %(exe, exe, bat))
b.close() b.close()
os.startfile(bat) os.startfile(bat)

View File

@ -83,7 +83,6 @@ def __init__(self, id):
HTMLParser.HTMLParser.__init__(self) HTMLParser.HTMLParser.__init__(self)
def error(self, message): def error(self, message):
#print >> sys.stderr, self.getpos()
if self.error_count > 10 or self.started: if self.error_count > 10 or self.started:
raise HTMLParser.HTMLParseError(message, self.getpos()) raise HTMLParser.HTMLParseError(message, self.getpos())
self.rawdata = '\n'.join(self.html.split('\n')[self.getpos()[0]:]) # skip one line self.rawdata = '\n'.join(self.html.split('\n')[self.getpos()[0]:]) # skip one line