#!/bin/bash
find ./ -type f | while read full
do
name=${full##*/}
mv -- "${full}" "${full%/*}/${name// /_}"
done

cat /dev/null > video.csv

array=(`find ./ -type f | grep -iv 'mp3' | grep  'new'`)
for i in "${array[@]}"
do :
str1="http://yogatriada.ru/av/tantra_triada/"
str2="$str1$i"
str3="${str2/"tantra_triada/."/tantra_triada}"
str4="&autostart=false&fullscreen=true\""
str5="$str3$str4"


 echo $str5 >> video.csv

done

 sort video.csv -o video.csv


declare -a myarray

# Load file into array.
readarray myarray < video.csv

day=$(date +%d)

if [ "${day}" -eq 01 ]

then
video="${myarray[0]}"
elif [ "${day}" -eq 02 ]
then
video="${myarray[1]}"
elif [ "${day}" -eq 03 ]
then
video="${myarray[2]}"
elif [ "${day}" -eq 04 ]
then
video="${myarray[3]}"
elif [ "${day}" -eq 05 ]
then
video="${myarray[4]}"
elif [ "${day}" -eq 06 ]
then
video="${myarray[5]}"
elif [ "${day}" -eq 07 ]
then
video="${myarray[6]}"
elif [ "${day}" -eq 08 ]
then
video="${myarray[7]}"
elif [ "${day}" -eq 09 ]
then
video="${myarray[8]}"
elif [ "${day}" -eq 10 ]
then
video="${myarray[9]}"
elif [ "${day}" -eq 11 ]
then
video="${myarray[10]}"
elif [ "${day}" -eq 12 ]
then
video="${myarray[11]}"
elif [ "${day}" -eq 13 ]
then
video="${myarray[12]}"
elif [ "${day}" -eq 14 ]
then
video="${myarray[13]}"
elif [ "${day}" -eq 15 ]
then
video="${myarray[14]}"
elif [ "${day}" -eq 16 ]
then
video="${myarray[15]}"
elif [ "${day}" -eq 17 ]
then
video="${myarray[16]}"
elif [ "${day}" -eq 18 ]
then
video="${myarray[17]}"
elif [ "${day}" -eq 19 ]
then
video="${myarray[18]}"
elif [ "${day}" -eq 20 ]
then
video="${myarray[19]}"
elif [ "${day}" -eq 21 ]
then
video="${myarray[20]}"
elif [ "${day}" -eq 22 ]
then
video="${myarray[21]}"
elif [ "${day}" -eq 23 ]
then
video="${myarray[22]}"
elif [ "${day}" -eq 24 ]
then
video="${myarray[23]}"
elif [ "${day}" -eq 25 ]
then
video="${myarray[24]}"
elif [ "${day}" -eq 26 ]
then
video="${myarray[25]}"
elif [ "${day}" -eq 27 ]
then
video="${myarray[26]}"
elif [ "${day}" -eq 28 ]
then
video="${myarray[27]}"
elif [ "${day}" -eq 29 ]
then
video="${myarray[28]}"
elif [ "${day}" -eq 30 ]
then
video="${myarray[29]}"
elif [ "${day}" -eq 31 ]
then
video="${myarray[30]}"
fi
# Explicitly report array content.
    printf "$video"
cat <<EOF > /home4/yoga/public_html/dailyvideo.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">
			<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  
		<body>
	<center>
<object type="application/x-shockwave-flash"
data="http://openyoga.ru/plugins/content/jw_allvideos/players/mediaplayer_4.0.46.swf" style="width: 740px; height: 390px;">
<param value="http://openyoga.ru/plugins/content/jw_allvideos/players/mediaplayer_4.0.46.swf" name="movie" />
<param value="high" name="quality" />
<param value="transparent" name="wmode" />
<param name="bgcolor" />
<param value="false" name="autoplay" />
<param value="true" name="allowfullscreen" /><param value="always" name="allowscriptaccess" />
<param value="file=$video name="flashvars" />
</object>
	</center>
		</body>
			</html>

EOF

