Advertisement
Guest User

Simple Script for Post Transmission Processing

a guest
May 2nd, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.89 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. logger -t Transmission-Renamer "Starting at $(date '+%r')"
  4.  
  5. tvshow=$(echo $TR_TORRENT_DIR | cut -d/ -f4)
  6.  
  7. if [ -n "$tvshow" ]; then
  8.   cd "$TR_TORRENT_DIR"
  9.   # tvn is a custom BASH script that processes a .series_id file then calls tvnamer with --series-id arg
  10.   /root/bin/tvn "$TR_TORRENT_NAME" | logger -t Transmission-Renamer
  11.  
  12.   showname=$(logread | grep "Transmission-Renamer" | grep "New filename:" | tail -n 1 | awk -F" New filename: " '{ print $2 }' | sed 's/\..*//')
  13.  
  14.   if [ "$showname" != "" ]; then
  15.     /root/bin/sendTweet "Download completed at $(date '+%r') of $showname"
  16.   else
  17.     /root/bin/sendTweet "Download completed at $(date '+%r') of $TR_TORRENT_NAME"
  18.   fi
  19. else
  20.   logger -t 'Transmission-Renamer' 'Not a TV Show'
  21.   /root/bin/sendTweet "Download completed at $(date '+%r') of $TR_TORRENT_NAME"
  22. fi
  23.  
  24. logger -t Transmission-Renamer "Stopping at $(date '+%r')"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement