Skip blank lines in batch file -- fixes issue #9
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>
Sat, 25 Apr 2009 11:30:50 +0000 (13:30 +0200)
committerRicardo Garcia <sarbalap+freshmeat@gmail.com>
Sun, 31 Oct 2010 10:24:12 +0000 (11:24 +0100)
youtube-dl

index 8764acda0592df1c628b0a7d4dceeaa59d2b7394..e20e59bf8c3fda8d320803c83794d5697cbb24f0 100755 (executable)
@@ -997,7 +997,9 @@ if __name__ == '__main__':
                batchurls = []
                if opts.batchfile is not None:
                        try:
-                               batchurls = [line.strip() for line in open(opts.batchfile, 'r')]
+                               batchurls = open(opts.batchfile, 'r').readlines()
+                               batchurls = [x.strip() for x in batchurls]
+                               batchurls = [x for x in batchurls if len(x) > 0]
                        except IOError:
                                sys.exit(u'ERROR: batch file could not be read')
                all_urls = batchurls + args