make-playlist-page.sh 868 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. # we have run import/download-playlist.sh in $PLAYLIST_DIR
  3. # we have segmented each video in the playlist
  4. # there is a thumbnail for each downloaded video
  5. PLAYLIST_DIR="$1"
  6. NAME="$2"
  7. NAME=$(basename $PLAYLIST_DIR)
  8. PAGE_IDX=$(expr 1000 + `ls -l md-pages/playlist-*.md | wc -l`)
  9. cat <<EOM
  10. {:title "$NAME"
  11. :page-index $PAGE_IDX
  12. :layout :playlist
  13. :playlist-items [
  14. EOM
  15. VIDEOS=$( find $PLAYLIST_DIR -maxdepth 1 -type f -name *.mp4 \
  16. | xargs -n1 basename -s .mp4 )
  17. #echo $VIDEOS | xargs -n1 echo "VID"
  18. for vid in $VIDEOS; do
  19. cat <<EOM
  20. {:video-thumbnail-url "/media/videos/${NAME}/${vid}.jpg"
  21. :video-url "/media/videos/${NAME}/${vid}.hls/out.m3u8"
  22. :title "${vid}"
  23. :tags ["playlist" "playlist-${NAME}"]
  24. :url "/video-${vid}.html"}
  25. EOM
  26. done
  27. echo "]}"
  28. #sed -e 's/^/https:\/\/tinydatacenter\.com\//' | xargs -n1 curl -o /dev/null