fnp
/
audio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
set max_length of flac file path to 255
[audio.git]
/
apps
/
archive
/
utils.py
diff --git
a/apps/archive/utils.py
b/apps/archive/utils.py
index
4710c20
..
6e0a8d1
100755
(executable)
--- a/
apps/archive/utils.py
+++ b/
apps/archive/utils.py
@@
-1,5
+1,7
@@
+from hashlib import sha1
from django.core.files.uploadedfile import UploadedFile
from django.core.files.uploadedfile import UploadedFile
+
class ExistingFile(UploadedFile):
def __init__(self, path, *args, **kwargs):
class ExistingFile(UploadedFile):
def __init__(self, path, *args, **kwargs):
@@
-11,3
+13,10
@@
class ExistingFile(UploadedFile):
def close(self):
pass
def close(self):
pass
+
+
+def sha1_file(f):
+ sha = sha1()
+ for piece in iter(lambda: f.read(1024*1024), ''):
+ sha.update(piece)
+ return sha.hexdigest()