Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Terrestrial Mapping Platform
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Field Science
Terrestrial Mapping Platform
Compare revisions
148c76e9493a01237bbca3ce9a17d10c51a40740 to 81863e647ebbf4deafcbfb80e865017d37ac08c8
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
field-science/terrestrial-mapping-platform
Select target project
No results found
81863e647ebbf4deafcbfb80e865017d37ac08c8
Select Git revision
Swap
Target
field-science/terrestrial-mapping-platform
Select target project
field-science/terrestrial-mapping-platform
1 result
148c76e9493a01237bbca3ce9a17d10c51a40740
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
minor changes
· 9c4c7dda
charliep
authored
2 years ago
9c4c7dda
Merge branch 'master' of
https://code.cs.earlham.edu/field-science/terrestrial-mapping-platform
· 81863e64
charliep
authored
2 years ago
81863e64
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fetch-gdrive-object.py
+14
-2
14 additions, 2 deletions
fetch-gdrive-object.py
with
14 additions
and
2 deletions
fetch-gdrive-object.py
View file @
81863e64
...
@@ -13,11 +13,16 @@
...
@@ -13,11 +13,16 @@
# Google Sheets: .xslx, .ods, .csv, .tsv, .pdf, and .html
# Google Sheets: .xslx, .ods, .csv, .tsv, .pdf, and .html
# Google Slides: .pptx, .pdf, .svg, .jpg, .png, and .txt
# Google Slides: .pptx, .pdf, .svg, .jpg, .png, and .txt
# Google Drawings: pdf, .svg, .jpg, .png
# Google Drawings: pdf, .svg, .jpg, .png
# Files:
# todo
# todo
# test on all machines (py2 or py3 code?)
# test on all machines (py2 or py3 code?)
# look for -i error in log to determine success? (in fetchObject())
# look for -i error in log to determine success? (in fetchObject())
# support presentation drawings text # slide is the language used elsewhere
# support for other object types:
# file - done
# presentation
# drawings # slide is the language used elsewhere
# text
# pylint
# pylint
# test under osx so that people can use it on their local machines to fetch workflows
# test under osx so that people can use it on their local machines to fetch workflows
...
@@ -33,6 +38,9 @@ def fetchObject(documentId, objectType, outputFormat, outputName, logFile):
...
@@ -33,6 +38,9 @@ def fetchObject(documentId, objectType, outputFormat, outputName, logFile):
elif
objectType
==
'
doc
'
:
elif
objectType
==
'
doc
'
:
location
=
'
document/d/
'
location
=
'
document/d/
'
elif
objectType
==
'
file
'
:
location
=
'
file/d/
'
# DOC_ID=1olFTlH4ssJIv01n40-44BIDda0OkXcFhXj-SLVtZwks
# DOC_ID=1olFTlH4ssJIv01n40-44BIDda0OkXcFhXj-SLVtZwks
command
=
'
wget --output-file=
'
+
logFile
+
'
\"
'
+
base
+
location
+
documentId
+
'
/export?format=
'
+
outputFormat
command
=
'
wget --output-file=
'
+
logFile
+
'
\"
'
+
base
+
location
+
documentId
+
'
/export?format=
'
+
outputFormat
...
@@ -43,6 +51,7 @@ def fetchObject(documentId, objectType, outputFormat, outputName, logFile):
...
@@ -43,6 +51,7 @@ def fetchObject(documentId, objectType, outputFormat, outputName, logFile):
command
=
command
+
'
\"
'
command
=
command
+
'
\"
'
command
=
command
+
'
-O
'
+
outputName
command
=
command
+
'
-O
'
+
outputName
_status
=
os
.
system
(
command
)
_status
=
os
.
system
(
command
)
return
_status
return
_status
...
@@ -52,7 +61,7 @@ if __name__ == "__main__":
...
@@ -52,7 +61,7 @@ if __name__ == "__main__":
parser
=
argparse
.
ArgumentParser
(
description
=
'
fetch-gdrive-object
'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'
fetch-gdrive-object
'
)
parser
.
add_argument
(
'
-d
'
,
'
--documentId
'
,
type
=
str
,
help
=
'
GDrive Document ID
'
,
required
=
True
)
parser
.
add_argument
(
'
-d
'
,
'
--documentId
'
,
type
=
str
,
help
=
'
GDrive Document ID
'
,
required
=
True
)
parser
.
add_argument
(
'
-t
'
,
'
--objectType
'
,
type
=
str
,
choices
=
[
'
doc
'
,
'
sheet
'
],
help
=
'
Object type {doc, sheet}
'
,
required
=
True
)
parser
.
add_argument
(
'
-t
'
,
'
--objectType
'
,
type
=
str
,
choices
=
[
'
doc
'
,
'
sheet
'
,
'
file
'
],
help
=
'
Object type {doc, sheet
, file
}
'
,
required
=
True
)
parser
.
add_argument
(
'
-f
'
,
'
--outputFormat
'
,
type
=
str
,
help
=
'
Output format (must fit type)
'
,
required
=
True
)
parser
.
add_argument
(
'
-f
'
,
'
--outputFormat
'
,
type
=
str
,
help
=
'
Output format (must fit type)
'
,
required
=
True
)
parser
.
add_argument
(
'
-o
'
,
'
--outputName
'
,
type
=
str
,
help
=
'
Output file name
'
,
required
=
True
)
parser
.
add_argument
(
'
-o
'
,
'
--outputName
'
,
type
=
str
,
help
=
'
Output file name
'
,
required
=
True
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
...
@@ -68,6 +77,9 @@ if __name__ == "__main__":
...
@@ -68,6 +77,9 @@ if __name__ == "__main__":
elif
args
.
objectType
==
'
sheet
'
and
args
.
outputFormat
in
[
'
xslx
'
,
'
ods
'
,
'
csv
'
,
'
tsv
'
,
'
pdf
'
,
'
html
'
]:
elif
args
.
objectType
==
'
sheet
'
and
args
.
outputFormat
in
[
'
xslx
'
,
'
ods
'
,
'
csv
'
,
'
tsv
'
,
'
pdf
'
,
'
html
'
]:
status
=
fetchObject
(
args
.
documentId
,
args
.
objectType
,
args
.
outputFormat
,
args
.
outputName
,
logFile
)
status
=
fetchObject
(
args
.
documentId
,
args
.
objectType
,
args
.
outputFormat
,
args
.
outputName
,
logFile
)
elif
args
.
objectType
==
'
file
'
and
args
.
outputFormat
in
[
'
xslx
'
,
'
ods
'
,
'
csv
'
,
'
tsv
'
,
'
pdf
'
,
'
html
'
,
'
jpg
'
,
'
png
'
]:
status
=
fetchObject
(
args
.
documentId
,
args
.
objectType
,
args
.
outputFormat
,
args
.
outputName
,
logFile
)
else
:
else
:
print
(
'
fetch-gdrive-object: error, unsupported objectType or objectType outputFormat combination
'
)
print
(
'
fetch-gdrive-object: error, unsupported objectType or objectType outputFormat combination
'
)
exit
(
-
1
)
exit
(
-
1
)
...
...
This diff is collapsed.
Click to expand it.