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
44fa091e
Commit
44fa091e
authored
Mar 26, 2021
by
Luca Braun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added change types
parent
2c2771d8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
pull_video_data.py
src/rest-gateway/app/pull_video_data.py
+21
-13
No files found.
src/rest-gateway/app/pull_video_data.py
View file @
44fa091e
...
...
@@ -20,40 +20,48 @@ for video in videosRequest.json():
print
(
f
"Status: {videoRequest.status_code}"
)
if
videoRequest
.
text
!=
""
:
print
(
f
"
\n\n
{videoUrl}{id}
\n
{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
]
lastState
=
eventMap
print
(
lastState
)
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
)
change
=
{
"changeType"
:
"PositionChange"
,
"changedValue"
:
"position"
,
"previousValue"
:
historyList
[
i
-
1
][
"position"
],
"newValue"
:
eventMap
[
"position"
]
}
print
(
change
)
elif
eventMap
[
"eventName"
]
==
"Hide"
:
print
(
eventMap
)
change
=
{
"changeType"
:
"Hide"
,
"changedValue"
:
"video_state"
,
"previousValue"
:
historyList
[
i
-
1
][
"video_state"
],
"newValue"
:
eventMap
[
"video_state"
]}
print
(
change
)
elif
eventMap
[
"eventName"
]
==
"Publish"
:
print
(
eventMap
)
change
=
{
"changeType"
:
"Publish"
,
"changedValue"
:
"video_state"
,
"previousValue"
:
historyList
[
i
-
1
][
"video_state"
],
"newValue"
:
eventMap
[
"video_state"
]}
print
(
change
)
elif
eventMap
[
"eventName"
]
==
"CMNote"
:
print
(
eventMap
)
change
=
{
"changeType"
:
"CMNote"
,
"changedValue"
:
"communityManagerNotes"
,
"previousValue"
:
historyList
[
i
-
1
][
"communityManagerNotes"
],
"newValue"
:
eventMap
[
"communityManagerNotes"
]}
print
(
change
)
elif
eventMap
[
"eventName"
]
==
"Move"
:
print
(
eventMap
)
change
=
{
"changeType"
:
"Move"
,
"changedValue"
:
"position"
,
"previousValue"
:
historyList
[
i
-
1
][
"position"
],
"newValue"
:
eventMap
[
"position"
]}
print
(
change
)
elif
eventMap
[
"eventName"
]
==
"VideoType"
:
print
(
eventMap
)
change
=
{
"changeType"
:
"VideoType"
,
"changedValue"
:
"video_type"
,
"previousValue"
:
historyList
[
i
-
1
][
"video_type"
],
"newValue"
:
eventMap
[
"video_type"
]}
print
(
change
)
elif
eventMap
[
"eventName"
]
==
"Delete"
:
print
(
eventMap
)
change
=
{
"changeType"
:
"Delete"
,
"changedValue"
:
""
,
"previousValue"
:
""
,
"newValue"
:
""
}
print
(
change
)
elif
eventMap
[
"eventName"
]
==
"Copy"
:
print
(
eventMap
)
change
=
{
"changeType"
:
"Copy"
,
"changedValue"
:
""
,
"previousValue"
:
""
,
"newValue"
:
""
}
print
(
change
)
elif
eventMap
[
"eventName"
]
==
"CustomLabel"
:
print
(
eventMap
)
change
=
{
"changeType"
:
"CustomLabel"
,
"changedValue"
:
"label"
,
"previousValue"
:
historyList
[
i
-
1
][
"label"
],
"newValue"
:
eventMap
[
"label"
]}
print
(
change
)
i
+=
1
...
...
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