aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>2008-07-22 10:00:43 +0200
committerRicardo Garcia <devnull@localhost>2008-07-22 10:00:43 +0200
commit05a84b35cc937952f86c0cf5b0accbd2a376ff93 (patch)
tree01f868f031d4199740655819bebb328f8b6113d6
parent7414bdf11d0382e1a7206caa9def3da999510b6b (diff)
Add forceurl and forcetitle downloader options
-rwxr-xr-xyoutube-dl18
1 files changed, 15 insertions, 3 deletions
diff --git a/youtube-dl b/youtube-dl
index 6a79bf93a..cc2ba4262 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -55,6 +55,8 @@ class FileDownloader(object):
password: Password for authentication purposes.
usenetrc: Use netrc for authentication instead.
quiet: Do not print messages to stdout.
+ forceurl: Force printing final URL.
+ forcetitle: Force printing title.
simulate: Do not download the video files.
format: Video format code.
outtmpl: Template for output names.
@@ -174,10 +176,18 @@ class FileDownloader(object):
if len(results) > 1 and self.fixed_template():
sys.exit('ERROR: fixed output name but more than one file to download')
- if self._params.get('simulate', False):
- continue
-
for result in results:
+
+ # Forced printings
+ if self._params.get('forcetitle', False):
+ print result['title']
+ if self._params.get('forceurl', False):
+ print result['url']
+
+ # Do nothing else if in simulate mode
+ if self._params.get('simulate', False):
+ continue
+
try:
filename = self._params['outtmpl'] % result
except (ValueError, KeyError), err:
@@ -450,6 +460,8 @@ if __name__ == '__main__':
'username': None,
'password': None,
'quiet': False,
+ 'forceurl': False,
+ 'forcetitle': False,
'simulate': False,
'format': None,
'outtmpl': '%(ext)s/%(ext)s/%(id)s.%(ext)s'