import glob
import os
import stat
+import time
import subprocess
try:
from xml.etree import cElementTree as ElementTree
except:
from xml.etree import ElementTree
+_removeableCache = None
+_removeableCacheTime = None
+
def _parseStupidPListXML(e):
if e.tag == 'plist':
return _parseStupidPListXML(list(e)[0])
return ret
def getPossibleSDcardDrives():
+ global _removeableCache, _removeableCacheTime
+ if _removeableCache is not None and time.time() - _removeableCacheTime < 5.0:
+ return _removeableCache
+
drives = []
if platform.system() == "Windows":
from ctypes import windll
else:
for volume in glob.glob('/media/*'):
drives.append((os.path.basename(volume), volume, os.path.basename(volume)))
+
+ _removeableCache = drives
+ _removeableCacheTime = time.time()
return drives
if __name__ == '__main__':