Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions samples/probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@
if os.getenv("SHOTSTACK_HOST") is not None:
apiUrl = os.getenv("SHOTSTACK_HOST")

api_response = api_instance.probe(url)

#print(api_response['response'])

streams = api_response['response']['metadata']['streams']

for stream in streams:
if stream['codec_type'] == "video":
print(f"Example settings for: {api_response['response']['metadata']['format']['filename']}")
print(f"Width: {stream['width']}px")
print(f"Height: {stream['height']}px")
print(f"Framerate: {stream['r_frame_rate']} fps")
print(f"Duration: {stream['duration']} secs")
try:
api_response = api_instance.probe(url)

streams = api_response['response']['metadata']['streams']

for stream in streams:
if stream['codec_type'] == "video":
print(f"Example settings for: {api_response['response']['metadata']['format']['filename']}")
print(f"Width: {stream['width']}px")
print(f"Height: {stream['height']}px")
print(f"Framerate: {stream['r_frame_rate']} fps")
print(f"Duration: {stream['duration']} secs")
except Exception as e:
print(f"Unable to resolve API call: {e}")
31 changes: 16 additions & 15 deletions samples/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,19 @@
if os.getenv("SHOTSTACK_HOST") is not None:
apiUrl = os.getenv("SHOTSTACK_HOST")

api_response = api_instance.get_render(id, data=False, merged=True)

#print(api_response['response'])

status = api_response['response']['status']
url = api_response['response']['url']

print('Status: ' + status.upper() + '\n')

if status == "done":
print(f">> Asset URL: {url}")
elif status == 'failed':
print(">> Something went wrong, rendering has terminated and will not continue.")
else:
print(">> Rendering in progress, please try again shortly.\n>> Note: Rendering may take up to 1 minute to complete."")
try:
api_response = api_instance.get_render(id, data=False, merged=True)

status = api_response['response']['status']
url = api_response['response']['url']

print('Status: ' + status.upper() + '\n')

if status == "done":
print(f">> Asset URL: {url}")
elif status == 'failed':
print(">> Something went wrong, rendering has terminated and will not continue.")
else:
print(">> Rendering in progress, please try again shortly.\n>> Note: Rendering may take up to 1 minute to complete.")
except Exception as e:
print(f"Unable to resolve API call: {e}")