Skip to content
Open
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
18 changes: 9 additions & 9 deletions automated_quality_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def get_ten_random_assets():
"""

response = requests.get(
'https://api.screenlyapp.com/v4/assets?select=id&type=in.("appweb","audio","edge-app","image","video","web")&status=in.("finished","processing")',
'https://api.screenlyapp.com/v4.1/assets?select=id&type=in.("appweb","audio","edge-app","image","video","web")&status=in.("finished","processing")',
headers=REQUEST_HEADERS,
)
response.raise_for_status()
Expand All @@ -43,7 +43,7 @@ def get_screens() -> List[Dict[str, Any]]:
Return a list of screens in the account.
"""

response = requests.get('https://api.screenlyapp.com/v4/screens?select=id,name,hostname,status,in_sync&type=eq.hardware&is_enabled=eq.true', headers=REQUEST_HEADERS)
response = requests.get('https://api.screenlyapp.com/v4.1/screens?select=id,name,hostname,status,in_sync&type=eq.hardware&is_enabled=eq.true', headers=REQUEST_HEADERS)
response.raise_for_status()
return response.json()

Expand Down Expand Up @@ -89,7 +89,7 @@ def get_qc_playlist_ids():
Get all playlists starting with 'PLAYLIST_PREFIX'.
"""

response = requests.get("https://api.screenlyapp.com/v4/playlists", headers=REQUEST_HEADERS)
response = requests.get("https://api.screenlyapp.com/v4.1/playlists", headers=REQUEST_HEADERS)
response.raise_for_status()

qc_playlists = []
Expand All @@ -106,13 +106,13 @@ def delete_playlist(playlist_id):
removed before the playlist itself can be deleted.
"""
items_response = requests.delete(
f"https://api.screenlyapp.com/v4/playlist-items?playlist_id=eq.{playlist_id}",
f"https://api.screenlyapp.com/v4.1/playlist-items?playlist_id=eq.{playlist_id}",
headers=REQUEST_HEADERS,
)
if not items_response.ok:
return False
response = requests.delete(
f"https://api.screenlyapp.com/v4/playlists?id=eq.{playlist_id}",
f"https://api.screenlyapp.com/v4.1/playlists?id=eq.{playlist_id}",
headers=REQUEST_HEADERS,
)
return response.ok
Expand All @@ -123,7 +123,7 @@ def get_all_screens_label_id():
Return the ID of the built-in 'all-screens' label.
"""
response = requests.get(
"https://api.screenlyapp.com/v4/labels?type=eq.all-screens",
"https://api.screenlyapp.com/v4.1/labels?type=eq.all-screens",
headers=REQUEST_HEADERS,
)
response.raise_for_status()
Expand All @@ -143,7 +143,7 @@ def add_asset_to_playlist(playlist_id, asset_id):
"duration": 10,
}
response = requests.post(
"https://api.screenlyapp.com/v4/playlist-items",
"https://api.screenlyapp.com/v4.1/playlist-items",
headers={**REQUEST_HEADERS, "Prefer": "return=representation"},
json=payload,
)
Expand All @@ -161,7 +161,7 @@ def assign_playlist_to_all_screens(playlist_id):
"playlist_id": playlist_id,
}
response = requests.post(
"https://api.screenlyapp.com/v4/labels/playlists",
"https://api.screenlyapp.com/v4.1/labels/playlists",
headers={**REQUEST_HEADERS, "Prefer": "return=representation"},
json=payload,
)
Expand All @@ -184,7 +184,7 @@ def create_qc_playlist():
}

response = requests.post(
"https://api.screenlyapp.com/v4/playlists",
"https://api.screenlyapp.com/v4.1/playlists",
headers={**REQUEST_HEADERS, "Prefer": "return=representation"},
json=payload,
)
Expand Down
Loading