1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-11-22 16:52:50 +08:00

Fix print_notes

This commit is contained in:
Philipp Hagemeister 2013-04-28 16:19:37 +02:00
parent fc63faf070
commit 46a127eecb

View File

@ -78,7 +78,7 @@ def update_self(to_screen, verbose, filename):
to_screen(u'Updating to version ' + versions_info['latest'] + '...') to_screen(u'Updating to version ' + versions_info['latest'] + '...')
version = versions_info['versions'][versions_info['latest']] version = versions_info['versions'][versions_info['latest']]
print_notes(versions_info['versions']) print_notes(to_screen, versions_info['versions'])
if not os.access(filename, os.W_OK): if not os.access(filename, os.W_OK):
to_screen(u'ERROR: no write permissions on %s' % filename) to_screen(u'ERROR: no write permissions on %s' % filename)
@ -157,11 +157,15 @@ del "%s"
to_screen(u'Updated youtube-dl. Restart youtube-dl to use the new version.') to_screen(u'Updated youtube-dl. Restart youtube-dl to use the new version.')
def print_notes(versions, fromVersion=__version__): def get_notes(versions, fromVersion):
notes = [] notes = []
for v,vdata in sorted(versions.items()): for v,vdata in sorted(versions.items()):
if v > fromVersion: if v > fromVersion:
notes.extend(vdata.get('notes', [])) notes.extend(vdata.get('notes', []))
return notes
def print_notes(to_screen, versions, fromVersion=__version__):
notes = get_notes(versions, fromVersion)
if notes: if notes:
to_screen(u'PLEASE NOTE:') to_screen(u'PLEASE NOTE:')
for note in notes: for note in notes: