Skip to content

Commit

Permalink
Renamed files and updated Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Gallardo Polanco committed Feb 1, 2021
1 parent 8f9a158 commit 82c341c
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 26 deletions.
39 changes: 25 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
# zotero-reMarkable-sync
# zotero - reMarkable Synchronization

# TODO: Update readme
Synchronize all the .pdf files in your [Zotero](https://www.zotero.org) library with your [reMarkable](https://remarkable.com) device.

This repository allows you to synchronize all the .pdf files from your [Zotero](https://www.zotero.org) library to your [reMarkable](https://remarkable.com) device.
![picture alt](images/workflow.png "Title is optional")

How does it work?
1. Download all the .pdf files from the Zotero library to a local folder `<dir-name>`
2. Synchronize the `<dir-name>` to your reMarkable `/<dir-name>` folder.
##### How does it work?

1. Fetch files from Zotero
2. Fetch files from reMarkable
3. Compare with the last sync files stored in `~/.zot_rm_sync/<dir-name>`
4. Pull changes from Zotero (add new files and remove deleted files)
5. Push changes to reMarkable (add new files and remove deleted files)
6. Pull changes from reMarkable (remove deleted files)
7. Push changes to Zotero (remove deleted files)

Note:
- New files are expected to be added to Zotero only. Files added manually to the reMarkable `/<dir-name>` directory will be ignored.
- reMarkable annotations are not saved in Zotero


## Requirements
Expand All @@ -15,34 +25,35 @@ Tested on Python 3.6
``` bash
pip install -r requirements.txt
```

## Authorization
### reMarkable

Get a **Security Code** from https://my.remarkable.com/connect/remarkable and run ***authorize_rmapy.py***
Get a [**Security Code**](https://my.remarkable.com/connect/remarkable) and run ***authorize_rmapy.py***

``` bash
python authorize_rmapy.py --security-code <security-code>
```

### zotero
### Zotero

Get your **Zotero Library ID** and **Zotero API Key** from https://www.zotero.org/settings/keys
Get your [**Zotero Library ID** and **Zotero API Key**](https://www.zotero.org/settings/keys)


## Use

``` bash
python sync.py --zot-library-id <zot-library-id> --zot-api-key <zot-api-key> --directory <dir-name> [--verbose]
python sync.py --zot-library-id/-l <zot-library-id> --zot-api-key/-k <zot-api-key> --directory/-d <dir-name> [--verbose/-v]
```

## Features
- [x] Download .pdf files from Zotero Library
- [x] Download .pdf files from the Zotero Library
- [x] Upload .pdf files to reMarkable
- [x] Keep the directory structure
- [x] Maintain directory structure
- [x] Prevent duplicate uploads and downloads
- [x] Delete files from reMarkable if they are deleted in the Zotero library
- [ ] Support more file extensions like .epub
- [ ] Delete files from reMarkable if they are deleted in the Zotero library
- [ ] Update files in the Zotero Library with the reMarkable annotations
- [ ] Update files in Zotero Library with reMarkable annotations


##### Thanks to @urschrei and @subutux for the fantastic APIs
Expand Down
4 changes: 2 additions & 2 deletions authorize_rmapy.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import sys
import argparse
from rM_utils import authorize
from utils.remarkable import authorize

def get_args():
"""Command line argument parsing"""

parser = argparse.ArgumentParser()

parser.add_argument("--security-code", "-s",
Expand Down
Binary file added images/workflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 3 additions & 7 deletions sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import sys
import argparse
from colorama import Fore, Style
from common import list_local_files, compare
from zotero_utils import Zotero
from rM_utils import ReMarkable
from utils.common import list_local_files, compare
from utils.zotero import Zotero
from utils.remarkable import ReMarkable

def get_args():
"""Command line argument parsing"""
Expand Down Expand Up @@ -136,7 +136,3 @@ def main():

if __name__ == "__main__":
main()



#
File renamed without changes.
4 changes: 2 additions & 2 deletions rM_utils.py → utils/remarkable.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from rmapy.exceptions import AuthError
from rmapy.folder import Folder
from rmapy.document import ZipDocument
from common import File
from utils.common import File

class ReMarkable():

Expand Down Expand Up @@ -239,7 +239,7 @@ def authorize(security_code):
Returns: True is authorized, False otherwise
"""

rma = Client()

try:
Expand Down
2 changes: 1 addition & 1 deletion zotero_utils.py → utils/zotero.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from colorama import Fore, Style
from pyzotero import zotero
from pyzotero.zotero_errors import UserNotAuthorised
from common import File
from utils.common import File

class Zotero():

Expand Down

0 comments on commit 82c341c

Please sign in to comment.