From 7311fef854632130af5edcae7f6762f0fedbaccb Mon Sep 17 00:00:00 2001 From: Gino Lisignoli Date: Wed, 13 Feb 2013 14:02:31 +1300 Subject: Modified youtube-dl to write new lines with the --newline switch. This enables easier process monitoring when being called with external scripts. --- youtube_dl/FileDownloader.py | 5 ++++- youtube_dl/__init__.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py index 4f51ed8b0..ca047ba4c 100644 --- a/youtube_dl/FileDownloader.py +++ b/youtube_dl/FileDownloader.py @@ -305,7 +305,10 @@ class FileDownloader(object): """Report download progress.""" if self.params.get('noprogress', False): return - self.to_screen(u'\r[download] %s of %s at %s ETA %s' % + if self.params.get('newline', True): + self.to_screen(u'\r[download] %s of %s at %s ETA %s' % + (percent_str, data_len_str, speed_str, eta_str)) + else: self.to_screen(u'\r[download] %s of %s at %s ETA %s' % (percent_str, data_len_str, speed_str, eta_str), skip_eol=True) self.to_cons_title(u'youtube-dl - %s of %s at %s ETA %s' % (percent_str.strip(), data_len_str.strip(), speed_str.strip(), eta_str.strip())) diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index abcb4f165..38b5fb163 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -202,6 +202,8 @@ def parseOpts(): verbosity.add_option('--get-format', action='store_true', dest='getformat', help='simulate, quiet but print output format', default=False) + verbosity.add_option('--newline', + action='store_true', dest='newline', help='Output progress bar as new lines', default=False) verbosity.add_option('--no-progress', action='store_true', dest='noprogress', help='do not print progress bar', default=False) verbosity.add_option('--console-title', @@ -210,7 +212,6 @@ def parseOpts(): verbosity.add_option('-v', '--verbose', action='store_true', dest='verbose', help='print various debugging information', default=False) - filesystem.add_option('-t', '--title', action='store_true', dest='usetitle', help='use title in file name', default=False) filesystem.add_option('--id', -- cgit v1.2.3 From 1528d6642d327571c1cd92a681deb819c41b5d67 Mon Sep 17 00:00:00 2001 From: Gino Lisignoli Date: Wed, 13 Feb 2013 16:43:08 +1300 Subject: Forgot to remove \r --- youtube-dl | Bin 3447 -> 59506 bytes youtube_dl/FileDownloader.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube-dl b/youtube-dl index e6f05c173..ef9f33241 100755 Binary files a/youtube-dl and b/youtube-dl differ diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py index ca047ba4c..7ad9d9a76 100644 --- a/youtube_dl/FileDownloader.py +++ b/youtube_dl/FileDownloader.py @@ -306,7 +306,7 @@ class FileDownloader(object): if self.params.get('noprogress', False): return if self.params.get('newline', True): - self.to_screen(u'\r[download] %s of %s at %s ETA %s' % + self.to_screen(u'[download] %s of %s at %s ETA %s' % (percent_str, data_len_str, speed_str, eta_str)) else: self.to_screen(u'\r[download] %s of %s at %s ETA %s' % (percent_str, data_len_str, speed_str, eta_str), skip_eol=True) -- cgit v1.2.3 From 380a29dbf7c504dec4999f5bd18aaa7eeaf88ac9 Mon Sep 17 00:00:00 2001 From: glisignoli Date: Fri, 15 Feb 2013 15:55:11 +1300 Subject: Update youtube_dl/__init__.py --- youtube_dl/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index 38b5fb163..035ab110c 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -203,7 +203,7 @@ def parseOpts(): action='store_true', dest='getformat', help='simulate, quiet but print output format', default=False) verbosity.add_option('--newline', - action='store_true', dest='newline', help='Output progress bar as new lines', default=False) + action='store_true', dest='newline', help='output progress bar as new lines', default=False) verbosity.add_option('--no-progress', action='store_true', dest='noprogress', help='do not print progress bar', default=False) verbosity.add_option('--console-title', -- cgit v1.2.3 From 355fc8e9443b991819b5ebf95464894bd131126c Mon Sep 17 00:00:00 2001 From: glisignoli Date: Fri, 15 Feb 2013 15:57:40 +1300 Subject: Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a14dac9f4..7c09d0c0d 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ which means you can modify it, redistribute it or use it however you like. --get-description simulate, quiet but print video description --get-filename simulate, quiet but print output filename --get-format simulate, quiet but print output format + --newline output progress bar as new lines --no-progress do not print progress bar --console-title display progress in console titlebar -v, --verbose print various debugging information -- cgit v1.2.3