Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
fde4bd2c
Commit
fde4bd2c
authored
4 years ago
by
Mnikolenko Productengine
Browse files
Options
Downloads
Patches
Plain Diff
SL-15177 Add slp-csv converting script
parent
3392d580
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/metrics/slp_conv.py
+55
-0
55 additions, 0 deletions
scripts/metrics/slp_conv.py
with
55 additions
and
0 deletions
scripts/metrics/slp_conv.py
0 → 100644
+
55
−
0
View file @
fde4bd2c
#!/usr/bin/python
"""
\
@file slp_conv.py
@author Callum Prentice
@date 2021-01-26
@brief Convert a Second Life Performance (SLP) file generated
by the Viewer into an comma separated value (CSV) file
for import into spreadsheets and other data analytics tools.
$LicenseInfo:firstyear=2018&license=internal$
Copyright (c) 2018, Linden Research, Inc.
$/LicenseInfo$
"""
from
llbase
import
llsd
import
argparse
parser
=
argparse
.
ArgumentParser
(
description
=
"
Converts Viewer SLP files into CSV for import into spreadsheets etc.
"
)
parser
.
add_argument
(
"
infilename
"
,
help
=
"
Name of SLP file to read
"
,
)
parser
.
add_argument
(
"
outfilename
"
,
help
=
"
Name of CSV file to create
"
,
)
args
=
parser
.
parse_args
()
with
open
(
args
.
infilename
,
"
r
"
)
as
slp_file
:
slps
=
slp_file
.
readlines
()
print
"
Reading from %s - %d items
"
%
(
args
.
infilename
,
len
(
slps
))
with
open
(
args
.
outfilename
,
"
w
"
)
as
csv_file
:
print
"
Writing to %s
"
%
args
.
outfilename
for
index
,
each_slp
in
enumerate
(
slps
):
slp_entry
=
llsd
.
parse
(
each_slp
)
first_key
=
slp_entry
.
keys
()[
0
]
# first entry so write column headers
if
index
==
0
:
line
=
""
for
key
,
value
in
slp_entry
[
first_key
].
iteritems
():
line
+=
key
line
+=
"
,
"
csv_file
.
write
(
"
entry, %s,
\n
"
%
line
)
# write line of data
line
=
""
for
key
,
value
in
slp_entry
[
first_key
].
iteritems
():
line
+=
str
(
value
)
line
+=
"
,
"
csv_file
.
write
(
"
%s, %s,
\n
"
%
(
first_key
,
str
(
line
)))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment