Code Monkey home page Code Monkey logo

transmission-trackers's Introduction

transmission-trackers

Script to automatically add trackers from a list to all torrents in Transmission. This allows to get more peers to download/upload from/to.

Features:

  • Download lists of trackers from any number of URLs and cache them locally. The cache will only be updated after the specified time passes (e.g. once a day)
  • Check if trackers obtained from remote URLs are resolvable in DNS
  • Load additional local tracker lists
  • Remove duplicates so that only unique hosts and IPs are used: if two or more URLs point to the same hostname or the hostname resolves to the same IP - only one URL will be loaded
  • Optionally filter torrents by status (seeding, stopped etc)
  • Compare the current tracker list of a torrent with the required one and only update Transmission if they don't match

Tracker list format:

  • One tracker URL per line
  • Empty lines are ignored
  • Only http[s]:// and udp:// trackers are loaded (Transmission does not support WebSocket trackers AFAIK)

Requirements:

  • Should work with both Python 2.7 and 3.x, although there may be problems with logging in Python2 due to different unicode handling, I don't want to fix that :)
  • transmissionrpc Python module

Usage:

  • Get transmissionrpc: pip[3] install transmissionrpc (or using any other method)
  • Put the transmission-trackers.py script somewhere
  • Make sure that the right Python interpreter is used (it's python3 by default)
  • Adjust the host/port/credentials to access the Transmission RPC inside the script
  • Add your URLs and local files to the appropriate lists in the script
  • Adjust other parameters if needed (see comments)
  • Make the script run by cron e.g. every minute
  • You're done

Cron Setup:

  • Open Crontab using crontab -e
  • For Updating Trackers to Every New Torrent Every 15 Minutes Add: */15 * * * * /usr/bin/sh [path]]/transmission-trackers-auto-cron.sh
  • Modify the transmission-trackers-auto.sh file as per your needs. We have provided two options, transmission-daemon & docker

transmission-trackers's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

transmission-trackers's Issues

TypeError: expected str, bytes or os.PathLike object, not NoneType

image

macserver@MacServer ~ % /Users/macserver/Desktop/transmission-trackers.py

Traceback (most recent call last):
File "/Users/macserver/Desktop/transmission-trackers.py", line 54, in
cache_file = path.join(env.get('TEMP',env.get('TMP',None)) ,'.cache/trackers.txt')
File "/usr/local/Cellar/[email protected]/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/posixpath.py", line 76, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

I'm using python 3.9.9 on macOS

trackerAdd argument is deprecated since transmission daemon 4.0.0

It seems that this script will not work with Transmission 4.0.0+ as trackerAdd has been depricated in favour of trackerList which replaces all the trackers of a given torrent with a new list of trackers.

However, i cant seem to get trackerList to work. I modified the end of the list as follows:

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

  diff = trackers - ttrk

  totaltrk = trackers.union(ttrk)

  if diff:
    lg('{}: Adding {} trackers (before: {})'.format(t.name, len(diff), len(ttrk)))
    tc.change_torrent(t.id, tracker_list = totaltrk)
  else:
    dbg('{}: update not needed'.format(t.name))

However this gives me the error:

transmission_rpc.error.TransmissionError: Query failed with result "Invalid tracker list".

noticed some break changes in the pre-release of the python-transmisionrpc package

transmisionrpc packge(ver:4.0.0a5)changes

  1. packge name form transmissionrpc to transmission_rpc
  2. Some filed are replaced with property
    • toorrent.isPrivate to is_private
    • trackers['announce'] to announce

I didn't check all the break changes in the rpc package in the pre-release, these adjustments just make him run on my machine.

Might want to check for other break changes once version 4.0 of the rpc package is released.

a4ad0ac

bug fix

  1. By the way, I fixed two possible problems e5c6e3f

Work with conditions

Your script adds trackers to all torrents in Transmission. It can be inconvenient if users have a lot of torrents, especially private and working fine. Can you add some conditions e.g. comment, existing trackers, download status etc?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.