Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
storagedriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
4
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b11847ec
authored
Oct 16, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-md5sum' into 'master'
Feature md5sum See merge request
!6
parents
c7e54d3d
b55486cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
disk.py
+9
-1
storagedriver.py
+2
-1
No files found.
disk.py
View file @
b11847ec
...
...
@@ -8,7 +8,7 @@ from zipfile import ZipFile, is_zipfile
from
zlib
import
decompressobj
,
MAX_WBITS
from
bz2
import
BZ2Decompressor
from
time
import
sleep
from
hashlib
import
md5
import
re
import
requests
...
...
@@ -52,6 +52,14 @@ class Disk(object):
self
.
actual_size
=
actual_size
self
.
base_name
=
base_name
@property
def
checksum
(
self
,
blocksize
=
65536
):
hash
=
md5
()
with
open
(
self
.
get_path
(),
"rb"
)
as
f
:
for
block
in
iter
(
lambda
:
f
.
read
(
blocksize
),
""
):
hash
.
update
(
block
)
return
hash
.
hexdigest
()
@classmethod
def
deserialize
(
cls
,
desc
):
"""Create cls object from JSON."""
...
...
storagedriver.py
View file @
b11847ec
...
...
@@ -37,7 +37,8 @@ class download(AbortableTask):
disk
=
Disk
.
deserialize
(
disk_desc
)
disk
.
download
(
self
,
url
,
parent_id
)
return
{
'size'
:
disk
.
size
,
'type'
:
disk
.
format
}
'type'
:
disk
.
format
,
'checksum'
:
disk
.
checksum
,
}
@celery.task
()
...
...
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