Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-tools-x393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-tools-x393
Commits
1e98674e
Commit
1e98674e
authored
Jun 03, 2019
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Read camogm.disk, get the footage size from it and download all if n==0
parent
e9c39d0f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
int_ssd_download.py
int_ssd_download.py
+15
-0
x393.py
x393.py
+29
-0
No files found.
int_ssd_download.py
View file @
1e98674e
...
...
@@ -18,6 +18,7 @@ import argparse
import
os
import
sys
import
time
import
math
import
x393
from
x393
import
bcolors
...
...
@@ -135,6 +136,20 @@ for i in range(len(cams)):
for
d
in
dirs
:
for
p
in
plist
:
if
d
==
p
[
0
]:
# p[1] == sdb2
# hardcoded /dev/sd?1
data_size
=
pc
.
read_camogm_disk_file
(
"/dev/"
+
p
[
1
][
0
:
-
1
]
+
"1"
)
data_size
=
round
(
data_size
,
2
)
# bs is in kB
chunk_size
=
float
(
args
.
bs
*
args
.
bc
)
/
1024
n_chunks
=
int
(
math
.
ceil
(
data_size
/
chunk_size
))
if
args
.
n
==
0
:
args
.
n
=
n_chunks
-
args
.
skip
print
(
"Data size: "
+
str
(
data_size
)
+
" GB"
)
print
(
"Download size: "
+
str
(
n_chunks
)
+
"x "
+
str
(
round
(
chunk_size
,
2
))
+
"GB, skipped the first "
+
str
(
args
.
skip
)
+
" chunks"
)
pc
.
download
(
args
.
dest
,
"/dev/"
+
p
[
1
],
args
.
bs
,
args
.
bc
,
args
.
skip
,
args
.
n
)
dirs
.
remove
(
d
)
proceed_to_next
=
True
...
...
x393.py
View file @
1e98674e
...
...
@@ -10,6 +10,7 @@ import os
import
re
import
subprocess
import
time
import
tempfile
def
shout
(
cmd
):
#subprocess.call prints to console
...
...
@@ -170,6 +171,34 @@ class PC():
plist
.
append
([
name
[
len
(
self
.
pattern
):],
item
[
-
1
]])
return
plist
# mounts partition (/dev/sd?1), reads camogm.disk file
# returns the download size from raw partition ((/dev/sd?2))
def
read_camogm_disk_file
(
self
,
part
):
result
=
""
tmp_mount_point
=
tempfile
.
mkdtemp
()
print
(
"mounting "
+
part
+
" to "
+
tmp_mount_point
)
shout
(
"sudo mount "
+
part
+
" "
+
tmp_mount_point
)
try
:
with
open
(
tmp_mount_point
+
"/camogm.disk"
,
"r"
)
as
myfile
:
data
=
myfile
.
readlines
()
if
len
(
data
)
==
2
:
l2
=
data
[
1
]
pointers
=
l2
.
split
(
"
\t
"
)
pntr1
=
int
(
pointers
[
1
])
pntr2
=
int
(
pointers
[
2
])
result
=
float
(
pntr2
-
pntr1
)
*
512
/
1024
/
1024
/
1024
except
IOError
:
print
(
tmp_mount_point
+
"/camogm.disk NOT FOUND"
)
shout
(
"sudo umount "
+
tmp_mount_point
)
os
.
rmdir
(
tmp_mount_point
)
return
result
def
is_raw
(
self
,
part
):
res
=
shout
(
"sudo blkid | grep "
+
str
(
part
))
typ
=
"TYPE="
...
...
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