BitTorrent Sync で サーバ と Android 間で同期させる

パソコンとAndroid間で使っていたが便利すぎる.

同期するんなら「BitTorrent Sync」 がなんか良いよ

・高速
・速度制限なし
・容量制限なし

大容量ファイルが高速で同期できたり.

24時間稼働しているサーバと連携すればもっと便利になりそうなので
サーバにセットしてみた.

関係するファイル
/usr/local/bin/btsync
/usr/local/etc/btsync/sync.conf
/etc/init.d/btsync

/usr/local/bin/btsync

実行バイナリ.
ダウンロードして置くだけ.
WEB-GUI もこれに含まれている.

BitTorrent Sync - ダウンロード

置いたらヘルプをとりあえずみてみる.

# btsync --help
BitTorrent Sync 1.3.106
Usage:
  btsync [--config <path>] [--nodaemon] [--generate-secret] [--dump-sample-config] [--help] [--get-ro-secret <secret>] [--log file]
Options:
--config - location and name of configuration file
--nodaemon - do not use daemon mode
--generate-secret - generate shared secret
--get-ro-secret - get read only secret for existing master secret
--dump-sample-config - dump sample config file
--log file - force logging to file in non-daemon mode
--help - print this message and exit

/usr/local/etc/btsync/sync.conf

JSONな設定ファイル.
サンプルを書き出して編集する.

# btsync --dump-sample-config > /usr/local/etc/btsync/sync.conf

デバイス名 (サーバ名) :

  "device_name": “My Server”,

対象ディレクトリ・シークレットキー :

  "shared_folders" :
  [
    {
      // use --generate-secret in command line to create new secret
      "secret" : “XXXXXXXXXXXXXXXXXXXXXX",   // * required field
      "dir" : "/home/maochanz/sync_dir”,     // * required field

キーは 該当ディレクトリでオプションを付けて叩く.

[sync_dir]# btsync --generate-secret
XXXXXXXXXXXXXXXXXXXXXX

pid ファイルの位置 :

停止時になんか気持ち悪いので指定しておく.

  // uncomment next line if you want to set location of pid file
  "pid_file" : "/var/run/btsync/btsync.pid”

設定ファイルを編集したら以下でとりあえず起動・停止できる.

# btsync —config /usr/local/etc/btsync/sync.conf

# killall btsync

How do I stop btsync in linux - Sync General Discussion - BitTorrent Forums

/etc/init.d/btsync

なんとなく終了が気持ち悪いので起動スクリプトを置いて自動サービス起動できるように.

A simple init script for BitTorrent Sync. Written and tested on CentOS 6.


#!/bin/bash
BIN='/usr/local/bin/btsync'
CONF='/usr/local/etc/btsync/sync.conf'
PID='/var/run/btsync/btsync.pid'
PIDMATCH=true
SERVICE=$(basename $0)
test $(id -u) -ne 0 && echo "This is for root." >&2 && exit 1
main(){
case $1 in
start)
if begin
then
echo "$SERVICE successfully started"
exit 0
else
echo "Error starting $SERVICE." >&2
exit 1
fi
;;
stop)
if end
then
echo "$SERVICE successfully stopped"
exit 0
else
echo "Error stopping $SERVICE" >&2
exit 1
fi
;;
status)
query
exit $?
;;
*)
printUsage
exit 1
;;
esac
}
running(){
test ! -f $PID && return 1
listen=$(netstat -tnlp | grep btsync | awk '{print $NF}' | cut -d'/' -f1)
last=$(cat $PID)
test -z $listen && return 1
if [[ $listen -ne $last ]]
then
echo "Warning: PID of listening instance does not match PID in $PID" >&2
PIDMATCH=false
return 0
else
return 0
fi
}
begin(){
if running
then
echo "$SERVICE is already running." >&2
return 1
else
$BIN --config $CONF
fi
}
end(){
if running
then
if ! $PIDMATCH
then
echo "Error: Failed to stop $SERVICE: PID in $PID does not match PID of listening instance" >&2
return 1
fi
kill -15 $(cat $PID)
xstat=$?
rm $PID
return $xstat
else
echo "$SERVICE is not running."
return 1
fi
}
query(){
if running
then
echo "$SERVICE is running"
return 0
else
echo "$SERVICE is stopped"
return 0
fi
}
printUsage(){
echo "Usage: $0 [start|stop|status]"
}
main $*

view raw

btsync-init

hosted with ❤ by GitHub

