From 60786749ec3c3ba12ad116f4f71fcda58fa1dc18 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 15 Nov 2018 12:10:59 +0000 Subject: [PATCH] pass output filename --- edit.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/edit.py b/edit.py index 301760d..f4ccfdf 100755 --- a/edit.py +++ b/edit.py @@ -146,6 +146,9 @@ if __name__ == '__main__': parser.add_argument('-c', '--config', dest='config', help='config.json containing config', default='~/.ox/client.json') + parser.add_argument('-o', '--output', dest='output', + help='json output', + default='') parser.add_argument('url', metavar='url', type=str, help='edit url') opts = parser.parse_args() @@ -255,9 +258,12 @@ if __name__ == '__main__': if not use_local: cache_clips(api, videos, use_source, use_pandora) - name = normalize(edit_id) - if sort_by != 'year': - name += '_' + sort_by + if opts.output: + name = opts.output.replace('.json', '') + else: + name = normalize(edit_id) + if sort_by != 'year': + name += '_' + sort_by if subtitles: with open('%s.srt' % name, 'wb') as fd: fd.write(ox.srt.encode(subtitles))