fnp
/
audio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Copy streams when muxing.
[audio.git]
/
src
/
archive
/
utils.py
diff --git
a/src/archive/utils.py
b/src/archive/utils.py
index
3e89a8b
..
b8598df
100644
(file)
--- a/
src/archive/utils.py
+++ b/
src/archive/utils.py
@@
-1,12
+1,12
@@
from hashlib import sha1
import os
import os.path
from hashlib import sha1
import os
import os.path
+import subprocess
from django.core.files.storage import FileSystemStorage
from django.core.files.uploadedfile import UploadedFile
class ExistingFile(UploadedFile):
from django.core.files.storage import FileSystemStorage
from django.core.files.uploadedfile import UploadedFile
class ExistingFile(UploadedFile):
-
def __init__(self, path, *args, **kwargs):
self.path = path
return super(ExistingFile, self).__init__(*args, **kwargs)
def __init__(self, path, *args, **kwargs):
self.path = path
return super(ExistingFile, self).__init__(*args, **kwargs)
@@
-19,19
+19,18
@@
class ExistingFile(UploadedFile):
class OverwriteStorage(FileSystemStorage):
class OverwriteStorage(FileSystemStorage):
-
def _save(self, name, content):
if self.exists(name):
self.delete(name)
return super(OverwriteStorage, self)._save(name, content)
def _save(self, name, content):
if self.exists(name):
self.delete(name)
return super(OverwriteStorage, self)._save(name, content)
- def get_available_name(self, name):
+ def get_available_name(self, name
, max_length
):
return name
def sha1_file(f):
sha = sha1()
return name
def sha1_file(f):
sha = sha1()
- for piece in iter(lambda: f.read(1024
*1024), ''
):
+ for piece in iter(lambda: f.read(1024
* 1024), b""
):
sha.update(piece)
return sha.hexdigest()
sha.update(piece)
return sha.hexdigest()
@@
-39,6
+38,5
@@
def sha1_file(f):
def all_files(root_path):
root_len = len(root_path)
for path, dirs, files in os.walk(root_path):
def all_files(root_path):
root_len = len(root_path)
for path, dirs, files in os.walk(root_path):
- for fname in files:
- yield os.path.join(path, fname)[root_len:].lstrip('/')
-
+ for fname in files:
+ yield os.path.join(path, fname)[root_len:].lstrip("/")