Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 06-19-2017, 05:44 PM   #1
masteranza
Member
masteranza began at the beginning.
 
masteranza's Avatar
 
Posts: 21
Karma: 10
Join Date: Jul 2016
Device: PW2
Monitoring incoming content on Kindle

Hi, so I've been a happy LibrarianSync user as I use it to sync my books folder with kindle through custom collection rebuild from folders.
Now I'm after a new endeavour, namely in automatic assignment of articles which come by Amazon mail (I often mail articles from the my laptop browser directly to my Kindle) to a specific folder.

I think I have a rough idea how to do it but I couldn't notice any new process spawning with incoming content by using 'ps -aux' command...
So my question would be - has someone identified the process which handles the content delivery on kindle? What should I monitor? Perhaps someone already wrote a content delivery monitor?

Thanks!
masteranza is offline   Reply With Quote
Advert
Old 06-19-2017, 07:34 PM   #2
knc1
Snappy answers department
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 14,777
Karma: 16114753
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by masteranza View Post
Hi, so I've been a happy LibrarianSync user as I use it to sync my books folder with kindle through custom collection rebuild from folders.
Now I'm after a new endeavour, namely in automatic assignment of articles which come by Amazon mail (I often mail articles from the my laptop browser directly to my Kindle) to a specific folder.

I think I have a rough idea how to do it but I couldn't notice any new process spawning with incoming content by using 'ps -aux' command...
So my question would be - has someone identified the process which handles the content delivery on kindle? What should I monitor? Perhaps someone already wrote a content delivery monitor?

Thanks!
The Amazon OS is an event driven system.
Significant events are logged into a message log (system).

So the first thing to do, is take advantage of that feature.
Very soon after (to simplify the searching) receiving one of these things you want to know about, do the 'dump messages' command.
Then read the files produced (preferable on a large screen monitor - although you can read them on the Kindle).

Once you spot the event messages related to what you want to know about, you can figure out what to 'wait for' to trigger your own actions.

In the searchbar, enter:
;dm
The semi-colon is part of the command ';dm' (dump messages).

The log format is very simple and not 'hidden' in any way, you'll figure out how to read them in a few minutes of study.
knc1 is offline   Reply With Quote
Old 06-20-2017, 06:30 AM   #3
masteranza
Member
masteranza began at the beginning.
 
masteranza's Avatar
 
Posts: 21
Karma: 10
Join Date: Jul 2016
Device: PW2
Thanks knc1!
I've followed your advise and here's a script I've managed to create I hope some of you might be able to help me optimize it:

showlog | grep "ExtractorBridge:EXTRACTION_ELAPSED_TIME" | awk -v FS="(P ExtractorBridge:EXTRACTION_ELAPSED_TIMEath=/mnt/us/documents/|.azw,type=add)" '{print $2}' | while read line; do mv "/mnt/us/documents/$line.azw" "/mnt/us/documents/Articles/$line.azw" 2>/dev/null; mv "/mnt/us/documents/$line.sdr" "/mnt/us/documents/Articles/$line.sdr" 2>/dev/null; done
/mnt/us/extensions/librariansync/generate_collections.py --folders

What I'm planning is to run it in background every 10 seconds - is this a good idea?

For now I'm running this script inside my "housekeeping" script that moves files from my computer to my kindle and that creates collections based on the directories.

Last edited by masteranza; 06-20-2017 at 07:11 AM.
masteranza is offline   Reply With Quote
Old 06-20-2017, 08:00 AM   #4
knc1
Snappy answers department
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 14,777
Karma: 16114753
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Terrible idea.
Use the event system.
knc1 is offline   Reply With Quote
Old 06-20-2017, 07:42 PM   #5
masteranza
Member
masteranza began at the beginning.
 
masteranza's Avatar
 
Posts: 21
Karma: 10
Join Date: Jul 2016
Device: PW2
Thanks, @knc. Where can I learn how to use the event system?
masteranza is offline   Reply With Quote
Advert
Old 06-20-2017, 08:11 PM   #6
knc1
Snappy answers department
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 14,777
Karma: 16114753
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by masteranza View Post
Thanks, @knc.
Where can I learn how to use the event system?
The one in the Amazon system are a layer over dbus.
That is easy to find out about on the 'net and everything applies to the version in the Amazon system.

The Amazon wrapper functions all have 'help' built-in.

The 5.x series of device firmwares include a Lua interface to the event system.

There have been various add-ins posted that use the event system.
Such as a general purpose add-in that runs user code on specific events (not the ones you are looking for).

