HLS-7: Implement use of getopt



Issue Information

Issue Type: New Feature
 
Priority: Major
Status: Closed

Reported By:
Ben Tasker
Assigned To:
Ben Tasker
Project: HLS Stream Creator (HLS)
Resolution: Done (2015-06-12 16:29:31)
Components: CLI Options ,

Created: 2015-06-11 12:07:16
Time Spent Working


Description
In order to allow more advanced configuration (such as specifying whether an input stream is linear, or to specify bitrates for an adaptive stream - HLS-6 ) probably need to switch over to using getopt rather than position in the argument list (given that some of the arguments are optional - output_directory being a prime example).

Need to maintain backwards-compatibility though, to ensure that scripts written around older revisions don't suddenly break completely.

As there's been no use of getopt so far, it should be as simple as running getopt, and if nothing is matched switch to using the old schema.


Issue Links

Toggle State Changes

Activity


Not sure why I didn't use getopt in the first place, though it was only originally ever intended as a quick and dirty script

Repo: HLS-Stream-Creator
Commit: 613a9b90b72f6e7cdea7dd0b37de5d04b04e533c
Author: Ben Tasker <github@<Domain Hidden>>

Date: Thu Jun 11 12:25:18 2015 +0100
Commit Message: Implemented getopt support, maintaining B/C for HLS-7



Modified (-)(+)
-------
HLS-Stream-Creator.sh




Webhook User-Agent

GitHub-Hookshot/99ae70d


View Commit


Repo: HLS-Stream-Creator
Commit: 0177e2285c7b08571438b33f181674ffe53f3300
Author: Ben Tasker <github@<Domain Hidden>>

Date: Thu Jun 11 12:26:36 2015 +0100
Commit Message: Updated README for HLS-7



Modified (-)(+)
-------
README.md




Webhook User-Agent

GitHub-Hookshot/99ae70d


View Commit

Have updated the script to use getopt

If no options are detected, the legacy input scheme is used instead, so older scripts should continue to work (though they'll not be able to use any option related features implemented in future).

If any option is detected, the legacy scheme won't be used and errors in input will be treated as an argument error. So for example, doing the following will simply print usage
./HLS-Stream-Creator.sh -i inputfile.avi 10 myoutputdir

Took the decision to do it that way, as including the -i changes the argument numbering and it seems silly to insert logic to try and unpick that when arguments should really be specified one way or the other.
btasker changed status from 'Open' to 'Resolved'
btasker added 'Done' to resolution
btasker changed status from 'Resolved' to 'Closed'
Re-opening to assign appropriate project component
btasker removed 'Done' from resolution
btasker changed status from 'Closed' to 'Reopened'
btasker changed status from 'Reopened' to 'Resolved'
btasker added 'Done' to resolution
btasker changed status from 'Resolved' to 'Closed'