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
dd6c873f
Commit
dd6c873f
authored
Mar 30, 2021
by
Luca Braun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix
parent
24f42cac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
17 deletions
+13
-17
pull_video_data.py
src/rest-gateway/app/pull_video_data.py
+13
-17
No files found.
src/rest-gateway/app/pull_video_data.py
View file @
dd6c873f
...
...
@@ -38,10 +38,14 @@ for video in videosRequest.json():
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'
],
reverse
=
True
)
historyList
.
append
(
empty
)
i
=
0
changeList
=
[]
for
eventMap
in
historyList
:
if
historyList
[
i
+
1
]
==
empty
:
break
if
i
==
0
:
lastState
=
eventMap
lastState
[
"AppicationType"
]
=
"vialog"
...
...
@@ -51,41 +55,32 @@ for video in videosRequest.json():
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"
:
""
}
elif
eventMap
[
"eventName"
]
==
"PositionChange"
:
change
=
{
"changeType"
:
"PositionChange"
,
"changedValue"
:
"position"
,
"previousValue"
:
historyList
[
i
-
1
][
"position"
],
"newValue"
:
eventMap
[
"position"
]}
print
(
change
)
change
=
{
"changeType"
:
"PositionChange"
,
"changedValue"
:
"position"
,
"previousValue"
:
historyList
[
i
+
1
][
"position"
],
"newValue"
:
eventMap
[
"position"
]}
elif
eventMap
[
"eventName"
]
==
"Hide"
:
change
=
{
"changeType"
:
"Hide"
,
"changedValue"
:
"video_state"
,
"previousValue"
:
historyList
[
i
-
1
][
"video_state"
],
"newValue"
:
eventMap
[
"video_state"
]}
print
(
change
)
change
=
{
"changeType"
:
"Hide"
,
"changedValue"
:
"video_state"
,
"previousValue"
:
historyList
[
i
+
1
][
"video_state"
],
"newValue"
:
eventMap
[
"video_state"
]}
elif
eventMap
[
"eventName"
]
==
"Publish"
:
change
=
{
"changeType"
:
"Publish"
,
"changedValue"
:
"video_state"
,
"previousValue"
:
historyList
[
i
-
1
][
"video_state"
],
"newValue"
:
eventMap
[
"video_state"
]}
print
(
change
)
change
=
{
"changeType"
:
"Publish"
,
"changedValue"
:
"video_state"
,
"previousValue"
:
historyList
[
i
+
1
][
"video_state"
],
"newValue"
:
eventMap
[
"video_state"
]}
elif
eventMap
[
"eventName"
]
==
"CMNote"
:
change
=
{
"changeType"
:
"CMNote"
,
"changedValue"
:
"communityManagerNotes"
,
"previousValue"
:
historyList
[
i
-
1
][
"communityManagerNotes"
],
"newValue"
:
eventMap
[
"communityManagerNotes"
]}
print
(
change
)
change
=
{
"changeType"
:
"CMNote"
,
"changedValue"
:
"communityManagerNotes"
,
"previousValue"
:
historyList
[
i
+
1
][
"communityManagerNotes"
],
"newValue"
:
eventMap
[
"communityManagerNotes"
]}
elif
eventMap
[
"eventName"
]
==
"Move"
:
change
=
{
"changeType"
:
"Move"
,
"changedValue"
:
"position"
,
"previousValue"
:
historyList
[
i
-
1
][
"position"
],
"newValue"
:
eventMap
[
"position"
]}
print
(
change
)
change
=
{
"changeType"
:
"Move"
,
"changedValue"
:
"position"
,
"previousValue"
:
historyList
[
i
+
1
][
"position"
],
"newValue"
:
eventMap
[
"position"
]}
elif
eventMap
[
"eventName"
]
==
"VideoType"
:
change
=
{
"changeType"
:
"VideoType"
,
"changedValue"
:
"video_type"
,
"previousValue"
:
historyList
[
i
-
1
][
"video_type"
],
"newValue"
:
eventMap
[
"video_type"
]}
print
(
change
)
change
=
{
"changeType"
:
"VideoType"
,
"changedValue"
:
"video_type"
,
"previousValue"
:
historyList
[
i
+
1
][
"video_type"
],
"newValue"
:
eventMap
[
"video_type"
]}
elif
eventMap
[
"eventName"
]
==
"Delete"
:
change
=
{
"changeType"
:
"Delete"
,
"changedValue"
:
""
,
"previousValue"
:
""
,
"newValue"
:
""
}
print
(
change
)
elif
eventMap
[
"eventName"
]
==
"Copy"
:
change
=
{
"changeType"
:
"Copy"
,
"changedValue"
:
""
,
"previousValue"
:
""
,
"newValue"
:
""
}
print
(
change
)
elif
eventMap
[
"eventName"
]
==
"CustomLabel"
:
change
=
{
"changeType"
:
"CustomLabel"
,
"changedValue"
:
"label"
,
"previousValue"
:
historyList
[
i
-
1
][
"label"
],
"newValue"
:
eventMap
[
"label"
]}
print
(
change
)
change
=
{
"changeType"
:
"CustomLabel"
,
"changedValue"
:
"label"
,
"previousValue"
:
historyList
[
i
+
1
][
"label"
],
"newValue"
:
eventMap
[
"label"
]}
change
[
"videoId"
]
=
id
change
[
"timestamp"
]
=
eventMap
[
"moderationDate"
]
change
[
"ApplicationType"
]
=
"vialog"
change
[
"docType"
]
=
"vialog-change"
print
(
change
)
#send_transaction_to_rest_gateway(change)
i
+=
1
elif
videoRequest
.
text
==
""
:
...
...
@@ -96,6 +91,7 @@ for video in videosRequest.json():
print
(
f
"empty: {empty}
\n\n
"
)
print
(
f
"html page: {html}
\n\n
"
)
print
(
f
"history: {historyList}"
)
print
(
dataCount
)
...
...
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