Skip to content

Commit 3dbbc95

Browse files
committed
Updating documentation.
1 parent 0e03449 commit 3dbbc95

File tree

1 file changed

+134
-23
lines changed

1 file changed

+134
-23
lines changed

README.md

Lines changed: 134 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77

88
### Purpose
99
This is CLI tool for day-to-day synchronization of kindle books between local
10-
directory and directory on device using wire protocol - MTP or old USBMS mount.
10+
directory and directory on device over the wire - using either MTP or old USBMS
11+
mount.
1112

12-
It was created to support simple day-to-day side loading usage scenario (based
13-
on my multi-year experience owning various Kindle devices):
13+
It was created to support day-to-day side loading usage scenario (based on my
14+
multi-year experience owning various Kindle devices):
1415

1516
I have one or more local directories containing books in Kindle-supported
1617
formats, possibly organized into subdirectories by authors or genres for easier
@@ -40,33 +41,140 @@ performance and added flexibility.
4041
### Installation:
4142

4243
Download from the [releases page](https://github.com/rupor-github/sync2kindle/releases) and unpack it in a convenient location.
44+
You could use following public key and [minisign](https://github.com/jedisct1/minisign) tool to verify the authenticity of the release:
4345

4446
<p>
4547
<img src="docs/build_key.svg" style="vertical-align:middle; width:15%" align="absmiddle"/>
4648
<span style="vertical-align:middle;">&nbsp;&nbsp;RWTNh1aN8DrXq26YRmWO3bPBx4m8jBATGXt4Z96DF4OVSzdCBmoAU+Vq</span>
4749
</p>
4850

49-
### Usage (not a complete description, run any command with --help to see all the details)
51+
### Usage
5052

51-
s2k --help
53+
To see details run any command with --help or -h.
54+
```
55+
EBooks> ./s2k
56+
NAME:
57+
s2k - synchronizing local books with supported kindle device over MTP protocol or USBMS mount
5258
53-
s2k [--config <configuration file>] dumpconfig [--help] [--dry-run]
59+
USAGE:
60+
s2k [global options] command [command options]
5461
55-
s2k [--config <configuration file>] usb|mtp [--dry-run]
62+
VERSION:
63+
<<<will be current version>>>
5664
57-
s2k [--config <configuration file>] history
65+
COMMANDS:
66+
mtp Synchronizes books between local source and target device over MTP protocol
67+
usb Synchronizes books between local source and target device using USBMS mount
68+
history Lists details for local history files
69+
dumpconfig Dumps either default or active configuration (YAML)
70+
71+
GLOBAL OPTIONS:
72+
--config FILE, -c FILE load configuration from FILE (YAML)
73+
--debug, -d changes program behavior to help troubleshooting (default: false)
74+
--help, -h show help
75+
--version, -v print the version
76+
```
77+
78+
**Or** to see default or currently active configuration run `s2k [--config <configuration file>] dumpconfig [--help] [--dry-run]`:
79+
80+
```
81+
EBooks> ./s2k dumpconfig -h
82+
NAME:
83+
s2k dumpconfig - Dumps either default or active configuration (YAML)
84+
85+
USAGE:
86+
s2k dumpconfig [command options] DESTINATION
87+
88+
OPTIONS:
89+
--dry-run output active configuration to be used in actual operations, including values from --config file (default: false)
90+
--help, -h show help
91+
92+
DESTINATION:
93+
file name to write configuration to, if absent - STDOUT
94+
95+
Produces file with default configuration values.
96+
To see actual "active" configuration use dry-run mode.
97+
```
98+
99+
**Or** to synchronize files use `s2k [--config <configuration file>] usb|mtp [--dry-run]`:
100+
101+
```
102+
EBooks> ./s2k mtp -h
103+
NAME:
104+
s2k mtp - Synchronizes books between local source and target device over MTP protocol
105+
106+
USAGE:
107+
s2k mtp [command options]
108+
109+
OPTIONS:
110+
--ignore-device-removals, -i do not respect books removals on the device (default: false)
111+
--dry-run do not perform any actual changes (default: false)
112+
--help, -h show help
113+
114+
Using MTP protocol syncronizes books between 'source' local directory and 'target' path on the device.
115+
Both could be specified in configuration file, otherwise 'source' is current working directory and 'target' is "documents/mybooks".
116+
Kindle device is expected to be connected at the time of operation.
117+
118+
When 'ignore-device-removals' flag is set, books removed from the device are not removed from the local source.
119+
```
120+
and
121+
122+
```
123+
EBooks> ./s2k usb -h
124+
NAME:
125+
s2k usb - Synchronizes books between local source and target device using USBMS mount
126+
127+
USAGE:
128+
s2k usb [command options]
129+
130+
OPTIONS:
131+
--ignore-device-removals, -i do not respect books removals on the device (default: false)
132+
--dry-run do not perform any actual changes (default: false)
133+
--unmount, -u Attempts to prepare device for safe disconnect (default: false)
134+
--help, -h show help
135+
136+
Using device storage mounted over USB syncronizes books between 'source' local directory and 'target' path on the device.
137+
Both could be specified in configuration file, otherwise 'source' is current working directory and 'target' is "documents/mybooks".
138+
Kindle device is expected to be mounted at the time of operation.
139+
140+
When 'ignore-device-removals' flag is set, books removed from the device are not removed from the local source.
141+
142+
With 'unmount' flag set, attempt is made to safely unmount storage after sync operation. Has no effect with 'dry-run'.
143+
Results of this flag are very OS dependent, for example on Windows it may fail if not all buffers have been yet written
144+
to storage and will fail if something still have device opened, on Linux it requires admin priviliges and will only
145+
unmount filesystem after mount seases to be busy, etc. Since this is command line tool this flag mostly makes sense
146+
on Windows, where standard way of unmounting USB media from the command line has been missing for years. On Linux
147+
you could simply use 'eject' or 'udisksctl' commands.
148+
```
149+
**Or** to see what history has been accumulated use `s2k [--config <configuration file>] history`:
150+
151+
```
152+
EBooks> ./s2k history -h
153+
NAME:
154+
s2k history - Lists details for local history files
155+
156+
USAGE:
157+
s2k history [command options]
158+
159+
OPTIONS:
160+
--help, -h show help
161+
162+
Lists local history databases specifying details for each of them.
163+
```
164+
165+
Logging output levels, both in terminal and file are configurable independently (see "configuration") below.
58166

59167
### Configuration
60168

61169
Configuration file is in YAML format and is fully described [here](https://github.com/rupor-github/sync2kindle/blob/main/config/config.yaml.tmpl)
62170

63171
Basically only values you need to define are "source" - one of your local books
64172
directories and "target" - place on device which will be used for
65-
synchronization. The rest is usually unnecessary.
173+
synchronization. The rest is rarely needed.
66174

67175
I suggest having multiple configurations - per device and "target" directory,
68-
rather than attempting to send and keep in sync humongous libraries. Main
69-
reason is rather obvious: Kindle storage is slow.
176+
rather than attempting to send and keep in sync humongous libraries all at
177+
once. Main reason is rather obvious: Kindle storage is slow.
70178

71179
Synchronization logic is fully defined [at the source](https://github.com/rupor-github/sync2kindle/blob/main/sync/prepare.go).
72180

@@ -78,33 +186,36 @@ set in configuration file. Reproduce the problem in debug mode, create an
78186
[issue](https://github.com/rupor-github/sync2kindle/issues) with description
79187
and share the report.
80188

189+
I tried to be as careful as possible, but working USB and MTP devices on
190+
different platforms is not straightforward.
191+
81192
### Supported platforms and devices
82193

83-
Kindle devices which mount as USBMS storage (everything before latest Kindle
84-
Scribe, Paperwhite 12 or Colorsoft) are supported with USB subcommand (tested with
85-
PW2, PW10 and Voyage) and later ones are supported by MTP command
86-
(tested with PW12).
194+
Kindle devices which mount as USBMS storage (**everything before latest Kindle
195+
Scribe, Paperwhite 12 or Colorsoft**) are supported with **USB** subcommand (tested
196+
with PW2, PW10 and Voyage) and later ones (**Scribe, Colorsoft and latest
197+
Paperwhite**) are supported by **MTP** subcommand (tested with PW12).
87198

88199
At the moment program is built for Windows x64 and Linux x64. That all I have
89200
access to. It was tested on fresh Windows 11 and KUbuntu 24.04 but should work on
90201
most 64 bit Windows and Linuxes supported by current GoLang.
91202

92203
I tried to structure source code in such a way that it should be easy to port
93204
to other Windows or Linux architectures and it could be relatively simple to
94-
add drivers to support Darwin architectures too. All logic code is platform
95-
independent.
205+
add drivers to support Darwin architectures too. Synchronization logic code is
206+
platform independent.
96207

97-
Windows build does not require CGO at all, but COM support is still platform
98-
dependent. Linux build is using CGO and libmtp (which should also work for
99-
Darwin) but USB discovery is very OS specific.
208+
Windows build does not require CGO at all, but COM support is very platform
209+
dependent.
210+
211+
Linux build is using CGO and libmtp (which should also work for Darwin) but USB
212+
discovery is very OS specific.
100213

101214
If you have a need to support something I have no way of supporting - say any
102215
Macs, take a look at sources and drop a PR. We could work together to
103216
incorporate your changes.
104217

105218
### TODO
106219

107-
- Thumbnail support for KFX files
220+
- Add thumbnail support for KFX files
108221
- Expand history reports with some useful statistics
109-
110-

0 commit comments

Comments
 (0)