Created
November 17, 2010 06:49
-
-
Save ssig33/703080 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
dir = "YOUR_DOWNLOAD_DIR" | |
config = "/home/YOUR_USER_NAME/.config/transmissioncli/torrents" | |
while true | |
flag = false | |
Dir.entries(dir).each do |f| | |
if f.split(".").last == "part" | |
flag = false | |
break | |
end | |
next if File.ftype("#{dir}#{f}") != "file" or f.split(".").last == "part" #f == "." or f == ".." or f == "windows" | |
Dir.entries(config).each do |t| | |
flag = true if t =~ /#{f.gsub(/\ /, "\\ ").gsub(/\[/, "\\[").gsub(/\]/, "\\]").gsub(/\(/, "\\(").gsub(/\)/, "\\)")}/ | |
end | |
end | |
if flag | |
`killall transmissioncli` | |
"killed" | |
end | |
sleep 30 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment