Videoob: download: replace data fields in video filename
This commit is contained in:
parent
9e735a740c
commit
cb411f4c54
1 changed files with 15 additions and 0 deletions
|
|
@ -87,6 +87,11 @@ class Videoob(ReplApplication):
|
|||
download ID [FILENAME]
|
||||
|
||||
Download a video
|
||||
|
||||
Braces-enclosed tags are replaced with data fields. Use the 'info'
|
||||
command to see what fields are available on a given video.
|
||||
|
||||
Example: download KdRRge4XYIo@youtube '{title}.{ext}'
|
||||
"""
|
||||
_id, dest = self.parse_command_args(line, 2, 1)
|
||||
video = self.get_object(_id, 'get_video', ['url'])
|
||||
|
|
@ -117,6 +122,16 @@ class Videoob(ReplApplication):
|
|||
|
||||
if dest is None:
|
||||
dest = video_to_file(video)
|
||||
else:
|
||||
fields = video.to_dict()
|
||||
def repl(m):
|
||||
field = m.group(1)
|
||||
if field in fields:
|
||||
return fields[field]
|
||||
else:
|
||||
return m.group(0)
|
||||
|
||||
dest = re.sub(r'\{(.+?)\}', repl, dest)
|
||||
|
||||
if video.url.startswith('rtmp'):
|
||||
if not check_exec('rtmpdump'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue