Last active
December 23, 2015 20:59
-
-
Save rajiteh/6693702 to your computer and use it in GitHub Desktop.
Automatically stop seeding transmission downloads (DONT USE THIS CODE!)
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
#!/usr/bin/env python | |
import transmissionrpc | |
import logging | |
import logging.handlers | |
LOG_FILE = '/root/logs/seedstop.log' | |
logger = logging.getLogger('Seedstop') | |
logger.setLevel(logging.INFO) | |
logHandler = logging.handlers.RotatingFileHandler(LOG_FILE, maxBytes=524288, backupCount=1) | |
logHandler.setFormatter(logging.Formatter('%(asctime)s %(message)s')) | |
logger.addHandler(logHandler) | |
tc = transmissionrpc.Client('10.1.1.1', port=9091) | |
for torrent in tc.get_torrents(): | |
if torrent.status=="seeding": | |
torrent.stop() | |
logger.info("Stopped torrent " + torrent.name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment