mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-13 23:57:25 +08:00
Basic playlist generation logic.
This commit is contained in:
parent
7ac40086f5
commit
3273672854
@ -237,6 +237,7 @@ which means you can modify it, redistribute it or use it however you like.
|
||||
--write-info-json Write video metadata to a .info.json file
|
||||
--write-annotations Write video annotations to a
|
||||
.annotations.xml file
|
||||
--write-playlists Write playlists to .m3u files
|
||||
--load-info FILE JSON file containing the video information
|
||||
(created with the "--write-info-json"
|
||||
option)
|
||||
|
@ -835,6 +835,15 @@ class YoutubeDL(object):
|
||||
extra_info=extra)
|
||||
playlist_results.append(entry_result)
|
||||
ie_result['entries'] = playlist_results
|
||||
|
||||
if download and self.params.get('writeplaylists'):
|
||||
ie_result['ext'] = 'm3u'
|
||||
playlist_filename = self.prepare_filename(ie_result)
|
||||
playlist_file = open(playlist_filename, 'w')
|
||||
for entry in ie_result['entries']:
|
||||
filename = self.prepare_filename(entry)
|
||||
playlist_file.write(filename + '\n')
|
||||
|
||||
self.to_screen('[download] Finished downloading playlist: %s' % playlist)
|
||||
return ie_result
|
||||
elif result_type == 'compat_list':
|
||||
|
@ -320,6 +320,7 @@ def _real_main(argv=None):
|
||||
'write_all_thumbnails': opts.write_all_thumbnails,
|
||||
'writesubtitles': opts.writesubtitles,
|
||||
'writeautomaticsub': opts.writeautomaticsub,
|
||||
'writeplaylists': opts.writeplaylists,
|
||||
'allsubtitles': opts.allsubtitles,
|
||||
'listsubtitles': opts.listsubtitles,
|
||||
'subtitlesformat': opts.subtitlesformat,
|
||||
|
@ -643,6 +643,10 @@ def parseOpts(overrideArguments=None):
|
||||
'--write-annotations',
|
||||
action='store_true', dest='writeannotations', default=False,
|
||||
help='Write video annotations to a .annotations.xml file')
|
||||
filesystem.add_option(
|
||||
'--write-playlists',
|
||||
action='store_true', dest='writeplaylists', default=False,
|
||||
help='Write playlists to .m3u files')
|
||||
filesystem.add_option(
|
||||
'--load-info',
|
||||
dest='load_info_filename', metavar='FILE',
|
||||
|
Loading…
x
Reference in New Issue
Block a user