diff options
| author | lens <lens@neural.garden> | 2021-03-23 21:10:11 +0000 |
|---|---|---|
| committer | lens <lens@neural.garden> | 2021-03-23 21:10:11 +0000 |
| commit | cc1d0c52e104245f9f1c0d77eb24a5a33800be38 (patch) | |
| tree | 02d8483dfe47803525b926a43c582dcfbf61c5db /cli/commands/site/populate.py | |
| parent | 81c673f058fda04b96baae7b2302f876479bc0a9 (diff) | |
| parent | 7a3ec205e001e4c071a67ecc5c375612fa72afdc (diff) | |
Merge branch 'master' of asdf.us:swimmer
Diffstat (limited to 'cli/commands/site/populate.py')
| -rw-r--r-- | cli/commands/site/populate.py | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/cli/commands/site/populate.py b/cli/commands/site/populate.py new file mode 100644 index 0000000..b1b9691 --- /dev/null +++ b/cli/commands/site/populate.py @@ -0,0 +1,79 @@ +import click + +lines = """/static/media/last-museum/nicole-foreshew/establishing1.mp4 +/static/media/last-museum/nicole-foreshew/sequence1b.mp4 +/static/media/last-museum/nicole-foreshew/sequence2.mp4 +/static/media/last-museum/nicole-foreshew/sequence3.mp4 +/static/media/last-museum/nicole-foreshew/sequence4.mp4 +/static/media/last-museum/nicole-foreshew/sequence5.mp4""".split("\n") + +letters = ['a','b','c','d','e','f','g','h','i','j'] + +@click.command('populate') +@click.pass_context +def cli(ctx): + """Populate video pages""" + + import requests + + def post(endpoint, data): + resp = requests.post(endpoint, json=data) + return None if resp.status_code != 200 else resp.json() + + graph_id = 3 + name = "Nicole Foreshew" + index = 0 + + for url in lines: + # slug = url.split("/")[5].replace(".mp4", "").lower() + slug = "foreshew-" + str(index) # + letters[index] + print(slug) + index += 1 + + page_data = { + "graph_id": graph_id, + "path": slug, + "title": name, # + str(index), + "username": "jules", + "description":"", + "settings": { + "x": 0.05, + "y": 0.05, + "background_color": "#000000", + "background_audio_id": 0, + "restart_audio": False + } + } + page_res = post("http://0.0.0.0:5000/api/v1/page/", page_data) + page_id = page_res['res']['id'] + + tile_data = { + "graph_id": graph_id, + "page_id": page_id, + "target_page_id": None, + "type": "video", + "settings": { + "x": 0, + "y": 0, + "width": 1920, + "height": 1080, + "rotation": 0, + "scale": 1, + "opacity": 1, + "units": False, + "align": "center_center", + "has_audio": False, + "audio_on_click_id": 0, + "audio_on_hover_id": 0, + "navigate_when_audio_finishes": False, + "video_style": "cover", + "url": url, + "external_link_url": "", + "cursor": "none", + "muted": True, + "loop": True, + "autoadvance": False + } + } + + page_res = post("http://0.0.0.0:5000/api/v1/tile/", tile_data) |
