Skip to main content

it syncs zotero storage with a rclone remote

Project description

Zoterosync

Syncs local zotero files to a remote storage using rclone. This is a work in progress.

Software requirements

  • python 3
  • pip
  • rclone
  • virtualenv: virtual environment is apropriated to install compatible dependencies
  • bash

Recomended software

  • Linux Distro: not tested on other platforms
  • Google Drive: rclone is compatible with a lot of cloud storage, but we've tested only with 'drive' option.

Install zoterosync

  • Download the latest version with git:
git clone https://gitlab.com/marceloakira/zoterosync
  • Create a virtual environment with python3 as default interpreter:
virtualenv --python=python3 zoterosync
  • Install required python libraries inside virtual environment:
cd zoterosync
source bin/activate
pip install -r requirements.txt
  • Create configuration:
# generates default configuration
python zoterosync_cli.py config
  • Setup script:
# create a directory for executable scripts
mkdir -P ~/bin
# add this path to PATH environment variable
echo "~/bin" >> ~/.profile
# setup script
ln -s $PWD/zoterosync.bash ~/bin/zoterosync
# close the current terminal and test command
zoterosync

Configure a remote storage

$ rclone config
Current remotes:

Name                 Type
====                 ====

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n
name> Quantum Computing
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
...
13 / Google Drive
   \ "drive"
...
Storage>13 
* See help for drive backend at: https://rclone.org/drive/ **

Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a string value. Press Enter for the default ("").
client_id>      <--- press Enter
OAuth Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>     <--- press Enter
Scope that rclone should use when requesting access from drive.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / Full access all files, excluding Application Data Folder.
   \ "drive"
...
scope> 1 
ID of the root folder
Leave blank normally.

Fill in to access "Computers" folders (see docs), or for rclone to use
a non root folder as its starting point.

Enter a string value. Press Enter for the default ("").
root_folder_id>       <--- press Enter
Service Account Credentials JSON file path 
Leave blank normally.
Needed only if you want use SA instead of interactive login.

Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.

Enter a string value. Press Enter for the default ("").
service_account_file>  <--- Press Enter
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n>      <-- press Enter
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
y) Yes (default)
n) No
y/n>     <-- press Enter
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=WOqyzeguK5dtqpDkDnplOQ
Log in and authorize rclone for access
Waiting for code...      <-- configuration with browser
Log in and authorize rclone for access
Waiting for code...
Got code
Configure this as a team drive?
y) Yes
n) No (default)
y/n> y
Fetching team drive list...
Choose a number from below, or type in your own value
...
  3 / Quantum Computing
   \ "0ABtgQWBCM1GiUk9PVA"
...
[Quantum Computing]
type = drive
scope = drive
token = {xxx}
team_drive = 0AIZzmLgyr5CaUk9PVA
root_folder_id = 
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y

List your groups and set a remote

$ zoterosync listremotes
quantum-computing
$ zoterosync listgroups
Quantum Computing
$ zoterosync setremote 'Quantum Computing' 'quantum-computing'
creating remote path quantum-computing:zotero-storage
remote path created

List your groups in local storage and push

$ zoterosync push 'Quantum Computing'
...
2020/12/25 11:50:43 INFO  : 
Transferred:       19.321M / 19.321 MBytes, 100%, 282.299 kBytes/s, ETA 0s
Transferred:           34 / 34, 100%
Elapsed time:      1m12.2s

List your remotes and pull

$ zoterosync listremotes
Quantum Computing
$ zoterosync pull 'Quantum Computing'
pulling changed files from remote to local storage
2020/12/25 11:53:53 INFO  : There was nothing to transfer
2020/12/25 11:53:53 INFO  : 
Transferred:             0 / 0 Bytes, -, 0 Bytes/s, ETA -
Checks:                34 / 34, 100%
Elapsed time:         3.5s
...

That's it, enjoy zoterosync!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zoterosync-0.1.3.tar.gz (7.2 kB view hashes)

Uploaded Source

Built Distribution

zoterosync-0.1.3-py3-none-any.whl (7.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page