Content-Length: 2034 | pFad | http://github.com/Freso/openlibrary/commit/c854d54922d6410d6d77d3bf0583fe5b920f90a8.diff
93 diff --git a/openlibrary/plugins/openlibrary/config/work/identifiers.yml b/openlibrary/plugins/openlibrary/config/work/identifiers.yml new file mode 100644 index 000000000000..4728bdb6c1fe --- /dev/null +++ b/openlibrary/plugins/openlibrary/config/work/identifiers.yml @@ -0,0 +1,22 @@ +identifiers: +- label: BookBrainz + name: bookbrainz + url: https://bookbrainz.org/work/@@@ + website: https://bookbrainz.org +- label: Книга Файнфиков + name: ficbook + notes: '' + url: https://ficbook.net/readfic/@@@ +- label: MusicBrainz + name: musicbrainz + url: https://musicbrainz.org/work/@@@ + website: https://musicbrainz.org +- label: MyAnimeList + name: myanimelist + notes: '' + url: https://myanimelist.net/manga/@@@ +- label: Wikidata + name: wikidata + notes: '' + url: https://www.wikidata.org/wiki/@@@ + website: https://wikidata.org diff --git a/openlibrary/plugins/upstream/utils.py b/openlibrary/plugins/upstream/utils.py index 5a05afc2317d..6bcac4ce2140 100644 --- a/openlibrary/plugins/upstream/utils.py +++ b/openlibrary/plugins/upstream/utils.py @@ -1261,6 +1261,32 @@ def _get_edition_config(): ) +@public +def get_work_config() -> Storage: + """Returns the work config. + + This just calls _get_work_config(). See that + function's documentation for further details. + """ + return _get_work_config() + + +@web.memoize +def _get_work_config() -> Storage: + """Returns the work config. + + The results are cached on the first invocation. + The /config/work page currently has no unique options so we + don't load/fetch it here currently. + """ + with open('openlibrary/plugins/openlibrary/config/work/identifiers.yml') as in_file: + id_config = yaml.safe_load(in_file) + identifiers = [ + Storage(id) for id in id_config.get('identifiers', []) if 'name' in id + ] + return Storage(identifiers=identifiers) + + from openlibrary.core.olmarkdown import OLMarkdownFetched URL: http://github.com/Freso/openlibrary/commit/c854d54922d6410d6d77d3bf0583fe5b920f90a8.diff
Alternative Proxies: