OSDN Git Service

カット別担当表HTML自動生成スクリプト 追加
authorbutameron <butameron@opap.jp>
Mon, 2 May 2016 18:18:49 +0000 (03:18 +0900)
committerbutaman <butaman_git@ebuta.net>
Mon, 28 Nov 2016 12:15:49 +0000 (21:15 +0900)
utils/make_authors_html_groupby_cut.sh [new file with mode: 0644]

diff --git a/utils/make_authors_html_groupby_cut.sh b/utils/make_authors_html_groupby_cut.sh
new file mode 100644 (file)
index 0000000..6e18907
--- /dev/null
@@ -0,0 +1,167 @@
+#!/bin/bash
+
+export LANG=ja_JP.UTF-8
+
+pushd `dirname $0` > /dev/null
+SCRIPTPATH=`pwd`
+popd > /dev/null
+
+
+cd "${SCRIPTPATH}/../"
+
+ffmpeg="${SCRIPTPATH}/bin/ffmpeg.exe"
+doga_output="${SCRIPTPATH}/../doga/_output"
+outfile="${SCRIPTPATH}/../_release/authors.html"
+imgdir="${SCRIPTPATH}/../_release/img"
+
+
+
+function GetAuthors() {
+       
+       local IFS=$'\n'
+       local names=()
+       declare -A name2notes
+       
+       while IFS="     " read f1 f2
+       do
+               if [ "${f1}" = "" ]; then
+                       continue
+               fi
+               names+=("${f1}")
+               if [ ! -v name2notes["${f1}"] ]; then
+                       name2notes["${f1}"]=""
+               fi
+               
+               name2notes["${f1}"]="${name2notes["${f1}"]},${f2}"
+       done < <(
+               perl -pe 's/^\xEF\xBB\xBF//g; s/\r//' AUTHORS.txt \
+                       | sed '/^#/d' \
+                       | awk '!x[$0]++' \
+       )
+       
+       printf '%s\n' "${names[@]}" \
+               | awk '!x[$0]++' \
+               | while IFS="   " read -r name
+       do
+               if [ "${name}" = "" ]; then
+                       continue
+               fi
+               
+               local note="$( \
+                       echo -n "${name2notes["$name"]}" \
+                               | sed 's/,/\n/g' \
+                               | sort \
+                               | uniq \
+                               | grep -v '^\s*$' \
+                               | perl -pe 's/\n/,/g' \
+               )"
+                               
+               echo "${name}   ${note}"
+
+       done
+       
+}
+
+
+
+
+mkdir "${imgdir}"
+
+cat <<EOM > "${outfile}"
+<html>
+<head>
+
+       <style>
+       
+               .authorlist
+               {
+                       width: 100%;
+                       border: solid 1px black;
+               }
+       
+               .authorlist>tbody>tr>* {
+                       border: solid 1px black;
+               }
+               
+               .author {
+                       width: 50%;
+               }
+       
+               .note {
+                       width: auto;
+               }
+               
+               .authorlist>tbody>tr>th {
+                       text-align: left;
+                       font-weight: normal;
+                       background-color: #f5deb3;
+               }
+               
+               th.author {
+                       width: 200px;
+               }
+       
+               th.note {
+                       width: auto;
+               }
+               
+               .warn {
+                       font-weight: bold;
+                       color: red;
+               }
+       </style>
+
+</head>
+<body>
+
+<h1>こうしす!第2話 カット別貢献者一覧表(非公式)</h1>
+
+<h2>はじめに</h2>
+
+<ul>
+<li span class="warn">この一覧は非公式に作成されたものです。あくまでも参考としてご活用ください。</li>
+<li>正式なクレジットは<a href="https://opap.jp/wiki/redirect/kosys_ep02_authors">https://opap.jp/wiki/redirect/kosys_ep02_authors</a>をご覧下さい。</li>
+<li>この一覧はカット別の貢献者を、更新履歴から投稿日順に並び替えて作成したものです。投稿日が不明な場合や手入力によって追加された貢献者リストは、各リストの最後に出力されています。</li>
+<li>カットによって、共通素材・資料の作成者(キャラデザ)のクレジットが入っていたり入っていなかったりしますが仕様です。</li>
+<li>備考欄の記載は手作業によるもので正確さに欠きます。</li>
+<li>この一覧には、作画に影響しない細かい変更履歴(ファイルの移動等)も含まれます。各貢献者がどのような役割で貢献したかについては、<a href="https://opap.jp/wiki/redirect/kosys_ep02_authors">正式なクレジット</a>をご覧下さい。</li>
+</ul>
+
+<h2>カット別貢献者一覧</h2>
+
+EOM
+
+for line in $(find doga -mindepth 2 -maxdepth 2 -type d); do 
+       echo "${line}"
+       pushd "${line}" > /dev/null
+       
+       scene_num=$(basename $(dirname "${line}"))
+       cut_num=$(basename "${line}")
+       
+       echo "<h3>${scene_num}_${cut_num}</h3>" >>"${outfile}"
+       
+       videofile="${doga_output}/${scene_num}_${cut_num}.avi"
+       if [ -f "${videofile}" ]; then
+               "${ffmpeg}" -i "${videofile}" -vframes 1 -ss 5 -f image2 -s 320x180 -y "${imgdir}/${scene_num}_${cut_num}.jpg"
+               echo "<img class='thumb' src='img/${scene_num}_${cut_num}.jpg' />" >>"${outfile}"
+       fi
+       
+       echo "<table class='authorlist'>" >>"${outfile}"
+       echo "<tr><th class='author'>名前</th><th class='note'>備考</th>" >>"${outfile}"
+       
+       GetAuthors \
+               | while IFS="   " read f1 f2
+       do
+               if [ "${f1}" = "" ]; then
+                       continue
+               fi
+               f2=$(echo -n "${f2}" | sed 's/,/, /g')
+               echo "<tr><td class='author'>${f1}</td><td class='note'>${f2}</td></tr>" >>"${outfile}"
+       done
+       echo "</table>" >>"${outfile}"
+       
+       popd > /dev/null
+done
+
+
+echo "</body></html>" >> "${outfile}"