Created
July 31, 2013 17:32
-
-
Save hostmaster/6124207 to your computer and use it in GitHub Desktop.
A simple watcher for clipboard. Start a new download task if new magnet link detected.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# | |
import time | |
import re | |
import subprocess | |
import xerox | |
bt_cmd = "/usr/bin/qbittorrent" | |
recent_value = "" | |
while True: | |
tmp_value = xerox.paste() | |
if tmp_value != recent_value: | |
recent_value = tmp_value | |
if re.search('magnet:', recent_value): | |
print "Value changed: {0}".format(str(recent_value)[:20]) | |
subprocess.call([bt_cmd, recent_value]) | |
time.sleep(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment