forked from Tigge/antfs-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSCRIPTING
43 lines (28 loc) · 1.15 KB
/
SCRIPTING
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Scripting
==============================================================================
In the location for scripts, usually ~/.config/antfs-cli/scripts
(but see README, for more precise location) you can add executable scripts
and programs.
The scripts and programs placed here will be executed in the background when
a file have been downloaded, uploaded or deleted.
The three arguments to the executables are:
- Action (DOWNLOAD, UPLOAD or DELETE -- depending on what action caused the
script to run)
- File name
- FIT type (e.g. 4 for an Activity, see File.Identifier in ant/fs/file.py
for other FIT file types)
Note: Do not modify, delete, or rename the original file. If you want to
modify or change the file, create a copy, or write the new data to a different
file.
Example
---------------------
#!/usr/bin/python
import sys
def upload(action, filename, fittype):
# if we downloaded a new activity
if action == "DOWNLOAD" and fittype == 4:
data = open(filename, 'b').read()
# upload file
pass
if __name__ == "__main__":
upload(sys.argv[1], sys.argv[2], int(sys.argv[3]))