Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
2c2771d8
Commit
2c2771d8
authored
Mar 24, 2021
by
Luca Braun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started work on upload-script
parent
c3a32399
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
0 deletions
+71
-0
pull_video_data.py
src/rest-gateway/app/pull_video_data.py
+71
-0
No files found.
src/rest-gateway/app/pull_video_data.py
0 → 100644
View file @
2c2771d8
import
requests
import
json
videoListUrl
=
"https://dev758755.vialog.app/Videos/Meta/ListAll"
videoUrl
=
"https://dev758755.vialog.app/stat/events?type=video&id="
videosRequest
=
requests
.
get
(
videoListUrl
)
test
=
set
()
if
(
videosRequest
.
status_code
!=
200
):
print
(
f
"Status: {videosRequest.status_code}"
)
for
video
in
videosRequest
.
json
():
id
=
video
[
"videoId"
]
videoRequest
=
requests
.
get
(
f
"{videoUrl}{id}"
)
if
videoRequest
.
status_code
!=
200
:
print
(
f
"Status: {videoRequest.status_code}"
)
if
videoRequest
.
text
!=
""
:
historyList
=
sorted
(
videoRequest
.
json
()[
0
][
"History"
],
key
=
lambda
k
:
k
[
'moderationDate'
],
reversed
=
True
)
i
=
0
changeList
=
[]
for
eventMap
in
historyList
:
if
i
==
0
:
lastState
=
videoRequest
.
json
()[
0
][
"History"
][
0
]
if
eventMap
[
"eventName"
]
==
'r1eabcbdc8f5378b2ba71a1b6fe2038b Created'
or
eventMap
[
"eventName"
]
==
'Created'
:
change
=
{
"changeType"
:
"Created"
,
"changedValue"
:
"video_state"
,
"previousValue"
:
""
,
"newValue"
:
"Created"
}
print
(
change
)
elif
eventMap
[
"eventName"
]
==
"Restore"
:
change
=
{
"changeType"
:
"Restore"
,
"changedValue"
:
""
,
"previousValue"
:
""
,
"newValue"
:
""
}
print
(
eventMap
)
#change = {"changeType": "Restore", "changedValue": ""}
elif
eventMap
[
"eventName"
]
==
"PositionChange"
:
change
=
{
"changeType"
:
"PositionChange"
,
"changedValue"
:
"position"
,
"previousValue"
:
eventMap
[
"position"
],
"newValue"
:
""
}
print
(
eventMap
)
elif
eventMap
[
"eventName"
]
==
"Hide"
:
print
(
eventMap
)
elif
eventMap
[
"eventName"
]
==
"Publish"
:
print
(
eventMap
)
elif
eventMap
[
"eventName"
]
==
"CMNote"
:
print
(
eventMap
)
elif
eventMap
[
"eventName"
]
==
"Move"
:
print
(
eventMap
)
elif
eventMap
[
"eventName"
]
==
"VideoType"
:
print
(
eventMap
)
elif
eventMap
[
"eventName"
]
==
"Delete"
:
print
(
eventMap
)
elif
eventMap
[
"eventName"
]
==
"Copy"
:
print
(
eventMap
)
elif
eventMap
[
"eventName"
]
==
"CustomLabel"
:
print
(
eventMap
)
i
+=
1
print
(
test
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment