Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions transmission-trackers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env python3
from __future__ import print_function
import socket
import time
import os
import sys
from os import getcwd

# Host, port, username and password to connect to Transmission
# Set user and pw to None if auth is not required
Expand Down Expand Up @@ -46,8 +51,8 @@
# Debug output
'debug': False
}

cache_file = None # Universal scope
from os import getcwd
if getcwd() != '/docker/transmission/transmission-trackers':
from os import environ as env, path, mkdir
try:
Expand All @@ -69,17 +74,15 @@
toml.dump( {'client': client, 'config': config }, f )
except KeyError:
# Where to cache downloaded lists
cache_file = path.join(env['TEMP'] ,'.cache/trackers.txt')
cache_file = path.join(env['TEMP'] ,'.cache/trackers.txt')
else:
cache_file = '/tmp/trackers_cache.txt'



### Configuration ends here ###
hdrs = {'User-Agent': 'Mozilla/5.0'}
hosts, ips = set(()), set(())

import sys, os, time, socket
try:
from transmissionrpc import Client
if 'host' in client:
Expand Down Expand Up @@ -237,13 +240,13 @@ def readLocalLists():
if config['status_filter'] and not t.status in config['status_filter']:
dbg('{}: skipping due to status filter'.format(t.name))
continue
if t.isPrivate:
if getattr(t, 'isPrivate', getattr(t, 'is_private', False)):
dbg('{}: skipping private torrent'.format(t.name))
continue

ttrk = set(())
for trk in t.trackers:
ttrk.add(trk['announce'])
ttrk.add(getattr(trk, 'fields', trk).get('announce'))

diff = trackers - ttrk

Expand Down