Adjust manifest filename in encryption. See HLS-20 and #15
Adjust manifest filename in encryption. See HLS-20 and #15

The encrypt function assumed a single bitrate stream (not generated using a -b argument), have changed the way manifest files are located when we write key information into them.

Could be improved - we'll currently write into the master playlist too, which is harmless but unnecessary. Just didn't seem worth putting a check in to stop it

--- a/HLS-Stream-Creator.sh
+++ b/HLS-Stream-Creator.sh
@@ -236,8 +236,13 @@
         count=$((count+1))
     done
 
-    # Insert the KEY at the 5'th line in the m3u8 file
-    sed -i "5i #EXT-X-KEY:METHOD=AES-128,URI="${PLAYLIST_PREFIX}.key "$OUTPUT_DIRECTORY/${PLAYLIST_PREFIX}.m3u8"
+    
+    # this isn't technically correct as we needn't write into the master, but should still work
+    for manifest in ${OUTPUT_DIRECTORY}/*.m3u8
+    do
+        # Insert the KEY at the 5'th line in the m3u8 file
+        sed -i "5i #EXT-X-KEY:METHOD=AES-128,URI="${PLAYLIST_PREFIX}.key "$manifest"
+    done
 }
 
 # This is used internally, if the user wants to specify their own flags they should be