This file contains hidden or 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
import os | |
import time | |
import argparse | |
import requests | |
import threading | |
import queue | |
class ImgDownloader(threading.Thread): | |
def __init__(self, folder, img_url_fmt, start, interval, print_queue): |
This file contains hidden or 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
""" | |
Usage: | |
python service.py install | |
Installs this script as a Windows service. Needs admin rights. | |
python service.py remove | |
Remove service. Needs admin rights. | |
""" |
This file contains hidden or 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
import threading | |
import functools | |
def with_lock(func): | |
""" Synchronization decorator applicable to bound methods, which | |
creates a threading.Lock for the decorated function, which is then acquired | |
on every call to the method. | |
Locks created will be stored in the dict self._func_locks. """ | |
@functools.wraps(func) | |
def wrapped(self, *args, **kwargs): |
This file contains hidden or 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
import threading | |
import ctypes | |
import time | |
import atexit | |
class InterruptableThread(threading.Thread): | |
""" Interruptable threading.Thread, based on: | |
https://gist.github.com/liuw/2407154 |