Play Magnet Link in VLC via qBittorrent — I'm close... help please?

Further to this macro, I thought I'd try the same thing using qBittorrent, as it's more ubiquitous than Peerflix, and as such may be of more use to more people.

The idea:

With your mouse hovering over a magnet link, trigger this macro. Assuming it is your browser's default application for torrents, it will open the magnet link in qBittorrent, wait for the file to reach a sufficient size and then open it in VLC. I'm using the same shell script suggested by @Sleepy to pause for file size, and as far as I can tell, I haven't made any glaring mistakes, but at the moment it just waits and waits.

Any help appreciated.

Edit: just had to increase the minimum size limit. Updated the macro below.

Play Magnet Link (qBittorrent).kmmacros (48 KB)

Macro screenshot (click to expand/collapse)

You may need to re-capture some button coordinates and you will need to set your own download folder. The actions that require attention are marked out in green.