View Single Post
Old 08-15-2013, 12:29 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,400
Karma: 27756918
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I doubt there's any existing plugin that does that. You will basically need to hook into the books_uploaded function defined in gui2/device.py

The easiest way is to simply replace that function with your own, something like

self.original_books_uploaded = self.gui.books_uploaded
self.gui.books_upload = self.my_books_uploaded

def my_books_uploaded(self, job):
self.original_books_uploaded(job)
# do whatever you want to do

There maybe some function binding issues you will have to deal with, basically ensure that self is the right object in every context. A bit of googling about python monkey patching should tell you how.
kovidgoyal is offline   Reply With Quote