diff --git a/Jiffy.py b/Jiffy.py index df0b19b..f784478 100644 --- a/Jiffy.py +++ b/Jiffy.py @@ -1,7 +1,8 @@ -import time import json -import requests import logging +import time + +import requests logging.basicConfig(level=logging.DEBUG) @@ -103,41 +104,3 @@ class Jiffy: time.sleep(duration) self._delete_asset(asset_id) - -# # If they forgot the filename. -# if not len(sys.argv): -# raise Exception('You forgot the file url. Moron.') - -# file_url = sys.argv[1] - -# if len(sys.argv) >= 3: -# duration = sys.argv[2] -# else: -# duration = 10 - -# resp = requests.get(file_url) - -# # If they didn't give us a valid url. -# if resp.status_code != 200: -# raise Exception('Yeah no, that thing doesn\'t exist.') - -# # If by some miracle the user gave us a filename, and it actually exists somewhere. -# asset_upload_url = f'http://{DASHPI_HOST}/{DASHPI_API_v1_2}/assets' -# data_to_upload = UPLOAD_IMAGE_JSON % (file_url, duration, file_url) - -# # Upload the file to dashpi so we can switch to it. -# resp2 = requests.post(url=asset_upload_url, data=data_to_upload, auth=DASHPI_CREDS) -# resp2_json = resp2.json() - -# # Get the asset ID back from dashpi, or break. -# if not isinstance(resp2_json, dict): -# raise Exception('NO JSON FOUND') -# else: -# asset_id = resp2_json.get('asset_id') - -# # Tell dashpi we want to view the image we just uploaded, obviously. -# resp3 = requests.get(f'http://{DASHPI_HOST}/{DASHPI_API_V1_0}/assets/control/asset&{asset_id}', auth=DASHPI_CREDS) - -# # Wait till we are done displaying the gif (plus 5s for safety) then delete it from dashpi. -# time.sleep(duration+1) -# resp4 = requests.delete(f'http://{DASHPI_HOST}/{DASHPI_API_v1_2}/assets/{asset_id}', auth=DASHPI_CREDS) \ No newline at end of file diff --git a/cli_run.py b/cli_run.py index 12b0622..ddf57a7 100644 --- a/cli_run.py +++ b/cli_run.py @@ -22,4 +22,4 @@ if len(sys.argv) >= 3: else: duration = 10 -jiffy.display_media_from_url(file_url, duration) \ No newline at end of file +jiffy.display_media_from_url(file_url, duration)