Giter VIP home page Giter VIP logo

trossr32 / ps-transmission Goto Github PK

View Code? Open in Web Editor NEW
17.0 4.0 0.0 222 KB

A Powershell module that integrates with the Transmission RPC API

Home Page: https://www.powershellgallery.com/packages/Transmission

License: Mozilla Public License 2.0

C# 96.83% PowerShell 3.17%
powershell powershell-module powershell-modules cmdlet cmdlets transmission transmission-rpc api api-wrapper transmission-api

ps-transmission's Introduction

PsTransmission

PowerShell Gallery Version PowerShell Gallery

A Powershell module that integrates with the Transmission RPC API.

Available in the Powershell Gallery

Description

A collection of Powershell cmdlets that allow integration with a Transmission instance via the RPC API.

All endpoints in the RPC specification are exposed: Transmission RPC spec.

Installation (from the Powershell Gallery)

Install-Module Transmission
Import-Module Transmission

Supplying API credentials

Before any of the Transmission cmdlets can be run, both your host and credentials need to be registered to the current session using the Set-TransmissionCredentials cmdlet, for example:

Set-TransmissionCredentials -Host "http://192.168.0.1:9091/transmission/rpc" -User "user" -Password "password"

This registers your credentials for the duration of the session. Adding a -StorePermanent switch to the Set-TransmissionCredentials command will create an encrypted file saved on your machine that will obviate the need to set credentials with each new session:

Set-TransmissionCredentials -Host "http://192.168.0.1:9091/transmission/rpc" -User "user" -Password "password" -StorePermanent

You can remove credentials at any time by using the Remove-TransmissionCredentials cmdlet. To remove a file created using the -StorePermanent switch run the Remove-TransmissionCredentials with a -DeletePermanent switch:

Remove-TransmissionCredentials -DeletePermanent

Included cmdlets

Credentials

Set-TransmissionCredentials
Remove-TransmissionCredentials

Session

Close-TransmissionSession
Get-TransmissionSession
Get-TransmissionSessionStatistics
Set-TransmissionAltSpeedLimits
Set-TransmissionSession

System

Test-TransmissionPort
Update-TransmissionBlockLists
Invoke-TransmissionWeb

Torrents

Add-TransmissionTorrents
Assert-TransmissionTorrentsVerified
Get-TransmissionTorrents
Invoke-TransmissionTorrentsReannounce
Move-TransmissionTorrentsQueue
Remove-TransmissionTorrents
Rename-TransmissionTorrentPath
Set-TransmissionTorrents
Set-TransmissionTorrentsLocation
Start-TransmissionTorrents
Start-TransmissionTorrentsNow
Stop-TransmissionTorrents

Building the module and importing locally

Build the .NET core solution

dotnet build [Github clone/download directory]\ps-transmission\src\PsTransmission.sln

Copy the built files to your Powershell modules directory

Remove any existing installation in this directory, create a new module directory and copy all the built files.

Remove-Item "C:\Users\[User]\Documents\PowerShell\Modules\Transmission" -Recurse -Force -ErrorAction SilentlyContinue
New-Item -Path 'C:\Users\[User]\Documents\PowerShell\Modules\Transmission' -ItemType Directory
Get-ChildItem -Path "[Github clone/download directory]\ps-transmission\src\PsTransmissionCmdlet\bin\Debug\netcoreapp3.1\" | Copy-Item -Destination "C:\Users\[User]\Documents\PowerShell\Modules\Transmission" -Recurse

Contribute

Please raise an issue if you find a bug or want to request a new feature, or create a pull request to contribute.

Buy Me a Coffee at ko-fi.com

ps-transmission's People

Contributors

banterboy avatar trossr32 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

ps-transmission's Issues

Request for additional commands

Couple of extra commands to consider adding to this module.

Enable-TransmissionSpeedLimits
Disable-TransmissionSpeedLimits

It would be useful to be able to disable/enable the speedlimits from the command line

Missing CmdLets

CmdLets exposed in the installed module are different from the commands listed in the repository readme.

image

Transmission returning value too large for Int32

Get-TransmissionTorrents
Get-TransmissionTorrents: Failed to retrieve torrents with error: One or more errors occurred. (JSON integer 20263907328 is too large or small for an Int32. Path 'torrents[139].corruptEver', line 1, position 1664164.)

