aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>2010-05-21 21:35:34 +0200
committerRicardo Garcia <sarbalap+freshmeat@gmail.com>2010-10-31 11:27:01 +0100
commit2a7353b87a3c393250fa20e1911385d5a6559b51 (patch)
treeea3a314d6e2709412b6960c6365b65b156a8f4c0
parent787f2a5d9570bcbd94eae9d54ee2dfaeef1a7ad4 (diff)
downloadyoutube-dl-2a7353b87a3c393250fa20e1911385d5a6559b51.tar.xz
Make -a understand dash means stdin
-rwxr-xr-xyoutube-dl10
1 files changed, 7 insertions, 3 deletions
diff --git a/youtube-dl b/youtube-dl
index 0f1d31c4e..14f5d0b54 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -2010,7 +2010,7 @@ if __name__ == '__main__':
filesystem.add_option('-o', '--output',
dest='outtmpl', metavar='TPL', help='output filename template')
filesystem.add_option('-a', '--batch-file',
- dest='batchfile', metavar='F', help='file containing URLs to download')
+ dest='batchfile', metavar='F', help='file containing URLs to download (\'-\' for stdin)')
filesystem.add_option('-w', '--no-overwrites',
action='store_true', dest='nooverwrites', help='do not overwrite files', default=False)
filesystem.add_option('-c', '--continue',
@@ -2018,12 +2018,16 @@ if __name__ == '__main__':
parser.add_option_group(filesystem)
(opts, args) = parser.parse_args()
-
+
# Batch file verification
batchurls = []
if opts.batchfile is not None:
try:
- batchurls = open(opts.batchfile, 'r').readlines()
+ if opts.batchfile == '-':
+ batchfd = sys.stdin
+ else:
+ batchfd = open(opts.batchfile, 'r')
+ batchurls = batchfd.readlines()
batchurls = [x.strip() for x in batchurls]
batchurls = [x for x in batchurls if len(x) > 0]
except IOError: