This Project Has Not Released Any Files
大量の素材を一度に公開するのは案外手間がかかるもの。特に開発中の環境のために、デモ素材を用意するのは、かなり面倒。中でも作品名や作家名などを厳密に設定したデータを作るのは簡単では無い。
そんなときに使うのがこの機能。
ruby -Ku uploader.rb 投稿先のホスト名 '原画セットのディレクトリ', '認証トークン'"
コマンドから上記のようなコマンドを叩くことで、原画セットディレクトリで指定したディレクトリの原画セットを一括で公開する。当然ながら公開したい絵師のアカウントの認証トークンを使う。
原画セットとは、原画の画像ファイルとライセンスに必要な項目を記述したjsonファイルの二つを合わせたペアのことを言う。たぶんサンプルを見た方が早い。
Dir hoge hoge.png hoge.json fuga fuga.png fuga.json
原画セットディレクトリとしてDirをパラメータに与えると、そのディレクトリの下にあるhoge・fuga・およびその他すべてのディレクトリに対してチェックをかける。それらのディレクトリ内に画像ファイルとjsonファイルが入っていれば、正式な原画セットと認識して公開処理を行う。必ず一つのサブディレクトリに対して一つの画像ファイルと一つのjsonファイルを入れる。処理的には、拡張子を見てファイルの検索を行っているので、ファイル名はどうでもいいが拡張子は重要となる。
Jsonファイルは以下のように記述する。
{ "license_name": "PettanPublicV01License:BY@pettanr", "formname": "pettan_public_license", "attributes": { "artist_name": "artist_name", "caption": "caption", "sources": "" } }
このように、ライセンス名(管理名)とライセンス内容に分けて記述する。formnameはライセンスのエンジンがパラメータを受け取るためのフォームの名前。ライセンス内容はライセンスによって項目がまちまちなので、各ライセンスの使用を調べた上で必要な項目を記述する。
CreativeCommons.json
{ "license_name": "CreativeCommonsV30License:BY@us", "formname": "creative_commons_license", "attributes": { "artist_name": "artist_name", "caption": "caption", "artist_url": "", "source_url": "", "more_permission_url": "" } }
PettanCommons.json
{ "license_name": "PettanCommonsV01License:BY@pettanr", "formname": "pettan_commons_license", "attributes": { "artist_name": "artist_name", "caption": "caption", "sources": "" } }
PublicDomain.json
{ "license_name": "PublicDomainV01License:PD@pettanr", "formname": "public_domain_license", "attributes": { "artist_name": "artist_name", "source_url": "", "note": "note" } }
PettanProtected.json
{ "license_name": "PettanProtectedV01License:BY@pettanr", "formname": "pettan_protected_license", "attributes": { "artist_name": "artist_name", "caption": "caption", "sources": "" } }
PettanPublic.json
{ "license_name": "PettanPublicV01License:BY@pettanr", "formname": "pettan_public_license", "attributes": { "artist_name": "artist_name", "caption": "caption", "sources": "" } }
Unknown.json
{ "license_name": "UnknownV01License:UK@pettanr", "formname": "unknown_license", "attributes": { "source_url": "source_url", "note": "note", "artist_name": "artist_name" } }
原画セットだと?そんなめんどくさいディレクトリ構造なんて取れるか!
はい、そうですね。そんなあなたにスクリプトを用意しました。画像が詰まったディレクトリを指定すると、サブディレクトリを作成してファイルを移動してくれるスクリプトです。第二パラメータにライセンスのファイルを指定しておくと、そいつも同時にコピーしてくれます。
[PageInfo]
LastUpdate: 2013-03-26 19:08:34, ModifiedBy: yasushiito
[Permissions]
view:all, edit:login users, delete/config:members