Get-TransmissionTorrents -TorrentIds 444
Get-TransmissionTorrents: Failed to retrieve torrents with error: One or more errors occurred. (JSON integer 20251148288 is too large or small for an Int32. Path 'torrents[0].corruptEver', line 1, position 123.)

Add launch web UI cmdlet

Launch the web UI in the system default browser based on the Host parameter set in the Set-TransmissionCredentials cmdlet

Unable to alter torrent location

I have been working on some automation for my torrents, and one of the things that would be handy id being able to set the location of a torrent, just like I do from the Qt GUI. I see that Set-TransmissionTorrents has a -Location parameter, but I have been unable to make it do anything. I also will note that in the GUI there is the option to move the data, or simply 'tell' Transmission that it has already been moved. I don't see how to specify what to do with the Commandlet, though when I looked up the RPC docs for transmission there is a 'move' parameter there which seems to be how you would indicate which option you want.

Here is an example of the failure:

PS E:\BigOne\FileBot> Get-TransmissionTorrents -torrentids 484 | ft name,id,DownloadDir

Name                                  Id DownloadDir
----                                  -- -----------
Jack Campbell - The Lost Stars (M4B) 484 E:\BigOne\BitTorrent\AB

PS E:\BigOne\FileBot> Set-TransmissionTorrents -TorrentIds 484 -Location "E:\BigOne\BitTorrent\Completed"
Set torrent(s) successful
PS E:\BigOne\FileBot> Get-TransmissionTorrents -torrentids 484 | ft name,id,DownloadDir

Name                                  Id DownloadDir
----                                  -- -----------
Jack Campbell - The Lost Stars (M4B) 484 E:\BigOne\BitTorrent\AB

I also confirmed that the GUI shows no change of location.

I am running Transmission 3.0 Qt on windows. These commands are being run on the same system that runs Transmission. I am using Powershell 7.2.4 on Windows Server 2019.

Get-TransmissionTorrents pipeline output always contains only one object

Transmission module version:

PS /> Get-Module -Name Transmission 

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.0.9                 Transmission                        {Add-TransmissionTorrents, Assert-Transmiss

PowerShell version:

PS /> $host

Name             : ConsoleHost
Version          : 7.2.5
InstanceId       : 89e6eb72-a355-47e3-b6dd-cf7726079002
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-AU
CurrentUICulture : en-AU
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

When calling Get-TransmissionTorrents the pipeline output always contains only one object:

PS /> Get-TransmissionTorrents | Measure-Object

Count             : 1
Average           : 
Sum               : 
Maximum           : 
Minimum           : 
StandardDeviation : 
Property          : 

If I use Where-Object to filter the pipeline output, I get the exact same result as if I hadn't applied a filter.

As a workaround, I can assign the result of Get-TransmissionTorrents to a variable. I then get the expected number of torrents:

PS /> $t = Get-TransmissionTorrents
PS /> $t | Measure-Object

Count             : 46
Average           : 
Sum               : 
Maximum           : 
Minimum           : 
StandardDeviation : 
Property          : 

Use "Install-Module Transmission" to install, but meet a fatal error

When I try to install this add-on by "Install-Module Transmission", I met a fatal error. And it returned as follow:

PackageManagement\Install-PackageProvider : Unable to find repository with SourceLocation ''. Use Get-PSRepository to s
ee all available repositories.
所在位置 C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7468 字符: 21

  • ... $null = PackageManagement\Install-PackageProvider -Name $script:N ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-Pac
      kageProvider],Exception
    • FullyQualifiedErrorId : RegisterPackageSourceRequired,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPack
      ageProvider

PackageManagement\Import-PackageProvider : No match was found for the specified search criteria and provider name 'NuGe
t'. Try 'Get-PackageProvider -ListAvailable' to see if the provider exists on the system.
所在位置 C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7474 字符: 21

  • ... $null = PackageManagement\Import-PackageProvider -Name $script:Nu ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (NuGet:String) [Import-PackageProvider],Exception
    • FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProv
      ider

PackageManagement\Get-PackageProvider : Unable to find package provider 'NuGet'. It may not be imported yet. Try 'Get-P
ackageProvider -ListAvailable'.
所在位置 C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7478 字符: 30

  • ... tProvider = PackageManagement\Get-PackageProvider -Name $script:NuGet ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (Microsoft.Power...PackageProvider:GetPackageProvider) [Get-PackageProvi
      der], Exception
    • FullyQualifiedErrorId : UnknownProviderFromActivatedList,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPacka
      geProvider

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.