Changeset 37933
- Timestamp:
- 2023-08-13T22:05:53+12:00 (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-installations/thewillow/trunk/sites/thewillow/collect/community-contributions/prepare/04-PREP-VIDEOS.sh
r37867 r37933 3 3 cd the-willow-videos 4 4 5 echo "" 6 echo "----" 7 echo "Unzipping" 8 echo "----" 9 5 10 for video_zf in *.zip ; do 6 video_dir=${video_zf% .*}7 11 video_dir=${video_zf%%-*.*} 12 8 13 if [ ! -d "$video_dir" ] ; then 9 14 echo "Unzipping: $video_zf" … … 14 19 done 15 20 21 # Rename MP4 so it doesn't have ' (with subtitles') in it 22 echo "" 23 echo "----" 24 echo "Renaming MP4 videos" 25 echo "----" 26 27 for video_zf in *.zip ; do 28 video_dir=${video_zf%%-*.*} 29 30 src_mp4_file=$(ls "$video_dir/"*" (with subtitles)".mp4 2> /dev/null) 31 32 if [ "x$src_mp4_file" != "x" ] ; then 33 dst_mp4_file="${src_mp4_file% (with subtitles).mp4}.mp4" 34 echo "Renaming $src_mp4_file -> $dst_mp4_file" 35 /bin/mv "$src_mp4_file" "$dst_mp4_file" 36 else 37 echo "Skipping processing MP4 video in $video_dir, as already renamed" 38 fi 39 40 41 if [ "$video_dir" = "1 In The Beginning" ] ; then 42 if [ -d "$video_dir/thumbnails - in the beginning" ] ; then 43 echo " Fixing lowercase thumbnail directory for $video_dir" 44 /bin/mv "1 In The Beginning/thumbnails - in the beginning" "1 In The Beginning/Thumbnails - In the Beginning" 45 fi 46 fi 47 done 48 49 echo "" 50 echo "----" 51 echo "Processing Thumbnails to generate JSON files" 52 echo "----" 53 54 for video_zf in *.zip ; do 55 video_dir=${video_zf%%-*.*} 56 57 thumbnail_dir=$(ls -d "$video_dir/Thumbnails - "*) 58 assocfile_root=${thumbnail_dir##* - } 59 60 json_file="$video_dir/$assocfile_root.json" 61 62 if [ ! -f "$json_file" ] ; then 63 echo "Processing Thumbnail directory: $thumbnail_dir" 64 echo " ... for '$assocfile_root'" 65 66 num_thumbnails=$(ls "$thumbnail_dir/"*".png" | wc -l) 67 echo " Number matching PNGs: $num_thumbnails" 68 69 echo "[" > "$json_file" 70 71 i=0 72 for full_f in "$thumbnail_dir/"*".png" ; do 73 echo " [$i]: $full_f" 74 75 f=${full_f##*/} 76 timestamp_md=${f%% *} 77 78 label_with_ext=${f#* } 79 label_md=${label_with_ext%.png} 80 81 label_md=`echo $label_md | sed "s/we_re/we're/"` 82 83 echo " {" >> "$json_file" 84 echo " 'timestamp': '$timestamp_md'," >> "$json_file" 85 echo " 'label' : '$label_md'" >> "$json_file" 86 echo " }" >> "$json_file" 87 88 i=$((i+1)) 89 90 if [ $i -lt $num_thumbnails ] ; then 91 echo " ," >> "$json_file" 92 fi 93 done 94 echo "]" >> "$json_file" 95 else 96 echo "JSON file already exits => Skipping Thumbnail directory: $thumbnail_dir" 97 fi 98 99 100 done 101 102 103 echo "" 104 16 105 cd ..
Note:
See TracChangeset
for help on using the changeset viewer.