Advertisement
Guest User

Untitled

a guest
Jul 30th, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. #!/bin/bash
  2. # Variables:
  3. # TR_APP_VERSION
  4. # TR_TIME_LOCALTIME
  5. # TR_TORRENT_DIR
  6. # TR_TORRENT_HASH
  7. # TR_TORRENT_ID
  8. # TR_TORRENT_NAME
  9.  
  10. # "${TR_TORRENT_DIR}/${TR_TORRENT_NAME}":
  11. # /home/torrents/complete/Directory
  12. # /home/torrents/complete/File.ext
  13.  
  14. TorrentFiles="${TR_TORRENT_DIR}/${TR_TORRENT_NAME}"
  15.  
  16. if [ -d "${TorrentFiles}" ]; then
  17. # If directory:
  18. TypeOf=$(
  19. {
  20. find "${TorrentFiles}" -type f |while read File; do
  21. file -b --mime-type "${File}" |cut -d '/' -f 1
  22. done
  23. } |sed 's/[^a-zA-Z]/\n/g' \
  24. |uniq -cd |sort -nr |head -n 1 |awk '{print $2}')
  25. else
  26. # If file:
  27. TypeOf=$(file -b --mime-type "${TorrentFiles}" \
  28. |cut -d '/' -f 1)
  29. fi
  30.  
  31. /usr/bin/sms "Torrent::Download Complete ${TR_TORRENT_NAME}"
  32.  
  33. case "${TypeOf}" in
  34. audio)
  35. transmission-remote -t ${TR_TORRENT_ID} --move \
  36. "/home/michael/msc/" &
  37. DISPLAY=:0 notify-send -t 5000 'Torrent::Download Complete' \
  38. "${TR_TORRENT_NAME} moved to /home/michael/msc/"
  39. ;;
  40. video)
  41. transmission-remote -t ${TR_TORRENT_ID} --move \
  42. "/home/michael/vds/" &
  43. DISPLAY=:0 notify-send -t 5000 'Torrent::Download Complete' \
  44. "${TR_TORRENT_NAME} moved to /home/michael/vds/"
  45. ;;
  46. image)
  47. transmission-remote -t ${TR_TORRENT_ID} --move \
  48. "/home/michael/img/" &
  49. DISPLAY=:0 notify-send -t 5000 'Torrent::Download Complete' \
  50. "${TR_TORRENT_NAME} moved to /home/michael/img/"
  51. ;;
  52. text)
  53. transmission-remote -t ${TR_TORRENT_ID} --move \
  54. "/home/michael/etc/" &
  55. DISPLAY=:0 notify-send -t 5000 'Torrent::Download Complete' \
  56. "${TR_TORRENT_NAME} moved to /home/michael/etc/"
  57. ;;
  58. application)
  59. transmission-remote -t ${TR_TORRENT_ID} --move \
  60. "/home/michael/iso-install/" &
  61. DISPLAY=:0 notify-send -t 5000 'Torrent::Download Complete' \
  62. "${TR_TORRENT_NAME} moved to /home/michael/iso-install/"
  63. ;;
  64. *)
  65. transmission-remote -t ${TR_TORRENT_ID} --move \
  66. "/home/michael/ldd/" &
  67. DISPLAY=:0 notify-send -t 5000 'Torrent::Download Complete' \
  68. "${TR_TORRENT_NAME} moved to /home/michael/ldd/"
  69. ;;
  70. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement