Commit 24f42cac authored by Luca Braun's avatar Luca Braun

added some finishing touches

parent 44fa091e
......@@ -5,29 +5,48 @@ import json
videoListUrl = "https://dev758755.vialog.app/Videos/Meta/ListAll"
videoUrl = "https://dev758755.vialog.app/stat/events?type=video&id="
# token from Rest Gateway to authorize
JWT_TOKEN = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InJlZ3VsYXJAaXRlYy5hYXUuYXQiLCJjcmVhdGVkX2F0IjoiMjAyMC0xMC0wNiAwOTowNzoyMy44MjEyOTciLCJ2YWxpZF91bnRpbCI6IjIwMjAtMTAtMDcgMDk6MDc6MjMuODIxMjk3In0.orqTjn-3J4qMM0kpreWVPkwUEtUcgoqo6wsUFxKCrwg'
def send_transaction_to_rest_gateway(transaction: dict):
res = requests.post(
url = 'https://articonf1.itec.aau.at:30401/api/trace',
json = transaction,
headers = {"Authorization": f"Bearer {JWT_TOKEN}"},
verify = False # ignore ssl error
)
print(res)
videosRequest = requests.get(videoListUrl)
test = set()
empty = set()
html = set()
if (videosRequest.status_code != 200):
print(f"Status: {videosRequest.status_code}")
dataCount = 0
for video in videosRequest.json():
dataCount += 1
id = video["videoId"]
videoRequest = requests.get(f"{videoUrl}{id}")
if videoRequest.status_code != 200:
print(f"Status: {videoRequest.status_code}")
if videoRequest.text != "":
if videoRequest.text != "" and not videoRequest.text.startswith("<!DOCTYPE html>"):
print(f"\n\n{videoUrl}{id}\n{videoRequest.text}")
historyList = sorted(videoRequest.json()[0]["History"], key=lambda k: k['moderationDate'], reversed=True)
historyList = sorted(videoRequest.json()[0]["History"], key=lambda k: k['moderationDate'], reverse=True)
i = 0
changeList = []
for eventMap in historyList:
if i == 0:
lastState = eventMap
lastState["AppicationType"] = "vialog"
lastState["docType"] = "vialog-video"
#send_transaction_to_rest_gateway(lastState)
print(lastState)
if eventMap["eventName"] == 'r1eabcbdc8f5378b2ba71a1b6fe2038b Created' or eventMap["eventName"] == 'Created':
......@@ -63,9 +82,21 @@ for video in videosRequest.json():
change = {"changeType": "CustomLabel", "changedValue": "label", "previousValue": historyList[i-1]["label"], "newValue":eventMap["label"]}
print(change)
change["videoId"] = id
change["timestamp"] = eventMap["moderationDate"]
change["ApplicationType"] = "vialog"
change["docType"] = "vialog-change"
#send_transaction_to_rest_gateway(change)
i += 1
elif videoRequest.text == "":
empty.add(id)
else:
html.add(id)
print(test)
print(f"empty: {empty}\n\n")
print(f"html page: {html}\n\n")
print(dataCount)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment