ywrac / python-btsync

Simple Python wrapper around the Bittorrent Sync API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is OBSOLETE, switch to https://github.com/ywrac/btsync-api-python

python-btsync

BTSync APIをPythonから利用することができます。 APIを利用するためにはBitTorrent社からAPI Keyを取得する必要があります。

The BTSync class is a light wrapper around the Bittorrent Sync API. For now, this code assumes a btsync instance is running with a working API key. (See the Notes section for more info on how to get this set up.)

インストール Installation

$ git clone https://github.com/jminardi/python-btsync.git
$ cd python-btsync
$ python setup.py install

最新版の[BitTorrent Sync][0]が必要です。 You will also need a recent version of the [Bittorrent Sync Application][0] [0]: http://www.bittorrent.com/sync/downloads

使い方 Basic Use

>>> # this code assumes a btsync instance is running
>>> from btsync import BTSync
>>> btsync = BTSync()
>>> btsync.get_folders()
[{u'dir': u'/Users/jack/sync/notes',
  u'error': 0,
  u'files': 13,
  u'indexing': 0,
  u'secret': u'NOPE',
  u'size': 70867,
  u'type': u'read_write'}]

メソッド Implemented Methods

すべてのメソッドが実装されているわけだはありません。 しかしrequest()メソッドを介して任意のメソッドを実行することができます。

At this time, not all API calls are implemented. However, you can still make any API call manually using the request() method like so:

btsync.request({'method': 'get_folder_peers', 'secret': '<yoursecret>'})

実装済みのメソッド一覧

  • Get folders
  • Add folder
  • Remove folder
  • Get files
  • Set file preferences
  • Get folder peers
  • Get secrets
  • Get folder preferences
  • Set folder preferences
  • Get folder hosts
  • Set folder hosts
  • Get preferences
  • Set preferences
  • Get OS name
  • Get version
  • Get speed
  • Shutdown

Notes

残念ながらBTSyncはプロプライエタリなソフトウェアです。 そのためAPIを利用するためには、BitTorrent社の許可を必要とします。 具体的にはAPIキーというものを以下のURLから取得する必要があります。

To use the API you will need to apply for a key. You can find out how to do that, and learn more about the btsync API here:

http://www.bittorrent.com/sync/developers/

APIキーを取得したら、設定ファイルにキーを入力してください。

Once you receive your key, you need to enter it into the config file. See config.json for a sample config file.

--configフラグをつけてBTSyncのバイナリを実行すればAPIが有効になります。

Then quit BTSync if it is running, and start it from the command line with the --config flag:

Macの実行例を以下に示します。

$ /Applications/BitTorrent\ Sync.app/Contents/MacOS/BitTorrent\ Sync --config path/to/config.json

About

Simple Python wrapper around the Bittorrent Sync API

License:MIT License


Languages

Language:Python 100.0%