Jump to content

.NET API (Wrapper) for uTorrent WebUI


bdizzle000

Recommended Posts

An API for uTorrent that is consumable from .NET and PowerShell. The API is written in C# and leverages WCF. Confirmed to work as of uTorrent 3.1.2. Unlike other uTorrent APIs floating around, token authentication is implemented.

Codeplex:

http://utorrentapi.codeplex.com/

Currrently, not all features are implemented, but everything that is there is pretty clean.

Documentation available here:

http://utorrentapi.codeplex.com/documentation

Feel free to contribute, request features, etc.

2012 Apr 12 ---------------------------------------------------------------------------------------------------------------

Updated to version 1.0.0.2. New features:

- Ability to see file structure within torrents (implemented as Torrent.Files)

- Ability to add local torrent files (implemented as Torrents.AddFile)

Be sure to check out the documentation and sample scripts

Link to comment
Share on other sites

POWERSHELL

Example Usage:


# --------------------------------------------------------------------------------------------------------
# uTorrentHandler.ps1
# ```````````````````
# Features:
# + Handle different torrents according to labels in uTorrent
# + Use theRenamer to handle TV episodes and Movies downloaded through uTorrent
# + Remove certain finished torrents from uTorrent
# --------------------------------------------------------------------------------------------------------

# ###################################################
# Setup
# `````
# Paste this command in uTorrent's "Run Program" Dialog Box:
# powershell.exe -ExecutionPolicy RemoteSigned -WindowStyle Hidden -File 'Script Location' -hash '%I'
#
# ###################################################

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Configuration
# `````````````
# Command Line Parameters
param ($hash)

# Location of ShowAnalyzer.exe
$theRenamerEXE = "C:\Program Files (x86)\theRenamer\theRenamer.exe"

# Video Extensions
$VideoExt = "*.mp4", "*.avi", "*.mpg", "*.mkv", "*.iso", "*.m4v"

# Movie Directory
$MovieDir = "D:\Movies"

# Download Directory
$DownloadDir = "C:\Users\Home Theater PC\Downloads"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(Get-Date -Format "MM-dd-yyyy HH:mm") + " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

$utorrentdll = Join-Path (Split-Path $MyInvocation.MyCommand.Path) 'UTorrentAPI.dll'
[Reflection.Assembly]::LoadFile($utorrentdll) | Out-Null
$utorrentclient = New-Object -TypeName UTorrentAPI.UTorrentClient -ArgumentList "http://127.0.0.1:8080/gui","admin","p@ssw0rd"

# Create Hash Array
$colHash = @()

if ($hash) {
$colHash += $hash
}
else {
exit
}

foreach ($hash in $colHash) {

$label = $utorrentclient.Torrents[$hash].Label
$dir = (Join-Path $DownloadDir $label) -replace "(\[|\])","*"

switch -wildcard ($label) {

"TV*" {

$utorrentclient.Torrents.Remove($hash)

. $theRenamerEXE -fetch

break
}

"Movie*" {

$utorrentclient.Torrents.Remove($hash)

. $theRenamerEXE -fetchmovie

break
}

"*Wii*" { break }

"*GameCube*" { break }

default { exit }
}
}

Link to comment
Share on other sites

  • 1 month later...
  • 5 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...