Author: dmeyer
Date: Sun Apr 15 08:24:21 2007
New Revision: 9449
Modified:
trunk/ui/src/directory.py
Log:
include freespace and totalspace into diritem
Modified: trunk/ui/src/directory.py
==============================================================================
--- trunk/ui/src/directory.py (original)
+++ trunk/ui/src/directory.py Sun Apr 15 08:24:21 2007
@@ -118,27 +118,6 @@
return string[0].upper() + string[1:]
-def freespace(path):
- """
- freespace(path) -> integer
- Return the number of bytes available to the user on the file system
- pointed to by path.
- """
- s = os.statvfs(path)
- return s[statvfs.F_BAVAIL] * long(s[statvfs.F_BSIZE])
-
-
-def totalspace(path):
- """
- totalspace(path) -> integer
- Return the number of total bytes available on the file system
- pointed to by path.
- """
-
- s = os.statvfs(path)
- return s[statvfs.F_BLOCKS] * long(s[statvfs.F_BSIZE])
-
-
class DirItem(Playlist):
"""
class for handling directories
@@ -217,7 +196,12 @@
return num_items[2]
if key in ( 'freespace', 'totalspace' ):
- space = eval(key)(self.filename) / 1000000
+ s = os.statvfs(self.filename)
+ if key == 'freespace':
+ space = s[statvfs.F_BAVAIL] * long(s[statvfs.F_BSIZE])
+ else:
+ space = s[statvfs.F_BLOCKS] * long(s[statvfs.F_BSIZE])
+ space = space / 1000000
if space > 1000:
space='%s,%s' % (space / 1000, space % 1000)
return space
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog