On Fri, 2006-24-11 at 18:54 -0500, Omen Nemo wrote: > Hi, > > I've written a small python plugin to copy albums to my usb player. > > The idea is to automatically: > - create the same artist/album path on the player > - add track number to the file name (which I don't want in my collection) so > the player plays in order > - convert the filenames to ascii (it doesn't like utf) > - and possibly recompress, convert ogg to mp3, or whatever other modification > required by the player. > > I'd like to open a small progress window while it's copying, but couldn't > find any way to do it since the gtk loop only comes back at the end of the > python operation. > Any way to get the plugin to run in a parallel thread, so the UI doesn't just > hang there? > > Thanks. > ON
What functions are you using to copy the files? You probably want to use something like gnomevfs.async.xfer, which does the transfer in a separate thread and calls another function once its done (it also calls a function periodically to report progress info). Take a look at the magnatune plugin for an example of how to use async.xfer in python. Specifically, look in MagnatuneSource.py at the functions __download_album(), __purchase_download_update_cb() (which gets called when "big" events happen like it's finished or an error occurs), and __purchase_download_progress_cb() (which gets called periodically with download progress). -- Adam Zimmerman <[EMAIL PROTECTED]> CREATIVITY - http://mirrors.creativecommons.org/movingimages/Building_on_the_Past.mpg ALWAYS - http://www.musiccreators.ca/ BUILDS - http://www.ubuntu.com/ ON THE PAST - http://www.theopencd.org/ -- If you want to know what god thinks of money, just look at the people he gave it to. -- Dorthy Parker _______________________________________________ rhythmbox-devel mailing list [email protected] http://mail.gnome.org/mailman/listinfo/rhythmbox-devel
