papers-cli 2.12__tar.gz → 2.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {papers_cli-2.12 → papers_cli-2.13}/PKG-INFO +1 -1
- {papers_cli-2.12 → papers_cli-2.13}/papers/__main__.py +19 -6
- {papers_cli-2.12 → papers_cli-2.13}/papers/_version.py +2 -2
- {papers_cli-2.12 → papers_cli-2.13}/papers_cli.egg-info/PKG-INFO +1 -1
- {papers_cli-2.12 → papers_cli-2.13}/.gitattributes +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/.github/workflows/pypi.yml +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/.github/workflows/tests.yml +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/.gitignore +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/LICENSE +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/README.md +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/papers/__init__.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/papers/bib.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/papers/config.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/papers/duplicate.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/papers/encoding.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/papers/extract.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/papers/filename.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/papers/latexenc.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/papers/utils.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/papers_cli.egg-info/SOURCES.txt +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/papers_cli.egg-info/dependency_links.txt +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/papers_cli.egg-info/entry_points.txt +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/papers_cli.egg-info/requires.txt +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/papers_cli.egg-info/top_level.txt +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/pyproject.toml +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/requirements.txt +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/setup.cfg +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/setup.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/__init__.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/common.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/config.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/download.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/downloadedpapers/.gitignore +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/downloadedpapers/bg-8-515-2011.txt +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/test_add.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/test_biblio.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/test_duplicates.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/test_encoding.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/test_extract.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/test_filecheck.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/test_install.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/test_list.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/test_misc.py +0 -0
- {papers_cli-2.12 → papers_cli-2.13}/tests/test_undo.py +0 -0
|
@@ -15,7 +15,7 @@ import time
|
|
|
15
15
|
import papers
|
|
16
16
|
from papers import logger
|
|
17
17
|
from papers.extract import extract_pdf_doi, isvaliddoi, extract_pdf_metadata
|
|
18
|
-
from papers.extract import fetch_bibtex_by_doi
|
|
18
|
+
from papers.extract import fetch_bibtex_by_doi, fetch_bibtex_by_fulltext_crossref, fetch_bibtex_by_fulltext_scholar
|
|
19
19
|
from papers.encoding import parse_file, format_file, family_names, format_entries, standard_name, format_entry, parse_keywords, format_key
|
|
20
20
|
from papers.config import bcolors, Config, search_config, CONFIG_FILE, CONFIG_FILE_LOCAL, DATA_DIR, CONFIG_FILE_LEGACY, BACKUP_DIR
|
|
21
21
|
from papers.duplicate import list_duplicates, list_uniques, edit_entries
|
|
@@ -569,7 +569,7 @@ def addcmd(parser, o, config):
|
|
|
569
569
|
logger.error("No entry added: use --doi, --metadata, --key, --attachment, --title, --author, --journal, --year to add a new entry")
|
|
570
570
|
raise PapersExit()
|
|
571
571
|
|
|
572
|
-
metadata.setdefault('ID', biblio.
|
|
572
|
+
metadata.setdefault('ID', biblio.keyformat(metadata))
|
|
573
573
|
metadata.setdefault('ENTRYTYPE', 'article')
|
|
574
574
|
if o.edit:
|
|
575
575
|
metadata = edit_entries(metadata)
|
|
@@ -717,7 +717,20 @@ def doicmd(parser, o):
|
|
|
717
717
|
print(extract_pdf_doi(o.pdf, image=o.image))
|
|
718
718
|
|
|
719
719
|
def fetchcmd(parser, o):
|
|
720
|
-
|
|
720
|
+
# either one or several DOIs
|
|
721
|
+
if all(isvaliddoi(field) for field in o.doi_or_text):
|
|
722
|
+
if o.scholar:
|
|
723
|
+
parser.error("Fetching from DOI does not support Google Scholar option")
|
|
724
|
+
for doi in o.doi_or_text:
|
|
725
|
+
print(fetch_bibtex_by_doi(doi))
|
|
726
|
+
return
|
|
727
|
+
|
|
728
|
+
# or one full text search
|
|
729
|
+
field = " ".join(o.doi_or_text)
|
|
730
|
+
if o.scholar:
|
|
731
|
+
print(fetch_bibtex_by_fulltext_scholar(field))
|
|
732
|
+
else:
|
|
733
|
+
print(fetch_bibtex_by_fulltext_crossref(field))
|
|
721
734
|
|
|
722
735
|
def extractcmd(parser, o):
|
|
723
736
|
print(extract_pdf_metadata(o.pdf, search_doi=not o.fulltext, search_fulltext=True, scholar=o.scholar, minwords=o.word_count, max_query_words=o.word_count, image=o.image))
|
|
@@ -1180,9 +1193,9 @@ def get_parser(config=None):
|
|
|
1180
1193
|
|
|
1181
1194
|
# fetch
|
|
1182
1195
|
# =====
|
|
1183
|
-
fetchp = subparsers.add_parser('fetch', description='fetch bibtex from DOI')
|
|
1184
|
-
fetchp.add_argument('
|
|
1185
|
-
|
|
1196
|
+
fetchp = subparsers.add_parser('fetch', description='fetch bibtex from DOI or full-text')
|
|
1197
|
+
fetchp.add_argument('doi_or_text', nargs='+', help='DOI or full text.')
|
|
1198
|
+
fetchp.add_argument('--scholar', action='store_true', help='use google scholar instead of default crossref for fulltext search')
|
|
1186
1199
|
|
|
1187
1200
|
# extract
|
|
1188
1201
|
# ========
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|