Browse files

get disk free space

  • Loading branch information...
1 parent bccac83 commit 09b9eec93c49248b36882f2ffd6e70532c1b5b1a @andreisavu committed May 18, 2009
Showing with 13 additions and 8 deletions.
  1. +13 −8 lib/__init__.py
View
21 lib/__init__.py
@@ -1,5 +1,10 @@
import mp3
+import os
+
+def freespace(p):
+ s = os.statvfs(p)
+ return s.f_bsize * s.f_bavail
def get_mp3_info(file):
file.seek(0)
@@ -9,13 +14,13 @@ def get_mp3_info(file):
return info
def is_mp3(fp):
- fp.seek(0)
- bf = fp.read(1024)
- import magic
- mc = magic.open(magic.MAGIC_MIME)
- mc.load()
- if mc.buffer(bf) != 'audio/mpeg':
- return False
- return True
+ fp.seek(0)
+ bf = fp.read(1024)
+ import magic
+ mc = magic.open(magic.MAGIC_MIME)
+ mc.load()
+ if mc.buffer(bf) != 'audio/mpeg':
+ return False
+ return True

0 comments on commit 09b9eec

Please sign in to comment.