Monitoring the boot process in Chrome

I am trying to hack a Python script to track current downloads in Chrome and turn off my computer automatically after the download process is complete. I know some JavaScript and, if necessary, consider using the PyJs library.

1) Is this a better approach? I do not need the application to be portable, it just works.

2) How to determine the boot process?

3) How would you track the download progress? Obviously, the Chrome API does not provide a specific function for it.

+4
source share
1 answer

A good question, maybe, because I can relate to the need to automate shutdown .;)

I just googled. There is an experimental API , but only for the dev channel at the moment. I am not on the dev channel to try this, so I just hope that I will point you in the right direction.

One approach:

  • Ask a Python HTTP server to listen on some XYZ port
  • In the extension, add permission to the URL http://localhost:XYZ/
  • In your extension you can use:

     chrome.downloads.search(query, function (arrayOfDownloadItem){ .. }) 
    • Where the query is an instance of DownloadQuery and contains state as in_progress
    • You can probably check the length of arrayOfDownloadItem .
      • If it is zero, create a new XMLHttpRequest at the endpoint of the HTTP server, and then let the server shut down your computer.

NTN

+1
source

All Articles