Bash Shell Script
No comment
Download Count: 158
Date Added: Sunday, 03-Jul-11 15:22:43 CDT
Tags: Transmission, shell script, torrent information,, Bit Torrent
Bash Shell Script to get information about a particular Transmission torrent.
Run the script from the command line to list all current torrents. The script then prompts you for a torrent ID. After entering the torrent ID, the scripts loops through and lists all available information about that torrent, then exits.
See my Completion Script for an example of how to use the information when a torrent completes downloading.
Make sure the file is executable (chmod 755 torrent_info.sh).
File Name: torrent_info.sh - Code Type: Bash
#!/bin/bash ## list current torrents echo "Current Torrents:" transmission-remote -l ## get Torrent ID from input read -p ">>> Enter Torrent ID >>>: " TR_TORRENT_ID ## array of torrent fields info=('Id:' 'Name:' 'Hash:' 'State:' 'Location:' 'Percent Done:' 'ETA:' 'Download Speed:' 'Upload Speed:' 'Have:' 'Availability:' 'Total size:' 'Downloaded:' 'Uploaded:' 'Ratio:' 'Ratio Limit:' 'Corrupt DL:' 'Peers:' 'Date added:' 'Latest activity:' 'Tracker #1:' 'Tracker #2:' 'Date created:' 'Public torrent:' 'Comment:' 'Creator:' 'Piece Count:' 'Piece Size:' 'Download Limit:' 'Upload Limit:' 'Honors Session Limits:' 'Peer limit:') #PIECES=() ## out put torrent info array_count=${#info[@]} index=0 while [ "$index" -lt "$array_count" ] do public=$(transmission-remote -t $TR_TORRENT_ID -i\ | grep "${info[$index]}"\ | cut -d: -f2-\ | sed 's/^ *//') echo ${info[$index]} $public let "index += 1" done exit
Parsed in 0.063 seconds - Rate: 14.97 KB/s - GeSHi version: 1.0.8.10
Hope you find this helpful! If you have any questions, please leave a comment.