Exemplo n.º 1
0
  def read(self, path, size, offset, fh):
    #TODO: handle file descriptors properly
    if path in self.data_cache:
      data = self.data_cache[path]
    else:
      url = filepicker.url_for_file(path)
      print "url to download from: ", url
      f = urllib2.urlopen(url)
      data = f.read()
      old_offset = 0
      self.data_cache[path] = data

    print "requesting", path, "offset:", offset, "size:", size, "real len:", len(data)
    start = min(len(data), offset)
    end = min(len(data), offset+size)
    print "start", start, "end", end

    return data[start:end]
Exemplo n.º 2
0
import filepicker
#filepicker.warm_cache()

#print filepicker.list_dir('/')
#print filepicker.list_dir('/Dropbox/150smoots/')
#print filepicker.data_for_dir('/Dropbox/150smoots/')
print filepicker.url_for_file('/Dropbox/PythonTut.pdf/')
#print filepicker.data_for_dir('/Facebook/1088936423670/')
#print filepicker.data_for_dir('/')
#print filepicker.data_for_dir('/Facebook/1088936423670/')
#print filepicker.data_for_dir('/')