CentOS init.d startup script for bittorrent sync btsync - kinggeek.co.uk

# chkconfig --add btsync
# chkconfig btsync on
# chkconfig —list btsync
btsync         0:off 1:off 2:on 3:on 4:on 5:on 6:off
# service btsync start
By using this application, you agree to our Privacy Policy and Terms.
http://www.bittorrent.com/legal/privacy
http://www.bittorrent.com/legal/terms-of-use
BitTorrent Sync forked to background. pid = 1588
btsync successfully started
# service btsync status
btsync is running
# service btsync stop
btsync successfully stopped
# service btsync start
By using this application, you agree to our Privacy Policy and Terms.
http://www.bittorrent.com/legal/privacy
http://www.bittorrent.com/legal/terms-of-use
BitTorrent Sync forked to background. pid = 1588
btsync successfully started

あとは, Androidアプリを入れてサーバで設定したキーを入力すればよい.

BitTorrent Sync - Google Play の Android アプリ

BitTorrent Sync - ダウンロード

大量な音楽, 動画ファイルがバンバン高速同期されてくる.

bit-torrent-sync-setup

unnamed

よすぎる.

同期してるということは, Andoroid 内のファイルを サーバ上で 編集できるということ.


Chromecast 1.7.4 で とっとと キャスト する

今回のアップデートはベータ版で、Googleによれば、Samsung、HTC、LGその他のメーカーの一部のデバイスにここ数日のうちに提供されるという。Chromecastアプリのバージョンは1.7となる。これは相当に役立つ機能だが、アップデートが全員に行き渡るには少々時間がかかる。しばし忍耐して待て

ここ数日中にAndroidデバイスからChromecast に画面ミラーリングできるようになる - TechCrunch

すでに, どこかにあるよな.

Chromecast_1_7_4_apk_https___copy_com_nDk8jjSV3Hu1cdfG__Android_Police__Artem…

Chromecast 1.7.4 apk https://copy.com/nDk8jjSV3Hu1cdfG +Android Police +Artem…

com.google.android.apps.chromecast.app.apk :: Copy

すでに, 1.5.5 入れてる人は上書きできないようです.

$ adb install com.google.android.apps.chromecast.app.apk 
4724 KB/s (4897903 bytes in 1.012s)
	pkg: /data/local/tmp/com.google.android.apps.chromecast.app.apk
Failure [INSTALL_FAILED_ALREADY_EXISTS]

一度, 1.5.5 をアンインストールしていれるといいです.

20140710-202800

20140710-202820

予定通りに動きます.

IMG_20140710_203249

音声画像共に遅延は感じられません.

サポートする端末は以下だそうです.

Nexus 4
Nexus 5
Nexus 7 (2013)
Nexus 10
Samsung Galaxy S4
Samsung Galaxy S4 (Google Play Edition)
Samsung Galaxy S5
Samsung Galaxy Note 3
Samsung Galaxy Note 10
HTC One M7
HTC One M7 (Google Play Edition)
LG G3
LG G2
LG G Pro 2

Chromecast が画面ミラーリングに対応、ニコニコやゲームも大画面にキャスト。要対応Android端末 - Engadget Japanese

日本国内メーカーで製造されてる端末てどうなっていくのかっ!

こちらからは以上です.


flightradar24 の 3Dモード が リアルタイム に着陸した件

なんとなく 眺めていました flightradar24.

Flightradar24_com_-_Live_flight_tracker_ 8

リアルタイムで どのへんを飛んでいるかわかります.

Flightradar24.com - Live flight tracker!

で, これ, Google Earth を使った「3Dモード」なるものがあって,

コックピットからの視点で眺めたりできます.

なんと, リアルタイムで景色が流れます.

Flightradar24_com_-_Live_flight_tracker_ 6

関空に着陸の様子とか.

Flightradar24_com_-_Live_flight_tracker_

Flightradar24_com_-_Live_flight_tracker_ 2

Flightradar24_com_-_Live_flight_tracker_ 3

Flightradar24_com_-_Live_flight_tracker_ 4

Flightradar24_com_-_Live_flight_tracker_ 5

眺めていると飽きませんよ, これ.

Android 無料アプリ版では, 3Dモードはみれなかったけれども.

Flightradar24 Free - Google Play の Android アプリ

パソコンブラウザから, 画面左の「3D」ボタンからお試しをば.

Flightradar24_com_-_Live_flight_tracker_

👉 「羽田空港飛行コースホームページ」で飛行コースを眺める