BtSync 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/README.md +26 -3
- data/lib/btsync.rb +10 -7
- data/lib/btsync/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGJmZjExMGJiNzcwOTU1MTVhM2EwZDI1YzVkYmVmOGYwMWE0MDI4Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjAwZDg4ZTk4YzI5NTRmNmEyNjk4M2E2YzI1ODExZDU0ZGFjYzk5NQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTE0ZWFkZWQ2MDA2NTdkZTAzYjE2NjkwODhjNTg5Y2I1NzNkMjVkMTUyNWI0
|
10
|
+
NTY0NmYxMzUwNTY0MjFiZmZkYTQ1NjRhMmViNTdkYWY1NDk3YTM3M2Q3ZWRh
|
11
|
+
NTAzY2E1NDgxNzgwMjQ5MmViZWRiYjg3Yzc2ZTM4MGViODcwM2E=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWU3YzZjNzA0MGI2M2ViYWFkYmY0NzU2MzQyODdhZjkwNzE4NGJkMDVlNjQx
|
14
|
+
MzFmZWY1MTZkMWE0ZDYzMDEyNjA2ZjYyNDUwYjZlOTI1ZTUzZjU1YThmYjlh
|
15
|
+
MGQzYmUwNzMxOWIyNGNjMjViYTE2ZDFlMjg4Y2JmOThhMDg1YWU=
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# BtSync
|
2
2
|
|
3
|
-
|
3
|
+
BtSync is a library to help you interact with Bittorrent Sync in Ruby
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,30 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
### Using BtSync
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
bittorrent = BtSync.new
|
25
|
+
```
|
26
|
+
|
27
|
+
####BtSync::Directory
|
28
|
+
|
29
|
+
A system directory managed with Bittorrent Sync is represented as a ```BtSync::Directory```.
|
30
|
+
|
31
|
+
On a ```BtSync::Directory`` you can
|
32
|
+
|
33
|
+
- Update the secret
|
34
|
+
- change the settings for
|
35
|
+
- Use tracker server
|
36
|
+
- Use relay server when required
|
37
|
+
- Search LAN
|
38
|
+
- SearchDHT network
|
39
|
+
- Delete Files to Sync Trash
|
40
|
+
- Use Predefined Hosts
|
41
|
+
|
42
|
+
## Todo
|
43
|
+
|
44
|
+
[ ] Manage predefined hosts
|
22
45
|
|
23
46
|
## Contributing
|
24
47
|
|
data/lib/btsync.rb
CHANGED
@@ -46,7 +46,7 @@ class BtSync
|
|
46
46
|
@errors << res["message"]
|
47
47
|
return false
|
48
48
|
end
|
49
|
-
|
49
|
+
Directory.new(folder_name, my_secret)
|
50
50
|
end
|
51
51
|
|
52
52
|
def get_settings
|
@@ -70,11 +70,7 @@ class BtSync
|
|
70
70
|
res = self.class.get(path('getdir'), :query => {:dir => with_dir}, :headers => {"Cookie" => cookies })
|
71
71
|
res.parsed_response["folders"]
|
72
72
|
end
|
73
|
-
|
74
|
-
my_secret ||= secret(with_dir)
|
75
|
-
res = self.class.get(path('getknownhosts'), :query => {:name => with_dir, :secret => my_secret}, :headers => {"Cookie" => cookies })
|
76
|
-
res["hosts"]
|
77
|
-
end
|
73
|
+
|
78
74
|
def secret with_dir
|
79
75
|
f = get_folders.select{|folder| folder.name == with_dir}.first
|
80
76
|
f.secret
|
@@ -98,7 +94,10 @@ class BtSync
|
|
98
94
|
@secret = secret
|
99
95
|
@errors = []
|
100
96
|
end
|
101
|
-
|
97
|
+
def destroy
|
98
|
+
self.class.get(path('removefolder'), :query => { :name => name, :secret => secret}, :headers => {"Cookie" => cookies})
|
99
|
+
self.instance_variables.each{|v| v = nil}
|
100
|
+
end
|
102
101
|
def update_secret new_secret = nil
|
103
102
|
new_secret ||= generate_secret
|
104
103
|
res = self.class.get(path('updatesecret'), :query => { :name => @name, :secret => @secret, :newsecret => new_secret}, :headers => {"Cookie" => cookies})
|
@@ -110,6 +109,10 @@ class BtSync
|
|
110
109
|
false
|
111
110
|
end
|
112
111
|
end
|
112
|
+
def get_known_hosts
|
113
|
+
res = self.class.get(path('getknownhosts'), :query => {:name => name, :secret => secret}, :headers => {"Cookie" => cookies })
|
114
|
+
res["hosts"]
|
115
|
+
end
|
113
116
|
def use_tracker=(opt)
|
114
117
|
res = self.class.get(path('setfolderpref'), query: make_opts('usetracker', opt), :headers => {"Cookie" => cookies })
|
115
118
|
true
|
data/lib/btsync/version.rb
CHANGED