Partial fix for #15 and HLS-20
Partial fix for #15 and HLS-20

This commit adjusts the code path when bitrates are specified on the command line. to ensure that encrypt is called (wasn't before)

A second fix is needed to the manifest rewrite as it is currently looking for the wrong file (unless bitrates haven't been specified)

--- a/HLS-Stream-Creator.sh
+++ b/HLS-Stream-Creator.sh
@@ -208,6 +208,14 @@
 
 function encrypt(){
 # Encrypt the generated segments with AES-128 bits
+
+
+    # Only run the encryption routine if it's been enabled  (and not blocked)
+    if [ ! "$ENCRYPT" == "1" ] || [ "$LIVE_STREAM" == "1" ]
+    then
+        return
+    fi
+
 
     KEY_FILE="$OUTPUT_DIRECTORY/${PLAYLIST_PREFIX}.key"
 
@@ -423,6 +431,9 @@
 	    # Monitor the background tasks for completion
 	    echo "All transcoding processes started, awaiting completion"
 	    awaitCompletion
+	    
+	    # As of HLS-20 encrypt will only run if the relevant vars are set
+	    encrypt
       fi
 
       if [ "$IS_FIFO" == "1" ]
@@ -450,10 +461,7 @@
 
   createStream "$PLAYLIST_NAME" "$OUT_NAME" "$BITRATE" "$INPUTFILE"
 
-
-  if [ "$ENCRYPT" == "1" ] && [ "$LIVE_STREAM" == "0" ]
-  then
-    encrypt
-  fi
-fi
-
+  # As of HLS-20 encrypt will only run if the relevant vars are set
+  encrypt
+fi
+