Skip to content

Commit

Permalink
Use yandeley instead of mendeley
Browse files Browse the repository at this point in the history
  • Loading branch information
shuichiro-makigaki committed Oct 12, 2021
1 parent 487917b commit 0a62bed
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
25 changes: 21 additions & 4 deletions mendeley_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
from urllib import parse
import json

from mendeley import Mendeley, MendeleyAuthorizationCodeAuthenticator
from mendeley.session import MendeleySession
from mendeley.auth import MendeleyAuthorizationCodeTokenRefresher
from mendeley.exception import MendeleyApiException, MendeleyException
from yandeley import Mendeley, MendeleyAuthorizationCodeAuthenticator
from yandeley.session import MendeleySession
from yandeley.auth import MendeleyAuthorizationCodeTokenRefresher
from yandeley.exception import MendeleyApiException, MendeleyException
import click
from tablib import formats, Dataset
from dotenv import load_dotenv
Expand Down Expand Up @@ -247,6 +247,23 @@ def cmd_get_groups(print_format):
print_table(dataset, print_format)


# @cmd_get.command(name='annotations')
# @click.option('--document-uuid', type=click.UUID, help='Document UUID')
# @click.option('--print-format', type=click.Choice(tablib_formats), help='Print format')
def cmd_get_annotations(document_uuid, group_uuid, print_format):
"""Get annotations"""
annotations = list(get_session().annotations.iter())
dataset = Dataset(headers=['UUID', 'Color', 'created', 'Type', 'document', 'last_modified', 'positions', 'privacy_level', 'profile', 'text'])
for annot in annotations:
dataset.append([
annot.id,
[annot.color.r, annot.color.g, annot.color.b],
annot.created, annot.type, annot.document().id, annot.last_modified,
[[(int(_.top_left.x), int(_.top_left.y)), (int(_.bottom_right.x), int(_.bottom_right.y), _.page)] for _ in annot.positions],
annot.privacy_level, annot.profile.id, annot.text])
print_table(dataset, print_format)


@cmd_create.command(name='document')
@click.option('--title', type=click.STRING, required=True, help='Document title (e.g --title "Paper One")')
@click.option('--doctype', type=click.STRING, default='generic', show_default=True,
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
requests
mendeley
yandeley
click
tablib[all]
python-dotenv
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='mendeley-cli',
version='0.1.4',
version='0.2.0',
packages=find_packages(),
include_package_data=True,
install_requires=Path('requirements.txt').read_text().splitlines(),
Expand Down

0 comments on commit 0a62bed

Please sign in to comment.