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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/bin/bash
if [ ! -f "$1" ]; then
echo "usage: $0 file.pdf title"
exit 1
fi
if [ -z "$2" ]; then
echo "usage: $0 file.pdf title"
fi
file="$1"
title="$2"
uuid=$(uuidgen)
tmpfolder=$(mktemp -d)
trap "rm -rf ${tmpfolder}" EXIT
cat > "${tmpfolder}/${uuid}".metadata <<METADATA
{
"parent": "",
"type": "DocumentType",
"visibleName": "$title"
}
METADATA
cat > "${tmpfolder}/${uuid}".content <<CONTENT
{
"extraMetadata": {
"LastColor": "Black",
"LastTool": "Highlighter",
"ThicknessScale": "1"
},
"fileType": "pdf",
"fontName": "",
"lastOpenedPage": 0,
"lineHeight": 0,
"margins": 0,
"pageCount": 1,
"textScale": 0,
"transform": {
"m11": 1,
"m12": 1,
"m13": 1,
"m21": 1,
"m22": 1,
"m23": 1,
"m31": 1,
"m32": 1,
"m33": 1
}
}
CONTENT
cp "${file}" "${tmpfolder}/${uuid}".pdf
scp "${tmpfolder}/${uuid}".* root@10.11.99.1:.local/share/remarkable/xochitl/
ssh root@10.11.99.1 systemctl restart xochitl
|