Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 03-30-2019, 06:58 PM   #1
karl1c
Connoisseur
karl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead community
 
Posts: 56
Karma: 15570
Join Date: Jul 2017
Device: iPad
Can I get notifications from a called script?

I can start a ThreadedJob and receive notifications using this function:

Code:
def sync_threaded(ids, db, log=None, abort=None, notifications=None):
    ...
    notifications.put((count/len(ids),
            _('Synced %d of %d')%(count, len(ids))))
    ...
In the same function, I can run another script successfully

Code:
import calibre_plugins.cal.cal2fun as cal2fun
def sync_threaded(ids, db, log=None, abort=None, notifications=None):
    ...
    cal2fun.main(ids, db)
    ...
Is it possible to call notifications.put() from within cal2fun.main() and how would I do it?

Thanks.
karl1c is offline   Reply With Quote
Old 03-31-2019, 04:24 AM   #2
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: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If your script is running in a separate process yu will need to set up IPC between them. python has some conveninece classes for this in the multiprocessing module in the stdlib. Look for LIstener and Client.
kovidgoyal is offline   Reply With Quote
Advert
Old 04-01-2019, 04:01 PM   #3
karl1c
Connoisseur
karl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead communitykarl1c has become a pillar of the MobileRead community
 
Posts: 56
Karma: 15570
Join Date: Jul 2017
Device: iPad
Thank you @kovidgoyal, all sorted now.

The initial release of the plugin has been uploaded https://www.mobileread.com/forums/sh...94#post3826694
karl1c is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
No Gmail notifications HarryT Apple Devices 5 11-16-2017 06:14 AM
Mail notifications exaltedwombat Feedback 4 04-25-2013 05:23 PM
notifications Senior Kobo Tablets 4 03-26-2013 09:45 AM
Daily notifications? devilsadvocate Feedback 8 01-22-2010 12:24 PM


All times are GMT -4. The time now is 03:54 PM.


MobileRead.com is a privately owned, operated and funded community.