update - add support for some scrobble types
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
899f9485bf
commit
c6166a9212
17
README.md
17
README.md
|
@ -1,3 +1,18 @@
|
|||
# pymicrocosm
|
||||
|
||||
A tiny python-based micropub endpoint that supports a Gitea + drone static website
|
||||
A tiny python-based micropub endpoint that supports a Gitea + drone static website
|
||||
|
||||
|
||||
## Developing
|
||||
|
||||
Using a recent version of python 3.7+ install [poetry](https://python-poetry.org/):
|
||||
|
||||
```shell
|
||||
pip install poetry
|
||||
```
|
||||
|
||||
Then you can install microcosm and its required libraries with:
|
||||
|
||||
```shell
|
||||
poetry install
|
||||
```
|
|
@ -31,10 +31,8 @@ app.config['SECRET_KEY'] = 'my super secret key'
|
|||
|
||||
|
||||
ENTITY_TYPE_PLURAL_MAP = {
|
||||
"post": "posts",
|
||||
"note": "notes",
|
||||
"reply": "replies",
|
||||
"bookmark": "bookmarks"
|
||||
"watch":"watches"
|
||||
}
|
||||
|
||||
|
||||
|
@ -296,6 +294,12 @@ def detect_entry_type(doc: dict) -> str:
|
|||
elif ('like-of' in doc) or ('u-like-of' in doc):
|
||||
entry_type = "like"
|
||||
|
||||
elif ('read-of' in doc):
|
||||
entry_type = "read"
|
||||
|
||||
elif ('watch-of' in doc):
|
||||
entry_type = "watch"
|
||||
|
||||
elif ('name' in doc) or ('p-name' in doc):
|
||||
entry_type = "post"
|
||||
else:
|
||||
|
@ -306,14 +310,23 @@ def detect_entry_type(doc: dict) -> str:
|
|||
def capture_frontmatter_props(doc: Dict[str, Union[str, List[str]]], frontmatter: Dict[str, Union[str,List[str]]]):
|
||||
|
||||
|
||||
keys = ['bookmark-of', 'in-reply-to', 'repost-of', 'like-of']
|
||||
keys = ['summary', 'bookmark-of', 'in-reply-to', 'repost-of', 'like-of', 'read-of', 'watch-of', 'read-status', 'rating']
|
||||
|
||||
keys += [f'u-{key}' for key in keys]
|
||||
|
||||
for key in keys:
|
||||
|
||||
if key in doc:
|
||||
if isinstance(doc[key], list) and (len(doc[key]) < 2):
|
||||
|
||||
if isinstance(doc[key], dict) and ('type' in doc[key]):
|
||||
|
||||
if doc[key]['type'][0] == 'h-cite':
|
||||
|
||||
if 'citations' not in frontmatter:
|
||||
frontmatter['citations'] = []
|
||||
frontmatter['citations'].append(doc[key]['properties'])
|
||||
|
||||
elif isinstance(doc[key], list) and (len(doc[key]) < 2):
|
||||
frontmatter[key] = doc[key][0]
|
||||
else:
|
||||
frontmatter[key] = doc[key]
|
||||
|
@ -415,7 +428,6 @@ def process_json_post():
|
|||
if 'name' in props:
|
||||
frontmatter['title'] = props['name'][0]
|
||||
|
||||
|
||||
docstr = ""
|
||||
|
||||
if 'photo' in props:
|
||||
|
@ -556,4 +568,4 @@ def index():
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
app.run(debug=False)
|
||||
|
|
Loading…
Reference in New Issue