From fe78371d1104558f965ac2d21c98d89eaacad35d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 29 Oct 2023 20:20:55 +0000 Subject: [PATCH] Get license when converting video to note --- video.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/video.py b/video.py index eb13c2243..8775d3e79 100644 --- a/video.py +++ b/video.py @@ -15,6 +15,7 @@ from utils import remove_id_ending from utils import get_attributed_to from utils import get_content_from_post from utils import dangerous_markup +from utils import license_link_from_name from blocking import is_blocked from filters import is_filtered @@ -196,4 +197,18 @@ def convert_video_to_note(base_dir: str, nickname: str, domain: str, 'name': 'Support' }) + if post_json_object.get('license'): + if isinstance(post_json_object['license'], dict): + if post_json_object['license'].get('name'): + if isinstance(post_json_object['license']['name'], str): + license_str = post_json_object['license']['name'] + content_license_url = \ + license_link_from_name(license_str) + if content_license_url: + new_post['object']['attachment'].append({ + "type": "PropertyValue", + "name": "license", + "value": content_license_url + }) + return new_post