Guest User

Untitled

a guest
Dec 14th, 2011
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.13 KB | None | 0 0
  1. # in file -> /usr/lib/rhythmbox/plugins/rb/Loader.py
  2. def get_url_chunks (self, uri, chunksize, want_size, callback, *args):
  3.                 # this can't possibly work yet, we need to get annotations and
  4.                 # other stuff for g_input_stream_read_async right first.
  5.                 raise Exception("rb.ChunkLoader not implemented yet")
  6.  
  7.                 try:
  8.                         self.uri = uri
  9.                         self.chunksize = chunksize
  10.                         self.total = 0
  11.                         self.callback = callback
  12.                         self.args = args
  13.  
  14.                         file = Gio.File(uri)
  15.                         if want_size:
  16.                                 file.query_info_async(Gio.FILE_ATTRIBUTE_STANDARD_SIZE, Gio.FileQueryInfoFlags.NONE, GLib.PRIORITY_DEFAULT, self._cancel, self._info_cb, None)
  17.                         else:
  18.                                 file.read_async(GLib.PRIORITY_DEFAULT, self._cancel, self._open_cb, None)
  19.                 except Exception, e:
  20.                         print "error reading file %s: %s" % (uri, e.message)
  21.                         self._callback(e)
Advertisement
Add Comment
Please, Sign In to add comment