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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file zoterosync-0.1.3.tar.gz.

File metadata

  • Download URL: zoterosync-0.1.3.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for zoterosync-0.1.3.tar.gz
Algorithm Hash digest
SHA256 1313f127e5ec30bc76811ec17cd1b4e49e780d7f82bb24970a8448e18b909d96
MD5 450d7b19c73b955c467f5b75496aab95
BLAKE2b-256 a8219d08d3ae8d98ff69b776afa000f24d72ffe3ea220c44718d53227b118450

See more details on using hashes here.

File details

Details for the file zoterosync-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: zoterosync-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for zoterosync-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a8f63461c2aee0d048e4ff27b31974c289085b4c52e9c2e5a9f49b7ed9c194f4
MD5 c32aed947ea28ae99b974ef1927cfb32
BLAKE2b-256 0a50467f1a825422b0670ca486c7b9a0374ffb471894b37625519cb7c078c700

See more details on using hashes here.

Supported by

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