import-playlist.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. PLAYLIST_ID=${1:-"PLD5lYPY-uZpq7x2zRIiULo2oZ-tWs2lPx"}
  3. NAME=${2:-"Random"}
  4. TINYDC=$HOME/tinydatacenter
  5. ISPOOGE=$TINYDC/ispooge.com-v2
  6. ISPOOGE_MEDIA=$HOME/ispooge-media
  7. PLAYLIST=$ISPOOGE_MEDIA/videos/$NAME
  8. echo "Playlist: $PLAYLIST"
  9. mkdir -p $PLAYLIST
  10. cd $PLAYLIST
  11. #$ISPOOGE/scripts/import/download-playlist.sh $PLAYLIST_ID
  12. ls -la
  13. VIDEOS=$( find $PLAYLIST -maxdepth 1 -type d -name "*.hls" \
  14. | xargs -n1 basename -s ".hls" )
  15. for vid in $VIDEOS; do
  16. cd $PLAYLIST
  17. hls="${PLAYLIST}/${vid}.hls"
  18. echo "HLS: $hls"
  19. if [ ! -d $hls ]; then
  20. # delete .hls dir if it gets inturrupted
  21. vid_file="${PLAYLIST}/${vid}.mp4"
  22. echo "segment $hls / $vid_file"
  23. mkdir -p $hls
  24. cd $hls
  25. #$ISPOOGE/scripts/import/segment-video.sh $vid_file
  26. fi
  27. cd $ISPOOGE
  28. pdate=`date +%Y-%m-%d` # todo get from video metadata
  29. scripts/import/make-video-page.sh $vid $NAME > "md-posts/${pdate}-video-${vid}.md"
  30. done
  31. cd $ISPOOGE
  32. pdate=`date +%Y-%m-%d` # todo get from playlist metadata
  33. scripts/import/make-playlist-page.sh $PLAYLIST $NAME > "md-posts/${pdate}-playlist-${NAME}.md"