ここの記述は仕様変更により古くなり利用できません。 GetAsf.sh †スクリプト内容を説明していきます。 まずは引数チェックといろいろな変数の設定を行います。 #!/bin/sh export PATH=$PATH:/home/users/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/\usr/local/sbin:/usr/local/bin export LD_LIBRARY_PATH=/home/users/lib export PERL5LIB=/home/users/lib/perl5/lib/perl5:/home/users/lib/perl5/lib/perl5/perl5/i386-freebsd-64int # args check if [ $# -ne 8 ]; then echo "usage : $0 OUTFILE_SUFFIX REC_TIME(s) "\ "STREAM(V/A) UPLOAD(0/1) COMMENT DL_PASS RM_PASS BIWEEK(0/1)" exit 1; fi SUFFIX=$1 REC_TIME=$2 STREAM=$3 UPLOAD_F=$4 COMMENT=$5 DL_PASS=$6 RM_PASS=$7 BIWEEK_F=$8 rtspurl="rtsp://1134mb-live3.daijinakoto.com/uniqueradio%5C2ch_movie" ftpaccount_pass=xxxxx:passpass; ftpurl="ftp://ftp.4shared.com"; #posturl="http://www6.puny.jp/uploader2/upload/"; working_dir=/home/users/REC posted_dir=/home/users/000 check_biweek_dir=/home/users/100 sid='*****DRM-KEY SID*****' # 23,24行目でftpアップロードするためのID,password,URLを設定しています。
とコロンで区切って入れてください。 now=`date '+%Y-%m-%d-%H%M'`; comment_date=`date '+%m%d'`; ftpdir=Public/Radio/`date '+%Y-%m'`; check_date=`date -v -1w '+%Y-%m-%d-%H%M'`; check_file=$check_date-fix-$SUFFIX.asf if ( [ $BIWEEK_F -eq 9 ] ); then today=`date -v -6H '+%d'`; weekly=`date -v -6H '+%u'`; checkmonday=$(expr $today - $weekly + 1); if ( [ $checkmonday -le 0 ] ); then exit 0; fi if ( [ $checkmonday -ge 8 ] && [ $checkmonday -le 14 ] ); then exit 0; fi if ( [ $checkmonday -ge 22 ] && [ $checkmonday -le 28 ] ); then exit 0; fi fi if ( [ $BIWEEK_F -eq 1 ] && [ -f $check_biweek_dir/$check_file ] ); then rm -f $check_biweek_dir/$check_file; exit 0; fi # ここではこれであっているのかわからないですが隔週、月2回放送に対応するためのロジックを書いてあります。 cd $working_dir outfile=$now-$1.asf; outasffile=$now-fix-$1.asf; upfile=$now-fix-$1-AG.asf.zip; [ $BIWEEK_F -eq 1 ] && touch "$check_biweek_dir/$outasffile"; ##### msdlretry=0; while : do roundrobbin=`date '+%S'`; index=$(expr $roundrobbin % 4); index=$(expr $index + 1); rtspurl=rtsp://1134mb-live${index}.daijinakoto.com/uniqueradio%5C2ch_movie msdl -a 10 -q --stream-timeout $REC_TIME \ -o $working_dir/$outfile \ $rtspurl if ( [ $? -eq 0 ] ); then break; fi msdlretry=$(expr $msdlretry + 1); if ( [ $msdlretry -ge 5 ] ); then echo "MSDL ERROR"; exit 1; fi # echo $rtspurl $msdlretry; sleep 5; done #### echo $sid | FreeMe2 2 $outfile 2>/dev/null #### 66行目で隔週用の「保存した印」ファイルを作っておきます。 if ( [ $STREAM = 'V' -o $STREAM = 'v' ] ); then wine asfbin -q -i Freed-$outfile -o $outasffile>/dev/null; else wine asfbin -q -nostr 2 -i Freed-$outfile -o $outasffile>/dev/null; fi rm -f $outfile Freed-$outfile #zip -q -P $DL_PASS $upfile $outasffile gpg --options /home/users/.gnupg/opt.txt $outasffile ##### posturl=`PostURL.pl $upfile`; if ( [ $posturl = 'NONE' ] ); then UPLOAD_F=0; fi if ( [ $UPLOAD_F -eq 1 ] ); then tmpfile=/tmp/aaa.$$ curl -s \ -F "file=@$upfile;type=application/x-zip-compressed" \ -F "comment=$COMMENT-$comment_date" \ -F "download_pass=$DL_PASS" \ -F "remove_pass=$RM_PASS" \ -F 'code_pat=京' \ --retry 5 \ --retry-delay 10 \ $posturl >$tmpfile echo $posturl > $posted_dir/$upfile GetId.pl $tmpfile > $posted_dir/$upfile.info rm -f $tmpfile; POSTURL=`cat $posted_dir/$upfile | sed 's/\/upload\//\/download\//'` ID=`cat $posted_dir/$upfile.info` TW.pl "[$upfile] is uploaded. $POSTURL$ID.zip" >/dev/null fi ###### DB=/home/users/.gnupg/Sessionkeys.db key=`gpg -o /dev/null --batch --show-session-key $outasffile.gpg 2>&1| perl -ne 'print $1 if (/gpg: session key:\s+.(\w+:\w+)/)'` sqlite3 $DB "insert into sKey values('$outasffile.gpg', '$key');" Update-crk.sh $working_dir/$outasffile.gpg curl -s \ -T "$outasffile.gpg" \ -u "$ftpaccount_pass" \ --retry 20 \ --retry-delay 10 \ --connect-timeout 300 \ --ftp-create-dirs \ $ftpurl/$ftpdir/ >/dev/null TW.pl "[$outasffile.gpg] is uploaded." >/dev/null rm -f $upfile $outasffile.gpg exit 0; 94行目で動画付きかどうかでasfbinの動作をかえています。音声放送であれば音声だけ抜き取ります。
情報がおかしくなるのはffmpegがwindows video v9にまだ対応していないためです。 |