Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make --info more script-friendly #4481

Closed
vodkolav opened this issue Dec 27, 2022 · 1 comment
Closed

Make --info more script-friendly #4481

vodkolav opened this issue Dec 27, 2022 · 1 comment

Comments

@vodkolav
Copy link

What is the issue?

When a user requests transmission for info about a torrent:
michael@michael-pc:~$ transmission-remote -ne -t 179 -i
He's getting an almost YAML-like output:

NAME
  Id: 179
  Name: ubuntu-22.04.1-desktop-amd64.iso
  Hash: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0
  Magnet: magnet:?xt=urn:btih:3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0&dn=ubuntu-22.04.1-desktop-amd64.iso&tr=https%3A%2F%2Ftorrent.ubuntu.com%2Fannounce&tr=https%3A%2F%2Fipv6.torrent.ubuntu.com%2Fannounce
  Labels: 

TRANSFER
  State: Idle
  Location: /media/michael/Data/Downloads/Torrents
  Percent Done: 0.0%
  ETA: 0 seconds (0 seconds)
  Download Speed: 0 kB/s
...

apart from the categories (NAME,TRANSFER,...) , which don't have a trailing colon after them.
In such state the output is not parseable.

If the output were to have a colon after categories, e.g:

NAME:
  Id: 179
  Name: ubuntu-22.04.1-desktop-amd64.iso
  Hash: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0
  Magnet: magnet:?xt=urn:btih:3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0&dn=ubuntu-22.04.1-desktop-amd64.iso&tr=https%3A%2F%2Ftorrent.ubuntu.com%2Fannounce&tr=https%3A%2F%2Fipv6.torrent.ubuntu.com%2Fannounce
  Labels: 

TRANSFER:
  State: Idle
  Location: /media/michael/Data/Downloads/Torrents
  Percent Done: 0.0%
  ETA: 0 seconds (0 seconds)
  Download Speed: 0 kB/s
...

It would allow the user to parse the --info output as regular YAML using any cli tool and use it further in scripts, e.g:

michael@michael-pc:~$ transmission-remote  -ne -t 179 -i | yq  .TRANSFER.Location
/media/michael/Data/Downloads/Torrents

or

michael@michael-pc:~$ transmission-remote  -ne -t 179 -i |yq e '.ORIGINS.["Public torrent"]'
Yes

Which application of Transmission?

transmission-remote

Which version of Transmission?

3.00 (bb6b5a0)

@ckerr
Copy link
Member

ckerr commented Dec 28, 2022

Duplicate of #2299, see #3819 for what was added in 4.0.0 😸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants