Skip to content

Commit ab3e315

Browse files
hfrmmarquezs
authored andcommitted
add: doc
1 parent df7c12b commit ab3e315

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

DIRECT.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Direct device access using My.JDownloader-API
2+
3+
This is an extension of myjdapi to allow a direct device access without My.JDownloader.
4+
5+
# Theory of operation
6+
7+
My.JDowloader manages JDownloader devices and myjdapi provides a python interface to access them.
8+
If possible My.JDowloader will push a direct connection to myjdapi which will be used consequently.
9+
If enabled this JDownloader api will be available locally. The direct access modification will make
10+
it possible to use the local api without any interaction with My.Downloader at all.
11+
12+
# Implemetation
13+
14+
In myjdapi all connetions will be managed by an instance of Myjdapi. To use myjdapi locally Myjdapi needs consequently be extended to allow local connextions.
15+
16+
`Myjdapi().connect_device(ip, port, _type='jd', username=None, password=None, timeout=None)` will create
17+
a local connection to a given device and it will make all modifications to the myjdapi instance to support
18+
the direct communication with the local device.
19+
20+
Even so the interface supports a user name and password it is not implemented yet.
21+
22+
The call to connect_device() will ping the device to make sure it exists and it will create a device with the name given by the ip-parameter and the id 'direct'.
23+
A direct device connection has the status connected but it has no session id since the session id is supported be My.Downloader only.
24+
25+
# Usage
26+
27+
After myjdapi has established the connection the device can be querried as usually be calling:
28+
29+
```python
30+
import myjdapi
31+
host = 'localhost'
32+
port = 3128
33+
# We need an instance of Myjdapi() but no application key is required
34+
jd = myjdapi.Myjdapi()
35+
# connect directly to the device
36+
jd.connect_device(host,port,timeout=10)
37+
# The device can be accessed using the host name or ip address.
38+
device = jd.get_device(host)
39+
# Or the device can be accessed by using the device id "direct".
40+
device = jd.get_device(device_id="direct")
41+
```
42+
43+
Once the connection is to the local device established myjdapi will not connect to My.JDownloader any more.
44+
The connection is is permanent and will not be refreshed.

0 commit comments

Comments
 (0)