Check the wiki on "hacking" the Kindle system.
knc1 is offline   Reply With Quote
Old 06-22-2017, 08:24 PM   #7
knc1
Snappy answers department
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 14,777
Karma: 16114753
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by masteranza View Post
Hi, so I've been a happy LibrarianSync user as I use it to sync my books folder with kindle through custom collection rebuild from folders.
Now I'm after a new endeavour, namely in automatic assignment of articles which come by Amazon mail (I often mail articles from the my laptop browser directly to my Kindle) to a specific folder.

I think I have a rough idea how to do it but I couldn't notice any new process spawning with incoming content by using 'ps -aux' command...
So my question would be - has someone identified the process which handles the content delivery on kindle? What should I monitor? Perhaps someone already wrote a content delivery monitor?

Thanks!
A worked example of how to wait for events:
https://www.mobileread.com/forums/sh...d.php?t=198484

The most recent build is in post #28.

Take the install package apart with KindleTool to get at the code that does the waiting.
knc1 is offline   Reply With Quote
Old 06-23-2017, 08:58 AM   #8
masteranza
Member
masteranza began at the beginning.
 
masteranza's Avatar
 
Posts: 21
Karma: 10
Join Date: Jul 2016
Device: PW2
Thanks @knc1! I'll get into that once I have some more time...
masteranza is offline   Reply With Quote
Old 06-23-2017, 09:36 AM   #9
knc1
Snappy answers department
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 14,777
Karma: 16114753
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by masteranza View Post
Thanks @knc1! I'll get into that once I have some more time...
If what you want to be notified about has a related event, then about all you will need to do is change the event name your waiting for.

Of course, you'll still have to remove any code not suitable for your purpose.
But the author of that thing knew his business, so it should be a good example.

All after you identify an event name from the logs.

You may not have a "Periodical update complete" event to wait for.
But if those periodicals get indexed, then you should see indexer event messages.

And there are 'job queues' in the system with related messages.
I would expect if the system checked and found something that needed to be downloaded, that 'job' would be entered into a queue.

I.E: If there isn't an exact message to wait for, there should be related messages that you could wait for.

= = = =

And while your at it -
Make a version that waits for: "OTA update available" and pops up a message panel, warning the user that their Kindle is about to update its firmware.

- - - -

The principles remain the same, only the names and actions change.
knc1 is offline   Reply With Quote
Old 06-23-2017, 10:36 AM   #10
shalym
Wizard
shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.shalym ought to be getting tired of karma fortunes by now.
 
shalym's Avatar
 
Posts: 1,939
Karma: 19000000
Join Date: Feb 2012
Location: New England
Device: KPW 1, 2, and 3, Voyage, Oasis, Kindle Fire, Kobo Aura HD, Onyx Lynx
Quote:
Originally Posted by knc1 View Post
If what you want to be notified about has a related event, then about all you will need to do is change the event name your waiting for.

Of course, you'll still have to remove any code not suitable for your purpose.
But the author of that thing knew his business, so it should be a good example.

All after you identify an event name from the logs.

You may not have a "Periodical update complete" event to wait for.
But if those periodicals get indexed, then you should see indexer event messages.

And there are 'job queues' in the system with related messages.
I would expect if the system checked and found something that needed to be downloaded, that 'job' would be entered into a queue.

I.E: If there isn't an exact message to wait for, there should be related messages that you could wait for.

= = = =

And while your at it -
Make a version that waits for: "OTA update available" and pops up a message panel, warning the user that their Kindle is about to update its firmware.

- - - -

The principles remain the same, only the names and actions change.
Hmmm...maybe better than a message that the Kindle is about to update the firmware would be a message saying that new firmware got downloaded to the Kindle. Would that be possible?

Shari
shalym is offline   Reply With Quote
Old 06-23-2017, 04:14 PM   #11
knc1
Snappy answers department
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 14,777
Karma: 16114753
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by shalym View Post
Hmmm...maybe better than a message that the Kindle is about to update the firmware would be a message saying that new firmware got downloaded to the Kindle. Would that be possible?

Shari
I have seen a "check for update" function.
And what I wrote was suppose to be about that (update available, download scheduled).

I don't know if there is a "download complete" event.

masteranza has to do a lot of log reading to see if there are events that would trigger the feature(s) that he wants.
I thought he might as well be keeping an eye open for what there is available about OTA updating.
knc1 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apple gripes about antitrust monitoring fjtorres News 474 07-17-2015 09:32 AM
Color eInk Kindle incoming? fjtorres News 20 02-22-2012 10:23 PM
Monitoring eBook Prices ebusinesstutor General Discussions 0 08-18-2011 12:23 AM
Kindle 3 incoming (Norway) Ingrid Which one should I buy? 2 09-02-2010 02:26 PM


All times are GMT -4. The time now is 04:08 PM.


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